The BPEL literal syntax can be used to define an endpoint address and assign it to a partner link. The following code sample shows a BPEL literal used to define an HTTP endpoint assigned to a partner link.
<bpws:assign name="Assign2"> <bpws:copy> <bpws:from> <bpws:literal> <sref:service-ref> <ns1:EndpointReference> <wsa:Address> http://localhost:8080/StockQuoteService /StockQuotePort </wsa:Address> <wsa:ServiceName PortName="stockQuotePort"> ns3:stockQuoteService> </wsa:ServiceName> </ns1:EndpointReference> </sref:service-ref> </bpws:literal> </bpws:from> bpws:to partnerLink="plStockQuote"/> </bpws:copy> </bpws:assign> |
In this scenario, you are invoking a partner link that is associated with a SOAP (HTTP) endpoint. That partner link, on the binding side of the application, acts as a proxy for BPEL to the external world.
In this example, we have an XML fragment that displays an Assign activity. The Assign has a copy and points to a literal address inline. When you invoke the service, you can assign a different address as a variable value in the invoke properties. In addition to assigning value to variable, you also assign a value to the partner link. Then, when the service is invoked, the HTTP Binding Component stops using the deployment address and instead uses the address that you just assigned.
The partnerLink "plStockQuote" could be subsequently used in an invoke.
Note that the WS-A defined schema object should be wrapped in an element called service-ref, that is defined in the BPEL. For more information about using the service-ref wrapper, refer to the BPEL Specification, section 6.3.