WebSphere Message Brokers
File: ac30040_
Writer: Catherine Tucker

Reference topic

This build: July 31, 2007 21:19:55

Accessing a WebSphere MQ enabled application as a Web service

This scenario represents a Web service providing an interface to a WebSphere MQ enabled application using MIME as the domain.

A message flow for this scenario, and the resulting message trees are given below:

This diagram shows an external HTTP client sending and receiving messages from a message flow. The message flow consists of an HTTPInput node connected to a Compute node called Compute1. The Compute node is then connected to a MQOutput node. The MQOutput node puts the message onto a queue that an external application uses. The application puts a message onto another queue. The message from the queue goes into an MQInput node. This node is connected to another Compute node called Compute2. The compute node is in connected to an HTTPReply node. The reply message is sent back to the HTTP client.

When a MIME message enters the message flow the top-level Content-Type of the message is stored in the HTTPInputHeader tree and in the MIME logical message tree. The broker also stores a copy of the Content-Type of the message as the ContentType value in the Properties subtree. The diagram below shows the message tree after the message has left the HTTPInput node:

The diagram shows the logical message tree after the message has left the HTTPInput node. The root of the tree is called Root, and it has three children. These are, in order, Properties, HTTPInputHeader, and MIME.

The first Compute node, Compute1, must add an MQMD header to the message and save the HTTP correlator for the return flow to use. The HTTP correlator could be stored in a database, or copied to the message body. The following example ESQL illustrates how the correlator can be stored in an XML message body:
SET OutputRoot.XMLNS.X.rid = CAST(InputLocalEnvironment.Destination.HTTP.RequestIdentifier AS CHARACTER); 
The diagram below shows the message tree after it has left Compute1:

The diagram shows the logical message tree after the message has left the first Compute node. The root of the tree is called Root, and it has four children. These are, in order, Properties, HTTPInputHeader, MQMD, and MIME.

If the application that is receiving the MQ message expects the message to be in a MIME format, a MIME tree is needed. Compute1 can supply this by either creating a new MIME tree, or modifying and propagating the existing MIME tree. To modify the Content-Type of the message, the broker ContentType property must be used. When the broker ContentType property is modified, the Content-Type property in the MIME tree is updated automatically.

When the message is received from the message queue via the MQInput node, the second Compute node, Compute2, must remove the MQMD header from the message and restore the HTTP correlator. If Compute1 copied the correlator from the message body as described above, Compute2 can restore the correlator with the following ESQL:
SET OutputLocalEnvironment.Destination.HTTP.RequestIdentifier = CAST(InputRoot.XMLNS.X.rid AS BLOB); 
Compute2 can also set up an explicit HTTPReplyHeader.

If the output domain is MIME, a MIME tree must be created to output the message. Compute2 either creates a new MIME message, or modifies and propagates the input MIME message as required to create the output message. The following diagram shows the message tree after it has gone through Compute2:

The diagram shows the logical message tree after the message has left the second Compute node. The root of the tree is called Root, and it has four children. These are, in order, Properties, HTTPInputHeader, HTTPReplyHeader, and MIME.

Many variations of this scenario are possible. For instance, a single flow could be created using an MQGet node instead of the MQInput node and then the HTTP correlator would not need to be saved. However, this is potentially less scalable. The following sample gives further information on using the MQGet node: You can view samples only when you use the information center that is integrated with the Message Brokers Toolkit.
Related concepts
Manipulating messages in the MIME domain
MIME tree details
MIME messages
Related tasks
Developing ESQL
Developing Java
Related reference
Creating a Web service with HTTP as the transport
Creating a Web service with WebSphere MQ as the transport
A WebSphere MQ enabled application calling a Web service
HTTPReply node
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:19:55

ac30040_ This topic's URL is: