Decision Table in SOA Suite 12C – Pending for review

Introduction:

A Decision Table is an alternative way of declaration of Business rule. Decision table presents multiple business rules with conditions and actions presented in a tabular format. When many rule combinations are needed for property values, we can use decision table to create a set of rules.

This article demonstrates how to select carrier value depends on the fulfillment price using Decision Table in Business Rule. Follow the below steps to implement Decision table in SOA application.

  1. Create a SOA application with SOA project. Click on File -> New -> Application and select SOA Application from Applications Enter application name DecisionTableBRApplicationDecison_Table_1 Decison_Table_2 Decison_Table_3
  2. Click on Next and enter project name DecisionTableBRDemoDecison_Table_4
  3. Click on Next and select composite type as Composite With Business RuleDecison_Table_5
  4. Click on Finish and Create Business Rule wizard will open. Enter business rule name as CarrierRule.Decison_Table_6
  5. Create input and output parameters. Click on green plus icon and select Input ParameterDecison_Table_7
  6. Select Input value from fulfillment.xsd. Import fulfillment.xsd file in the project and select fulfillment as input value. Uncheck the check box Maintain original directory structure for imported files.Decison_Table_8Decison_Table_9Decison_Table_10
  7. Select output value from fulfillment.xsd. Select CarrierSelection as output valueDecison_Table_11
  8. Now Create Business Rule wizard will look like below screenshotDecison_Table_12
  9. Click on OK and CarrierRule.rule file will be created. Navigate to Facts tab and select the checkbox in the visible column for FulfillmentType andA�CarrierSelection.Decison_Table_13
  10. Go to Value Sets tab and CarrierValue is created automaticallyDecison_Table_14
  11. Navigate to Rule Set tab. Click on green plus icon beside Rule Set and create new rule set. Now create rules under rule set. Click on green plus icon in Decision TablesDecison_Table_15
  12. Below window will openDecison_Table_16
  13. Click on insert condition and select total from FulfillmentTypeDecison_Table_17
  14. Click on pencil icon (Edit Value Set)A�beside the Local Range Value Set.Decison_Table_18
  15. Edit the value set as per the below screenshotDecison_Table_19 Decison_Table_20
  16. Click on icon Decison_Table_21A�and from the list select Split Table optionDecison_Table_22
  17. Condition part of the Decision table will look like below screenshotDecison_Table_23
  18. Click on insert action and select assert newDecison_Table_24
  19. Select CarrierSelection in the Facts and select carrier as propertyDecison_Table_25
  20. Click on OKDecison_Table_26
  21. Select carrier value against each row in fulfillment type. Click on box below the check box in R1 column for selecting carrier value. Select NONE as carrier value in R1, USPS in R2, UPS in R3 and FED_EX in R4 like the below screenshotDecison_Table_27 Decison_Table_28
  22. One more action can be inserted against each condition according to business requirement. Click on assert new CarrierSelection and select insert after -> assert new. Another action will be inserted after the first one.Decison_Table_29 Decison_Table_30
  23. Save the project. Select BPEL process from component palette and drag and drop it in the component laneDecison_Table_31
  24. Create BPEL Process wizard will open and enter BPEL process name. Select template type as Asynchronous BPEL Process and except default input and output valueDecison_Table_32
  25. Connect BPEL process and Business ruleDecison_Table_33
  26. Create a variable in BPEL process to hold the reply from the Business Rule. Click on variable icon in the main scope.Decison_Table_34
  27. Click on green plus icon to create new variableDecison_Table_35
  28. Enter variable name CarrierVar and select variable type as string.Decison_Table_36 Decison_Table_37
  29. Double click on BPEL process to open the process. Select Business Rule from SOA Components and drag and drop it in between receiveInput and callbackClientDecison_Table_38
  30. Double click on Rule1 and select CarrierRule as Dictionary. Service and Operation will be selected automatically based on the value of Dictionary.Decison_Table_39
  31. Create input fact and output fact . Click on green plus icon in the Assign input Facts Select input payload of BPEL process in the From part and select total in the To part as per the below screenshotDecison_Table_40
  32. Navigate to Assign Output Facts tab and create new output fact. Select CarrierValue from dsOut payload in the From part and select CarrierVar variable in the To partDecison_Table_41
  33. Drag and drop IF activity below the Business Rule. Add three more elseif conditions in the IF activity and delete the else partDecison_Table_42
  34. Add conditions in each IF Write condition in the expression builder of IF condition like below screenshotDecison_Table_43 Decison_Table_44
  35. Add the below conditions in the rest of the IF conditions$inputVariable.payload/client:input > 100 and $inputVariable.payload/client:input < 500
    $inputVariable.payload/client:input > 500 and $inputVariable.payload/client:input < 1000
    $inputVariable.payload/client:input >= 1000
  36. Select Assign activity from Basic Activities and drag and drop it in each IF sectionDecison_Table_45
  37. Double click on Assign activity and map the output payload with BPEL variableDecison_Table_46
  38. Do the same for the other three assign activities.
  39. Now the BPEL process will look like below screenshotDecison_Table_47
  40. Deploy the project and test the project in Enterprise Manager ConsoleDecison_Table_48
  41. Enter 200 in the input payload and click on Test Web ServiceDecison_Table_49
  42. Output should be USPS. Click on Launch Flow Trace to check the output value. Click on DecisionTableBPELProcessDecison_Table_50
  43. Go to Audit Trail tab and click on View Payload after callback clientDecison_Table_51
  44. Check the resultDecison_Table_52
  45. You can visualize the whole process flow in the Flow tab. Here the input amount was 200, so the second If condition is selected.Decison_Table_53

Test the project with different input values and check the output payload. In this example carrier value is selected based on the rules in the Decision Table. Business user can change the rule in SOA Composer (http://localhost:7101/soa/composer)Decison_Table_54

Leave a Reply

Your email address will not be published. Required fields are marked *

Show my latest post here