Friday, November 14, 2008

dynamic partner link @BPEL

Recently I was asked to take a session on Advanced BPEL topics, so one of the topics which I believed will be interesting to the audience was on how to use dynamic partner links. I would like you all to go through this article - Making BPEL Processes Dynamic .This article explains the concepts and need to go for dynamic partner links.

I will be explaining a stripped down version of this concept using my HelloWorld examples which I believe is apt for understanding the concepts of Dynamic Partner link. I will not be going into step by step detail because the above mentioned article explains it all.

  • First step to do is to come up with a common interface WSDL which all the interacting services using the dynamic partner link should follow. This is done to standardize the service @partnerlink so that it has same operation, input/output messageTypes.

  • Next step is to create dummy BPEL processes /services which will take part in dynamic binding. Here I will try with bpel processes as services. Create a BPEL process say “HelloProcess1”. Copy the content of the common WSDL and replace the content of BPEL process wsdl file.Modify the BPEL process(.bpel file) -change the namespaces, variables to use our custom defined WSDL namespaces and messageTypes. After that add your logic in the process. Create another BPEL process say “HelloProcess2”and follow the same steps.Now you have your services taking part in Dynamic partner link. Deploy them.

  • Next step is to create the main BPEL process which will call our services.Define a switch activity which will check the input and dynamically call either HelloProcess1 or HelloProcess2. In the Partnerlink WSDL which will be our Common HelloService WSDL you need to add the services

<service name="HelloProcess1">

<port name="HelloServicePort" binding="tns:HelloServiceBinding">

<soap:address location="http://geo.com/Process"/>

</port>

</service>

<service name="HelloProcess2">

<port name="HelloServicePort" binding="tns:HelloServiceBinding">

<soap:address location="http://geo.com/Process"/>

</port>

</service>

NO need to worry about the soap:address, it will assigned during runtime.For assigning the address @runtime you need to use the XML fragment of EndPointReference

For HelloProcess1

<EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing">

<Address>http://hsg-host_name:port/orabpel/default/HelloProcess1</Address>

<ServiceName xmlns:ns1="http://geo.com/HelloService">ns1:HelloProcess1</ServiceName>

</EndpointReference>

For HelloProcess2

<EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing">

<Address>http://hsg-host_name:port/orabpel/default/HelloProcess2</Address>

<ServiceName xmlns:ns1="http://geo.com/HelloService">ns1:HelloProcess2</ServiceName>

</EndpointReference>

This code snippet will be assigned to the dynamic ParnterLink and it will decide @runtime which service to call.

  • Deploy the Main BPEL process and see the results. Based on switch condition it should call process1 or process2.

I have uploaded the helloWorld sample @ DynamicPartnerLink. It will be helpful to begin with and understand the flow I have explained here.

No comments: