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:
In a text editor, open the JMSAdmin.config file.
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/
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:
On Windows:
cd mq_install_dir\java\bin
JMSAdmin < "workspace_path\AddressBook\AddressBookSample.defs"
On Linux:
cd mq_install_dir/java/bin
./setjmsenv
./JMSAdmin < workspace_path/AddressBook/AddressBookSample.defs
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
Open the AddressBook.AddressBookProviderFlow.msgflow message flow
in the Message Flow editor.
Right-click the SOAP Input node in the message flow and click
Properties to show the Properties view.
In the Properties view, select the Basic tab.
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.
Open the AddressBook.AddressBookConsumerFlow.msgflow message flow in
the Message Flow editor to configure the SOAPRequest node to use the JMS
transport.
Right-click the findAddressRequest SOAPRequest node in the message flow and click
Properties to show the Properties view.
In the Properties view, select the Basic tab.
The value of the Imported binding field is set to
AddressBookPortBinding. Using the drop-down list, change the value of
Imported binding to AddressBookJMSBinding.
Change the value of the Binding Operation property to
FindAddress.
Ensure that the Transport property value is JMS.
Select the saveAddressRequest SOAPRequest node in the message flow and go to the
Properties view.
In the Properties view, select the Basic
tab.
The value of the Imported binding field is set to
AddressBookPortBinding. Using the drop-down list, change the value of
Imported binding to AddressBookJMSBinding.
Change the value of the Binding Operation property to
SaveAddress.
Ensure that the Transport property value is JMS.
Configuring the JNDI path in the message flows
On Windows:
The SOAP nodes are already configured with the location of the .bindings file.
However, if you have created a .bindings file in a different location,
you must reconfigure the
SOAP nodes with the different location of the .bindings file. Follow the
steps in the following section: "Configuring the SOAP nodes with the location
of the .bindings file."
On Linux:
To ensure that the SOAP nodes in the message flows know the location of
the .bindings file that you have created,
follow the steps given in the following section: "Configuring the
SOAP nodes with the location of the .bindings file."
Configuring the SOAP nodes with the location of the .bindings file:
Open the AddressBook.AddressBookProviderFlow.msgflow message flow
in the Message Flow editor.
Right-click the SOAP Input node in the message flow and click
Properties to show the Properties view.
In the Properties view, select the JMS Transport
tab.
In the Location JNDI URL Bindings field, enter the path that is
specified in the PROVIDER_URL line in the JMSAdmin.config file.
On Linux: Enter file:///home/myuser/SOAPJNDIBindings, where
myuser is the user name that you used to run the broker.
On Windows: If you have modified the location of the .bindings
file, enter the new location, otherwise leave the
value as file:/C:/SOAPJNDIBindings.
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.
Save the message flow.
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.
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:
Double-click the BAR file: AddressBook.AddressSampleConsumer.bar.
In the Manage tab, click Build
to rebuild the BAR file.
Save the built BAR file.
Double-click the BAR file: AddressBook.AddressSampleProvider.bar.
In the Manage tab, click Build
to rebuild the BAR file.
Save the built BAR file.
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.