Wednesday, May 22, 2013

Setting and Getting Preferences SOA Suite 11G

Deployment descriptors are BPEL process service component properties used at runtime by Oracle WebLogic Server, Oracle Enterprise Manager, or both.

Oracle has provided the functionality to add preferences to your bpel process.Preferences are like a variable whose value can be changed from EM console requiring no code change.For instance,consider one use case for File adapter.Suppose in test environment we are writing the files to /test/source location.Now once the code is migrated to production environment, now you want to write the files to /prod/source location.

These type of properties can be set using preferences, where you have to just update the value of preference variable for dircetory location on EM and there you go.We dont have to explicitly make changes in the code to point it to new location and deploy it again.

Depends upon requirement,what type of variables in BPEL can be declared as preferences.Ill be demonstrating how to set and get the values of these preference variables and how to change them using Enterprise Manager.


Step1: I will be using "HelloWorld" tutorial for this that we created in my first post.Open up your Hello World BPEL process.
Step2: Got to source of composite.xml and add "<property name="bpel.preference.MyVar">Old Value in Response</property>" in component section.Here we are setting the value for variable "MyVar" which we will be using in our BPEL process.
Step3: Now double click and open your BPEL process.Open the assign action.We will be populating the result of our BPEL process using this preference variable.Double click on result of our output variable to open up the expression window.Drill down to BPEL XPath Extension Functions and insert getPreference into expression field.Add the preference var in the function as ora:getPreference("MyVar").Make sure you enclose your preference variable using double quotes.Click OK.
Step4: your assign action will look like this.Click OK.
Step5: Now deploy your composite on EM and test it passing any random input and open the flow trace of invoke composite.In the assign action you will see value of result as "Old Value in Response".It is the same value that we set inside composite.xml.
Step6: Now we will change this value from EM to some other value.Right click on SOA-Infra --> Administration --> System MBean Browser.
Step7: Drill down to your composie following this path oracle.soa.config-->Mgd Sever --> SCAComposite-->HeloWorld-->SCacomponnt.SCAComposite-->HelloWorldProcess.
Step8: Click on the properties tab on the right hand side and expand properties tab to find out element containg your defined preference variable
Step9: Change its value and click "Apply"
Step10: Test your interface again and thsi time you will see the updated value in the result.
In this way you can define n number of preference variables in your composite.xml and use them in your BPEL process.Should you guys have any question ,feel free to ask.

Happy Learning,
Cheers









6 comments:

  1. Hi,
    This post is good enough to get very clear understanding on bpel preferences.

    Thanks a lot..

    Regards,
    Venkat

    ReplyDelete
  2. Welcome.......Glad you liked it.

    Regards,
    Karan

    ReplyDelete
  3. Awesome Article. Very Helpful. Thank you.

    ReplyDelete
  4. Thanku... very helpful

    ReplyDelete
  5. Very Good Article. Thanks . Subhadip

    ReplyDelete