How to submit a SOAP over JMS request to Websphere MQ using LoadRunner SOA protocol?
Solution:
Prerequisite
- JMS Queue details
- Websphere MQ Client installed (if not installed, instructions are below)
- Websphere MQ jar files installed (if not installed, instructions are below)
- JDK installed (if not installed, instructions are below)
JMS Queue Details
Depending on which queue(s) you want to send and receive a message from as well as the MQ architecture design, you will require following MQ information from your Websphere MQ Admin.
- HostName
- Channel
- Port
- Queue Manager
- Input Queue
- Output Queue
- Queue Connection Factory
- Username and password
For example, in my case, to send a message to an Input Queue, following information was required:
- HostName – xxx.xxx.xxx
- Channel - ICF.DEF.SVRCONN
- Port - 1414(might be different)
- Queue Manager - Not Required
- Input Queue - Input_queue_name
- Output Queue - Not Required
- Queue Connection Factory - qcf
- Username and password - Not required
- Install JAVA JDK on your local machine
- Copy MQ jar files into the JDK...->Java ->jre-> ext folder. You will need to get these jar files from your Webpshere MQ admin
- Also, since we are using fscontext as initial context factory, you will need to download and save fscontext and providerutil.jar files in the above mentioned folder
- Install Websphere MQ Client application on your local machine.
- Navigate to the location where JMSAdmin.config file is located and open it. We are going to select a context factory to use and path where to create the binding file. In my case this file is located at C:\Program Files (x86)\IBM\WebSphere MQ\Java\bin Update and save the file with following details: INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory PROVIDER_URL=file:/C:/JNDI
- Create a new qm.scp file (make sure this file is in the same folder as JMSAdmin.bat file) and put there the MQ details. The .scp file will look like this: DEFINE QCF(qcf) tran(client) chan(ICF.DEF.SVRCONN) host(xxx.xxx.xxx) port(1414) DISPLAY QCF(qcf) DEFINE Q(Input_queue) QUEUE(Input_queue) DISPLAY Q(Input_queue) end
- Create the JNDI folder on your C drive. This is where your binding file will automatically be saved.
- Navigate to “...\WebSphere MQ\Java\bin” and edit JMSAdmin.bat by replacing “java” text with the full java path incase it is not already defined in your System environment settings.
- Navigate to Websphere MQ Java bin folder via the command prompt and execute the JMSAdmin Tool (JMSAdmin. Bat file) with qm.scp as the parameter. This will generate a .bindings file in the JNDI folder automatically.
You will see something like this when JMSAdmin bat application is executed.
Cool, JNDI binding is done.
- Open up a new web services script.
- Press F4 to Navigate to Run-time setting and update the following fields in JMS->Advanced option: -JVM Home: JAVA path -JNDI initial context factory: com.sun.jndi.fscontext.RefFSContextFactory -JNDI provider URL: file:/C:/JNDI/ -JMS connection factory: QCF name
- Now you are ready to create your MQ script.
- You can then use Web Services jms_set_general_property, jms_send_message_queue, jms_set_message_property and jms_receive_message_property functions.