Configuring a permanent reply queue for web services using SOAP over JMS

When using two-way web service communications using the industry standard SOAP over JMS protocol, you can benefit from configuring a permanent reply queue on a Java™ API for XML Web Services (JAX-WS) or Java API for XML-based RPC (JAX-RPC) web services client. The use of a permanent reply queue can improve performance because this reply queue prevents the client from having to create a temporary reply queue each time a web services request is invoked.

About this task

A permanent reply queue is configured on the web services client in one of the following ways:
  • Specify the optional replyToName property in the JMS endpoint URL.
  • Set the reply queue programmatically.
    • For a JAX-WS web services client, set the JNDI name of the reply queue programmatically on the client RequestContext object. Setting the reply queue JNDI name on the RequestContext object affects all subsequent requests that are invoked using that RequestContext object.
    • For a JAX-RPC web services client, set the JNDI name of the reply queue programmatically on the client Stub or Call object. Setting the reply queue JNDI name as a Stub or a Call property affects all subsequent requests that are invoked using that Stub or Call object.
  • Set the reply queue as a Java virtual machine (JVM) system property. Setting the reply queue as a JVM system property affects all of your web services clients running in the particular JVM. If there are multiple clients running in the same JVM that need to use a different reply queue, then this option does not work. Instead, use one of the other two options.

To set the permanent reply queue using any of these options, only client-side configuration is necessary. There is no configuration necessary for the web service provider.

Use the typical administrative functions of the JMS messaging provider to create the permanent reply queue prior to configuring the reply queue with the web services client.

Procedure

Configure the JNDI name of the permanent reply queue using one of the following ways:
  • Specify the optional replyToName property in the JMS endpoint URL; for example:
    jms:jndi:jms/MyRequestQueue&jndiConnectionFactoryName=jms/MyCF&replyToName=jms/MyReplyQueue
  • Set the reply queue programmatically on the client.
    The value of the property is a String and represents the JNDI name of the reply queue.
    • For JAX-WS web services clients, set the com.ibm.wsspi.webservices.Constants.JMS_REPLY_QUEUE_JNDI_NAME property on the client JAX-WS RequestContext object; for example:
      ((BindingProvider) port).getRequestContext().put
      (com.ibm.wsspi.webservices.Constants.JMS_REPLY_QUEUE_JNDI_NAME, "jms/MyReplyQueue");
    • For JAX-RPC web services clients, set the com.ibm.wsspi.webservices.Constants.JMS_REPLY_QUEUE_JNDI_NAME property on the client JAX-RPC Stub or Call object; for example:
      ((javax.xml.rpc.Stub) stub)._setProperty(com.ibm.wsspi.webservices.Constants.JMS_REPLY_QUEUE_JNDI_NAME, 
      "jms/MyReplyQueue"); 
  • Set the JNDI name of the reply queue as a JVM system property.
    • For a Java client invocation, enter the following code at a command prompt:
      java -Dcom.ibm.websphere.webservices.JMSReplyQueueJndiName=jms/MyReplyQueue
    • For a JVM running on the application server, perform the following actions:
      • Set a JVM system property using the administrative console for the application server that runs the web service client application.

        To set custom properties, log on to the administrative console, and navigate to the Java virtual machine custom properties panel.

        1. Click Servers > Server Types > WebSphere application servers > server_name> Java and Process Management > Process Definition > Java Virtual Machine > Custom Properties> New
        2. Set the Name property to: com.ibm.websphere.webservices.JMSReplyQueueJndiName
        3. Set the Value property to: jms/Permanent_Q
        4. Click OK to save your changes.
        5. Click Synchronize changes with Nodes and click Save.
        6. Restart the application server.

Results

Your web services client can now receive SOAP over JMS messages from a permanent reply queue.