1. Schedule the BPEL to call the SAP BAPI
2. Transform the results from BAPI and call the vendor web service. We do not have the target web service yet !
Wait...did it mention "do not have the target web service yet". My experience so far in BPEL was with static partner links where I was aware of the target WSDL location which I could use for the configuration. But here I didn't have that information available. Fortunately I was also provided another vital piece of information : an XML Schema (.xsd) which was the data model for the vendor WSDL. That helped me to go ahead and complete the integration.
I am sure many developers have come across similar scenarios where the end service(WSDL) we are going to call is unknown during design/development phase. So it becomes a challenge to provide an endpoint to the BPEL process or configure the partner links. And this is where dynamic partnerlinks come in handy. They use WS-Addressing feature of BPEL PM and enable us to pass values to the dynamic end points at runtime.
A very good example of this has been provided in the BPEL Cookbook on OTN ,where they have explained Dynamic PartnerLink usage in the Sample Loan Approval BPEL flow.
In this post I would like to highlight some key points while configuring dynamic partnerlinks in BPEL. The most important point to be remembered when using dynamic partnerlinks is that you need to ensure each process that you wish to call has to be based on exactly the same WSDL. The message types, namespaces, port types, bindings etc...everything have to be same just the endpoint url will be different.
If the above is taken care of then configuration wise things are simple :
a. First create the patnerlink with a template WSDL file.
b. Then add the following namespace to your bpel process
c. Import the schema from above namespace URL to your project.
d. Based on this namespace, create an “EndpointReference” variable.
<variable name="partnerReference" element="wsa:EndpointReference"/>
e.Initialize the endpoint-reference by copying the following xml-fragment to the endpoint reference.
<EndpointReference xmlns="http://schemas.xmlsoap.org/ws/2003/03/addressing"> <Address/> </EndpointReference>
f. You can use a bpel preference to store the end point URL so that at runtime this can be changed easily. Copy the determined endpoint url into the address node of the EndpointReference variable.
<copy> <from expression='ora:getPreference("EndPointURL")'/> <to variable="partnerReference" query="/wsa:EndpointReference/wsa:Address"/> </copy>
g. Finally before invoking the partnerlink copy the Endpoint Reference to the partnerlink
<copy> <from variable="partnerReference" query="/wsa:EndpointReference"/> <to partnerLink="DummyService"/> </copy>