WebSphere Enterprise Service Bus for z/OS, Version 6.2.0 Operating Systems: z/OS


The MQ data binding sample

The WebSphere® ESB MQ data binding sample demonstrates how to write a MQ data binding.

About this task

All artifacts required to run the MQ data binding sample, are located in the following directories:
  • install_root/samples/bin/ESBMQBinding for the jar file and jython script.
  • install_root/samples/lib/ESBMQBinding for the ear file.
Procedure
  1. Use the MQ explorer to set up the MQ Server. You will need to have a queue manager started, with four queues:
    • Request input queue
    • Request output queue
    • Response input queue
    • Response output queue
    The MQ server will also require a running MQ listener.
  2. Run the Jython script MQDataBindingJNDIResources.py to create the JNDI resources needed by the sample. This will create the import and export connection factories, and the four queues. The syntax for running the script is:
    Wsadmin –lang jython –f MQDataBindingJNDIResources.py [–mqhost hostname] [–mqport portnumber] –qmname qmname –request_input_q req_in_q –request_output_q 
    req_out_q –response_input_q resp_in_q –response_output_q resp_out_q [-clean]
  3. For the data binding test, deploy the MQ data binding sample EAR file, named MQDataBindingMediation.ear to the WebSphere ESB server and start the application.
  4. Restart the server to connect to the MQ server.
  5. On the MQ server machine, run the test program to put a test message on to the request input queue. Use the following command:
    java MQTest queueManager request_input_Queue request_output_Queue response_input_Queue response_ouptut_Queue
    The MQ server machine will put a delimited message on to the request input queue, with a ‘,’ as the delimiter. The MQ data binding sample will pick up this message, change the header, and output a fixed length message on to the request output queue. The message has a fixed length of 15 characters per element, and a ‘~’ as the padding character. The MQTest class will then pick up the message and display the header and message content, as the example is shown below:
    Sending message: 23,John,Doe,address,10,577 Airport Blvd,Burlingame,CA,94010,
    to the req_in queue.
    
    Message received from the req_out queue:
    strucID     = WESB
    strucLength = 20
    msgType     = FXLN
    msgOption1  = 15
    msgOption2  = ~
    Message length is 135
    Message type is 1
    Received message: 23~~~~~~~~~~~~~John~~~~~~~~~~~Doe~~~~~~~~~~~~address~~~~~~~~10~~~~~~~~~~~~~577 Airport BlvBurlingame~~~~~CA~~~~~~~~~~~~~94010~~~~~~~~~~
    The message is then forwarded to the response input queue. The response mediation flow will pick up the message, change it back to a delimited message, and output it onto the response output queue. MQTest will pick up the final message from the response output queue and display the header and message, as the example is shown below.
    Sending message: 23~~~~~~~~~~~~~John~~~~~~~~~~~Doe~~~~~~~~~~~~address~~~~~~~~10~~~~~~~~~~~~~577 Airport BlvBurlingame~~~~~CA~~~~~~~~~~~~~94010~~~~~~~~~~
    to the resp_in queue.
    
    Message received from the resp_out queue:
    strucID     = WESB
    strucLength = 20
    msgType     = DELI
    msgOption1  = ,
    msgOption2  =
    Message length is 59
    Message type is 2
    Received message: 23,John,Doe,address,10,577 Airport Blv,Burlingame,CA,94010,

task Task topic

Terms of use | Feedback


Timestamp icon Last updated: 21 June 2010


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wesb620.zseries.doc/samples/webservices/mqbindingsample.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).