Tutorial: Practicing Automatically Adding Catch Branches for Named Faults

Prerequisites:

You performed the steps in Tutorial: Creating an Empty Synchronous Orchestration Workflow for Automatically Adding Catch Branches for Named Faults.

In this exercise, you use a Scope step in the NamedFaultOWF2 orchestration workflow and you add Catch branches to its FaultHandler section automatically.

After you complete the steps in this exercise, your orchestration workflow should look like the one in the following figure:

Figure 1. NamedFaultOWF2

Catch branches to handle named faults in orchestration workflows

To automatically add Catch branches for named Web service faults:

  1. Under Orchestration Workflows, click NamedFaultOWF2.
  2. Create a working data element of type String to hold the message that is passed to the Description field as follows:
    1. Click a blank area of the orchestration workflow editor.
    2. On the Data Mapping tab of the Property Editor, under NamedFaultOWF2, right-click Working Data, select Add New, and then select String.
    3. Change the name of the new data element (String) to Message.
  3. In the New Items section of the Step Palette, drag a Scope step onto the orchestration workflow editor, and drop it between the Start and End steps.
  4. Change the name of the Scope step to GetBuyRatingScope, and then press the Tab key.
  5. In the Configured Items section of the Step Palette, drag a SerenaSampleTickerService Service step onto the orchestration workflow editor, and drop it onto the line inside the top section of the GetBuyRatingScope step.
  6. On the General tab of the Property Editor, change the Name to GetBuyRating.
  7. From the Operation menu, select GetBuyRating.
  8. On the Data Mapping tab, locate the symbol data element, select the corresponding cell in the Source elements column, and then click the down arrow.
  9. In the Select a Source popup that opens, under NamedFaultOWF2, Inputs, EventNoticeWithReply, Extension; select Title; and then click OK.
  10. In the New Items section of the Step Palette, drag a Calculate step onto the orchestration workflow editor, and drop it onto the line inside the top section of the GetBuyRatingScope step, to the right of the GetBuyRating step.
  11. On the General tab of the Property Editor, change the Name to ReturnBuyRating.
  12. On the Options tab, in the Target section, enter the following using the expression editor: Message.

    See About the Expression Editor.

  13. In the Expression section, enter the following expression using the expression editor: GetBuyRating.GetBuyRatingResponse.GetBuyRatingResult.
  14. Select the End step.
  15. On the Data Mapping tab, under Extension, locate the Description data element, select the corresponding cell in the Source elements column, and then click the down arrow.
  16. In the Select a source popup that opens, under NamedFaultOWF2, WorkingData; select Message; and then click OK.
  17. Expand the FaultHandler section of the GetBuyRatingScope step.
  18. In the top section of the GetBuyRatingScope step, right-click the GetBuyRating step, and then select Add Catch Branches to GetBuyRatingScope.

    SBM Composer scans the SerenaSampleTickerService WSDL for any named faults defined for the GetBuyRating operation and adds the following three Catch branches to the FaultHandler section: CatchUnknownTickerSymbolFault, CatchInvalidInputFault, and CatchGetBuyRatingFault.

    Note: If the Web service operation does not return any named faults, the Add Catch Branches to Scope option is not available.
  19. Select each Catch branch, and note on the General tab of the Property Editor that the Fault name and Fault message are automatically configured.
  20. In the New Items section of the Step Palette, drag a Calculate step into the FaultHandler section, and drop it onto the CatchUnknownTickerSymbolFault branch.
  21. On the General tab of the Property Editor, change the Name to ReturnUnknownTickerSymbolFault.
  22. On the Options tab, in the Target section, enter the following using the expression editor: Message
  23. In the Expression section, enter the following expression using the expression editor: CatchUnknownTickerSymbolFault\UnknownTickerSymbolFault\detail

    You can use errorCode rather than detail if you specified a decision based on the error code.

    Note: For this step, you must first type CatchUnknownTickerSymbolFault followed by a period. Then you can use the expression editor to complete the expression. Also, any time you rename a Catch branch, you must use the new name in the expression.
  24. In the New Items section of the Step Palette, drag a Calculate step into the FaultHandler section, and drop it onto the CatchInvalidInputFault branch.
  25. On the General tab of the Property Editor, change the Name to ReturnInvalidInputFault.
  26. On the Options tab, in the Target section, enter the following using the expression editor: Message.
  27. In the Expression section, enter the following expression using the expression editor: CatchInvalidInputFault\InvalidInputFault.
    Note: For this step, you must first type CatchInvalidInputFault followed by a period. Then you can use the expression editor to complete the expression.
  28. In the New Items section of the Step Palette, drag a Calculate step into the FaultHandler section, and drop it onto the CatchGetBuyRatingFault branch.
  29. On the General tab of the Property Editor, change the Name to ReturnGetBuyRatingFault.
  30. On the Options tab, in the Target section, enter the following using the expression editor: Message.
  31. In the Expression section, enter the following expression using the expression editor: CatchGetBuyRatingFault\GetBuyRatingFault\detail.

    You can use errorCode rather than detail if you created a system that correlates the message detail with the error code.

    Note: For this step, you must first type CatchGetBuyRatingFault followed by a period. Then you can use the expression editor to complete the expression. Also, any time you rename a Catch branch, you must use the new name in the expression.
  32. In the New Items section of the Step Palette, drag a Calculate step into the FaultHandler section of the GetBuyRatingScope step, and drop it onto the CatchAll branch.
  33. On the General tab of the Property Editor, change the Name to CreateUnknownErrorMessage.
  34. On the Options tab, in the Target section, enter the following using the expression editor: Message.
  35. In the Expression section, type: "An unknown error occurred at NamedFaultAWF_NamedFaultOWF2_GetBuyRating"

    Be sure to include the quotation marks.

  36. On the Quick Access Toolbar, click the Validate button.

    The following warning messages appear in the Validation Results:

    • The required DefaultElement 'NamedFaultOWF2\Message' is not mapped or defaulted in 'NamedFaultOWF2'

      This message warns you that you did not provide a value for the Message working data element. You can ignore the message, or you can set the default value to 0 (zero) to prevent the message from appearing.

    • Compensation handler is empty

      You can ignore this message, because a compensation handler is not required for this orchestration workflow.

    • The required DataElement 'GetBuyRating\GetBuyRating\type' is not mapped or defaulted in 'NamedFaultOWF2

      You can ignore this message.

  37. Publish and deploy the FaultHandlingProcApp.

    See Step 6: Publish the Process App and Step 7: Deploy the Process App for instructions.

Related Topics

Using the Service Step

Using the Calculate Step

Tutorial: Running the NamedFaultAWF Project and Invoking a Catch Branch