Deploying to an Axis2 client using W3C SOAP over JMS
A web service bound to the W3C candidate recommendation for SOAP over JMS must run in the EJB container of a Java EE application server. This task is step 4 of connecting an Axis2 web service client and a web service deployed to WebSphere Application Server using the W3C SOAP over JMS protocol. Modify the URL in the Axis2 client developed for IBM MQ transport for SOAP to use the W3C candidate recommendation for SOAP over JMS.
Before you begin
You must first complete the task, Developing a JAX-WS client for WebSphere transport for SOAP using Eclipse to call SimpleJavaListener using an Axis2 client and the IBM MQ transport for SOAP protocol.
You must also have created the web service and configured IBM MQ and WebSphere Application Server.
See Use IBM MQ and WebSphere Application Server together.
You must also have completed the following task, Developing a JAX-WS EJB web service for W3C SOAP over JMS.
In the task, the client runs in Eclipse Galileo. You might run the client from the command line by modifying the Axis2.bat file shipped with Axis2.
About this task
The only change you must make to the existing Axis2 StockQuoteAxis static client to call the StockQuoteAxis service hosted by WebSphere Application Server is to change the URL passed to the client. Since the WSDL has not changed, we can use the same proxy classes in the soap.server package.
You have two approaches to defining the URL to pass to the client. You might use the same URL as in the generated StockQuoteAxis.wsdl. You must add the jndiInitialContextFactory and the jndiURL parameters to access the WebSphere Application Server JNDI directory. Another approach is to change the URL and give the client direct access to the REQUESTAXIS and REPLYAXIS queues on QM1, without using a JNDI lookup.
The connection parameters you define in the URL passed to the Axis2 client are used to connect to the IBM MQ queue manager and queues required to send and receive SOAP messages. The connection parameters passed to the Axis2 client are not necessarily used by the service. We can use the distributed queuing capabilities of IBM MQ to decouple the client and service from using the same queue manager, or the same name server.
Procedure
-
Save the URL from the generated StockQuoteAxis.wsdl and close down Rational® Application Developer to save on memory.
If you did not change the server configuration, closing Rational Application Developer stops the application server. In which case start the server with the command:
startserver server1
- Open Eclipse Galileo in the workspace with the Axis2 client project.
- Open SQA2StaticClient.java.
-
Call the service using the queue variant of the URI.
-
Modify the URL.
The new URI is:
jms:queue:REQUESTAXIS ?replyToName=REPLYAXIS &connectionFactory=connectQueueManager(QM1)Bind(Server) &targetService=StockQuoteAxis;
Compare this to the URL from StockQuoteAxis.wsdl:- REQUESTAXIS is now uppercase as it is a queue name and not a JNDI name.
- The connection to QM1 is straightforward.
- The URI does not contain the name of the Reply to destination. The client must define the queue it expects replies on.
- Run SQA2StaticClient.java using the same Run as... configuration as you did in the task, Developing a JAX-WS client for WebSphere transport for SOAP using Eclipse.
-
Modify the URL.
The new URI is:
-
Call the service using the jndi variant of the URI, using WebSphere Application Server as the naming server.
-
Use the URL from StockQuoteAxis.wsdl, Figure 1, providing the missing parameters to use the naming service in WebSphere Application Server.
The missing parameters and values you must provide are:
Table 1. Additional JNDI parameters Parameter Value used in this example Description &jndiURL iiop://localhost:2810
or
corbaname:iiop:localhost:2810
URI of naming provider. For WebSphere Application Server the value defaults to 2809. It is also known as the port number of the RMI connector, and the bootstrap port. The value is listed in the SystemOut.log 00000000 NameServerImp A NMSV0018I: Name server available on bootstrap port 2810
&jndiInitialContextFactory com.ibm.websphere.naming.
WsnInitialContextFactory
The name of the initial context factory used by WebSphere Application Server. &replyToName replyaxis JNDI name of REPLYAXIS queue. jms:jndi:requestaxis? &jndiURL=iiop//localhost:2810 &jndiConnectionFactoryName=qm1 &jndiInitialContextFactory=com.ibm.websphere.naming.WsnInitialContextFactory &targetService=StockQuoteAxis &replyToName=replyaxis;
-
Add the JAR files required by the JNDI lookup.
In this configuration, the following JAR files were added to the build path to run the task using the jndi variant of the JMS url:
- com.ibm.jaxws.thinclient_7.0.0.jar from Rational installation directory\SDP\runtimes\base_v7\runtimes.
- com.ibm.ws.runtime.jar from Rational installation directory\SDP\runtimes\base_v7\plugins
- All the JAR files in WebSphere MQ Installation directory\java\lib.
- All the JAR files in Axis2-1.5.1\lib.
- Java 6.0 JRE.
- Run SQA2StaticClient.java using the same Run as... configuration as you did in the task, Developing a JAX-WS client for WebSphere transport for SOAP using Eclipse.
-
Use the URL from StockQuoteAxis.wsdl, Figure 1, providing the missing parameters to use the naming service in WebSphere Application Server.
The missing parameters and values you must provide are:
Results
In both cases the reply from the service is displayed in the client console view.