A WebSphere MQ enabled application calling a Web service

This scenario represents an application that uses WebSphere MQ to make a call to a Web service while processing a message. The MIME domain is used for this example. A message flow for this scenario, and the resulting message trees are given below:

This diagram shows an external MQ enabled client sending and receiving messages from a message flow. The message flow consists of a MQInput node connected to a Compute node called Compute1. The Compute node is then connected to a HTTPRequest node. The HTTPRequest node makes a request to an expernal Web service, and recieives the response. The message is then sent to a second Compute node called Compute2. This node is then connected to an MQOutput node that sends a reply message back to the MQ client.

When a MIME message enters the message flow the Content-Type and any other top-level MIME headers are stored in the MIME 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 some of the message tree after it has left the MQInput node:

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

The first Compute node, Compute1, is used to set up the HTTPRequestHeader if one is required. Compute 1 can also be used to create a new MIME tree or to modify the existing MIME tree if the intermediate application providing the Web service requires a MIME message.

When the HTTPRequest node makes a request message, it removes the MQMD header from the message tree. If you need to save the information from the MQMD, such as the MsgId, to use in the reply message to the MQ client, you can do it in one of the following ways:
  • Compute1 can save the required fields in the Environment tree so that the second Compute node, Compute2, can re-create the MQMD.
  • Compute1 saves the required fields into the OutputLocalEnvironment tree so that Compute2 can re-create the MQMD. To do this, Compute1 must be configured to propagate both Message and LocalEnvironment.
  • Configure the HTTPRequest node to not replace the input message with the HTTP response. Instead specify that the response should be attached as OutputRoot.MIME. The original input tree and MQMD are then still available, but Compute2 needs to alter the tree before passing the message to the MQOutput node. For example, Compute2 might need to remove parts of the tree, such as HTTPRequestHeader and HTTPResponseHeader. To do this, copy just the parts of the tree that you do want to keep. The following ESQL shows an example of how to do this:
    SET OutputRoot.MQMD = InputRoot.MQMD; 
    SET OutputRoot.MIME = InputRoot.MIME;

HTTPRequest node properties control the content of output tree.

The diagrams below show the message tree before and after making the Web service call in the HTTPRequest node:

The diagram shows the logical message tree as the Web service request is being sent from the HTTPRequest node. The root of the tree is called Root, and it has three children. These are, in order, Properties, HTTPRequestHeader, and MIME.

The diagram shows the logical message tree when the message is returned from the Web service request to the HTTPRequest node. The root of the tree is called Root, and it has four children. These are, in order, Properties, HTTPRequestHeader, HTTPResponseHeader, and MIME.

Compute2 is used to create or restore an MQMD if one is needed, and to tidy up the tree to remove inappropriate headers such as the HTTPResponseHeader.

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
Accessing a WebSphere MQ enabled application as a Web service
HTTPReply node
HTTPRequest node