Assemble a Web services client

The steps in this topic explain how to use the command-line tools to assemble a Web service-enabled client application.

To assemble a Web services client in an application client JAR or enterprise bean JAR file, follow these steps:

  1. Expand the JAR file in the root directory.
  2. Place the WSDL file in the META-INF/wsdl subdirectory. The WSDL file is indicated by the <wsdl-file> element in the webservicesclient.xml file.
  3. Place the webservicesclient.xml and the JAX-RPC mapping files in the META-INF subdirectory. The JAX-RPC mapping file is indicated by the <jaxrpc-mapping-file> element in the webservicesclient.xml file.
  4. (Optional) If you use the ibm-webservicesclient-bnd.xmi file, place it in the META-INF subdirectory.
  5. Add the files to the existing JAR file with the appropriate command for your platform.

    • On iSeries, run jar -uvf existing.jar META-INF/* from Qshell.
    • For UNIX platforms, run jar -uvf existing.jar META-INF/*.
    • For Windows platforms, run jar -uvf existing.jar META-INF\*.

  6. Assemble the JAR file into an EAR file using typical assembly techniques if the client runs in a container.

To assemble a Web services client in a Web archive (WAR) file, follow these steps:

  1. Expand the WAR file in the root directory.
  2. Place the WSDL file in the WEB-INF/wsdl subdirectory.
  3. Place the webservicesclient.xml and JAX-RPC mapping files in the WEB-INF subdirectory.
  4. (Optional) If you use the ibm-webservicesclient-bnd.xmi file, place it in the WEB-INF subdirectory.
  5. Add the files to the existing WAR file with the appropriate command for your platform.

    • On iSeries, run jar -uvf existing.war WEB-INF/* from Qshell.
    • For UNIX platforms, run jar -uvf existing.war WEB-INF/*.
    • For Windows platforms, run jar -uvf existing.war WEB-INF\*.

After you assemble the client application, test it to verify that it runs correctly. See Test the Web services-enabled client application for information.

Example

This example uses a JAR file named AddressBookClient.jar and an EAR file named AddressBookClient.ear:

After running the jar -u command, the AddressBookClient.jar file contains the following files. The files added in this task are in bold:

META-INF/MANIFEST.MF
META-INF/application-client.xml
META-INF/wsdl/AddressBook.wsdl
META-INF/webservicesclient.xml
META-INF/AddressBook_mapping.xml

com/ibm/websphere/samples/webservices/addr/Address.class
com/ibm/websphere/samples/webservices/addr/AddressBook.class
com/ibm/websphere/samples/webservices/addr/AddressBookClient.class
com/ibm/websphere/samples/webservices/addr/AddressBookService.class
...other generated classes...

After assembling the AddressBookClient.jar file into the AddressBookClient.ear file, the AddressBookClient.ear file contains these files: