invoke Activity


The invoke activity invokes a service synchronously or asynchronously.

 <invoke partnerLink="agent" portType="policyPT"         operation="requestQuote"         inputVariable="quoteRequest"         outputVariable="requestInfo"> </invoke> 

In relation to this activity, the word "input" and the elements inputVariable and toParts refer to the data that the BPEL process sends to the partner service.

Among the attributes of the invoke activity:

  • partnerLink identifies the partner link used to connect to the service.

  • portType identifies the port type but is optional because the port type is implied by the partner link and by the role identifier partnerRole in that partner link. Many developers repeat the port type in the invoke activity because they are familiar with the port-type name, and the repetition adds clarity at design time. However, the repetition creates a small dependency: if the partner link type (in the WSDL) changes to refer to a port type that has a different name, the BPEL process is no longer valid.

  • operation identifies the service operation to invoke.

  • inputVariable identifies a variable that contains the business data being sent to the service. Specify this attribute only if you don't specify the toParts element.

  • outputVariable identifies a variable that receives the business data being returned from the service. Specify this attribute for synchronous processing, but only if you don't specify the fromParts element.

Among the elements in the invoke activity:

  • correlations references one or more correlation sets.

  • toParts identifies a set of message parts and related variables for data sent to the partner service. Specify this element only if you don't specify the inputVariable attribute.

  • fromParts identifies a set of message parts and related variables for data returned to the BPEL process. Specify this element for synchronous processing, but only if you don't specify the outputVariable attribute.

A special form of the invoke activity embeds fault handlers, a compensation handler, or both. This form provides a shortcut to those who are working directly with the XML. Listing 8.10 shows an example.

Listing 8.10: Sample invoke activity with embedded compensation handler

image from book
 <invoke name="AgentQuoteRequest"         partnerLink="agent"         portType="policyPT"         operation="requestQuote"         inputVariable="quoteRequest"         outputVariable="requestInfo">    <compensationHandler>       <invoke partnerLink="agent"               portType="policyPT"               operation="cancelQuoteRequest"               inputVariable="requestInfo"               outputVariable="confirmationInfo" />    </compensationHandler> </invoke> 
image from book

Listing 8.11 shows an example of the equivalent statements when the scope is declared explicitly.

Listing 8.11: Sample invoke activity with an explicitly declared scope

image from book
 <scope name="AgentQuoteRequest">    <compensationHandler>       <invoke partnerLink="agent"               portType="policyPT"               operation="cancelQuoteRequest"               inputVariable="requestInfo"               outputVariable="confirmationInfo" />    </compensationHandler>    <invoke name="AgentQuoteRequest"            partnerLink="agent"            portType="policyPT"            operation="requestQuote"            inputVariable="quoteRequest"            outputVariable="requestInfo">    </invoke> </scope 
image from book

If the special form of the invoke activity has a name, the BPEL engine accepts that name as the name of an implicit scope, and a compensateScope activity in the immediately higher-level scope can reference the name.




SOA for the Business Developer. Concepts, BPEL, and SCA
SOA for the Business Developer: Concepts, BPEL, and SCA (Business Developers series)
ISBN: 1583470654
EAN: 2147483647
Year: 2004
Pages: 157
Authors: Ben Margolis

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net