Assembling a Web services-enabled client WAR 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, we need to assemble these artifacts to create an EAR file that is used in the Web services application.

 

Before you begin

We can assemble Web Services for J2EE modules with assembly tools provided with WebSphere Application Server.

You must configure the assembly tool before use it. You need the following artifacts that are generated by the WSDL2Java command to complete this task:

  • Assembled client WAR module that contains the implementation, all of the classes generated by the WSDL2Java command-line tool, and the web.xml deployment descriptor

  • The WSDL file that you used to develop the client.

  • The templates for the ibm-webservicesclient-ext.xmi and ibm-webservicesclient-bnd.xmideployment descriptor, if used, and the Java API for XML-based remote procedure call (JAX-RPC) mapping file.

 

Overview

Assemble the client code and artifacts that enable the application client to access a Web service with steps provided:

 

Procedure

  1. Start an assembly tool. The Eclipse assembly tools, Application Server Toolkit (AST) and Rational Web Developer, provide a graphical interface for developing code artifacts, assembling the code artifacts into various archives (modules) and configuring related J2EE V1.2, 1.3 or 1.4 compliant deployment descriptors.

  2. Click File > Import to import the web archive (WAR) file into the assembly tool.

  3. Open the J2EE perspective by clicking Windows >Open Perspective > Other >J2EE.

  4. Switch to the Navigator pane by clicking the Navigator tab.

  5. Locate the project for the file that you just imported in the Navigator pane.

  6. Expand the webContent entry so the WEB-INF directory is displayed. Expand the WEB-INF directory.

  7. Right-click the WEB-INF directory and click New > Folder. Create a subfolder named wsdl in the WEB-INF directory.

    1. Copy the WSDL file to the WEB-INF\wsdl directory by right-clicking the wsdl directory and click Import > File system. Browse the WSDL file for this Web service and click Finish.

    2. Copy the web.xml file. If the WAR module already contains a web.xml file, manually merge the <service-ref> elements in the web.xml file with the original web.xml file that is generated by the WSDL2Java command.

    3. Copy the JAX-RPC mapping file in the WEB-INF subdirectory in the same manner in which you copied the WSDL file. The JAX-RPC mapping file is indicated by the element in the web.xml file.

    4. (Optional) Place the ibm-webservicesclient-ext.xmi file and the ibm-webservicesclient-bnd.xmi file in the WEB-INF subdirectory, if used. If these files are already contained in the WAR module, manually merge the ibm-webservicesclient-ext.xmi and the ibm-webservicesclient-bnd.xmi files that are generated by the WSDL2Java command with the existing files.

 

Result

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 AddressBookWeb.war WAR

file and the AddressBook.ear EAR file

WEB-INF/MANIFEST.MF
WEB-INF/web.xml
WEB-INF/wsdl/AddressBook.wsdl
WEB-INF/AddressBook_mapping.xml
WEB-INF/ibm-webservicesclient-ext.xmi (optional)
WEB-INF/ibm-webservicesclient-bnd.xmi 
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 AddressBookWeb.war file into the AddressBook.ear file, the AddressBook.ear file contains the following files

META-INF/MANIFEST.MF 
AddressBookWeb.war
META-INF/application.xml

 

What to do next

Configure the client deployment descriptor . Now that you have assembled the client module, we need to configure the bindings so that the client can communicate with a Web service that is deployed on a server.


 

See Also


Web services

 

Related Tasks


Testing Web services-enabled clients
Configuring the Web services client bindings in the ibm-webservicesclient-bnd.xmi deployment descriptor
Implementing Web services applications
Developing Web services clients

 

See Also


Artifacts used to develop Web services