ActiveBPEL® Designer User’s Guide

Tutorial Part 8: Simulating the Process

To start at the beginning of the tutorial, see Introduction to ActiveBPEL Tutorial.

If you have followed all tutorial parts so far, you have completed a BPEL process definition that contains all the steps for normal and fault processing.

Now you will turn from the design phase to the testing phase by simulating execution of your process.

In the Navigator view of ActiveBPEL, you should have the following files:

By completing Part 8 of the tutorial, you will be able to:

Step 1: Complete the prerequisite checklist for simulation

ActiveBPEL validates your BPEL process before you execute it, adding validation tasks to the Problems view for you to complete. The tasks are broken down into errors, warnings, and information. You must ensure your process is executable, and you must complete all error tasks before running your process.

  1. Open tutorial.bpel.
  2. Ensure that the Abstract Process and Suppress Join Failure properties are set as follows:
    1. Select Properties view.
    2. Click on an empty part of the Process Editor (or select Process from the Outline view).
    3. Set Abstract Process to No to indicate that the process should be validated for execution.
    4. Click the Show Advanced Properties button in the Properties view toolbar, and ensure that Suppress Join Failure is set to Yes. This allows you to test various simulation paths without testing that all links to an activity are true.
  3. Ensure that ActiveBPEL is reporting BPEL validation tasks, as follows:
    1. Select Window>Preferences>ActiveBPEL>Tasks and Problems.
    2. Enable all BPEL Validation problems, as shown.

    BPEL validation tasks circled

  4. In the Process Editor canvas, move an activity slightly. This action requires that your file must be saved. Save your file to ensure that all validation tasks appear in the Problems view.
  5. Select Problems view.
  6. If an error task exists, such as the one shown in the following example, correct the error, and save your file.
  7. Example of invalid activity marked with red X icon

Step 2: Add sample data values for simple message parts

To simulate process execution, you need to initialize process variables. ActiveBPEL has a convenient way to provide default data values and ways to override the defaults for different test scenarios.

When you add WSDL files to Web References, you can view a list of the defined messages, and then add sample data values for simple message parts. The sample data is available for all processes that use the messages.

  1. Select Web References view.
  2. From the Web References toolbar drop-down list, select View Messages.
  3. Expand creditInformationMessage.
  4. Select the amount message part, and from the right-mouse menu, select Add Sample.
  5. Fill in the Add Sample Data dialog as follows:
  6. Add Sample Data dialog

  7. Repeat steps 4 and 5 to add another sample data value of 11000.
  8. Expand the amount part. Right-mouse click on the sample data value of 9000 and select Default Sample.
  9. Add a sample data value for each of the remaining two parts of creditInformationMessage: name and firstName.
  10. Your Web References view should look similar to the following example.

    Web References Messages view with sample data added

  11. Continue adding sample data for the two other simple message parts, as follows:
  12. Message

    Part

    Value

    approvalMessage

    accept

    yes

    riskAssessmentMessage

    level

    low

Step 3: Adding a Sample Data File for the ErrorMessage Variable

The errorMessage variable in the loanServicePT.wsdl file is defined with a schema complex type and requires namespace-qualified sample data. This means the sample data file must contain the appropriate references to the data type definition. We will automatically generate a valid data file using the XML Data Wizard. This wizard uses the type definition located in error-messages.xsd.

  1. In Web References view, select View Messages from the toolbar.
  2. Expand errorMessage.
  3. Select the errorCode message part, and from the right-mouse menu, select Generate Sample.
  4. The definition of the errorMessage message points to a schema element of type integer, which has been selected by the wizard as shown in the following example:
  5. XML Data Wizard Preferences page

  6. Leave the remaining preferences as is, since they do not apply to the schema definition of this message, and click Next.
  7. In the Save Results wizard page, select the ActiveBPEL_tutorial project as the parent folder, and name the generated sample data file errorCode, as shown:
  8. XML Data Wizard Save Results page

  9. Click Finish, and then expand the errorCode message part to see the errorCode.xml file, as shown:
  10. Generated sample data file

    If you wish to view the contents of the data file, right-mouse click it, and select View Sample. The XML file opens in the editor. Close the file when you are done.

  11. In Web References, view the file you added, as well as the simple data values for the other variables, as shown:
  12. Web References Messages view with sample data added to all messages

  13. Select the Refresh icon (double arrows) from the Web References toolbar. This action refreshes the contents of Web References and makes sample data available to process variables.

Step 4: Display Data Values for Process Variables

In Steps 2 and 3 you added sample data to message parts, making the data available to all processes that reference the WSDL file. The data is used as the default initial values for process variables. As you run simulation, you can inspect process variables to view initialized and changed values.

  1. Display the Process Variables view.
  2. Select a variable, such as request, and from the right-mouse menu, select Open All.
  3. From the Process Variables toolbar, select Show Variable Data. Your Process Variables view should look like the following example.
  4. Process Variables view in Show Data mode

Notice the following visual information cues in the Process Variables view:

Tip: There are more icons and symbols for complex schema and message-type variables. The tutorial process uses only simple message types.

Step 5: Simulate Process Execution

If you have completed all previous steps in this part of the tutorial, you are ready to begin simulating execution of your process.

  1. Click on a blank part of the Process Editor canvas to activate the main toolbar.
  2. Select the Start Simulation icon, as shown.
  3. Debug perspective with Start Simulation toolbar icon circled

  4. Notice the changes to the ActiveBPEL environment, as shown in the following example.
  5. Debug perspective annotated

    1

    The perspective switches to a debug perspective.

    2

    The beginning activity is highlighted

    3

    The current variable is highlighted

    4

    The sample data is cleared

    5

    The Debug view is opened to run and step through a process

    6

    The Console is opened to report simulation events

  6. In the Debug view, click the Step Over button to continue, as shown.
  7. Debug view with Step Over toolbar icon circled

  8. Step through your process, inspecting process variables as each activity is executed. The simulator stepped through the loan assessor path because the loan amount requested was less than $10,000. The Process Editor canvas should look like the following example when you are done.
  9. Simulation path of process via InvokeLoanAssessor

Step 6: Clear the Process Execution State

  1. Click anywhere on a blank part of the Process Editor canvas.
  2. On the main toolbar, click the Clear Process Execution State icon, which is next to the Start Simulation icon.

Step 7: Override Default Values for Different Test Scenarios

The simulation path went through the loan assessor’s service using the default sample data value of 9000. To test the loan approver’s path, do the following.

  1. Select the Receive activity.
  2. In the Properties view, select Input Message, under the Simulation heading.
  3. Click the button at the end of the Input Message row.
  4. In the Set Simulation Data dialog, enable the check box for Override sample data for simulation.
  5. In the amount row, click next to 9000, and then select the Dialog button.
  6. In the Sample dialog, change the value to 11000. The Set Simulation Data dialog should look like the following example.
  7. Set Simulation Data dialog

  8. Rerun the process. Your simulation path should look like the following example:
  9. Simulation path of process via InvokeLoanApprover

  10. Clear the process execution state.
  11. Inspect the request variable in Process Variables view to see the data value used.
  12. Inspect the Console to view all simulation events.
  13. From the Debug view toolbar, select Remove All Terminated Launches.

Step 8: Simulate Fault Handling

In the loan approval process, a fault is thrown if the loan approver’s service cannot handle the customer request. In Tutorial Part 6: Adding Fault Handling, you added a fault handler to catch this fault and send a reply containing an error code. We will simulate this.

  1. On the Process Editor canvas, select the Invoke Loan Approver activity.
  2. In Properties View, under Simulation, do the following:
    1. Set Result to Fault.
    2. Set Fault Name to loanProcessFault.
  3. Start simulation and step through the process.
  4. The simulator executes the fault handler, as shown.
  5. Simulator executing fault handler

  6. On the Process Activities tab, the simulator shows activity termination with a fault, as shown.
  7. Simulation path of process faulted at InvokeLoanApprover

  8. View the Console to see execution path events.
  9. Clear the process execution state.

Tip: You can also simulate fault handling for the loan assessor service. The same fault message is defined for both the loan approver and the loan assessor service.

To simulate fault handling for the loan assessor service, select the Invoke Assessor activity and set the Result property to Fault. Change the sample data value to be less than 10000 and re-simulate.

Continue to Tutorial Part 9: Deploying the Process.