Creating the main message flow

The WebSphere Service Registry and Repository (WSRR) Connectivity sample main message flow is supplied, but if you prefer to create the message flow yourself, use the following instructions:

  1. Create a new message flow called WSRR_Connectivity.msgflow in the Message Broker project called My WSRR Connectivity Message Flows, which you created when you created the Web services message flow.
    For instructions, see Creating a message flow in the WebSphere Message Broker documentation.
  2. In the Message Flow editor, add and rename the nodes listed in the following table.
    For instructions, see Adding a message flow node in the WebSphere Message Broker documentation.
    Palette drawers Node type Node name
    WebSphere MQ MQInput WSRR_IN
    Transformation Compute SetVersion
    WebServices EndpointLookup Endpoint Lookup One
    WebServices SOAPRequest SOAP Request
    Transformation Compute InformFailure
    Transformation Compute InformWSResult
    Transformation Compute InformNoMatch
    WebSphere MQ MQOutput WSRR_OUT
  3. Connect the nodes together as listed in the following table.
    For instructions, see Connecting message flow nodes in the WebSphere Message Broker documentation.
    To check that you have connected the nodes together correctly, see the diagram in About the WebSphere Service Registry and Repository 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
  4. 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 message flow node in the WebSphere Message Broker documentation.
    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.
    When selected, this file populates the other properties on the Basic page.
    Binding Operation Set this property to updateCustomer.
    HTTP Transport Web Service URL Enter any value, for example: http://dummy.
    This property is overridden at runtime with the Web service URL specific to the WSDL document that was retrieved from the WebSphere Service Registry and Repository.
    WSRR_OUT Basic Queue name WSRR_OUT
  5. 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 in the WebSphere Message Broker documentation.
    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 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;
    
    
    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;
    
  6. Save the ESQL file.
  7. Ensure that the ESQL module property in the SetVersion node points to the WSRR_Connectivity_SetVersion module.
  8. Repeat the preceding step for the following nodes, setting the ESQL module property to the corresponding module in the ESQL file:
  9. Save the message flow.

You can now create the queues and run your flow, see Creating the queues.

Back to Building the WebSphere Service Registry and Repository Connectivity sample