About the SOAP Nodes sample

The SOAP Nodes sample shows how the SOAPInput, SOAPReply, and SOAPRequest nodes can be used to both provide and consume a Web service through an HTTP or JMS transport.

The starting point for the sample is a Web Services Description Language (WSDL) file that defines a simplified ordering service, see WSDL file. The WSDL file, which contains both HTTP and JMS bindings, points to the operations that are defined in the WSDL. The Web service always returns a response indicating the part ordered is available; an option for extending the Web service might be to use a Database node to query a stock database.

The "Start from WSDL and/or XSD files" wizard is used with the WSDL file to create the message set, and two message flows that compose this sample.

The SOAP Nodes sample demonstrates the following tasks:

The message flows

The sample uses two message flows. One message flow provides a Web service and the other consumes a Web service. The request and response message remain the same in the case of HTTP and JMS Web Services. The message flows are described later in this section.

The following diagram shows the Web Service Provider message flow:

A screen capture of the Web Service Provider message flow

The following table shows the nodes in the Web Service Provider message flow:

Node type Node name
SOAPInput Input
Subflow OrderService_Extract
Compute Compute Response
SOAPReply Reply

The SOAPInput node receives incoming SOAP messages and, if they are valid, passes them down the message flow to the OrderService_Extract subflow. The OrderService_Extract subflow is created by the "Start from WSDL and/or XSD files" wizard. The following diagram shows the Web Service Provider subflow:

A screen capture of the Web Service Provider subflow

The following table shows the nodes in the Web Service Provider subflow:

Node type Node name
Input Terminal in
SOAPExtract Extract
Output Terminal failure
Label ws_submitPORequest
Output Terminal submitPORequest

The SOAPExtract node takes a SOAP message and removes the SOAP envelope. In this sample, removing the SOAP envelope leaves an XML message in the XMLNSC domain that can be used in nodes such as the Mapping node or the Compute node. The SOAPExtract node then routes the message to a label based on the Web service operation that is being called. In this sample, only one operation is used. If the WSDL that is used as a starting point has multiple operations, the "Start from WSDL and/or XSD files" wizard gives the option of implementing more than one operation. If multiple operations are selected, the subflow has multiple labels, which produce multiple output terminals in the parent message flow.

When the XMLNSC message leaves the subflow and returns to the main provider message flow, it enters a Compute node. By using the Compute node, you can reference the original SOAP body as XML, and perform ESQL operations on the data in the message. In the sample, the data in the message is ignored, and valid XML data is created from scratch. This data is then sent to the SOAPReply node, which constructs a SOAP message to return to the Web service consumer that initiated the Web service call.

The following diagram shows the Web Service Consumer message flow:

A screen capture of the Web Service Consumer message flow

The following table shows the nodes in the Web Service Consumer message flow:

Node type Node name
MQInput SOAPSample_IN
Compute Compute Request
Subflow Invoke_submitPO
Compute Compute Response
MQOutput SOAPSample_OUT
MQOutput SOAPSample_FAULT

The Web Service Consumer flow is initiated by a WebSphere MQ message arriving on the queue monitored by the MQInput node. The message is an XML message in the XMLNSC domain. The message enters a Compute node where the incoming data is used to create the XML data to send to the Web service. The message is then passed down the flow to the Invoke_submitPO subflow. The Invoke_submitPO subflow is created by the "Start from WSDL and/or XSD files" wizard.

The following diagram shows the Web Service Consumer subflow:

A screen capture of the Web Service Consumer subflow

The following table shows the nodes in the Web Service Consumer subflow:

Node type Node name
Input Terminal in
SOAPRequest Request
Output Terminal fault
SOAPExtract Extract
Output Terminal failure
Label ws_submitPOResponse
Output Terminal submitPOResponse

The SOAPRequest node takes the incoming XML data and uses it to build a valid SOAP message to send to the Web service that is defined by the node properties. If a valid response is received, it is passed to a SOAPExtract node, which removes the SOAP envelope from the response, and returns the message to the XMLNSC domain. The message is then routed to the ws_submitPOResponse Label node and exits the subflow.

In the main consumer flow, the output message is sent to an MQOutput node that writes the XML data to the specified WebSphere MQ queue. The fault message is sent to an MQOutput node that writes the SOAP Fault data to the specified WebSphere MQ queue.

The messages

The Web client message flow is driven by a WebSphere MQ message. A test client file is supplied for running the sample by using the following XML message:

	<OrderMessage>
  	<localElement>
    <FirstName>Message</FirstName>
    <LastName>Broker</LastName>
    <Street>IBM</Street>
    <City>IBM</City>
    <ZipCode>IBM</ZipCode>
    <PartNumber>Some Part</PartNumber>
    <Quantity>1</Quantity>
  	</localElement>
	</OrderMessage>

The valid format for a Web service request message and response message is shown in the following edited schema extract:

	<xsd:element name="submitPORequest">
	...
	<xsd:complexType>
    <xsd:sequence>
	<xsd:element name="partNo" type="xsd:string"/>
    <xsd:element name="partQuantity" type="xsd:int"/>
    <xsd:element name="personName">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="firstName" type="xsd:string"/>
    <xsd:element name="lastName" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="address">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="street" type="xsd:string"/>
    <xsd:element name="city" type="xsd:string"/>
    <xsd:element name="zipCode" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
	</xsd:element>
	<xsd:element name="submitPOResponse">
	...
  	<xsd:complexType>
    <xsd:sequence>
    <xsd:element name="orderStatus" type="xsd:string"/>
    <xsd:element name="orderAmt" type="xsd:int"/>
    <xsd:element name="partNo" type="xsd:string"/>
    <xsd:element name="partQuantity" type="xsd:int"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>


Back to sample home