Assembling a Web services-enabled client JAR file into an EAR file
Now that we have generated the application artifacts, we need to assemble these artifacts to create an EAR file used in the Web services application.
For JAX-WS Web service applications, we need the portable artifacts that are generated by wsimport when starting from a WSDL file to complete this task. The wsimport tool processes a WSDL file as input and generates the following portable artifacts:
- Service Endpoint Interface (SEI)
- Service class
- Exception classes that are mapped from the wsdl:fault class (if any)
- JAXB generated type values which are Java classes mapped from XML schema types
- An assembled client module that contains the implementation, all of the classes generated by wsimport 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.
For JAX-RPC Web service applications, 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 EJBs 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 JAX-RPC mapping deployment descriptor.
Use assembly tools included with WAS 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:
- Start an assembly tool.
- If we have not done so already, configure the assembly tool so that it works on Java EE modules. we need to make sure that the Java EE and Web categories are enabled.
- Import the client implementation and the artifacts generated by the command-line tooling into the assembly tool.
- Migrate JAR files created with the Rational Application Developer assembly tool. To migrate files, import the JAR files to the assembly tool.
- Assemble the JAR file into an EAR file using typical assembly techniques if the client runs in a container.
Results
we have assembled the artifacts required to enable the client application for Web services into an EAR file.
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
For JAX-WS applications, we are ready to deploy the Web services client application.
For JAX-RPC applications, we need to configure the client deployment descriptor bindings so that the client can communicate with a Web service that is deployed on a server.
Related tasks
Web services
Assembly tools
Testing Web services-enabled clients
Task overview: Implement Web services applications
Implementing JAX-WS Web services clients
Implementing JAX-RPC Web services clients
Deploy a Web services client application
Set the JAX-RPC Web services client deployment descriptor with an assembly tool
Related
Artifacts used to develop Web services
wsimport command for JAX-WS applications
WSDL2Java command for JAX-RPC applications