About the SOAP/JMS Web Services sample

The SOAP/JMS Web Services sample shows how Message Broker can interact with a web services using JMS transport.

An e-Retail request-response scenario has been implemented using two message flows and a message set.  These message flows are
Client Message Flow and WebServices Message flow. These two message flows works in the following way :
 
flowchart

The Client Message Flow and WebService Message Flow usages JMSInput and JMSOutput nodes as a JMS consumer and producer respectively to an external JMS provider.
The sample uses WebSphere MQ as the JMS provider.

Message Flows

There are two message flows in this sample. The retail client application (Web application) sends the SOAP request message to the RETAIL_Client message flow. The SOAP request message contains Item ID for which the user wants detail description. Here the SOAP request message is captured in the message flow enqueue file, which will be used as an input message.

RETAIL_CLIENT flow is acting as JMS Client and sends the SOAP request message to JMS destination queue.

The RETAIL_WEBSERVICE message flow is simulates a web service. RETAIL_WEBSERVICE message flow retrieves the SOAP request message from the JMS Destination queue. It connects to the backend database and gets the item details from the database. Then it creates SOAP reply message and sends it back to the JMS Reply to Queue. The Compute nodes in RETAIL_WEBSERVICES message flow contain detailed ESQL comments explaining exactly what has been done.

RETAIL_CLIENT flow which is waiting at ReplyToQueue gets the SOAP Reply message and sends it to the client application.

RETAIL Message Set

This message set is created to parse the SOAP request message. The message set is designed to create a request-reply wsdl file. The SOAP message Envelop is created using "IBM Supplied message" file. How to create the message set for SOAP message is described below.
1. Create the Message Set for the SOAP request and reply messages as RetailIN and RetailOut message..
2. Create SOAP Envelop message set using
         Select MessageSet --> New --> Message Definition from --> IBM supplied message --> Click --> Select soapenv11.xsd to create SOAP 1.1 message set parser for SOAP 1.1 messages.
.
3. Create the Message Category to define "request-reply" kind of WSDL and Select RetailIN as input and RetailOut as output from the message set.. This you can do  by
            Select MessageSet ---> right click --> New --> Message Category File
4. Create WSDL for web services over SOAP/JMS using the above created category file.
            Select MessageSet --> right click --> Generate --> WSDL definition.
             While creating the WSDL select the binding as SOAP/JMS, select the initial context factory as com.sun.jndi.fscontext.RefFSContextFactory, write the correct JNDI Connection Factory and JNDI Destination Name (RETAIL_SRV_REQ) used by the JMS provider, write the JNDI Path as C:\JNDI-Directory\.bindings, Change the JMS Service Name and Port Name if required.

RETAIL_CLIENT message flow 

This flow is present in Flows-->"client" folder of the RetailMsgFlowProject and  represents a JMS Client.

ClientFlow

SOAP request message is put on the MQInput Queue "RETAIL_REQ" of RETAIL_CLIENT message flow using message.enqueue file. When the message is passed through the flow, it is converted the MQ input message into a JMS message using MQJMSTransform Node and sends the request message into JMS destination Queue "RETAIL_SRV_REQ" and set the Reply to Destination Queue as "RETAIL_CLI_REP".
The JMS client waits for the SOAP Reply message at "RETAIL_CLI_REP".

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:c="http://www.retailShop.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<c:RetailIN>
<ItemID>ID101</ItemID>
<Description></Description>
<TechDescription></TechDescription>
<Associaries></Associaries>
<Availability></Availability>
<Price></Price>
</c:RetailIN>
</soapenv:Body>
</soapenv:Envelope>

The message is then turned into a producer message, and is put on a queue "RETAIL_SRV_REQ" for the RETAIL_WEBSERVICE flow to pick it up.


RETAIL_WEBSERVICE message flow

This flow is present in Flows-->"webservices" folder of the RetailMsgFlowProject.  The flow is simulated as Web Services, it connects to the database and gets the required  item details like descriptions, technical details etc from the database table and send the SOAP reply message the JMS ReplyToQueue "RETAIL_CLI_REP".  The RETAIL_CLIENT  flow gets the SOAP reply message and puts it on the "CLIENT_REPLY_Q" queue of  MQOutput Node. The Client application will pick the SOAP Reply message from this queue.

WebserviceFlow
The Reply Message from the Web Service is
<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                xmlns:tns="http://www.retailShop.com"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <soapenv:Body>
                            <tns:RetailOut>
                                       <ItemID>ID101</ItemID>
                                       <Description>Mobile Model  8810</Description>
                                       <TechDescription>CAMERA WITH 1 Mega Pixel, FM Radio</TechDescription>
                                       <Associaries>speaker,microphone</Associaries>
                                       <Availability>100</Availability>
                                       <Price>17000</Price>
                          </tns:RetailOut>
             </soapenv:Body>
</soapenv:Envelope>


Test message

The test message used to drive the sample is a SOAP request Message for ItemID "ID102"  requested by an e-Retail Client Application :

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:c="http://www.retailShop.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<c:RetailIN>
<ItemID>ID102</ItemID>
<Description></Description>
<TechDescription></TechDescription>
<Associaries></Associaries>
<Availability></Availability>
<Price></Price>
</c:RetailIN>
</soapenv:Body>
</soapenv:Envelope>

Main Page icon   Back to sample home