Thursday, September 18, 2008

dynamically updating process descriptor using java embedding

As I have written in my previous blog one of the tasks which I felt challenging was using creating and using dynamic partner links. For choosing dynamic partner link concept you would be having a scenario in which a service (partner link) is invoked based on a runtime input. Based on this input condition decided at runtime the endpoint reference is dynamically set to the partner link.

In one of my research works on orabpel jar I came across some classes which will help you in dynamically modifying the wsdllocation of the partner link,This is done by overwriting the wsdllocation in process descriptor( bpel.xml).

Some of the classes which are useful for this purpose are Locator, BPELProcessHandle ProcessDescriptor , PartnerLinkBindings and PartnerLinkBinding.

For example if I have a bpel process named HelloWorld, use Locator to look up the process . locator.lookupProcess("HelloWorld") will return you a BpelProcessHandle instance which represents HelloWorld process. BpelProcessHandle has a method getDescriptor() which will return you its process descriptor-bpel.xml(in java terms ProcessDescriptor instance). ProcessDescriptor has a getPartnerLinkBindings() which will return a PartnerLinkBindings instance. PartnerLinkBindings has getPartnerLinkBinding("partnerLinkName") method which will return you PartnerLinkBinding instance corresponding to the partner Link Name. The properties associated with this particular partner link can be retrieved as well as modified using the getPropertyValue and setPropertyValue methods respectively. Similarly you can modify all the properties in the process descriptor at runtime.

The java code to perform this functionality can be either invoked using XPath-Bpel function or by using java embedding.

I am listing below one of the code snippets I used in Java embedding

try {



setPropertyValue("wsdlLocation", "http:/hostname:port/orabpel/default/Hello2/Hello2?wsdl");

}catch(Throwable ex) {


No comments: