In this post we will see how to create Preference variables in SOA composites and use them in BPEL process.
Oracle SOA suite has provided us the facility to add preferences in your composite process. These preferences are worked as variables which we can change at runtime from EM console.
By using these preferences we won’t require to update the code when we have to change this variable.
Ex:- We can use these variables for Email Addresses and File Locations(usually these values will get changed based on the environment).
Let’s see how to add Preferences to our composites.
Go to source of your composite.xml and add the property “<property name=”bpel.preference.EmailVar”>firstname.lastname@example.org</property>” in component section.
Means we are setting the value for variable “EmailVar” which we will be using in our BPEL process.
Now open your bpel process and assign this to a variable using the function (getPreference). In my case whenever any error occurs in my bpel process I will send a mail to the user with details. So I have assigned this preference variable to my Email TO list.
Now deploy your composite on EM and test it .
Changing the Preference value from EM console
Right click on SOA-Infra –> Administration –> System MBean Browser.
Go to your composite using this path oracle.soa.config–>soa_server –> SCAComposite–>Project1–>SCacomponnt.SCAComposite–>BPELProcess1.
Click on the properties tab on the right hand side and expand properties tab to find out element contains your defined preference variable
Change its value and click “Apply”.