Setting up the Address Book sample to use JMS transport

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

If you are running the sample on Linux, you must add the JMSAdmin class to the classpath. Add the following file to your classpath:

<mq_install_directory>/java/lib/com.ibm.mqjms.jar

To add the Java location to your PATH variable, include the following file in your classpath:

<JAVA_HOME>/bin

Creating the administered objects by using JMSAdmin

WebSphere MQ is installed in the mq_install_dir directory. The JMSAdmin tool and JMSAdmin configuration file are located in mq_install_dir/java/bin on Linux, and mq_install_dir\java\bin on Windows.

In the Address Book Sample Flow project, you must use the AddressBookSample.defs file with the JMSAdmin tool.

Before you can use the JMSAdmin tool, you must modify the JMSAdmin.config file as shown in the following instructions.

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 required, remove a 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. Save the file, then create the JNDI-Directory directory as it is shown in the PROVIDER_URL line.

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.

The JMSAdmin tool uses the AddressBookSample.defs file as input. You create the objects by running JMSAdmin, and by using the AddressBookSample.defs file as input.

On the command line, enter the following commands:

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

The objects and the .bindings file are created.

Configuring the SOAP nodes to use JMS

  1. Open the AddressBook.AddressBookProviderFlow.msgflow message flow in the Message Flow editor.
  2. Right-click the SOAP Input 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 AddressBookPortBinding and the value of the Transport property is set to HTTP. Using the drop-down list, change the value of Imported binding to AddressBookJMSBinding. The Transport property value changes to JMS.
  5. Open the AddressBook.AddressBookConsumerFlow.msgflow message flow in the Message Flow editor to configure the SOAPRequest node to use the JMS transport.
  6. Right-click the findAddressRequest SOAPRequest node in the message flow and click Properties to show the Properties view.
  7. In the Properties view, select the Basic tab.
  8. The value of the Imported binding field is set to AddressBookPortBinding. Using the drop-down list, change the value of Imported binding to AddressBookJMSBinding.
  9. Change the value of the Binding Operation property to FindAddress.
  10. Ensure that the Transport property value is JMS.
  11. Select the saveAddressRequest SOAPRequest node in the message flow and go to the Properties view.
  12. In the Properties view, select the Basic tab.
  13. The value of the Imported binding field is set to AddressBookPortBinding. Using the drop-down list, change the value of Imported binding to AddressBookJMSBinding.
  14. Change the value of the Binding Operation property to SaveAddress.
  15. Ensure that the Transport property value is JMS.

Configuring the JNDI path in the message flows

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

  1. Open the AddressBook.AddressBookProviderFlow.msgflow message flow in the Message Flow editor.
  2. Right-click the SOAP Input 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 AddressBook.AddressBookConsumerFlow.msgflow message flow in the Message Flow editor to configure the SOAPRequest nodes 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 AddressBookConsumerFlow and AddressBookProviderFlow flows, rebuild a broker archive (BAR) file that contains both message flows.

Build the BAR file:

  1. Double-click the BAR file: AddressBook.AddressSampleConsumer.bar.
  2. In the Manage tab, click Build to rebuild the BAR file.
  3. Save the built BAR file.
  4. Double-click the BAR file: AddressBook.AddressSampleProvider.bar.
  5. In the Manage tab, click Build to rebuild the BAR file.
  6. Save the built BAR file.
  7. In the Application Development view, click the BAR file and drag each BAR file one-by-one to the default execution group in the Integration Nodes view. This action deploys the flows onto the broker.

You are now ready to run the sample.

Back to sample home