Configuring a Web service client deployed WSDL file name with the wsadmin tool

When a Web service application is deployed into WebSphere Application Server, an instance is created for each application or module. The instance contains deployment information for the Web module or Enterprise JavaBeans (EJB) module, including the client bindings.

 

Before you begin

You should have the Web service application ready for deployment or already deployed the Web service into WAS before starting this task.

To complete this task, we need to know the topology of the URL endpoint address of the Web services servers and which Web service the client depends upon. We can view the deployment descriptors in the administrative console to find topology information. See the article View Web services server deployment descriptors for more information.

For more information about the wsadmin tool options, review Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands

 

About this task

The client bindings define the Web Services Description Language (WSDL) file name and preferred ports. The relative path of a Web service in a module is specified within a compatible WSDL file that contains the actual URL to be used for requests. The address is only needed if the original WSDL file did not contain a URL, or when a different address is needed. For a service endpoint with multiple ports, we need to define an alternative WSDL file name. The following steps describe how to edit bindings for a Web service after these bindings are deployed on a server. When one Web service communicates with another Web service, configure the client bindings to access the downstream Web service.

Use the WebServicesClientBindDeployedWsdl command-line option in this task to change the endpoint. One of the benefits to using the command-line option is that we can avoid uninstalling, modifying enterprise archive (EAR) files and reinstalling applications to make binding configuration changes. Another benefit is the ability to customize the Web service bindings applications for different environments during installation, and to avoid the need to create different application EAR files for each version.

Several versions of WSDL files, each with different service endpoints, can be provided during the development and assembly of a Web service module that is acting as a client to a Web service. During or after the installation, when you are configuring the installed application, the WebServicesClientBindDeployedWsdl option can be used to specify which of the WSDL files to use.

Because the WSDL file defines all the service endpoints or implementations for all of the port types and ports that the client can use, the deployed WSDL file can group a set of choices into one WSDL. We can override the endpoint by port.

Use Jacl or Jython scripts, but this task assumes that you are using Jacl. For more information about using scripting see Deploying and managing using scripting.

To configure client bindings with the wsadmin tool, proceed with the following steps:

 

Procedure

  1. Launch a scripting command.

  2. At the wsadmin command prompt, enter the command syntax. Use install, installInteractive, edit or editInteractive options. The following example presents the syntax

    $AdminApp edit <app_name> { 
    -WebServicesClientBindDeployedWsdl {{<module_name> <EJB_name> <web_service> 
    <deployed_WSDL_filename>}...} 
    
    
    The example shows multiple nodules and URL endpoints because we can edit multiple URL fragments. where:

    • app_name is the application name, for example WebServicesSample.ear

    • module_name is the EJB or Web module name, for example AddressBookW2JE.jar

    • EJB_name is the name of the EJB if the module is not a Web module, for example Exchange

    • web_service is the name of the Web service, for example service/StockQuoteService

    • deployed_WSDL_filename identifies the WSDL file, relative to this module, for example, META-INF/wsdl/AlternativeStockQuoteFetcher.wsdl

  3. Save the configuration changes with the $AdminConfig save command:

 

Results

Your Web service client bindings are configured.

 

Example

The following example presents the application, module and deployed WSDL file name as it is written in the command line

$AdminApp edit MultiEjbJar {-WebServicesClientBindDeployedWSDL {{ejbclientonly.jar Exchange 
service/StockQuoteService META-INF/wsdl/AlternateStockQuoteFetcher.wsdl}...}} 

 

What to do next

Now we can finish any other configurations, start or restart the application, and verify the expected behavior of the Web service.


Related tasks
Web services client bindings Configuring Web service client bindings Related reference
Options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands