When you run the Web Service Host sample, the broker receives a SOAP/XML message over HTTP protocol and sends back a SOAP/XML reply message, again using HTTP. Thus the broker is acting as a Web service host.
The broker takes data from this SOAP message, and generates a new message mapped to a C header file. This is sent it to a legacy application using WebSphere MQ. The legacy application responds, and data from this response is put into the HTTP reply which the broker generates. Thus the broker has fronted a legacy application as a Web service.
To run the Web Service Host sample:
The legacy application is written in C, and is started with two input parameters: a WebSphere MQ queue manager name and a queue name. The application reads messages from this queue and queue manager, and sends replies to the queue and queue manager specified in the reply information of the input message.
Two executable versions of the legacy application are supplied:
The sample is configured to run the legacy application using the same WebSphere MQ queue manager as the broker. If your broker is to use a different queue manager to the legacy application, you will need to configure your WebSphere MQ queue managers (broker and legacy) for inter-communication.
You must also make a small change to the MQOutput to legacy node in message flow WSHOST_WSHOST1. Set the Basic property Queue Manager Name to the name of the legacy application's queue manager.Both the input and the output messages are mapped to the following C structure:
typedef struct tagIA81CONF { char MessageId[8]; char OrderNumber[8]; char ItemReference[12]; char ItemQuantity[8]; char CustomerNumber[12]; char DeliveryRef[8]; char Confirm[1]; char filler1[3]; } IA81CONF;
This is supplied in file legacyservice.h of project WSHOST_LEGACY. Note that this header file also contains other structures
All the test messages used in running this sample are based on the following format:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:c="http://www.brokersamplewshost.ibm.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <c:IA81CONFIN> <MessageId>IA81CONF</MessageId> <OrderNumber>ON4002</OrderNumber> <ItemReference>IY4003</ItemReference> <ItemQuantity>4</ItemQuantity> <CustomerNumber>CY4004</CustomerNumber> </c:IA81CONFIN> </soapenv:Body> </soapenv:Envelope>
The Web Service Host sample invokes a legacy application with a message called msg_tagIA81CONF. In that message, a field called DeliveryRef is set to blank on input, and on output is set to JOHNCORP. Also, a field called Confirm is set to blank on input, and on output is set to either Y or N, depending on whether input field ItemReference contains the character Y.
If you are using Nettool, the right-hand pane contains the HTTP response.
The response message from the above input message is as follows:
<?xml version="1.0"?> <tns:Envelope xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:NS1="http://www.brokersamplewshost.ibm.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <tns:Body> <NS1:IA81CONFOUT> <MessageId>IA81CONF</MessageId> <OrderNumber>ON4002</OrderNumber> <ItemReference>IY4003</ItemReference> <ItemQuantity>4</ItemQuantity> <CustomerNumber>CY4004</CustomerNumber> <DeliveryRef>JOHNCORP</DeliveryRef> <Confirm>Y</Confirm> </NS1:IA81CONFOUT> </tns:Body> </tns:Envelope>