Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop web services - Transports > Invoke JAX-WS web services asynchronously using the SOAP over JMS transport


Use the JAX-WS JMS asynchronous response message listener

Java API for XML-Based Web Services (JAX-WS) includes a Java Message Service (JMS) asynchronous response message listener, which is used to receive responses to asynchronous JAX-WS requests that use the JMS transport. The JMS asynchronous response message listener is used in the application server and application client environments.

JAX-WS provides support for invoking web service operations asynchronously by using either a callback or a polling model. When the JAX-WS client uses the JMS transport to invoke asynchronous operations, the responses are received by the asynchronous response message listener. To learn how to use the JAX-WS asynchronous client invocation model, read about invoking JAX-WS web services asynchronously.

The JMS asynchronous response message listener is used within the web services client environment to receive incoming asynchronous responses when the client application is using the JMS Transport. The listener requires a connection factory and a queue to function correctly. Begin by configuring the connection factory and queue, and then specify the JNDI names of the connection factory and queue to the listener by setting Java system properties. The environment in which the client is running determines how the system properties are set.

The JMS asynchronous response message listener is started automatically by the web services client runtime environment when the client invokes the first asynchronous JAX-WS operation using the JMS transport.

The connection factory and the queue configured with the asynchronous response message listener is used for all requests that are invoked within a particular Java process such as for the application server or an application client container. We can share the connection factory among different Java processes. However, you cannot share a queue among Java processes.


Procedure

  1. Determine if you want the JAX-WS client to use the JMS transport mechanism.

  2. For each Java process that will use JMS as a transport for asynchronous JAX-WS requests, configure the connection factory and queue that are used by the JMS asynchronous response listener for that process. You can share a connection factory among multiple Java processes, but you cannot share a queue among Java processes.

  3. For each Java process, set the com.ibm.websphere.webservices.jms.AsyncReplyQueueName and com.ibm.websphere.webservices.jms.AsyncReplyCFName Java system properties to specify the JNDI names of the queue and connection factory that are used by the JMS asynchronous response message listener for that process.

    If the JNDI name of the queue is the default value, jms/DefaultAsyncReplyQueue, then you do not need to set the AsyncReplyQueueName property. Likewise, if the JNDI name of the connection factory is the default value, jms/DefaultAsyncReplyCF, then you do not need to set the AsyncReplyCFName property as well.

    If your client runs within the application server environment, then set the properties as application server system properties by using the admin console or the wsadmin command.

    If your client runs within the application client container environment, then you should set the properties by using the –CCD option on the launchClient command line.


Results

Your JAX-WS web services client is configured to use the JMS asynchronous response message listener to receive asynchronous response messages when using the JMS transport.


Example

Suppose that we have a JAX-WS web services client that runs in the application client container environment and uses the JMS transport to communicate with the server. Suppose also that the client invokes asynchronous JAX-WS operations. We can create a connection factory with the JNDI name, jms/MyAppCF, and a queue with the JNDI name, jms/MyAppAsyncReplyQueue. When you invoke the client with the launchClient command, specify the JNDI names of the queue and connection factory as illustrated in the following command:

launchClient MyAppClient.ear \
   -CCDcom.ibm.websphere.webservices.jms.AsyncReplyQueueName=jms/MyAppReplyQueue \
   -CCDcom.ibm.websphere.webservices.jms.AsyncReplyCFName=jms/MyAppCF \

<application arguments>

Implement web services applications with JAX-WS
Invoke JAX-WS web services asynchronously
wsadmin scripting tool
Implement static JAX-WS web services clients


Related


SOAP over JMS protocol
JMS endpoint URL syntax
Web services specifications and APIs

+

Search Tips   |   Advanced Search