BPEL preference properties are extensively used in many
projects.
One use case would be, passing the endpoint location to
inoke activity. So it’s a very important command which a developer should
know.
In 10g we had a functionality to add preferences to bpel
process and by adding below command in bpel.xml file we could pass the value as
a variable to our bpel process. And there was also an option to change the
value of preference from BPEL console which made it dynamic.
Coming to 11g we still have this functionality but things
has changed a little and now we need to add preferences in composite.xml file
for a particular bpel process i.e. under component tab of a particular bpel:
Code Snippet of composite.xml
<component name="BPELProcess1">
<implementation.bpel src="BPELProcess1.bpel"/>
<property name="bpel.preference.myPref">anyValue</property>
</component>
Now we can use the function ora:getPreference(myPref) in our
bpel process to retrieve the value of the preference.
Code Snippet of .bpel
<assign name="AssignManagerDetails">
……………
<copy>
<from
expression="ora:getPreference('myPref') "/>
<to
variable="Manager" part="payload"
query="/client:processResponse/client:id"/>
</copy>
……
</assign>
Or if we define the preference value in composite.xml as
some endpoint location, we can use that in invoke.
<invoke name="Invoke_ExecuteEligibility"
partnerLink="EligibilityManagement"
portType="ns8:EligibilityManagementPortType_v1" operation="ExecuteEligibility"
inputVariable="executeEligibilityRequest" outputVariable="executeEligibilityResponse"
bpelx:invokeAsDetail="no">
<bpelx:toProperties>
<bpelx:toProperty name="endpointURI"
>ora:getPreference('myPref')</bpelx:toProperty>
</bpelx:toProperties>
</invoke>
portType="ns8:EligibilityManagementPortType_v1" operation="ExecuteEligibility"
inputVariable="executeEligibilityRequest" outputVariable="executeEligibilityResponse"
bpelx:invokeAsDetail="no">
<bpelx:toProperties>
<bpelx:toProperty name="endpointURI"
>ora:getPreference('myPref')</bpelx:toProperty>
</bpelx:toProperties>
</invoke>
It’s a very good approach to pass end points to invoke through
preferences, as later on we can define preferences in cfgplan.xml which will
override the values present in composite.xml while deployment.
So a better approach would be to give for ex localhost as
the endpoint location in composite.xml and use that preference in invoke or
assign.
And give the actual endpoint location in configuration plan(cfgplan.xml)
file. For ex.
Code Snippet of cfgplan.xml
<component name=" BPELProcess1">
<property
name="bpel.config.<invoke_name>">
<replace> http://<actualendPoint>:8001/xyz/abc-v1</replace>
</property>
</component>
To change
the preference value from console:
To change to values
from the prefences go to the ‘Enterprise Manager’ (http://localhost:7001/em).On the left go to :
Farm_soa_domain > Weblogic Domain > soa_domain > right mouseclick and select ‘System MBean Browser’.
Navigate to Application Defined MBeans > oracle.soa.config
> Server : soa_server1 > SCAComposite > your_project >
SCAComposite.SCAComponent > your bpel_process.
Select the Attribute ‘Properties’.
Select the Attribute ‘Properties’.
Change the value of our preference and click apply.
Run the bpel again to see if the new value got used in the
process.
Thanks a lot for sharing a great blog I was browsing through the internet looking for Oracle SOA and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can find more information blogs about Oracle SOA at Oracle SOA Blogs. Bookmarked this page, it helped me a lot and I have gained a lot of knowledge by reading your blog and Oracle SOA Training
ReplyDeleteThanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle SOA Interview Questions and Answers
ReplyDelete. Actually, I was looking for the same information on internet for
Oracle SOA Training and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject, you can learn more about Oracle SOA Tutorial also.