Friday 8 November 2013

SOA BPEL Process Invokes Business Rule Componet


Business Rule component can be used to validate custom business requirements. We can invoke a Business Rule component from a BPEL component.

In Business Rule component we can put our validations in two ways i.e. If/Then Ladder and Decision Table. Both has same functionality but in Decision Table we can create rules in a shortcut manner.

Following is an example where an employee salary is validating by Business Rule and it gives the Salary grade of that employee as output. This is an simple example intends to the beginners of Business Rule learners.


  • Create a SOA project as BRDemoProject.
  


  • Create a Synchronous BPEL process.


  • Change the BPEL auto created xsd format as mentioned below.
  • Change the auto created WSDL request and response elements accordingly as we change the xsd element structure of the process.

  • Drag and drop a Business Rule component into the Composite of the process from component pallet of Jdeveloper.

  • Create a Business Rule dictionary in which we can give the input and output formats to the component.




  • Now connect the BPEL process to the corresponding Business Rule component
  • Now Double Click on the Business Rule Component to create the rules.


  • Change the rule name and create the rule. Here no need to type the xpath elements manually. It gives all the operands of the business rule by clicking on the operand and also we can change the relational operators by selecting the appropriate one from the drop down. It is pretty simpler and time save process.

  • Fill both the IF and Then part according to the requirement. In the below text field put the number and press enter key.

  • Create another rules as like above for different grades as mentioned below.


  • Now the Business Rule is ready. We need to invoke it from the BPEL. Double click on the BPEL process on the Compsite.xml.
  • Drag and drop a Business Rule activity into the BPEL process flow. Here we are not creating any further Business Rule.  


  • It is only configure all the input and output parameters and invokes the previously created Rule dictionary. It auto creates the invoke activity and assign parameters. This is the simpler way to invoke a BR component in BPEL. Also we can configure it using Assign and invoke activity manually.
  • Fill the input output parameters on  the wizard as mentioned below.







  • Now expand the Business Rule activity on the BPEL process flow.It is pretty cool that creates the following activities automatically.

  • Change the output response message from the Business rule as user friendly.


  • Deploy the BPEL process into Weblogic and test the process.




Please give a feedback over this post and blog.

Happy Coding.


    

11 comments:

  1. Hello,
    It is good post, I followed the above mentioned steps. But while deploying in jdeveloper I am getting error as "Rule Dictionary is Invalid". Could you please assist to solve the issue

    Regards,
    Mithun

    ReplyDelete
  2. Sir,

    There is small glitch in my code, I resolved and fixed the issue. Now it is working fine

    Regards,
    Mithun

    ReplyDelete
  3. @Mithun Varma Sir how did you resolve "Rule Dictionary is Invalid" error ?
    Thank you in advance.

    ReplyDelete
  4. You saved my day, thank you

    ReplyDelete
  5. Hi, how to resolve this Rule Dictionary Invalid error. Plz help with ideas

    ReplyDelete
  6. Is this resolved for you.

    ReplyDelete