Cookbook Oracle SOA Business Rules


Published on

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

Published in: Technology, Design
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
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.