An Example Process Flow

In this section:

Provides a step-by-step example of creating a process flow.

About This Example

In this section:

The function of the process flow in this example, is to route two specific XML document types, identified by the root element, to specific directories on your system. To accomplish this, we must use multiple Decision Test objects using a True/False test. A single Decision Test Object testing for multiple value switching cannot handle testing for a document tag name. Once the XML documents are identified, they will be routed through the process flow to File objects that are configured to write the XML document contents to a file in a designated directory.

The following image shows the process flow we will create. It includes a Start object, two Decision Test objects, each with a true and false path, three File objects, and an End object.

Create the Input XML Documents

Normally, you will have multiple XML documents as input to a process flow. For illustrative purposes, we will use just two documents as input to our example process flow.

Use a text editor, such as Notepad, to create the following two XML documents.

  • Name the following file Route1:
    <SWIFT1>Route1
       <USER>Atlas</USER>
    </SWIFT1>
  • Name the following file Route2:
    <SWIFT2>Route2
       <USER>USA</USER>
    </SWIFT2>

Creating the Process Flow

In this section:

How to:

This section walks you through the steps to create the example process flow. You will begin by creating a new project and process flow, and continue by adding and defining each object that makes up the flow. As you add objects, you will define the relationship between them. Finally, you will validate and test the flow using the XML documents you created as input to the process flow.

Procedure: How to Create the Project and Process Flow

To create the Router_Example project and the SWIFT_ROUTER process flow:

  1. From the File menu, select New and select Integration Project from the drop-down list.

    The Integration Project Configuration dialog box opens.

  2. In the Project name field, type Router_Example.
  3. Click Finish.

    The Router_Example project node appears in the Navigation Pane.

  4. Expand the Router_Example project node to expose the project elements.
  5. Right-click the Flows folder, select New, and then select Process Flow.

    The New Process Flow properties dialog box opens, as shown in the following image.

  6. In the Name field, type SWIFT_ROUTER as the process flow name.
  7. Click Finish.

    The new SWIFT_ROUTER process flow node appears under the Flows folder, and the workspace displays a Start object, as shown in the following image.

You are ready to build the SWIFT_ROUTER process flow.

Procedure: How to Create the First Decision Test Object

To create the first Decision Test object:

  1. Drag the Decision Test object from the toolbar to the workspace. The New Decision Test Object dialog box opens.
  2. Name the Decision Test object IsType1, and click Next.

    The Test Operands dialog box opens, as shown in the following image.

  3. We will create an XPath statement for Operand One of the test parameters. Select Create XPath statement from the Operand One drop-down list.

    The XPath Builder tool opens.

  4. Click Import..., and choose the Route1 XML document that you created earlier.

    The Select Destination dialog box opens.

    The Route1 XML document contents appear in the XPath Builder dialog box, as shown in the following image.

  5. Click Next.

    The XPath Builder - Build an XPath dialog box opens.

  6. In the left pane of XPath Builder, double-click the Swift1element. This adds the //SWIFT1 element to the XPath Expression field, as shown in the following image.
  7. Click Finish.

    You are returned to the Test Operands dialog box, which now contains the XPath expression you just created, as shown in the following image.

  8. From the Operation drop-down list, select Is Not Null.

    These parameters allow any XML input documents with a <SWIFT1> root tag to be captured.

  9. Click Next.

    The Value Occurrences dialog box opens, as shown in the following image.

  10. Select Any and click Finish.

    The Decision Test object appears in the workspace, as shown in the following image.

Procedure: How to Define the Relationship Between Start and IsType1

To define the relationship between the Start and IsType1 objects:

  1. Select the Start object, press the Ctrl key, and then select the IsType1 object.
  2. Right-click IsType1, and select Create Relation from the drop-down list.

    The Configuration dialog box opens, as shown in the following image.

  3. Since this is the first relationship in the process flow, you can only choose OnCompletion as the Event. This means the document will always follow this path.
  4. Click Finish.

A line appears between Start and IsType1, showing that a relationship has been established. This line is blue to indicate an OnCompletion event.

Procedure: How to Route the Document Based on Decision Test Result

We want all XML documents captured by IsType1 that contain the <SWIFT1> element, sent to a File object named File_1. In addition, we want the File_1 object to write its output document to a disk.

To create the File_1 object:

  1. Drag the File Execution object from the toolbar to the workspace.

    The New File Object dialog box opens, as shown in the following image.

  2. In the Name field, type File_1, and leave the Description as File object.
  3. Click Next.

    The File Type dialog box opens, as shown in the following image.

  4. From the Type drop-down list, select File Emit Agent. This tells the File_1 object to write the incoming document to the disk.
  5. Click Next.

    The New File Object - Properties dialog box opens, as shown in the following image.

    1. In the Target Directory field, type a path to the directory where the file will be written. In this example, we direct the file to C:\Temp\Out.
    2. In the File Pattern field, type TYPE_1_*.xml.
    3. In the Avoid Preemitter field, select true. This ignores any assigned preemitters.
    4. In the Return field, select status to return a status document.
  6. Click Finish.

    The File_1 object appears in the workspace, as shown in the following image.

Procedure: How to Define the Relationship Between IsType1 and File_1

Build a relationship between the IsType1 Decision Test object and the File_1 File object, so that an XML document coming into IsType1 that has a <SWIFT1> element, is sent onto the File_1 object. To build this relationship:

  1. Select the IsType1 object, press the Ctrl key, and then select the File_1 object.
  2. Right-click File_1 and select Create Relation from the drop-down list.

    The Relation Configuration dialog box opens.

  3. Select OnCustom from the Event drop-down list.
  4. Select true as the case for the event.

    The following image shows the Relation Configuration dialog box with the OnCustom event and true case selections.

  5. Click Finish.

    A line appears between IsType1 and File_1, showing that a relationship has been established. This line is brown to indicate a Custom event.

Procedure: How to Create the Second Decision Test Object

Create the second Decision Test object, which will receive all documents that do not contain the <SWIFT1> element. We want this object to capture all documents containing <SWIFT2> elements and route them to the second File object. We will route all other files to a dead-end File object.

  1. Drag the Decision Test object from the toolbar to the workspace. The New Test Object dialog box opens.
  2. Name the Decision Test object IsType2, and click Next.

    The Test Operands dialog box opens, as shown in the following image.

  3. From the Operand One drop-down list, select Create XPath statement.

    The XPath Builder tool opens.

  4. Click Load XML File, and browse to the Route2 XML document that you created earlier.

    The Route2 XML document contents appear in the XPath Builder dialog box, as shown in the following image.

  5. Click Next.

    The XPath Builder - Build an XPath dialog box opens.

  6. In the left pane of XPath Builder, double-click the Swift2element. This adds the //SWIFT2 element to the XPath field, as shown in the following image.
  7. Click Finish.

    You are returned to the Test Operands dialog box, which now contains the XPath expression you just created, as shown in the following image.

  8. From the Operation drop-down list, select Is Not Null.

    These parameters allow any XML input documents with a <SWIFT2> root tag to be captured.

  9. Click Next.

    The Value Occurrences dialog box opens, as shown in the following image.

  10. Select Any and click Finish.

    The Decision Test object, IsType2, appears in the workspace, as shown in the following image.

Procedure: How to Define the Relationship Between IsType1 and IsType2

Build a relationship between Decision Test objects IsType1 and IsType2, so that an XML document coming into IsType1 does not have the tag <SWIFT1>, and then send it to IsType2.

  1. Select the IsType1 object, press the Ctrl key, and then select the IsType2 object.
  2. Right-click IsType2, and select Create Relation from the drop-down list.

    The Line Configuration dialog box opens.

  3. Select OnCustom from the Events drop-down list.
  4. Select false as the case for the event.

    The following image shows the Line Configuration dialog box with the OnCustom event, false case selections.

  5. Click Finish.

    A line appears between IsType1 and IsType2, showing that a relationship has been established. This line is brown to indicate a Custom event.

    The following image shows the routing of XML documents from the Decision Test object IsType1, based on a true or false condition. If the document coming into IsType1 has the <SWIFT1> element, it will be routed to File_1. If it does not, it will be routed to IsType2.

Procedure: How to Route the Document Based on a Second Decision Test True Result

We want the XML documents captured by the IsType2 Decision Test object that contain a <SWIFT2> element, to be sent to a File object named File_2. To create the File_2 object:

  1. Drag the File Execution object from the toolbar to the workspace.

    The New File Object dialog box opens, as shown in the following image.

  2. In the Name field, type File_2, and leave the Description as File object.
  3. Click Next.

    The File Type dialog box opens, as shown in the following image.

  4. From the Type drop-down list, select File Emit Agent. This tells the File_2 object to write the incoming document to the disk.
  5. Click Next.

    The New File Object - Properties dialog box opens, as shown in the following image.

    1. In the Target Directory field, type a path to the directory where the file will be written. In this example, we will send the file to C:\Temp\Out.
    2. In the File Pattern field, type TYPE_2_*.xml.
    3. In the Avoid Preemitter field, select true. This ignores any assigned preemitters.
    4. In the Return field, select status to return a status document.
  6. Click Finish.

    The File_2 object appears in the workspace.

Procedure: How to Define the Relationship Between IsType2 and File_2

Build a relationship between Decision Test object IsType2 and the File_2 object, so that XML documents with a <SWIFT2> element coming into IsType2 will be sent to File_2.

  1. Select the IsType2 object, press the Ctrl key, and then select the File_2 object.
  2. Right-click File_2 and select Create Relation from the drop-down list.

    The Line Configuration dialog box opens.

  3. Select OnCustom from the Events drop-down list.
  4. Select true as the case for the event.

    The following image shows the Line Configuration dialog box with the OnCustom event and true case selections.

  5. Click OK.

A line appears between IsType2 and File_2, showing that a relationship has been established. This line is brown to indicate a Custom event.

Procedure: How to Route the Document Based on a Second Decision Test False Result

We want all XML documents captured by the IsType2 Decision Test object that do not contain the <SWIFT1> or <SWIFT2> XML element, to be sent to the NONE File object. To set this up:

  1. Drag the File Execution object from the toolbar to the workspace.

    The New File Object dialog box opens, as shown in the following image.

  2. In the Name field, type NONE, and leave the description as File object.
  3. Click Next.

    The File Type dialog box opens, as shown in the following image.

  4. From the Type drop-down list, select File Emit Agent. This tells the NONE File object to write the incoming document to the disk.
  5. Click Next.

    The New File Object - Properties dialog box opens, as shown in the following image.

    1. In the Target Directory field, type a path to the directory where the file will be written. In this example, we will write the file to C:\Temp\Out.
    2. In the File Pattern field, type NONE_OF_THE_ABOVE_*.xml.
    3. In the Avoid Preemitter field, select true. This ignores any assigned preemitters.
    4. In the Return field, select status to return a status document.
  6. Click Finish.

The NONE File object appears in the workspace.

Procedure: How to Define the Relationship Between IsType2 and NONE

Build a relationship between Decision Test object IsType2 and the NONE File object, so that any XML documents coming into IsType2 without a <SWIFT2> tag are not routed to any other object in the process flow.

  1. Select the IsType2 object, press the Ctrl key, and then select the NONE object.
  2. Right-click NONE and select Create Relation from the drop-down list.

    The Line Configuration dialog box opens.

  3. Select OnCustom from the Events drop-down list.
  4. Select false as the case for the event.

    The following image shows the Line Configuration dialog box with the OnCustom event and false case selections.

  5. Click Finish.

    A line appears between IsType2 and NONE, showing that a relationship has been established. This line is brown to indicate a Custom event.

    The following image shows the process flow with all of the required Decision Test and File objects.

The final step is to terminate the SWIFT_ROUTER process flow with an End object.

Procedure: How to Terminate the Process Flow

To terminate the process flow, add an End object, and then build a relationship between it and the File_1, File_2, and None objects.

  1. Drag the End object onto the workspace.

    The New End Object - End Name and Description dialog box opens.

  2. Keep the default name, End, and leave the description as, End object.
  3. Click Next.

    The End Object Schema dialog box opens, as shown in the following image.

  4. Leave the Terminate box unchecked. This indicates that you want to obtain output from the process flow.
  5. Click Finish.

    The End object appears in the workspace, as shown in the following image.

Procedure: How to Define Relationships Between the End Object, File_1, File_2, and NONE

Build a relationship between the File_1 object and the End object to end the process flow.

  1. Select the File_1 object, press the Ctrl key, and then select the End object.
  2. Right-click the End object and select Create Relation from the drop-down list.

    The Relation Configuration dialog box opens.

  3. Select OnCompletion from the Events drop-down list. This directs the process flow to always follow this route.
  4. Click Finish.

    A line appears between File_1 and End, showing that a relationship has been established. This line is blue to indicate an OnCompletion route, meaning the document will always follow this path.

  5. Follow Steps 1 through 4, using the OnCompletion event type, to establish a relationship between File_2 and End, and then between NONE and End.

You are now ready to save, validate, and test the process flow.

Save the Process Flow

The complete process flow is shown in the following image.

Note: You can add text to the diagram to easily identify an area of the process flow. In this example, the text identifies the true and false decision paths. To add text to the workspace, drag the Text icon to the workspace, type the text you want to appear, click outside of the text box to paste the text in the workspace, then drag the text to its location in the diagram.

To save the process flow, in the File menu, select Save from the drop-down list.

Validate and Test the Process Flow

The validate feature verifies that the process flow structure is complete and properly assembled. Once the process flow is validated, you can test it with one of the input documents we created at the beginning of our example.

Procedure: How to Validate the Process Flow

To validate the SWIFT_ROUTER process flow:

  1. In the Navigator pane, right-click the SWIFT_ROUTERprocess flow node.
  2. Select Validate from the drop-down list.

    The status of the validation appears in the Validation Results dialog box, as shown in the following image.

Procedure: How to Test the Process Flow

To test this process flow:

  1. In the Navigator Pane, right click the SWIFT_ROUTER process flow node, select Run As from the drop-down list, and then select Process Flow.

    The Edit configuration and launch dialog box opens, as shown in the following image.

  2. The Process Flow field contains the path to the SWIFT_ROUTER process flow.
  3. In the Input document field, type the path or browse to the Route2.XML file you created at the beginning of this example.
  4. In the Server Environment section, enter the URL, User Name, and Password.
  5. If you are using a test server, select Use test server.
  6. In the Test Server tab, browse to enter the Application and Template details.

    Click the Runtime Options tab, as shown in the following image.

  7. You can select the level of debugging that you want through the Process Object Debugging and Server Side Tracing options. In this example, we will select to trace all active objects and Commit Transactions, so that the transaction of the process flow will be performed during the test.
  8. Click Apply.
  9. Click Run.

    The process flow goes through the test run and displays a status dialog box, as shown in the following image.

    The test results are displayed in the Message Console pane, as shown in the following image.

    The workspace area displays a message that the test was successful, as shown in the following image.

To view the output document, right-click on the corresponding End object in the Test Results view, and select View Output Document. You can also use the Output Document link found under the Trace tab in the Properties view.

iWay Software