One just needs to make sure, AIA is replaced by a suitable component. By this statement, I mean one needs to make sure a mechanism is available to change, load and reference the endpoint at runtime. Oracle Fusion Middleware offers a lot of option for one to replace AIA. You can do any one of the below and yet use the dynamic endpoint feature without AIA:
- Store information in a file and use file adapter to read the file whenever required
- Store information in a database table and use a DB adapter to fetch the information
- Use BPEL Preference Properties to store the information (Preference Properties can be modified at runtime from EM Console)
- Store the information in Domain Value Map (DVM) and use functions to read the information from DVM
I created a DVM to store the information: Name of the Composite and Endpoint URI for the Composite. Teh DVM can be created within the Composite or deployed to MDS directly and referred from MDS. As to, how to deploy the DVM to MDS and referring from MDS, read this post.
Implementing the Dynamic Endpoint:
Creating Variables in BPEL:
- Create two variables in the BPEL flow namely, TargetEndpointLocation (String) and EndpointReference (of Type EndpointReference from WS-Addressing)
- When creating the variable EndpointReference, import the XSD ws_addressing.xsd and choose the element type EndpointReference to create the variable
- ws_addressing.xsd can be downloaded from here
- This way, one need not copy-paste any code, or insert any namespace in the BPEL Process and its corresponding WSDL
- After creating the variables, open the .bpel in source mode and look for the namespace http://schemas.xmlsoap.org/ws/2003/03/addressing. Change the namespace prefix to wsa so that the namespace looks like below:
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
- Use the dvm:lookupValue function to look up the endpoint URI from the DVM. In the code snippet below, I have the DVM in MDS and I am looking up a DVM by name Endpoints to get the endpoint URI
- Assign the URI to /wsa:EndpointReference/wsa:Address
- Assign the /wsa:EndpointReference/wsa:Address to Partner link in the invoke that follows this logic
- Insert the below code snippet just before the invoke node from the source view of the .bpel
Code Snippet:
<scope name="Scope_GetDynamicEndpoint">
<sequence>
<assign name="Assign_targetEndpointLocation">
<copy>
<from expression="dvm:lookupValue('oramds:/apps/Samples/Endpoints.dvm','ServiceName','SampleFlow','EndPoint','')"/>
<to variable="TargetEndpointLocation"/>
</copy>
</assign>
<assign name="AssignPartnerlinkEndpointReference">
<copy>
<from>
<wsa:EndpointReference xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
<wsa:Address/>
</wsa:EndpointReference>
</from>
<to variable="EndpointReference" query="/wsa:EndpointReference"/>
</copy>
<copy>
<from variable="TargetEndpointLocation"/>
<to variable="EndpointReference"
query="/wsa:EndpointReference/wsa:Address"/>
</copy>
<copy>
<from variable="EndpointReference"/>
<to partnerLink="SampleFlowTarget"/>
</copy>
</assign>
</sequence>
</scope>
inputVariable="Invoke_SampleFlowTarget_InputVariable"
......
Peace!
Cheers,
- AR
2 comments:
Thanks for the post. I would like to know what is the difference between using the end point from DVM and referencing wsdl end point from mds itself. I have never used the DVM, but used the wsdl reference from MDS and find that easier. But would like to know what would be the difference. Thanks.
Sonya Krishna
Post a Comment