Creating the Web service message flows

The WebSphere Service Registry and Repository (WSRR) Web service message flows are supplied, but if you prefer to create the message flows yourself, use the following instructions:

  1. Create a new Message Broker project called My WSRR Connectivity Message Flows. Add a project dependency to the My WSRR Connectivity Message Set project.
    For instructions, see Creating a Message Broker project in the WebSphere Message Broker documentation.
  2. Create a new message flow called DemoCustomer_WebService_v10.
    For instructions, see Creating a message flow in the WebSphere Message Broker documentation.
  3. 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
    Web Services SOAPInput SOAP DemoCustomer
    Transformation Compute Create WS Response
    Web Services SOAPReply SOAP Reply
  4. 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
    SOAP DemoCustomer Out Create WS Response
    Create WS Response Out SOAP Reply
  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 message flow node in the WebSphere Message Broker documentation.
    Node name Page Property Value
    SOAP DemoCustomer Basic WSDL file name Browse to the DemoCustomer_v10.wsdl file imported previously into the WSRR Connectivity Message Set.
    When selected, this file populates the other properties on the Basic page.
  6. Double-click the Create WS Response node to open the ESQL editor. Copy and paste the following ESQL code modules to the ESQL file.
    For more information, see Developing ESQL in the WebSphere Message Broker documentation.
    DECLARE tns NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
    DECLARE intf NAMESPACE 'http://demo.sr.eis.ibm.com';
    
    CREATE COMPUTE MODULE DemoCustomer_WebService_v10_CreateWSResponse
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN
        CALL CopyMessageHeaders();
        SET OutputRoot.SOAP.Body.intf:updateCustomerResponse.updateCustomerReturn = 'Updated Customer via WebService version 1.0';
        RETURN TRUE;
      END;
      
      CREATE PROCEDURE CopyMessageHeaders() BEGIN
        DECLARE I INTEGER;
        DECLARE J INTEGER;
        SET I = 1;
        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 DemoCustomer_WebService_v20_CreateWSResponse
      CREATE FUNCTION Main() RETURNS BOOLEAN
      BEGIN
        CALL CopyMessageHeaders();
        SET OutputRoot.SOAP.Body.intf:updateCustomerResponse.updateCustomerReturn = 'Updated Customer via WebService version 2.0';
        RETURN TRUE;
      END;
    
      CREATE PROCEDURE CopyMessageHeaders() BEGIN
        DECLARE I INTEGER;
        DECLARE J INTEGER;
        SET I = 1;
        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 Create WS Response node points to the DemoCustomer_WebService_v10_CreateWSResponse module.
  9. Save the message flow.
  10. Make a copy of the DemoCustomer_WebService_v10.msgflow flow. Call the new flow DemoCustomer_WebService_v20.msgflow.
  11. Configure the ESQL module property in the Create WS Response node to point to the DemoCustomer_WebService_v20_CreateWSResponse module.
  12. Save the message flow.

You can now create the main WSRR Connectivity message flow to invoke these Web services, see Creating the main message flow.

Back to Building the WebSphere Service Registry and Repository Connectivity sample