Deploying a Web service client to Axis2 to use WebSphere 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 WebSphere® MQ queues and channels, start the service and test the client.
Before you begin
About this task
Deploying an Axis2 client to use WebSphere MQ transport for SOAP is like deploying an Axis2 client to use HTTP. Additional steps are required to provide a classpath to the WebSphere 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 WebSphere 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.
- 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:
ororg.apache.axiom.om.util.UUIDGenerator.getInitialUUID(UUIDGenerator.java:76)
org.apache.axis2.deployment.DeploymentException: java.security.NoSuchAlgorithmException: MD5 MessageDigest not available
The 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
Examples
cd C:\IBM\ID\Workspaces\Axis2docs\StockQuoteAxis2PojoClient\bin>
runpojo soap/client/SQA2AsyncClient
HTTP Sync: 55.25
Callback constructor
Waiting for HTTP callback
Result in Callback 55.25
HTTP poll: 55.25
JMS: Sync: 55.25
Callback constructor
Waiting for JMS callback
Result in Callback 55.25
JMS poll: 55.25
Press any key to continue . . .
@echo off
set AXIS2_HOME=C:\OpenSource\axis2-1.4.1
set JAVA_HOME=C:\IBM\Java50
set WMQ_HOME=C:\IBM\MQ\java\lib
setlocal EnableDelayedExpansion
set CLASSPATH=
set AXIS2_CLASS_PATH=
FOR %%c in ("%AXIS2_HOME%\lib\*.jar") DO set AXIS2_CLASS_PATH=!AXIS2_CLASS_PATH!;%%c
"%JAVA_HOME%\bin\java" -Daxis2.repo="%AXIS2_HOME%\repository"
-Daxis2.xml="%AXIS2_HOME%\conf\axis2.xml" -cp
".;%WMQ_HOME%\com.ibm.mqjms.jar;%WMQ_HOME%\com.ibm.mq.axis2.jar;%AXIS2_CLASS_PATH%" %1
pause
export AXIS2_HOME=/home/OpenSource/axis2-1.4.1
export JAVA_HOME=/usr/lib/j2sdk1.5-ibm
# update classpath
AXIS2_CLASSPATH=""
for f in "$AXIS2_HOME"/lib/*.jar
do
AXIS2_CLASSPATH="$AXIS2_CLASSPATH":$f
done
AXIS2_CLASSPATH="$AXIS2_HOME":"$JAVA_HOME/lib/tools.jar":"$AXIS2_CLASSPATH":"$CLASSPATH"
java -cp /home/alex/dev/sandbox/Soap/axis2:/opt/mqm/java/lib/com.ibm.mqjms.jar:
/opt/mqm/java/lib/com.ibm.mq.axis2.jar:$AXIS2_CLASSPATH
-Daxis2.xml=/home/alex/dev/sandbox/axis2-1.4.1/conf/axis2.xml %1
@echo off
set AXIS2_HOME=C:\OpenSource\axis2-1.4.1
set JAVA_HOME=C:\IBM\Java50
set WMQ_HOME=C:\IBM\MQ\java\lib
%AXIS2_HOME%\bin\axis2 -cp .;%WMQ_HOME%\com.ibm.mqjms.jar;%WMQ_HOME%\com.ibm.mq.axis2.jar; %1
pause
export AXIS2_HOME=/home/OpenSource/axis2-1.4.1
export JAVA_HOME=/usr/lib/j2sdk1.5-ibm
%AXIS2_HOME%\bin\axis2 -cp .;%WMQ_HOME%\com.ibm.mqjms.jar;%WMQ_HOME%\com.ibm.mq.axis2.jar; %1