When you import the sample you might receive several warnings in the Toolkit about attributes, CWF messages, elements, and the MRM domain. These warnings are message set related and do not affect the running of the sample.
The Web Services using HTTP nodes sample has two parts:
If you encounter any problems when you run the sample, see Resolving problems when running samples in the IBM Integration Bus documentation.
When you run the Web Service Host sample, the broker receives and sends back a SOAP/XML message, over HTTP protocol. 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 new message is sent to a legacy application by using WebSphere MQ. The legacy application responds, and data from this response is put into the HTTP reply that is generated by the broker. 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:
legacyservice qmname qname
where qmname is your queue manager name and qname
is WSHOST1_OUT1 (from the first MQOutput node). For example:
legacyservice IB9QMGR WSHOST1_OUT1.
You cannot call the legacy application from the IBM Integration Toolkit.The sample is configured to run the legacy application by using the queue
manager that is used by the broker and created by the Default Configuration
wizard (IB9QMGR). If your broker uses a different queue manager to the legacy
application, configure your WebSphere MQ queue managers (broker and legacy)
for inter-communication; you must also change the MQOutput to legacy node in
message flow WSHOST_WSHOST1. Set the Basic property Queue Manager Name
to the name of the queue manager that is used by the legacy application.
If you want to run the legacy application on a platform other than Windows or Linux,
the source files are
provided in project WSHOST_LEGACY1. The C source file is legacyservice.c,
with header files legacyservice.h and
legacyservice2.h.
Compile by using a compiler of your choice, then run the application following the
preceding guidelines for input parameters.
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 structure is supplied in the legacyservice.h file in project WSHOST_LEGACY1. This header file also contains other structures.
All of the test messages that are 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> <DeliveryRef> </DeliveryRef> <Confirm> </Confirm> <filler1> </filler1> </c:IA81CONFIN> </soapenv:Body> </soapenv:Envelope>
The Web Service Host sample calls a legacy application with a message called msg_tagIA81CONF. In that message, the DeliveryRef field is set to blank on input, and on output is set to JOHNCORP. The Confirm field is set to blank on input, and on output is set to either Y or N, depending on whether the ItemReference input field contains the character Y.
The following code shows the response message from the preceding input message:
<?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> <filler1> </filler1> </NS1:IA81CONFOUT> </tns:Body> </tns:Envelope>
When you run the Web Service Client sample, the broker receives a message in the legacy format over WebSphere MQ protocol. It calls a Web service by sending a SOAP/XML message by using HTTP protocol. It receives a Web service reply as a SOAP/XML message, by using HTTP, and sends back a legacy reply message, by using WebSphere MQ. The broker is acting as a Web service client.
The broker takes data from the legacy message, which is mapped to a C header file. This data is used to build a SOAP/XML message that is mapped to the XML schema in a WSDL file. The WSDL file was supplied by a Web service host, and imported into a message set in the broker. In this sample the Web service host is the Web Service Host sample.
The Web Service Host sample must be running in order to run this Web Service Client sample.
To run the Web Service Client sample:
The input test messages used in running this sample are based on the following format:
typedef struct tagIA81BUY { char MessageId[8]; char OrderNumber[8]; char ItemReference[12]; char ItemQuantity[8]; char CustomerNumber[12]; char DeliveryRef[8]; } IA81BUY;
The following message is sent to the Web Service Host message flow:
<?xml version="1.0"?> <tns:Envelope xmlns:tns=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:NS1="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS2="http://www.brokersamplewshost.ibm.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mrm="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <tns:Body> <NS2:IA81CONFIN> <MessageId>IA81CONF</MessageId> <OrderNumber>LAB51234</OrderNumber> <ItemReference>ITEM12345678</ItemReference> <ItemQuantity>qty00005</ItemQuantity> <CustomerNumber>CUST34567890</CustomerNumber> <DeliveryRef> </DeliveryRef> <Confirm> </Confirm> <filler1> </filler1> </NS2:IA81CONFIN> </tns:Body> </tns:Envelope>
The following response message is received by the Web Service Client message flow for the preceding input message:
<?xml version="1.0"?> <tns:Envelope xmlns:tns=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:NS1="http://www.brokersamplewshost.ibm.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <tns:Body> <NS1:IA81CONFOUT> <MessageId>IA81CONF</MessageId> <OrderNumber>LAB51234</OrderNumber> <ItemReference>ITEM12345678</ItemReference> <ItemQuantity>qty00005</ItemQuantity> <CustomerNumber>CUST34567890</CustomerNumber> <DeliveryRef>JOHNCORP</DeliveryRef> <Confirm>N</Confirm> <filler1> </filler1> </NS1:IA81CONFOUT> </tns:Body> </tns:Envelope>
The reply message.
The Web Service Client message flow outputs the previous message in CWF format, which is based on C structure tagIA81CONF. The following information details the fields and values:
typedef struct tagIA81CONF { char MessageId[8]; IA81CONF char OrderNumber[8]; LAB5123 char ItemReference[12]; ITEM12345678 char ItemQuantity[8]; qty00005 char CustomerNumber[12]; CUST34567890 char DeliveryRef[8]; JOHNCORP char Confirm[1]; N char filler1[3]; } IA81CONF;
Close the legacy application. You can now remove the sample from your workspace by using the Prepare the Samples wizard.