Wednesday 8 February 2012

Change DB JNDI dynamically in SOA 11g

Lets take one simple example , we want to retrieve data from employees table of HR schema based on employee_id.For that I created a datasource and outbound connection factory in database adapter.I passed on the newly created JNDI name in adapter .jca file accordingly and deployed.It ran successfully.
But my requirement is to pass on the JNDI name dynamically from descriptor, means if the destination database change then user can change the JNDI name from soa preference of deployed process, no need for redeployment. Here are some simple steps to achieve that,
Say like below you created your composite,
image
In composite.xml for the BPEL process I created one preference say,jndiVar like,
image
Here is my BPEL flow outline,
image
At setJNDI I’m assigning preference value to a process variable,
image
Then after creating the adapter go to the BPEL source and add
<bpelx:inputProperty name="jca.jndi" variable="jndiVar"/> as below,
image
Then deploy the process and change your preference value accordingly to point to right JNDI as below,
Farm_soa_domain > Weblogic Domain > soa_domain > right mouseclick and select ‘System MBean Browser’.
image
Navigate to Application Defined MBeans > oracle.soa.config > Server : soa_server1 > SCAComposite > your_project > SCAComposite.SCAComponent > your bpel_process.
Select the Attribute ‘Properties’.
image
Change the value of our preference,set JNDI accordingly and click apply.
image
Thats all your adapter will retrieve the data using new JNDI, obviously that JNDI should be defined in weblogic.

No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...