Creating the web service client flow

Use the following instructions to create the web service client flow from an existing WSDL definition. You must have successfully created the web service flow, by using the OrderService.wsdl file that you imported, see Creating the web service message flow and message set.

  1. Add a new message flow called WebServicesAsyncClientFlow.msgflow to the AsyncWebServiceFlows project.
  2. Add the nodes described in the following table to the WebServiceAsyncClientFlow message flow.
    Node type Node name
    MQInput MQWSInput
    MQOutput MQWSOutput
    Compute Compute Request, Format Response
    SOAPAsyncRequest SOAP Asynchronous Request
    SOAPAsyncResponse SOAP Asynchronous Response

  3. Connect the nodes as described in the following table, see Connecting message flow nodes in the WebSphere Message Broker documentation.

    Node name Terminal Connect to this node
    MQWSInput Out Compute Request
    Compute Request Out1 SOAP Asynchronous Request
    SOAPAsyncResponse Out Format Response
    Format Response Out1 MQWSOutput

    The following diagram shows a screen capture of the WebServicesAsyncClientFlow message flow with the nodes connected together:

    screen capture of the WebServicesAsyncClientFlow message flow

  4. Drag OrderService.wsdl from the AsyncWebServiceMessages project onto the SOAP Asynchronous Request node. You can find the OrderService.wsdl file in the AsyncWebServicMessages > AsyncWebServicMessages > Deployable WSDL folder.
  5. In the Basic properties for the SOAP Asynchronous Request node, enter SampleAsynchNodePair in the Unique identifier field.
  6. In the Basic properties for the SOAP Asynchronous Response node, enter SampleAsynchNodePair in the Unique identifier field to pair the two asynchronous nodes.
  7. Set the queue for the MQWSInput node to WEBSERVICECLIENTIN, set the queue for the MQWSOutput node to WEBSERVICECLIENTOUT.
  8. Set the following Input Message Parsing properties for the MQWSInput node.
    Message domain XMLNSC
    Messgae set SampleDriverMessages
  9. Double-click the Compute Request node, paste the following module into the ESQL file:
    DECLARE ns NAMESPACE 'http://www.acmeOrders.com/OrderService';
    
    CREATE COMPUTE MODULE WebServicesAsyncClientFlow_Compute
    	CREATE FUNCTION Main() RETURNS BOOLEAN
    	BEGIN
    		DECLARE inMsg REFERENCE TO InputRoot.XMLNSC.OrderMessage.localElement;
    		SET OutputRoot.SOAP.Body.ns:submitPORequest.partNo = inMsg.PartNumber;
    		DECLARE outMsg REFERENCE TO OutputRoot.SOAP.Body.ns:submitPORequest;
    		SET outMsg.partQuantity = inMsg.Quantity;
    		SET outMsg.personName.firstName = inMsg.FirstName;
    		SET outMsg.personName.lastName = inMsg.LastName;
    		SET outMsg.address.street = inMsg.Street;
    		SET outMsg.address.city = inMsg.City;
    		SET outMsg.address.zipCode = inMsg.ZipCode;
    		
    		RETURN TRUE;
    	END;
    END MODULE;
  10. Double-click the Format Response node, paste the following module into the ESQL file:
    CREATE COMPUTE MODULE WebServicesAsyncClientFlow_Format
    	CREATE FUNCTION Main() RETURNS BOOLEAN
    	BEGIN
    		SET OutputRoot.Properties.MessageDomain   = 'XMLMSC';
    		SET OutputRoot.Properties.MessageSet   = 'SampleDriverMessages';
    		SET OutputRoot.Properties.MessageType   = 'OrderResponse'; 
    		
    		DECLARE inMsg REFERENCE TO InputRoot.SOAP.Body.ns:submitPOResponse;
    		SET OutputRoot.XMLNSC.OrderResponse.PartNo = inMsg.partNo;
    		DECLARE respMsg REFERENCE TO OutputRoot.XMLNSC.OrderResponse;
    		SET respMsg.PartQuantity = inMsg.partQuantity;
    		SET respMsg.AMT = inMsg.orderAmt;
    		SET respMsg.Status = inMsg.orderStatus;
    		
    		RETURN TRUE;
    	END;
    END MODULE;


You can now create the queues for the sample, see Creating the WebSphere MQ queues.

Back to Building the Asynchronous Consumer sample