Lesson 3: Adding a rule to a business process service

In this lesson, you add a rule to check the results of the service invocation you created in the previous lessons.

  1. If MySalesBPService.svc_bpmn is not open, in the WorkSpace Navigator, expand MySybStore_Tutorials/Services/BP and double-click MySalesBPService.svc_bpmn to open it in the Business Process Service Editor.

  2. Select the Business Process tab in the editor.

  3. Double-click ValidateSalesItem in the diagram to open the activity to open it, then click ValidateSalesItem maximize icon to expand the display.

    Add single-rule logic to the business process logic.

  4. Right-click in the editor diagram and select Show Tool Palette.

  5. On the Tool Palette, select the Logic category, then drag the Single-Rule logic onto the canvas to the right of the Validate icon.

  6. Connect these icons in the business process logic. Click the right arrow of the Validate activity and drag to and click the left arrow of the Single-rule activity.

  7. Rename the Single-rule activity by selecting the icon on the canvas, double-clicking the name and entering ifInvalid.

  8. Select the ifInvalid activity on the canvas and expand the Properties pane at the bottom of the editor window. The ifInvalid logic displays in the Expression editor.

    NoteTo expand the Expression editor window, click the right border of the window and drag out.

    The expression you want to build for the ifInvalid rule is:

    ValidateReturn is not equal to 1
    
  9. Expand the Business Process Variables pane and select Invoked Services Variables/MySalesValidate/SalesItem/Validate/ValidateReturn.

  10. Drag ValidateReturn from the Business Process Variables pane on top of the Select Variable icon in the Expression editor in the Properties pane.

  11. Select the is equal to operator in the Expression editor. The properties for the operator display to the right of the Expression editor.

  12. Change the is equal to operator properties. Select != from the Source Text drop-down list. The Logical Name automatically changes to is not equal to.

    NoteA red “X” displays for this operator in the Expression editor. The “X” changes to the proper “is not equal to” sign when you save your changes.

  13. Select string constant in the Expression editor.

  14. Change the Logical Name to 1, select the Bind Source Text to Logical Name option, and select int from the Data Type drop-down list. The value in the Source Text field changes to “1”.

  15. Right-click the background of the Expression editor canvas and select Save from the context menu.

  16. Move the cursor over the ifInvalid activity on the business process canvas to see the rule expression.

  17. Minimize the Properties pane, but leave the ValidateSalesItem activity maximized in the editor diagram.

The ifInvalid single rule continues to be marked with a red “X” until you map one of its paths in a later lesson. You have finished adding a rule to a business process service to check the results of a service invocation.