Pages

Sunday, February 17, 2008

Business Rules in Soa Suite 11g

With the new soa suite patch ( 4 feb ) for the jdeveloper 11g TP3 release we can test the business rules. The 11g version is a totally different then the 10.1.3 version. The first thing is a lot easier to make business rules and you can expose these rules as web services so you can use it in other applications. In 10.1.3 you have a binary br repository which you can use. Now you create service in the BR to expose a particular ruleset or function. You can also use business rules to create advanced approval routing in the workflow component.
The first step is to drag the business rule to the composite.xml. Now you get a wizard to create a new business rule. In my case I made a simple schema with a element total order amount which I use as input and as output boolean element supersize order. You can also check expose as composite service so you can use this br in other applications

Because I checked the expose as composite service you can see that soa suite creates a webservice.

If we open the new BR then we see that soa suite has created xml facts of the input and output element. This is done with jaxb.

Soa suite also creates a service which calls the empty created ruleset. You can add more services based on br functions or other rulesets.

To the created the ruleset we can add a new rule. We select a simple test where we check if the total order is greater then 2000.

Next I select the input element, > and 2000. Now we can add the return value. Choose assert new.

We have to select the output element and in the output element we select true. Now we can make a second rule where the outcome is false when the input is lower then 2000

We are ready with the composite part now we can go to bpel where we add a business rule to the right place in the bpel designer. We have to select the just created br and the right operation, in my case assert facts , execute and retrieve result. We also have to assign the input and output variable of the br.

This is how it looks when we open the business rule scope.

You are ready to deploy this to soa container and test this

29 comments:

  1. how to implement a global variable in 11g jdeveloper

    ReplyDelete
  2. Hi,

    maybe this can help http://download.oracle.com/docs/cd/E12839_01/integration.1111/e10224/bp_app_deploydesc.htm#SOASE11121

    ReplyDelete
  3. Hi Edwin,
    With Oracle Business rules 11g can we create a central GUI for Business users to change the rules than changing them in jdeveloper and redeploying the coposites. And also, do you have any idea if Oracle is planning to come out with something like that in the future. Thanks
    Mayur

    ReplyDelete
  4. Hi Mayur,

    With Oracle Business rules 11g can we create a central GUI for Business users to change the rules than changing them in jdeveloper and redeploying the coposites.

    yep this is possible, you can make br composites and use this in other composites. If you want to change things then you have to go to jdeveloper . br variables which influence br can be set in the composite

    And also, do you have any idea if Oracle is planning to come out with something like that in the future

    maybe in 11gr2 or 12g you can br from the console

    thanks Edwin

    ReplyDelete
  5. Hi Edwin,

    A couple of questions on OBR. The dictionaries that we create are part of the SAR, when we deploy. Is it possible store them into MDS, so that everytime, a change in dictionary is there, the BPEL does not have to be redeployed and the vice versa.

    Secondly, I have a composite with close to 75 dictionaries and the size of the SAR has gone to 52MB. Is there any statistics that is available which states what is the maximum size of SAR that we can deploy and how many such SAR's can exist on the domain?

    Cheers,
    Arun Ramesh

    ReplyDelete
  6. Hi Arun,

    If you can use oramds: or lookup a obr in the resource view then this should be possible.

    so add your OBR to your local MDS and put it in /apps/xxx/...
    and a oramds ref to this file and compile.

    I don't know the limits probably it is wls memory setting. But why don't you deploy to MDS in smaller files. ( dont remove the app folder before uploading )

    thanks

    ReplyDelete
  7. While creating a business rule the input payload for the business rule comprises of many fields

    like name,configURL,processId,ConversationID

    Could you please thow some light on them,My scenario is very simple i have created a simple rule which is being called by bpel,but i am not sure on what i should map to these fields

    ReplyDelete
  8. Hi Edwin,
    I've implemented the Business rule activity in a BPEL Process.
    While testing the same, i'm getting following error:


    Fact not found in the rule engine working memory, rule session execution failed.
    The rule session 620073 failed because an instance of the fact com.autoloan.ns.autoloan.LoanOffer could not be found in the working memory of the rule session.
    This is most likely a rule modeling error. The decision service interaction expects the fact instance to exist in the working memory of the rule session. Check the rule actions in rule designer and make sure that a fact of the expected type is being asserted. If the error persists, contact Oracle Support Services.

    Kindly help me on the above...

    Regards,
    Rupesh

    ReplyDelete
  9. Is it possible to integrate Oracle service Bus with Oracle Business Rule ,please suggest me some site/samples/reference or provide steps for same if possible.

    ReplyDelete
  10. Hi,

    Yes it is possible , create your business rule composite and expose it with a direct binding or use a ws binding.

    Then in OSB do a service call out to the business service which calls the SOA composite,

    Or maybe you can do a java call out and loads the business rule file .

    Good luck

    ReplyDelete
  11. Hi Edwin,
    I am new to OBR and want to check if its possible to implement a standard rule rule, such as checking the order Value > 2000, but have this value of 2000 dynamically set so that each customer could have there own amount....

    Cust1 has an amount of 2000
    Cust2 has an amount of 10000
    cust3 has an amount of 7000

    So when you apply the rule it dynamically pulls in the amount you are evaluating against as a substitution.

    If order > x

    where X is set for each instance of the rule.
    Is this possible?
    Stuart

    ReplyDelete
  12. Hi,

    Can you provide besides the order information also the relation information which has this order amount value.

    Then you can determine or use this values. Maybe you can say if it is a gold customer and with gold has a value of 2000. Decision table can do this.

    Thanks

    ReplyDelete
  13. can you upload this project, we can easily implement and understand the code.

    ReplyDelete
  14. Hi Edwin, Im quite new with Jdeveloper and the business rules. When trying to expose my BR as a web service, I'm only able to change the service name but the operations of the web service stay the same (callFunctionStateless,callFunctionStateful). Is there a way to configure this?

    ReplyDelete
  15. Hi,

    I am new to JDeveloper and BPMn,OBR.Can some tell me the process, how can a BR of a projects exposed as a webservice and used by another projects. Please help. Thanks in advance.

    ReplyDelete
  16. HI Biemond,

    Can we use the an EBM.xsd from AIA to create FACTS in the OracleBusinessRules 11g.We are using RulesSDkAPI to do a run-time update of the RuleData,Buckets,Bucketsets.If so what are the difficulties we encounter ?

    Thanks
    Raghu

    ReplyDelete
  17. Hi Biemond,

    Do you have an example of using the OBR rule file stored in MDS in a BPEL flow?
    I have a .rules file stored in MDS which I want to use in my new BPEL workflow.
    Am unable to find an option to import .rules file.

    Thanks for the help.
    Sapna

    ReplyDelete
    Replies
    1. Hi,

      I think BPEL calls BR or HWF with a partnerlink ( not embedded in BPEL) and it is a different service component. maybe you can expose this BR or add a BR service component and make a reference to this rules file in the MDS

      Thanks

      Delete
    2. Hi Edwin,
      Hi Edwin,
      I've created a Rules Dictionary (abc.rules) and copied it to integration\seed\apps. In JDeveloper, I've created a new composite wherein I've created a Rules Dictionary (xyz.rules). Under "Links", I'm able to browse to abc Rules Dictionary but when I click ok, I get the following error-
      RUL-05601: The dictionary cannot be found using link "abc".

      Is there a restriction on how to store a Rule Dictionary in MDS?
      p.s.- I am able to "Link" to an existing Dictionary (CaseManagementBaseDictionary) in the soa/shared folder.

      Thank you in advance, Edwin.
      --
      Dilip

      Delete
  18. Hello Edwin,
    WOuld it be possible for you help me in providing direction on converting Java Fact to XML Fact ? I have created a simple java fact and loaded it and created a rule as well. But while exposing that as Decision Service (Function), it is not accepting the java facts. The User guide states, that it has to be converted but I am not sure how to do this.

    ReplyDelete
  19. Are there any performance implications in using XMLFACT versus Java Facts ? Kindly provide your insight.

    ReplyDelete
    Replies
    1. Hi,

      probably some jaxb conversion but this will not take that much time/resources ( unless you will use a big payload )

      Thanks

      Delete
  20. Hi Edwin,

    From a rule file i want to created dictionary links from MDS ( refering the rules files MDS). And also the same question i am asking that is asked by many people

    From BPEL can i refer the decision service function that is expsoed in the rules file that is stored in MDS.

    My question is : our typical way of using rules file thru linking with BPEL.
    I don't want this. I want the rule file is independent of BPEL process for which i am storing in the MDS. Now how can i access the MDS rules from BPEL.

    second: If i have rule file in the composite then can i refer all other dictionaries in MDS using dictionary links. I have tried this ...I am getting this error -RUL-05601: The dictionary cannot be found using link

    ReplyDelete
  21. Hi Edwin,

    From a rule file i want to created dictionary links from MDS ( refering the rules files MDS). And also the same question i am asking that is asked by many people

    From BPEL can i refer the decision service function that is expsoed in the rules file that is stored in MDS.

    My question is : our typical way of using rules file thru linking with BPEL.
    I don't want this. I want the rule file is independent of BPEL process for which i am storing in the MDS. Now how can i access the MDS rules from BPEL.

    second: If i have rule file in the composite then can i refer all other dictionaries in MDS using dictionary links. I have tried this ...I am getting this error -RUL-05601: The dictionary cannot be found using link

    ReplyDelete
  22. HI Edwin,

    Can we expose BR as webservice and invoke it just like BPEL, I tried and got below error:




    fpre:operationErroredFault




    TestBR






    Please help.

    Thanks
    Yatan

    ReplyDelete
    Replies
    1. Hi,

      You can use a mediator in front of it just what Emiel did in this presentation
      http://www.slideshare.net/emielpaasschens/cookbook-oracle-soa-business-rules

      thanks

      Delete
  23. Hi Edwin,

    In BR, can we have a ELSE condition, like if no conditions got satisfied it can execute the ELSE.

    Thanks
    Yatan

    ReplyDelete
  24. Hi Edwin,
    In oracl business rules how to use RL Functions and is it possible to Invoke Decision Table from another Decision Table????

    ReplyDelete