Assembling a WAR file enabled for web services from Java code
We can assemble a web application archive (WAR) file enabled for web services from Java code with an assembly tool.
We can assemble Java-based web services modules with assembly tools provided with WebSphere Application Server.
For JAX-WS web service applications, we need the portable artifacts that are generated by the wsgen command-line tool when starting from a service endpoint implementation to complete this task. The wsgen tool processes a compiled service endpoint implementation class as input and generates the following portable artifacts:
- any additional Java Architecture for XML Binding (JAXB) classes required to marshal and unmarshal the message contents. The additional classes include classes that are represented by the @RequestWrapper annotation and the @ResponseWrapper annotation for a wrapped method.
- a WSDL file if the optional -wsdl argument is specified. The wsgen command does not automatically generate the WSDL file. The WSDL file is automatically generated when we deploy the service endpoint.
For JAX-RPC web service applications, we need the following artifacts that are generated by the WSDL2Java command-line tool to complete this task:
- An assembled WAR file containing the web.xml file, but is not enabled for web services.
- The Java class for the service endpoint interface
- A 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 generated by the WSDL2Java command.
Assemble a web services-enabled WAR file from Java code by following the actions in the steps for this task section.
Tasks
- Start an assembly tool. Read about starting the assembly tool in the Rational Application Developer documentation.
- 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. Read about configuring the assembly tool in the Rational Application Developer documentation.
- Import the JavaBeans implementation and the artifacts generated by the command-line tooling into the assembly tool.
- Migrate WAR files created with the Assembly Toolkit, Application Assembly Tool (AAT) or a different tool to the Rational Application Developer assembly tool. To migrate files, import your WAR files to the assembly tool. Read about migrating code artifacts to an assembly tool in the Rational Application Developer information.
The artifacts required to enable the web module for web services are added to the WAR file.
What to do next
Now we can assemble the WAR file enabled for Web services into an EAR file. To learn more, read about assembling a web services-enabled WAR into an EAR file.
Related:
Development and assembly tools Assembling a web services-enabled WAR into an EAR file Assembling a web services-enabled WAR file from a WSDL file WSDL2Java command for JAX-RPC applications