Publishing WSDL files using wsadmin.sh

 

You can provide WSDL files to the clients that want to invoke your Web services.

The scripting client, wsadmin.sh, can publish the WSDL files in either local, for example, -conntype NONE, or remote mode. However, in local mode, the target application should be located at the same node where wsadmin.sh is invoked.

The steps below assume that the application has been deployed and that the appserver is running.

To publish a WSDL file with wsadmin.sh...

  1. From a command prompt, start $WAS_HOME\bin\wsadmin if you are using Windows or $WAS_HOME/bin/wsadmin if you are using UNIX.

  2. At wsadmin.sh prompt, enter one of the two commands...

    • $AdminApp publishWSDL app_Name path_Name

    • $AdminApp publishWSDL app_Name path_Name {{module {{binding url-prefix}}}}

    Where

    • app_Name is the application name

    • path_Name is the absolute path to the zip file that will contain the published WSDL files. The zip file is saved on the machine running WebSphere Application Server, therefore, if the server is running on a different machine, you need to obtain the zip file from that machine. The directory structure of the resulting zip file is based on the following information

      Application file name
              module file name
                  META-INF/ or WEB-INF/
                      wsdl/
                            WSDL file name 
      
      See the usage scenario for an example of this directory structure.

    • binding is either http or jms (both are in lower case)

    • url-prefix is the partial SOAP address for the associated SOAP binding. For an HTTP binding the form is http://host:port/ or https://host:port

      For JMS bindings, the form is jms:/queue?destination=dest&connectionFactory=cf or jms:/topic?destination=dest&connectionFactory=cf

    The $AdminApp publishWSDL app_Name path_Name command updates the WSDL SOAP address prefixes using the default values. If you do not want to update the WSDL SOAP address prefixes, use the other command, instead of the default values.

    The $AdminApp publishWSDL app_Name path_Name {{module {{binding url-prefix}}}} command allows you to customize the WSDL SOAP address for each module. You can specify a different address prefix for each SOAP binding.

The WSDL files from Web services are published to a specified zip file. You can hand the zip file to the client and the client can use the published WSDL files to create a Web services client that accesses the deployed service.

 

Usage Scenario

The command to publish WSDL files for a Web service named WebServicesSamples could be $AdminApp publishWSDL WebServicesSamples c:/temp/samplesWsdl.zip

or

$AdminApp publishWSDL WebServicesSamples c:/temp/sampleswsdl.zip { {AddressBookJ2WB.war {{http http://localhost:9080}}} {StockQuote.jar {{http https://localhost:9443}}} }

The directory structure for this created zip files is

WebServicesSamples.ear/StockQuote.jar/META-INF/wsdl/StockQuoteFetcher.wsdl 
WebServicesSamples.ear/AddressBookW2JE.jar/META-INF/wsdl/AddressBookW2JE.wsdl 
WebServicesSamples.ear/AddressBookJ2WE.jar/META-INF/wsdl/AddressBookJ2WE.wsdl 
WebServicesSamples.ear/AddressBookJ2WB.war/WEB-INF/wsdl/AddressBookJ2WB.wsdl 
WebServicesSamples.ear/AddressBookW2JB.war/WEB-INF/wsdl/AddressBookW2JB.wsdl

 

See Also

Developing a WSDL file
Deploying Web services based on Web Services for J2EE
Publishing WSDL files
Publishing WSDL files with the administrative console