WAS v8.5 > Script the application serving environment (wsadmin) > Welcome to scripting for web services > Configure web services applications using wsadmin.shConfigure a web service client deployed WSDL file name using wsadmin.sh
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 EJB module, including the client bindings.
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, you 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 dmgr console to find topology information. To learn more, see the viewing web services server deployment descriptors in the dmgr console information.
For more information about wsadmin options, see the information on options for the AdminApp object install, installInteractive, edit, editInteractive, update, and updateInteractive commands.
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 containing 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, you 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.
We can 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 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 we 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 the client can use, the deployed WSDL file can group a set of choices into one WSDL. We can override the endpoint by port.
We can use Jacl or Jython scripts, but this task assumes that you are using Jacl. For more information about deploying and managing using scripting, see the getting started with scripting information.
To configure client bindings with wsadmin, proceed with the following steps:
- Launch a scripting command. To learn more, see the starting the wsadmin scripting client information.
- At wsadmin prompt, enter the command syntax. We can 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
- 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}...}}
Now we can finish any other configurations, start or restart the application, and verify the expected behavior of the web service.
Related
Web services client bindings
View web services deployment descriptors in the dmgr console
Get started with wsadmin scripting
Start the wsadmin scripting client using wsadmin.sh
Configure web services client bindings