Configuring the Asynchronous Consumer sample to use a JMS transport

In this sample, WebSphere MQ is used as the JMS provider; you must create the administered objects by using the JMSAdmin tool.

Before you start:

If you are running the sample on Linux you must complete the following steps:

  1. Add the JMSAdmin class to the classpath by adding the following file to your classpath:
    >mq_install_directory</java/lib/com.ibm.mqjms.jar
  2. Add the Java location to your PATH variable by including the following code in your classpath:
    >JAVA_HOME</bin

Creating the administered objects by using JMSAdmin

The following instructions assume that WebSphere MQ is installed in the mq_install_dir directory. The JMSAdmin tool and JMSAdmin configuration file are in the following locations:

In the AsyncWebServiceFlows project, you must use the SOAPJMSSample.defs file with the JMSAdmin tool.

Before you can use the JMSAdmin tool, you must modify the JMSAdmin.config file.

Modifying the JMSAdmin.config file

To modify the JMSAdmin.config file:

  1. In a text editor, open the JMSAdmin.config file.
  2. To comment out any options that are not required, add a number sign (#). To uncomment any option, remove the number sign (#).
    #  The following line specifies which JNDI service provider is in use.
    #  It currently indicates a File System Context. If a different
    #  service provider is used, this line must be commented out, and the
    #  appropriate one must be uncommented.
    #
    #  com.sun.jndi.fscontext.RefFSContextFactory is the FileSystem JNDI Context
    #
    #INITIAL_CONTEXT_FACTORY=com.sun.jndi.ldap.LdapCtxFactory
    INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
    #INITIAL_CONTEXT_FACTORY=com.ibm.ejs.ns.jndi.CNInitialContextFactory
    #INITIAL_CONTEXT_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory
    #
    #  The following line specifies the URL of the initial context
    #  for the service provider. It currently refers to a File System Context. 
    #  Examples of an LDAP root context URL and the JNDI namespace for WebSphere 
    #  are also shown, commented out.
    #
    #PROVIDER_URL=ldap://localhost/o=ibm,c=us
    PROVIDER_URL=file:/C:/SOAPJNDIBindings
    #PROVIDER_URL=iiop://localhost/	
    
  3. Ensure that the PROVIDER_URL is set to /C:/SOAPJNDIBindings, or an equivalent location on Linux, and INITIAL_CONTEXT_FACTORY is set to com.sun.jndi.fscontext.RefFSContextFactory.
  4. Save the file.

Now you can create the objects.

Creating the objects

By running the WebSphere MQ JMSAdmin tool, you create the JNDI administered objects to configure the JMS Connection Factories and Destinations that are used in the sample.

You create the objects by running JMSAdmin tool and by using the SOAPJMSSample.defs file as input.

On the command line, enter the following commands:

Where WebSphere MQ is installed in the following location: mq_install_dir, and workspace_path is the full path to the WebSphere Message Broker Toolkit workspace directory.

The objects and the .bindings file are created.

Configuring the SOAP nodes to use JMS

  1. Open the AsyncWebServiceFlows.WebServicesAsyncServerFlow message flow in the Message Flow editor.
  2. Right-click the SOAPInput node in the message flow and click Properties to show the Properties view.
  3. In the Properties view, select the Basic tab.
  4. The value of the Imported binding field is set to OrderServiceSOAP and the value of the Transport property is set to HTTP. Change the value of Imported binding to OrderServiceSOAPJMSBinding. The Transport property value changes to JMS.
  5. Open the AsyncWebServiceFlows.WebServicesAsyncClientFlow message flow in the Message Flow editor, configure the Imported binding field for the SOAPAsyncRequest node by using the previous steps.

Configuring the JNDI path in the message flows

Configuring the SOAP nodes with the location of the .bindings file:

  1. Open the AsyncWebServiceFlows.WebServicesAsyncServerFlow message flow in the Message Flow editor.
  2. Right-click the SOAPInput node in the message flow and click Properties to show the Properties view.
  3. In the Properties view, select the JMS Transport tab.
  4. In the Location JNDI URL Bindings field, enter the path that is specified in the PROVIDER_URL line in the JMSAdmin.config file.
  5. Ensure that the path that you entered in the node properties matches the path in the JMSAdmin.config file. If the two paths do not match, the message flows will not work.
  6. Save the message flow.
  7. Open the AsyncWebServiceFlows.WebServicesAsyncClientFlow message flow in the Message Flow editor, configure the SOAPAsyncRequest node with the location of the .bindings file by using the previous steps.
  8. The message flows are now configured, and are ready to be deployed to the broker.

Rebuilding the BAR file and deploying the message flows

To deploy the modified WebServicesAsyncServerFlow and WebServicesAsyncClientFlow, rebuild a broker archive (BAR) file that contains both message flows.

Build the BAR file:

  1. Double-click the AsyncWebServiceFlows.AsyncWebServiceSample.bar BAR file.
  2. In the Manage tab, click Build to rebuild the BAR file.
  3. Save the built BAR file.
  4. Click the BAR file and drag it to the default execution group in the Brokers view. This action deploys the flows onto the broker.

You can now run the sample, see Running the Asynchronous Consumer sample. You can use the same Flow Test because the client flow is driven by a WebSphere MQ queue.

Back to sample home