Assembling a Web services-enabled client JAR file into an EAR file
Now that you have generated deployment descriptors, located the Web Services Description Language (WSDL) file that was used to develop the Web services client, and generated the necessary classes for the client module, assemble these artifacts to create an enterprise archive (EAR) file that is used in the Web services application.
You can assemble Java-based Web services modules with assembly tools provided with WAS. We need the following artifacts that are generated from the WSDL2Java command-line tool to complete this task:
- An assembled client module that contains the implementation, all of the classes generated by the WSDL2Java command-line tool and the ejb-jar.xml deployment descriptor or the application-client.xml deployment descriptor. This module can be:
- An application client module that contains the META-INF/application-client.xml file.
- An EJB module that contains the META-INF/ejb-jar.xml file.
- The WSDL file that you used to develop the client.
- The templates for the ibm-webservicesclient-ext.xmi and ibm-webservicesclient-bnd.xmi deployment descriptor, if used.
- A generated Java API for XML-based remote procedure call (JAX-RPC) mapping deployment descriptor.
Overview
You can use assembly tools included with WebSphere Application Server to assemble Web services-enabled client applications.
Assemble the client code and artifacts that enable the application client to access a Web service with steps provided:
Procedure
- Start an assembly tool. See "Starting WAS Toolkit" in the Application Server Toolkit documentation for more information.
- If you have not done so already, configure the assembly tool so that it works on J2EE modules. We need to make sure that the J2EE and Web categories are enabled. See "Configuring WAS Toolkit" in the Application Server Toolkit documentation for more information.
- Migrate JAR files created with the Assembly Toolkit, Application Assembly Tool (AAT) or a different tool to an AST or Rational Application Developer assembly tool. To migrate files, import your JAR files to the assembly tool. See "Migrating code artifacts to an assembly tool" in the Application Server Toolkit documentation.
- Assemble the JAR file into an enterprise archive (EAR) file using typical assembly techniques if the client runs in a container.
Results
You have the artifacts required to enable the client module to use Web services are added to the module.
Example
This example of the assembly process uses the AddressBookClient.jar JAR file the AddressBookClient.ear EAR file:META-INF/MANIFEST.MF META-INF/application-client.xml META-INF/wsdl/AddressBook.wsdl 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 the following files:META-INF/MANIFEST.MF AddressBookClient.jar META-INF/application.xml
What to do next
Now that you have assembled the client module, configure the bindings so that the client can communicate with a Web service that is deployed on a server.
Web services
Related tasks
Testing Web services-enabled clients
Task overview: Implementing Web services applications
Developing and deploying Web services clients
Related Reference
Artifacts used to develop Web services