Creating the main message flow

The WSRR Connectivity sample main message flow is supplied, but if you prefer to create the message flow yourself, follow the instructions below:

  1. In the Message Brokers Toolkit, switch to the Broker Application Development perspective.
  2. Create a new message flow called WSRR_Connectivity.msgflow in the message flow project called WSRR Connectivity Message Flows, which you created when you created the Web Services.
    For instructions, see Creating a message flow. [TODO: FIX THIS LINK]
  3. In the Message Flow editor, add and rename the nodes listed in the following table.
    For instructions, see Adding a node. [TODO: FIX THIS LINK]
    Palette drawers Node type Node name
    WebSphere MQ MQInput WSRR_IN
    Transformation Compute SetVersion
    WebServices Endpoint Lookup Endpoint Lookup One
    WebServices SOAP Request SOAP Request
    Transformation Compute InformFailure
    Transformation Compute InformWSResult
    Transformation Compute InformNoMatch
    WebSphere MQ MQOutput WSRR_OUT
  4. Connect the nodes together as listed in the following table.
    For instructions, see Connecting nodes. [TODO: FIX THIS LINK]
    To check that you have connected the nodes together correctly, see the figure in About the WSRR Connectivity sample.
    Node name Terminal Connect to this node
    WSRR_IN Out SetVersion
    SetVersion Out Endpoint Lookup One
    Endpoint Lookup One Out SOAP Request
    Failure InformFailure
    NoMatch InformNoMatch
    SOAP Request Out InformWSResult
    FaultWSRR_OUT
    InformFailure Out WSRR_OUT
    InformWSResult Out WSRR_OUT
    InformNoMatch Out WSRR_OUT
  5. Configure the node properties as listed in the following table. Accept the default values for all properties unless an alternative value is listed in the table.
    For instructions, see Configuring a node. [TODO: FIX THIS LINK]
    Node name Page Property Value
    WSRR_IN Basic Queue name WSRR_IN
    Input Message Parsing Message domain XMLNSC : For XML messages
    SetVersion Basic Compute mode Local Environment and Message
    Endpoint Lookup One Basic Port Type Name DemoCustomer
    Port Type Namespace http://demo.sr.eis.ibm.com
    Port Type Version 1.0
    SOAP Request Basic WSDL file name Browse to the DemoCustomer_v10.wsdl file imported earlier into the WSRR Connectivity Message Set.
    Once selected, this will populate the other properties on the Basic page.
    HTTP Transport Web Service URL Put in a bogus value here ie http://dummy.
    This property will be over-ridden at runtime with the Web Service URL specific to the wsdl document that was retrieved from the WSRR,.
    WSRR_OUT Basic Queue name WSRR_OUT
  6. Double-click the SetVersion node to open the ESQL editor. Copy and paste the following ESQL code modules to the ESQL file, then save the file. For more information, see Developing ESQL. [TODO: FIX THIS LINK]
    DECLARE soapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
    
    CREATE COMPUTE MODULE WSRR_Connectivity_SetVersion
      CREATE FUNCTION Main() RETURNS BOOLEAN
        BEGIN
          -- Set the LE to the over-rides specified in the input data
          -- Note if the input message does not contain a Version tag, the LE will not be written
          SET OutputLocalEnvironment.ServiceRegistryLookupProperties.Version = InputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.Request.Version;
    
          -- Store the MQMD to rebuild after HTTP Response node
          SET Environment.MQMD = InputRoot.MQMD;		
    
          CALL CopyEntireMessage();
          RETURN TRUE;
        END;
    
      CREATE PROCEDURE CopyEntireMessage() BEGIN
        SET OutputRoot = InputRoot;
      END;
    END MODULE;
    
    
    CREATE COMPUTE MODULE WSRR_Connectivity_InformWSResult
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN
        CALL CopyEntireMessage();
        -- The response from the WebService contains a HTTP Header
        -- Remove the HTTP header and create a MQMD header in order to propagate the message to a MQ output node
        SET OutputRoot.HTTPResponseHeader = NULL;
        CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'MQMD';
        -- Retrieve the MQMD that was stored earlier
        SET OutputRoot.MQMD = Environment.MQMD;
        
        RETURN TRUE;
      END;
    
      CREATE PROCEDURE CopyEntireMessage() BEGIN
        SET OutputRoot = InputRoot;
      END;
    
    END MODULE;
    
    
    CREATE COMPUTE MODULE WSRR_Connectivity_InformNoMatch
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN
        CALL CopyMessageHeaders();
        CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC';
        SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
        SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
    		
        CREATE LASTCHILD OF OutputRoot.XMLNSC NAME 'LookupResults';
        SET OutputRoot.XMLNSC.LookupResults.WSRR_Request = InputRoot.XMLNSC.WSRR_Request;
        SET OutputRoot.XMLNSC.LookupResults.ServiceRegistry = 'No matching services!';
    
        RETURN TRUE;
      END;
    
      CREATE PROCEDURE CopyEntireMessage() BEGIN
        SET OutputRoot = InputRoot;
      END;
    
    END MODULE;
    
    CREATE COMPUTE MODULE WSRR_Connectivity_InformFailure
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN
        CALL CopyMessageHeaders();
        CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC';
        SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
        SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
    		
        CREATE LASTCHILD OF OutputRoot.XMLNSC NAME 'LookupResults';
        SET OutputRoot.XMLNSC.LookupResults.WSRR_Request = InputRoot.XMLNSC.WSRR_Request;
        SET OutputRoot.XMLNSC.LookupResults.ServiceRegistry = 'Failure to retrieve Service from WSRR!';
        SET OutputRoot.XMLNSC.LookupResults.Exception = InputExceptionList;		
    		
        RETURN TRUE;
      END;
    
      CREATE PROCEDURE CopyMessageHeaders() BEGIN
        DECLARE I INTEGER 1;
        DECLARE J INTEGER;
        SET J = CARDINALITY(InputRoot.*[]);
        WHILE I < J DO
          SET OutputRoot.*[I] = InputRoot.*[I];
          SET I = I + 1;
        END WHILE;
      END;
    
    END MODULE;
    
    
  7. Save the ESQL file.
  8. Ensure that the ESQL module property in the SetVersion node points to the WSRR_Connectivity_SetVersion module.
  9. Repeat the above step for the following nodes, setting the ESQL module property to the corresponding module in the ESQL file.
    InformFailure, InformWSResult and InformNoMatch.
  10. Save the message flow.

You can now create the queues and run your flow: Creating the MQ queues.

Main Page icon   Back to Building the WSRR Connectivity sample.