This topic explains how to assemble a WAR file that is enabled
for Web services from Java code with an assembly tool.
Before you begin
You can assemble Web Services for J2EE modules with assembly tools provided with WebSphere Application Server.
You
must configure the assembly tool before
you can use it.
You need the following artifacts that are generated by
the
WSDL2Java command-line tool to complete this task:
- An assembled WAR file that contains the web.xml file, but is
not enabled for Web services.
- The Java class for the service endpoint interface
- A Web Services Description Language (WSDL) file
- The complete webservices.xml,ibm-webservices-bnd.xmi,
and ibm-webservices-ext.xmi deployment descriptors, and the Java
API for XML-based remote procedure call (JAX-RPC) mapping file classes that
are generated by the WSDL2Java command.
Why and when to perform this task
Assemble a Web services-enabled WAR file from Java code by following
the actions in the steps for this task section.
Steps for this task
- Start an assembly tool.
The 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
Java 2 Platform, Enterprise Edition (J2EE) Version 1.2, 1.3 or 1.4 compliant
deployment descriptors.
- Click File > Import to import the 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 WAR file you just imported in the Navigator pane.
- Expand the WebContent directory so that the WEB-INF directory
is displayed. Expand the WEB-INF directory.
- Confirm that the WEB-INF/web.xml deployment descriptor
for the Web module contains a <servlet-class> element that indicates the
Java bean class that is implementing the service:
- Double-click Web Deployment Descriptor.
- In the Web Deployment Descriptor editor, click the Servlets tab
at the bottom of the editor window.
- Enter the full path name of the Java bean class that implements
the Web service in the Servlet class field.
- Close the editor window to save your changes.
- Right-click the WEB-INF directory and click New > Folder.
Create a subfolder named wsdl in the WEB-INF directory.
- 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.
- Copy the JAX-RPC mapping file, as specified by the <jaxrpc-mapping-file>
element of the webservices.xml file.
- Copy webservices.xml,ibm-webservices-bnd.xmi and ibm-webservices-ext.xmi files
into the WEB-INF subdirectory in the same manner.
- Import the service endpoint interface class so that the service
endpoint interface package begins in the JavaSource directory. When
you import the source file, it is automatically compiled.
Result
The artifacts required to enable the Web module for Web services are
added to the WAR file.