Business Rules CompositeCookbook on how to create a simple Business Rule Composite in Oracle             SOA Suite
Create New SOA Project
Enter Project Name and Directory
Begin with Empty Composite (or Composite With Business Rule)
Drag Business Rule in thecomposite.xml, enter Name and  Package and click + Input…
Define Input Message by importing         types from MDS
Do not ‘Copy to Project’ !You don’t want to have copies of shared xsd’s (xsd’s used bymultiple composites and/or systems) ...
Select Input Type
Click + Output…
Define Output Message by importing         types from MDS
Again do not ‘Copy to Project’ !
Select Output Type
Select tab Advanced to enter a nice           Service Name
Finally Select OK
Open composite
Drag a Mediator to the Components   lane, enter Name and select       Synchronous InterfaceAlways use a Mediator to expose...
Select as Input same type as Business  Rule Engine, so first import types
Again do not ‘Copy to Project’ !
Select same Input Type
Same applies for output type.Make sure “Create Composite Service  with SOAP Bindings” is checked
Press OK
Drag the arrow of the Mediator to theRule Engine to wire execute method to     callFunctionStateless method
Double click on Mediator and click on    button to create a mapping
Provide meaningfull name for the new            Mapper file
In the mapper on the right side expand   node parameterList, right click on NOM-details and select Add XSL Node           ...
Select “Replace the selected Node with the results of the copy-of”
Drag the NOM-details on the left side           to the copy-of
In the mapper on the right click, right-click on attribute name and select Set           Text > Enter Text…
Enter text “NominationRulesService”(name of the service in the business             rule engine)
Save all, close mapper, open mediator   again and create reply mapping
Copy in the same way VAL-answerfrom resultList to Val-answer target
Save all, close mapper and mediatorand open NominationRules by double         click in the composite
Select Ruleset1 and Create Decision               Table
Click on the table name to enter a         meaningful name
Click on <insert condition>
Double click on C1 <edit condition>  and select TNOMDetails.status
Click on ? below R1 and select INITIAL
Click on button Gap Analysis…
Select the checkbox to fill the gap
Click on tab Functions
Click on + to create a function andenter Name, select void as Return Type  and enter a meaningful Description
Click on <insert action> in the Bodypart and create the following code:assert new TVALAnswer( <edit properties> )
Click on <edit properties> and select   null and true as constant values
The same for new function       validateNOK with null and false as                constant valuesDon’t worry, we’re gonna ...
Navigate back to DecisionTableNomStatus in Ruleset1, click on <insert       action> and select Call
Double click on ‘A1 call(’ and select       function validateOK
Click on + and select Action > Call
Select validateNOK for A2, select A1 as      action for R1 and A2 for R2
Test this basic setup by deploying the      composite and using soapUI.Retrieve WSDL url from Test tab in Enterprise Manag...
Create new Project in soapUI with           WSDL url
Fill request with test data and invoke
Nominaton status value ‘initial’ results  to true as nomination response
Open NominationRules again and      select the Facts tab
Select subtab Java Facts (bottomscreen), press + button, browse and    search for java.util.ArrayList
Select! (checkbox) and press OK
Select tab Functions and selectvalidateNOK function to change it
Add two arguments of type String withthe + button of the Arguments section  and name them code and message
With right click next to statement youcan delete, insert new statements, etc
Create code for function validateNOK:
Select Ruleset1 and double click onaction A2 to edit argument settings
Check Parameterized checkbox for  both arguments and press OK
Fill arguments for R2 with code “001”     message “Invalid Nomination”
Deploy and assert arguments are      returned in output
In decision table create two more rules  and split up R2 into separate values   and enter their arguments for A2If you, by...
Deploy and test again
Select tab Globals and with + buttoncreate variable MaxNomAmount oftype int, value 10000 and check bothConstant and Final
Select tab Bucketsets and with +button create new bucketset of type           “List of Ranges”
Edit this new bucketset by selecting it and the pencil button(or double click on bucketset icon)  and first provide a dece...
Use the + button to create 0 valueendpoint and again to create Endpoint  of Global value MaxNomAmount.Uncheck checkbox Inc...
Press OK to save the bucketset
Select Ruleset1 again and add   condition with + button
Double click on C2 and select TNOMDetails.totalAmount
Select C2 and assignNominationAmountBuckets to it
Set [0..MaxNomAmount] as value for R1 with status INITIAL and OK result
Enter - , a dash, as value for R2-R4       meaning ‘otherwise’
Create two rules for status INITIAL with < 0 and > MaxNomAmount buckets, assign validateNOK and    provide decent arguments
Deploy and test your end result
Upcoming SlideShare
Loading in...5
×

Cookbook Oracle SOA Business Rules

9,514

Published on

How to create a simple decision table in Oracle SOA Suite 11g

Published in: Technology, Design
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,514
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
381
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide
  • To fill the error list we need to import an implementation of a List, for example java.util.ArrayList
  • Cookbook Oracle SOA Business Rules

    1. 1. Business Rules CompositeCookbook on how to create a simple Business Rule Composite in Oracle SOA Suite
    2. 2. Create New SOA Project
    3. 3. Enter Project Name and Directory
    4. 4. Begin with Empty Composite (or Composite With Business Rule)
    5. 5. Drag Business Rule in thecomposite.xml, enter Name and Package and click + Input…
    6. 6. Define Input Message by importing types from MDS
    7. 7. Do not ‘Copy to Project’ !You don’t want to have copies of shared xsd’s (xsd’s used bymultiple composites and/or systems) scattered around in multipleprojects. Only xsd’s which are only used within a composite arestored within a composite project.
    8. 8. Select Input Type
    9. 9. Click + Output…
    10. 10. Define Output Message by importing types from MDS
    11. 11. Again do not ‘Copy to Project’ !
    12. 12. Select Output Type
    13. 13. Select tab Advanced to enter a nice Service Name
    14. 14. Finally Select OK
    15. 15. Open composite
    16. 16. Drag a Mediator to the Components lane, enter Name and select Synchronous InterfaceAlways use a Mediator to expose to the outside world! It offers routing andmapping flexibility for future changes.
    17. 17. Select as Input same type as Business Rule Engine, so first import types
    18. 18. Again do not ‘Copy to Project’ !
    19. 19. Select same Input Type
    20. 20. Same applies for output type.Make sure “Create Composite Service with SOAP Bindings” is checked
    21. 21. Press OK
    22. 22. Drag the arrow of the Mediator to theRule Engine to wire execute method to callFunctionStateless method
    23. 23. Double click on Mediator and click on button to create a mapping
    24. 24. Provide meaningfull name for the new Mapper file
    25. 25. In the mapper on the right side expand node parameterList, right click on NOM-details and select Add XSL Node > copy-of
    26. 26. Select “Replace the selected Node with the results of the copy-of”
    27. 27. Drag the NOM-details on the left side to the copy-of
    28. 28. In the mapper on the right click, right-click on attribute name and select Set Text > Enter Text…
    29. 29. Enter text “NominationRulesService”(name of the service in the business rule engine)
    30. 30. Save all, close mapper, open mediator again and create reply mapping
    31. 31. Copy in the same way VAL-answerfrom resultList to Val-answer target
    32. 32. Save all, close mapper and mediatorand open NominationRules by double click in the composite
    33. 33. Select Ruleset1 and Create Decision Table
    34. 34. Click on the table name to enter a meaningful name
    35. 35. Click on <insert condition>
    36. 36. Double click on C1 <edit condition> and select TNOMDetails.status
    37. 37. Click on ? below R1 and select INITIAL
    38. 38. Click on button Gap Analysis…
    39. 39. Select the checkbox to fill the gap
    40. 40. Click on tab Functions
    41. 41. Click on + to create a function andenter Name, select void as Return Type and enter a meaningful Description
    42. 42. Click on <insert action> in the Bodypart and create the following code:assert new TVALAnswer( <edit properties> )
    43. 43. Click on <edit properties> and select null and true as constant values
    44. 44. The same for new function validateNOK with null and false as constant valuesDon’t worry, we’re gonna fill the error part later on.
    45. 45. Navigate back to DecisionTableNomStatus in Ruleset1, click on <insert action> and select Call
    46. 46. Double click on ‘A1 call(’ and select function validateOK
    47. 47. Click on + and select Action > Call
    48. 48. Select validateNOK for A2, select A1 as action for R1 and A2 for R2
    49. 49. Test this basic setup by deploying the composite and using soapUI.Retrieve WSDL url from Test tab in Enterprise Manager.
    50. 50. Create new Project in soapUI with WSDL url
    51. 51. Fill request with test data and invoke
    52. 52. Nominaton status value ‘initial’ results to true as nomination response
    53. 53. Open NominationRules again and select the Facts tab
    54. 54. Select subtab Java Facts (bottomscreen), press + button, browse and search for java.util.ArrayList
    55. 55. Select! (checkbox) and press OK
    56. 56. Select tab Functions and selectvalidateNOK function to change it
    57. 57. Add two arguments of type String withthe + button of the Arguments section and name them code and message
    58. 58. With right click next to statement youcan delete, insert new statements, etc
    59. 59. Create code for function validateNOK:
    60. 60. Select Ruleset1 and double click onaction A2 to edit argument settings
    61. 61. Check Parameterized checkbox for both arguments and press OK
    62. 62. Fill arguments for R2 with code “001” message “Invalid Nomination”
    63. 63. Deploy and assert arguments are returned in output
    64. 64. In decision table create two more rules and split up R2 into separate values and enter their arguments for A2If you, by accident provide arguments, for unused A2 call, you can not delete them! Runtime this doesn’t matter, but you can set them to null value for readability.
    65. 65. Deploy and test again
    66. 66. Select tab Globals and with + buttoncreate variable MaxNomAmount oftype int, value 10000 and check bothConstant and Final
    67. 67. Select tab Bucketsets and with +button create new bucketset of type “List of Ranges”
    68. 68. Edit this new bucketset by selecting it and the pencil button(or double click on bucketset icon) and first provide a decent name
    69. 69. Use the + button to create 0 valueendpoint and again to create Endpoint of Global value MaxNomAmount.Uncheck checkbox Included Endpoint, so MaxNomAmount will be allowed.
    70. 70. Press OK to save the bucketset
    71. 71. Select Ruleset1 again and add condition with + button
    72. 72. Double click on C2 and select TNOMDetails.totalAmount
    73. 73. Select C2 and assignNominationAmountBuckets to it
    74. 74. Set [0..MaxNomAmount] as value for R1 with status INITIAL and OK result
    75. 75. Enter - , a dash, as value for R2-R4 meaning ‘otherwise’
    76. 76. Create two rules for status INITIAL with < 0 and > MaxNomAmount buckets, assign validateNOK and provide decent arguments
    77. 77. Deploy and test your end result
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×