Deploying a web service client to Axis2 to use IBM MQ transport for SOAP
Prepare a deployment directory and Axis2 configuration file for the client. Provide the client proxies and client class, and set up the CLASSPATH. Configure IBM MQ queues and channels, start the service and test the client.
Before you begin
Tip: Deploy the service to HTTP. Develop and test the client for HTTP, and then modify the URL to reference the service using IBM MQ transport for SOAP. The task shows how to deploy an unmanaged Axis2 client to Java Standard Edition. You might want to deploy an Axis2 client to a Web container. In Developing a JAX-WS client for WebSphere transport for SOAP using Eclipse, you developed a client in a Web container and deployed it to WebSphere Application Server Community Edition. As part of the server configuration, you enabled the Axis2 facet and included the facet in the configuration of the Web container. To configure Web containers on other application servers, refer to the Axis2 documentation, http://ws.apache.org/axis2/1_4_1/installationguide.html#servlet_container, or the documentation supplied with the Web server. Note: Axis2 use the term, Servlet container. A Servlet container is the same as a Web container.
About this task
Deploying an Axis2 client to use IBM MQ transport for SOAP is like deploying an Axis2 client to use HTTP. Additional steps are required to provide a classpath to the IBM MQ JAR files, and to modify the Axis2 configuration file. The Axis2 configuration file requires an additional entry for JMS. The entry refers to the IBM MQ transport for SOAP JAR file that implements the JMS transportSender.
Axis2 provides a script, axis2.bat or axis2.sh, which simplifies client deployment; see the examples in Figure 4 and Figure 5.
Note:
- axis2.bat has a bug that must be corrected. The string -Djava.ext.dirs=
%AXIS2_HOME%\lib\must be changed to -Djava.ext.dirs=%AXIS2_HOME%\lib\\.In axis2.bat and axis2.sh, -Djava.ext.dirs is used as a quick way to reference all the Axis2 JAR files, instead of adding them separately to the classpath. Unfortunately this approach is flawed, and only works with some JREs. It does not work with the IBM JREs.
The JVM parameter, -Djava.ext.dirs=%AXIS2_HOME%\lib\\, makes the Axis JAR files available to the JVM. The JVM attempts to instantiate some of the Axis JAR files, and leads to an error, the details of which depend on the JVM. Typically, you might see one of the following lines in the stack trace:org.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:76)or org.apache.axis2.deployment.DeploymentException: java.security.NoSuchAlgorithmException: MD5 MessageDigest not availableThe correct way to run an unmanaged Axis2 client is to add the Axis2 JAR files to the classpath. The classpath is available only to the client application and not to the JVM.
The procedure describes the general steps to run an unmanaged Axis2 client without using the axis2 script. The examples in Figure 2 and Figure 3 are scripts for Windows and Linux .
Procedure
- Download Axis2 1.4.1 from http://ws.apache.org/axis2/download/1_4_1/download.cgi and unpack into a folder, Axis2-1.4.1.
- Update axis2.xml in Axis2-1.4.1\conf.
See step 3 in Developing a JAX-WS client for WebSphere transport for SOAP using Eclipse.
- Update axis2.xml in Axis2-1.4.1\conf. Add IBM MQ transport for SOAP as a transportSender:
<transportSender name="jms" class="com.ibm.mq.axis2.transport.jms.WMQJMSTransportSender"/>- If required, alter the size of the connection pool from the default of 10.
<transportSender name="jms" class="com.ibm.mq.axis2.transport.jms.WMQJMSTransportSender"> <parameter name="ResourcePoolCapacity">20</parameter> </transportSender>ResourcePoolCapacity defines how many service endpoint entries are kept in the cache. The value must be at least 1. If the number of service endpoint entries exceeds the cache size, entries are deleted to make room for new entries. The size of an endpoint entry varies. Set a number that is large enough to avoid the cache thrashing.
- Create a directory deployDir. Under this directory copy the folder structure containing the client and client proxies. deployDir is equivalent to the project\bin folder in an Eclipse Java project.
- Open a command window on Windows, or a command shell using X Window System on UNIX and Linux systems, in deployDir.
- Update the classpath to include the current directory, Axis2 JAR files, com.ibm.mqjms.jar and com.ibm.mq.axis2.jar. com.ibm.mqjms.jar references all the other IBM MQ JAR files that are required.
- Use the Java command to start the client program.
Examples
Four example of running an Axis2 client are listed in Figure 3 to Figure 5. Figure 1 shows the output from running the asynchronous client listed in Figure 4. Note Note