Creating and Debugging Flow Services using webMethods Service Designer

Introduction

This document provides the text for the procedures covered in the video Creating and Debugging Flow Services using webMethods Service Designer Demo.

Problem Statement

Create an integration service to fetch the list of employees with salary greater than 10,000 from the database.

Steps Involved

  1. Create an Adapter Service to fetch the list of employees from the database.
  2. Create a Flow Service and write the logic using flow steps.
  3. Debug the logic to analyze and fix issues, if any.

Creating an Adapter Service

  1. Create a new package: 
    1. Click File > New > Package.
    2. Type the package name as HR.
  2. Create a new folder in the package: 
    1. Click File > New > Folder.
    2. Type the folder name as dept.
  3. Create a new folder in the folder:
    1. Click File > New > Folder.
    2. Type the folder name as finance
  4. Create a new adapter service in the folder:
    1. Click File > New > Adapter Service.
    2. Type the name of the flow service as selectAllEmp and click Next.
    3. Select an Adapter type and click Next.
    4. Select an Adapter Connection Alias and click Next.
    5. Select a template and click Finish.

  1. Select the table name.
    1. From the Table Name column, click .
    2. From the Adapter Tree Chooser screen, select HR > Jobs.
    3. Click OK.

  1. Populate the table content:
    1. Click the SELECT tab.
    2. Click  to populate the table rows.

The Jobs table is displayed.

Creating a Flow Service

  1. Create a new folder in the package: 
    1. Click File > New > Folder.
    2. Type the folder name as services
  2. Create a new flow service in the folder:
    1. Right-click the folder and click New > Flow Service.
    2. Type the name for the flow service as fetchEmpWithMinSal.
    3. Click Finish.

  1. Add an invoke step to the flow service:
    1. Drag and drop the Invoke step from Palette > Insert.
    2. Type or select the selectAllEmp adapter service that you created.

Note: When you add a flow step, provide relevant comment describing the requirement of the flow step in Property > Comment field. This is a best practice.

  1. Add a LOOP flow step to the flow service:
    1. Drag and drop the LOOP step from Palette > Flow Steps.
    2. Select the selectAllEmp service and go to the Pipeline view.
    3. In Service Out, right-click results and select Copy.
    4. On the flow editor, select LOOP step and go to the Property view.
    5. In the Input array field, click.
    6. In Input array text editor, paste the copied content.

  1. Add a BRANCH flow step under the LOOP step:
    1. Drag and drop the BRANCH step from Palette > Flow Steps.
    2. Go to the Property view.
    3. From the Evaluate label drop down, select True.
  2. Add a SEQUENCE flow step under the BRANCH step:
    1. Drag and drop the SEQUENCE step from Palette > Flow Steps.
    2. Select the selectAllEmp service and go to the Pipeline view.
    3. Right-click MIN_SALARY in Service Out and select Copy.
    4. On the flow editor, select SEQUENCE step and go to the Property view.
    5. In the Label field, paste the copied content.
    6. Edit the copied content to include the condition as follows: results/MIN_SALARY. 
  3. Add a MAP flow step under the SEQUENCE step:
    1. Drag and drop the MAP step from Palette > Flow Steps.
    2. In the Pipeline view, right-click Add Transformer > pub.list > appendToDocumentList.
    3. Expand the Transformers.
    4. From the Pipeline In and transformer Service In, select the selectAllEmpOutput and fromItem respectively. 
    5. Click  to create a link.

  1. Add a MAP flow step to the flow service to create a temporary variable:
    1. Drag and drop the MAP step from Palette > Flow Steps.
    2. Go to Pipeline view.
    3. In the Pipeline Out section, right click Insert > Document List.
    4. Type a name for the document list variable such as, tempList.
    5. Right click the document list variable and click Set Value.
    6. In the Enter Input screen, click OK.
  2. Link the input and output variable:
    1. Select the MAP flow step under the SEQUENCE step.
    2. From the Pipeline Out and Transformer Service Out, select tempList and toList respectively.
    3. Click   to create a link.
    4. From the d and transformer Service In, select tempList and toList respectively.
    5. Click   to create a link.

  1. Add a MAP flow step to the flow service to store the final output:
    1. Drag and drop the MAP step from Palette > Flow Steps.
    2. Select the Input/Output tab.
    3. Drag and drop the Document List from Palette > Variables
    4. Type a name for the document list variable such as, empList.
    5. From the Pipeline In and Pipeline Out, select tempList and empList respectively. 
    6. Click  to create a link.
    7. From the Pipleline Out, select SelectAllEmpOutput and tempList.
    8. Right click and select Drop.

  1. Run the flow service:
    1. Select the fetchAllEmpWithMinSal flow service.
    2. Click Run As > Run Flow Service.

The result is displayed in Results tab. In this case, no result is displayed.

Debugging Flow Service

  1. In the Package Navigator, select the fetchAllEmpWithMinSal flow service. 
  2. Right-click and select Debug As > Debug Flow Service.

Debug view opens. The first step of flow service (INVOKE step) is highlighted.

  1. Click the Step Over icon , each time to execute the next steps.

All the steps till the SEQUENCE step get executed.

  1. Click the   to terminate debug session.
  2. Select the SEQUENCE step. Right-click and select Show Properties View.
  3. Correct the condition provided in the Label field as follows: %selectAllEmpOutput/results/MIN_SALARY%>10000

The syntax to retrieve values from the pipeline variable is now corrected.

  1. Click Run > Debug to resume debugging.
  2. Click   each time to execute the flow steps till the MAP step.
  3. When the MAP step is executing, click .
  4. Check the Variables view to view the list of the tempList variables carrying the required result.

  1. When the tempList variables no more display the new results, right click the MAP step to store the output. 
  2. Click Toggle Breakpoint.
  3. Click  to resume the debug session.
  4. Click  each time to execute the flow steps till all the steps are executed.
  5. Click   to go to the Service Development perspective.

The list of employees with min salary greater than 10000 is displayed in the Results view.