Setting up the SOAP/JMS Web Services sample

Before running the WebService Over JMS sample you must create JNDI administered objects for Client Message Flow and WebService  Message Flow. In the sample WebSphere MQ is used as the JMS provider, so you must create the administered objects using the JMSAdmin tool.

Creating the administered objects using JMSAdmin

The JMSAdmin tool is located in install_dir/java/bin on Unix, and install_dir\java\bin on Windows, where install_dir is the directory in which WebSphere MQ is installed.

In the RetailMsgFlowProject , there is "jms.defs" file under "objects" folder which you need to use with the JMSAdmin tool.
Note : The "jms.def" contains the JNDI object definitions for default Queue Manager. If you are using  any other legacy Queue Manager to run this Sample, then change the Queue Manager and Port number in the "jms.def" file.

Before using the JMSAdmin tool, modify the JMSAdmin.config file as follows.

Modifying the JMSAdmin.config file

To modify the JMSAdmin.config file:

  1. Open the JMSAdmin.config file in a text editor.
  2. On Windows and Unix platforms, remove the # sign, as shown, to uncomment the line highlighted in bold:
    # The following line specifies which JNDI service provider is in use.
    # It currently indicates an LDAP service provider. If a different
    # service provider is used, this line should be commented out and the
    # appropriate one should be uncommented.
    #
    #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
    #
  3. On Windows only, remove the # sign, as shown, to uncomment the line highlighted in bold:
    # The following line specifies the URL of the service provider's initial
    # context. It currently refers to an LDAP root context. Examples of a
    # file system URL and WebSphere's JNDI namespace are also shown, commented out.
    #
    #PROVIDER_URL=ldap://polaris/o=ibm,c=us
    PROVIDER_URL=file:/C:\JNDI-Directory
    #PROVIDER_URL=iiop://localhost/
    #

    When you have saved the file, create the JNDI-Directory directory as it appears in the PROVIDER_URL line.

  4. On Linux /AIX / Solaris / HP-UX only, remove the # sign, as shown, to uncomment the line highlighted in bold, then replace <myuser> with the user name you use to run the broker. When you have saved the file, create the JNDI-Directory directory as it appears in the PROVIDER_URL line.
    # The following line specifies the URL of the service provider's initial
    # context. It currently refers to an LDAP root context. Examples of a
    # file system URL and WebSphere's JNDI namespace are also shown, commented out.
    #
    #PROVIDER_URL=ldap://polaris/o=ibm,c=us
    PROVIDER_URL=file:/home/<myuser>/JNDI-Directory
    #PROVIDER_URL=iiop://localhost/
    #

Now you are ready to create the objects.

Creating the objects

You create the objects, by running JMSAdmin, using the "jms.defs" file as input. This file is present in "objects" folder of the RetailMsgFlow Project. On the command line, enter the following commands:

On Windows:

cd mq_install_dir\Java\bin

JMSAdmin < "workspace_path\RetailMsgFlowProject\objects\jms.defs"

On Linux:

cd mq_install_dir/java/bin

./JMSAdmin < workspace_path/RetailMsgFlowProject/objects/jms.defs

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

On AIX, Solaris, HP-UX:
Copy / ftp the jms.defs file from the Toolkit system where you are working to the local file system.  This file are available on the following path,
            On Windows:
                "workspace_path\RetailMsgFlowProject\objects\jms.defs"
            On linux:
                workspace_path/RetailMsgFlowProject/objects/jms.defs 

cd mq_install_dir/java/bin

./JMSAdmin < (FTP-PATH)/jms.defs  [ FTP-PATH is were you have copied or ftp the "jms.defs" file on Unix system)

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

The objects and the .bindings file are created.

Configuring the JNDI path in the message flows

You need to tell the JMS nodes in the message flows where to find the .bindings file that you just created.

To configure the JMS nodes with the location of the .bindings file:

  1. In the Message Brokers Toolkit, switch the Application Development perspective.
  2. Open the RETAIL_CLIENT message flow in the Message Flow editor.
  3. Right-click the JMSOutput node in the message flow, then click Properties to open the Properties dialog.
  4. In the Location JNDI Bindings field, type the path that is specified in the PROVIDER_URL line in the JMSAdmin.config file. Ensure that the path that you type 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.
  5. Click OK to close the Properties dialog.
  6. Similarly modify the location JNDI bindings in the JMSInput Node of the RETAIL_CLIENT flow.
  7. Open the RETAIL_WEBSERVICE message flow in the Message Flow editor, and configure the JMSInput node and JMSOutput Node by modifying the  location  JNDI bindings property.

The message flows are now configured, and Create the new Bar file and add the sample message flows and message sets.
Deploy the bar on the legacy broker using the below instructions.

Creating the BAR file and deploying the message flows on AIX, Solaris, HP-UX, Linux, Windows systems for the Legacy Broker :

To deploy the RETAIL_CLIENT.msgflow, RETAIL_WEBSERVICES.msgflow and RetailMsgSet message set, create a broker archive (BAR) file that contains all the two  message flows and the message set.

To create the BAR file:

  1. In the Message Brokers Toolkit, switch to the Broker Administration Domain perspective.
  2. In the Domians view, right-click, then click New > Message Broker Archive, and enter a name for the BAR file.
  3. Add the two flows and retail message set to the BAR file, then save the file (Ctrl+S).
  4. In the Broker Administration Navigator view, click the BAR file and drag it to the default execution group in the Domains view. This deploys the flows onto the legacy broker.
  5. Alternately, you can copy the BAR file on Non-Tooling platforms, add the broker to the Configuration Manager and use mqsideploy command to deploy the bar file on the legacy Broker.
  6. Create the required queue needed to run the sample. Copy the mq.defs file into the Unix machine.
                Run the following command :           runmqsc  QueueManagerName  < mq.defs
Database Setup :
  1. Create the  Cloudscape or DB2 database called "RETAIL".
  2. Create the ODBC Data Source name  for 'RETAIL'  database. For more details click on  Set up ODBC (Unix )
  3.  db2 connect to RETAIL
  4.  Run the "RetailInformation.sql" file present in "RetailMsgFlowProject" project to create the required table and records.
      Use the command :  db2 -vf  RetailInformation.sql on DB2 database.   

Setting up the ODBC drivers on Unix

This step must be performed on Unix but not on Windows. So skip this step if you are working only on Windows.

To set up the ODBC drivers on Unix:

  1. Open the /var/mqsi/odbc/.odbc.ini file in a text editor.
  2. In the .odbc.ini file, Locate the line that says: [ODBC Data Source] then insert the following lines below it:
    ESDSALES= IBM DB2 ODBC Database
    ESDSTOCK= IBM DB2 ODBC Database
  3. Add the following stanzas to the .odbc.ini file:
    [ESDSALES]
    Driver=/opt/IBM/db2/V8.1/lib/libdb2.so
    Description=ESDSALES DB2 ODBC Database
    Database=ESDSALES
    [ESDSTOCK]
    Driver=/opt/IBM/db2/V8.1/lib/libdb2.so
    Description=ESDSTOCK DB2 ODBC Database
    Database=ESDSTOCK

The ODBC drivers are now configured correctly.

You are now ready to run the sample.

Main Page icon   Back to sample home