Now that you have generated your application artifacts,
you need to assemble these artifacts to create an enterprise archive
(EAR) file that is used in the Web services application.
Before you begin
You can assemble Java-based Web services modules with assembly tools provided
with WebSphere Application Server.
You
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 Enterprise JavaBeans (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.
Restriction: Do not include a pound sign
(#) in the name of files that are packaged within an application archive.
Due to internal processing, the application server fails to correctly
deploy the application when a pound sign is included in a file name
within the application archive. When this failure occurs, an exception
might occur when the application is being processed. Also, parts of
the application might be missing after the application is deployed.
To address this issue, rename any file names within the application
archive so that they do not contain a pound sign.
About this task
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
- Click File > Import to
import the enterprise bean Java archive (JAR) file, AppClient JAR
file, or the web archive (WAR) file into the assembly tool.
- Open the J2EE perspective by clicking
Windows >Open Perspective > Other >J2EE.
- Switch to the Navigator pane by
clicking the Navigator tab.
- Locate the project for the file
that you just imported in the Navigator pane.
- Expand the ejbModule for
an enterprise bean JAR file or the appClientModule for the
application client JAR file entry so that the META-INF directory
is displayed. Expand the META-INF directory.
- Right-click the META-INF directory
and click New > Folder. Create a subfolder named wsdl,
in the META-INF directory.
- Copy the WSDL file to the META-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.
- Copy theejb-jar.xml deployment descriptor or
the application-client.xml deployment descriptor. If
the deployment descriptor file already exists in the JAR file, manually
merge the <service-ref> elements in the existing ejb-jar.xml file
or the application-client.xml file with the original ejb-jar.xml file
or the application-client.xml file that you generated with
the WSDL2Java tool.
- (Optional) Place the ibm-webservicesclient-ext.xmi file
and the ibm-webservicesclient-bnd.xmi file in the META-INF subdirectory,
if used.
- Assemble the JAR file into an enterprise archive (EAR)
file using typical assembly techniques if the client runs in a container.
- Right-click the META-INF directory
and click New > Folder. Create a subfolder named wsdl in
the META-INF directory.
- Copy the WSDL file to the META-INF\wsdl directory
by right-clicking on the wsdl directory and click Import > File
system. Browse the WSDL file for this Web service and click Finish.
- Copy the JAX-RPC mapping file in the META-INF subdirectory
in the same manner that you copied the WSDL file. The JAX-RPC
mapping file is indicated by the element in the ejb-jar.xml file
or the application-client.xml file.
- (Optional) Place the ibm-webservicesclient-ext.xmi file
and the ibm-webservicesclient-bnd.xmi file in the META-INF subdirectory,
if used. If these files are already in the module, manually
merge the contents of the files that are generated by the WSDL2Java
tool into the existing files.
Results
You 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
Configure the client deployment
descriptor . Now that you have assembled the client module,
you need to configure the bindings so that the client can communicate
with a Web service that is deployed on a server.