Basic activities (such as receive and invoke) do discrete tasks.
The assign activity copies sources to targets and was described in Chapter 8. As shown later, a from-spec describes a source; a to-spec describes a target.
<assign validate="yes|no"? standard-attributes> standard-elements <copy keepSrcElementName="yes|no"? ignoreMissingFromData="yes|no"?> from-spec to-spec </copy>+ </assign>
The from-spec is any of the next from elements.
<from variable="BPELVariableName" part="NCName"?> <query queryLanguage="anyURI"?>? queryContent </query> </from> | <from partnerLink="NCName" endpointReference="myRole|partnerRole" /> | <from variable="BPELVariableName" property="QName" /> | <from expressionLanguage="anyURI"?>expression</from> | <from><literal>literal value</literal></from><from
The to-spec is any of the next to elements.
<to variable="BPELVariableName" part="NCName"?> <query queryLanguage="anyURI"?>? queryContent </query> </to> | <to partnerLink="NCName" /> | <to variable="BPELVariableName" property="QName" /> | <to expressionLanguage="anyURI"?>expression</to>
Here's an example.
<assign name="DefaultQuoteAssignment"> <copy> <from variable="quoteRequest" part="placeQuoteParameters"> <query>/quoteInformation</query> </from> <to variable="highlightQuote" part="placeQuoteResult"> <query>/quote/customerInformation</query> </to> </copy> <copy> <from variable="mvRecord" property="licenseNumber"/> <to variable="vehicleLicense"/> </copy> <copy> <from><literal>false</literal></from> <to variable="highlightQuote" part="placeQuoteResult"> <query>/quote/quoteProvided</query> </to> </copy> <copy> <from>$input.msgPart/descendant::Make[.="Ford"]</from> <to variable="output"/> </copy> </assign>
A BPEL engine may extend the assign activity. For details, see your product documentation.
The compensate activity is available only in a fault handler, a compensation handler, or a termination handler. The activity invokes the compensation handler for each nested scope that completed successfully. We describe this activity in Chapter 7.
<compensate standard-attributes> standard-elements </compensate>
Here's an example.
<scope name="Primary"> <faultHandlers> <catch faultName="QuoteCancelled"> <compensate/> </catch> </faultHandlers> <eventHandlers> <onEvent> . . <scope> <if> <condition>$status="cancelled"</condition> <throw faultName="QuoteCancelled" /> </if> </scope> </onEvent> </eventHandlers> <sequence> <scope name="StoreQuote"> <compensationHandler> <!- remove the stored quote -> </compensationHandler> <sequence> <!- store the quote -> </sequence> </scope> <scope name="InformCustomer"> <compensationHandler> <!- withdraw the quote by email -> </compensationHandler> <sequence> <!- confirm the quote by email -> </sequence> </scope> </sequence> </scope>
The compensateScope activity is available only in a fault handler, a compensation handler, or a termination handler. The activity invokes the compensation handler for a specific scope. We describe this activity in Chapter 7.
<compensateScope target="NCName" standard-attributes> standard-elements </compensateScope>
Here's an example.
<scope name="Primary"> <faultHandlers> <catch faultName="QuoteProblem"> <compensateScope target="StoreQuote"/> </catch> </faultHandlers> <eventHandlers> <onEvent> . . <scope> <if> <condition>$status="problem"</condition> <throw faultName="QuoteProblem" /> </if> </scope> </onEvent> </eventHandlers> <scope name="StoreQuote"> <compensationHandler> <!- remove the stored quote -> </compensationHandler> <sequence> <!- store the quote -> </sequence> </scope> </scope>
The empty activity is used as a placeholder for other activities or as the source or target of links.
<empty standard-attributes> standard-elements </empty>
Here's an example.
<if> <condition>$numberOfDrivers > 5</condition> <empty> <sources> <source linkName="manyDrivers"/> </sources> </empty> </if>
The exit activity ends all processing immediately, without invoking a fault handler or termination handler and without responding in any way to partner services.
<exit standard-attributes> standard-elements </exit>
Here's an example.
<if> <condition>$numberOfDrivers > 10</condition> <exit/> </if>
The purpose of an extension activity is specific to a BPEL engine. If an extension activity is not recognized by a BPEL engine, the activity is treated as empty.
<extensionActivity> <anyElementQName standard-attributes> standard-elements </anyElementQName> </extensionActivity>
Here's an example of an activity that writes a message to a log.
<sequence> <extensionActivity> <writeToLog> <message>Received a new task</message> <variable>otherInfo</variable> <severity>2</severity> </writeToLog> </extensionActivity> </sequence>
The invoke activity invokes a service synchronously or asynchronously and can include fault handlers and a compensation handler. We describe this activity in Chapter 8.
The attribute inputVariable and element toParts refer to the data that the BPEL process sends to the partner service. The attribute outputVariable and element fromParts refer to the data returned in a synchronous invocation.
<invoke partnerLink="NCName" portType="QName"? operation="NCName" inputVariable="BPELVariableName"? outputVariable="BPELVariableName"? standard-attributes> standard-elements <correlations>? <correlation set="NCName" initiate="yes|join|no"? pattern="request|response|request-response"? />+ </correlations> <catch faultName="QName"? faultVariable="BPELVariableName"? faultMessageType="QName"? faultElement="QName"?>* activity </catch> <catchAll>? activity </catchAll> <compensationHandler>? activity </compensationHandler> <toParts>? <toPart part="NCName" fromVariable="BPELVariableName" />+ </toParts> <fromParts>? <fromPart part="NCName" toVariable="BPELVariableName" />+ </fromParts> </invoke>
Here's an example.
<invoke name="RecalculateQuote" partnerLink="QuoteManagementPL" portType="QuoteManagementPT" operation="buildQuote" inputVariable="customerQuoteInfo"/>
The receive activity waits for a message that matches the detail in the related WSDL operation. We describe this activity in Chapter 8.
<receive partnerLink="NCName" portType="QName"? operation="NCName" variable="BPELVariableName"? createInstance="yes|no"? messageExchange="NCName"? standard-attributes> standard-elements <correlations>? <correlation set="NCName" initiate="yes|join|no"? />+ </correlations> <fromParts>? <fromPart part="NCName" toVariable="BPELVariableName" />+ </fromParts> </receive>
Here's an example.
<receive name="UnderwritingApprovalResponse" partnerLink="UnderwriterPL" portType="UnderwriterPT" operation="policyEvaluation" variable="underwriterResponse"> </receive>
The reply activity responds to a message received by one of the following kinds of inbound message activities (IMAs):
receive activity
onMessage handler (within the pick activity)
onEvent handler
We describe this activity in Chapter 8.
<reply partnerLink="NCName" portType="QName"? operation="NCName" variable="BPELVariableName"? faultName="QName"? messageExchange="NCName"? standard-attributes> standard-elements <correlations>? <correlation set="NCName" initiate="yes|join|no"? />+ </correlations> <toParts>? <toPart part="NCName" fromVariable="BPELVariableName" />+ </toParts> </reply>
Here's an example.
<reply name="StatusReply" partnerLink="ProcessPolicy" portType="NewPolicySystem" operation="status" variable="statusResponse" />
The rethrow activity is available only in a fault handler. The activity forwards a fault to the parent scope. If any data was provided in the original fault, the same (unchanged) data is forwarded, too. We describe this activity in Chapter 7.
<rethrow standard-attributes> standard-elements </rethrow>
Here's an example.
<faultHandlers> <catchAll> <compensate /> <rethrow name="invalid" /> </catchAll> </faultHandlers>
The throw activity throws a fault to the parent scope, with or without data. The purpose is to identify a business error. We describe this activity in Chapter 7.
<throw faultName="QName" faultVariable="BPELVariableName"? standard-attributes> standard-elements </throw>
Here's an example.
<eventHandlers> <onEvent messageType="abandonRequestMsg" partnerLink="ProcessPolicyPL" portType="ProcessPolicyPT" operation="abandon" variable="abandonVar"> <throw faultName=" cancelPurchase" name="CancelPurchase" /> </onEvent> </eventHandlers>
The validate activity verifies that the data contained in one or more variables is consistent with the data types used to declare those variables. A data type may be expressed as an XML Schema simple type, complex type, or element; or as a WSDL message definition.
<validate variables="BPELVariableNames" standard-attributes> standard-elements </validate>
Here's an example.
<validate variables="applicantInfo spouseInfo"/>
The wait activity causes a delay for a specified period or until a specified date and time. We describe this activity in Chapter 8.
<wait standard-attributes> standard-elements ( <for expressionLanguage="anyURI"?>duration-expr</for> | <until expressionLanguage="anyURI"?>deadline-expr</until> ) </wait>
Here's an example.
<sequence> <!- wait until 6:00 PM Pacific Standard Time on 25 December 2010 -> <wait> <until>'2010-12-25T18:00-08:00'</until> </wait> <invoke ... /> </sequence> <sequence> <!- wait for 1 year, 2 months, and 1 hour -> <wait> <for>'P1Y2MT1H'</for> </wait> <invoke ... /> </sequence>