Title: Business Process Execution Language for Web Services (BPEL4WS)
1Business Process Execution Language for Web
Services (BPEL4WS)
2BPEL vs. WSDL
- WSDL supports a stateless model which describes
operations supported by web servers - One or two messages needed for client/server
communication - No mechanism for describing state between
operations - A business process (BP) typically characterized
by long-running, statefull sequence of operations
with one or more web services (business partners).
3Simple Example Ordering Stationery
- cobegin
- invoke Staples.StationeryQuote(staples-quot
e) - invoke Office-Max.StationeryQuote
Service(max-quote) - coend
- if staples-quote lt max-quote
- invoke Staples.StationeryPurchase
- else
- invoke Office-Max.StationeryPurchase
-
state
4New Issues
- Must be able to communicate with other Web
Services - Must be able to access and modify data received
in messages - Use XPath to extract information from messages
- Must have control constructs
- sequence, switch (if), flow (concurrency), while,
link (synchronize concurrent processes), invoke,
etc - Must be able to handle faults
5Example (BPEL)
- ltsequencegt
- ltflowgt
- ltinvoke partnerLinkStaples
interfacestaplesPurchasePt - operationrequestQuote
inputVariablestationeryReq - outputVariablestaplesStati
oneryQuotegt - lt/invokegt
- ltinvoke partnerLinkOfficeMax
interfaceofficeMQuotePT - operationrequestQuote
inputVariablestationeryReq - outputvariableofficeMStati
oneryQuotegt - lt/invokegt
- lt/flowgt
-
- .. Continued
on next slide ..
6Example (BPEL)
- ltswitchgt
- ltcase conditionbpwsgetVariableProperty(sta
plesStationeryQuote, quote) - lt
bpwsgetVariableProperty(officeMStationeryQuote,
quote) /gt - ltinvoke partnerLinkStaples
interfacestaplesQuotePt - operationpurchStation
ery inputVariablestationeryPurch - outputVariablestation
eryRespgt - lt/invokegt
- lt/case
- ltotherwisegt
- ltinvoke partnerLinkOffice Max
interfaceofficeMQuotePT - operationpurchStation
ery inputVariablestationeryPurch - outputVariablestation
eryRespgt - lt/invokegt
- lt/otherwisegt
- lt/switchgt
- lt/sequencegt
7Business Process (BP)
- A BP consists of both internal computations and
invocations of operations exported by web service
partners - The operations it exports constitute its
interface to its partners - The sequence of invocations it executes is
referred to as a protocol and - is data dependent
- responds to exceptional conditions
8Abstract Vs. Executable BPs
- Executable BP complete description of BP
(including all computations) - Abstract BP contains only externally visible
(communication related) behavior of BP - Not executable
- Internal decision making algorithm and data
manipulation not described - Languages for describing abstract and executable
BPs share a common core, but differ primarily in
data handling capabilities - BPEL4WS is used to specify both abstract and
executable BPs
9Executable BPs
- BPEL is sufficient for describing a complete
(executable) BP that - Relies on web services and XML data
- Is portable (platform independent)
- Executable BP is a complete specification of the
Web Service - Actual implementation, however, might not use
BPEL, - Abstract BP specifies external interface and can
be exported for use by business partners
10Abstract BP
- Unfolding of protocol related portion of BP
- depends on properties - a subset of the data
contained in messages - Ex. Message invoking getQuoteRequest might have
parts instrumentType (with value stock or bond)
and symbol (which identifies a particular
instrument of that type) - instrumentType will be a property if it affects
the course of the protocol - symbol will not if it does not affect the course
of the protocol - Only properties are visible to abstract BP
11Abstract Vs Executable BP
- Internal computation of executable BP not
included in abstract BP - If assignment is to a variable that is not a
property, it is eliminated from abstract process - Ex. Address data might not affect the protocol
- If assignment is to a variable that is a
property, it (generally) affects the protocol - Ex. Value of bidPrice might affect protocol
- if (bidPricegt1000) invoke webService1 else invoke
webService2 - bidPrice will be a property, but its value is
computed by an internal algorithm - The computation that produces the new value is
generally not relevant to the protocol
12Abstract BP Non-determinism
- Description of abstract BP allows assignment of
non-deterministic values to properties to model
this - Abstract and executable BPs differ in data
handling ability - Executable can explicitly manipulate all data
- Abstract can access only properties in limited
ways and can assign non-deterministic values to
them - Executable cannot assign non-deterministic values
to anything
13Abstract BP Non-determinism
computation that assigns a value to part x
non-deterministic assignment to property
x? (alias of x)
switch(x)
switch(x? )
Abstract BP
Executable BP
14Communication Client Side
- Invoking an operation of an interface (specified
in WSDL) exported by server - Client assigns message to operations input
variable - Client executes invoke on operation
- Asynchronous (in-only WSDL pattern)
- Client resumes execution immediately
- Synchronous (in-out WSDL pattern)
- Client waits for response and then resumes
execution - Client can access response message in operations
output variable
15Communication Client Side
- Receiving an operation (e.g., an asynchronous
response to a prior invocation) on a (callback)
operation exported by client - Client executes receive on operation
- Client waits for message
- Client can access message in variable associated
with operation and resume execution
16Communication Client Side
client
server invoke invoke invoke receive
client waits
(synchronous invoke)
server exports interface
(asynchronous invoke)
client continues
problem how do you associate request
with response?
client exports (callback) operation
17Communication Server Side
- Accepting an operation invocation on an
(exported) interface (specified in WSDL) - Server executes receive on operation and waits
- Responding to a synchronous operation invocation
- Server executes reply on operation (rpc)
- Invoking a clients exported (callback) operation
- Server executes invoke on operation
18Communication Server Side
client
server invoke
receive
(synchronous invoke)
reply
receive
server exports interface
invoke
(asynchronous invoke)
receive
invoke
receive
invoke
client exports (callback) interface
19Example Purchase Order (PO) Service
receive purchase order
concurrency
sequencing
initiate price calculation
decide on shipper
initiate production scheduling
complete price calculation
arrange logistics
complete production scheduling
synchronization
invoice processing, reply
20PO Service
PO Service
receive
synchronous invocation
POMsg
Body of PO Service
customer
operation sendPurchOr on interface purchOrIf
InvMsg
reply
21PO Service Interface (WSDL)
ltdefinitions targetNamespace.
xmlnshttp//schemas.smlsoap.org/wsdl/ gt
ltmessage namePOMsggt ltpart namecustInfo
typesnscustInfo/gt ltpart namepurchOr
typesnspurchOr/gt lt/messagegt ltmessage
nameInvMsggt ltpart nameIVC
typesnsInvoice/gt lt/messagegt .. ltinterface
namepurchOrIfgt ltoperation
namesendPurchOrgt ltinput
messageposPOMsg/gt -- arguments supplied
ltouput messageposInvMsg/gt -- response
lt/operationgt lt/interfacegt ..
interface exported by PO Service
prefix for target namespace in this document
lt/definitionsgt
22Variables (BPEL)
- Variables maintain the state of a BP
- Used to store messages that have been sent or
received or for local storage (no message
involved) - Has an associated type
- Can be a message type
- Can be an XML simple type
- Can be an XML schema element (which might have a
complex type) - Has an associated scope
ltvariable namePO messageTypelnsPOMsg/gt
lns is prefix in BPEL document for the WSDL
document
23Partner Link Type (WSDL)
ltpartnerLinkTypegt describes the way two BPs
interact - names an interface that must
be declared in each - associates ltrolegt
with each end of the interaction
Not a process (allows actual partner to be
specified dynamically)
Identifies a BPEL schema
ltplnkpartnerLinkType namepurchLTgt
ltplnkrole namepurchServicegt
ltplnkinterface namepospurchOrIf/gt
lt/plnkrolegt lt/plnkpartnerLinkTypegt
Unit of collaboration
Only one role since only POService needs to
provide an interface
24Partner Link Type (WSDL)
ltplnkpartnerLinkType nameinvoicingLTgt
ltplnkrole nameinvoiceServicegt
ltplnkinterface nameposcomputePriceIf/gt
lt/plnkrolegt ltplnkrole nameinvoiceRequester
gt ltplnkinterface nameposinvoiceCallbackI
f/gt lt/plnkpartnerLinkTypegt
description of a possible relationship between
two BPs
BP playing role of invoice requester
BP playing role of invoice service
invoiceCallbackIf
computePriceIf
25Partner Link (BPEL)
Connection to another BP described by a
partner link ltpartnerLinkgt construct in BPEL
names a process and associates it with a
role in that link.
partner specification in PO service
name of partnerLink
prefix lns refers to WSDL document
ltpartnerLinksgt ltpartnerLink namepurchLink
partnerLinkTypelnspurchLT
myRolepurchService/gt lt!-- other
partnerLinks go here --gt lt/partnerLinksgt
hence PO service must provide purchOrIf
26Partner (BPEL)
- A BP might interact with another BP called a
partner - through several partnerLinks - Need a mechanism that asserts that the same BP is
at the other end of a set of partnerLinks - Ex BPs might support getFareIf and
purchaseTicketIf an acceptable partner is one
that supports both
ltpartnersgt ltpartner nameticketVendorgt
ltpartnerLink namexxxx/gt lt!-- supports
getFareIf --gt ltpartnerLink nameyyyy/gt
lt!-- supports purchaseTicketIf --gt
lt/partnergt lt/partnersgt
27Process Name
- Each BP is assigned a name in the ltprocessgt tag
ltprocess namecustomer
namespace declarations query
language (default XPath)
expression language (default XPath) gt
declarations and process body lt/processgt ltproce
ss namepurchOrProcess
similarly gt declarations and body of
PO service lt/processgt
28Linkage Customerto PO Service
plnk prefix in WSDL doc refers to
WSDL extension pos target ns of WSDL doc lns
prefix in PO Service refers to WSDL
doc cns prefix in customer refers to
WSDL doc
ltplnkpartnerLinkType namepurchLTgt
ltplnkrole namepurchServicegt
ltplnkinterface namepospurchOrIf/gt
lt/plnkrolegt lt/plnkpartnerLinkTypegt ltpartnerLink
namelinkToPurch
partnerLinkTypecnspurchLT
partnerRolepurchService/gt ltpartnerLink
namepurchLink partnerLinkTypeln
spurchLT myRolepurchService/gt
WSDL inter- face exported by PO Service
partner specification in customer process
partner specification in PO Service
29Partners
In general - A partnerLinktype is not
specific to a particular BP it is a
global, bilateral (WSDL) description of the
interaction between two BPs. - A
partnerLink declaration (BPEL) describes how the
local BP interacts with other BPs
through a
partnerLinktype.
ltpartnerLinksgt ltpartnerLink nameinvoiceProvid
er partnerLinkTypelnsinvoice
LT myRoleinvoiceRequester
partnerRoleinvoiceServices/gt lt/
partnerLinksgt
30PO Service (BPEL)
ltvariablesgt ltvariable namePO
messageTypelnsPOMsg/gt ltvariable
nameInvoice messageTypelnsInvMsg/gt lt/variab
lesgt ltsequencegt ltreceive partnerLinkpurchLi
nk interfacelnspurchOrIf
operationsendPurchOr variablePO/gt
lt/receivegt ltflowgt . concurrent body.
lt/flowgt ltreply partnerLinkpurchLink
interfacelnspurchOrIf
operationsendPurchOr variableInvoice/gt lt/se
quencegt
Both necessary since PO Service might
communicate with several BPs
through the same interface
31Interaction with Shipping Provider
operation requestShipping on interface shippingIf
decide on shipper (invoke)
shipReqMsg
shippingProvider
shipInfoMsg
scheduleMsg
arrange logisitics (receive)
role shippingService
operation sendSchedule on port shippingCallbackIf
role shippingRequester
32Handling Shipping (WSDL)
ltinterface nameshippingCallbackIfgt
ltoperation namesendSchedulegt ltinput
message/gt lt/operationgt lt/interfacegt ltinter
face nameshippingIfgt ltoperation
namerequestShippinggt ltinput
message/gt ltoutput message/gt
lt/operationgt lt/interfacegt
interface exported by PO Service
interface imported from shipping service
33Handling Shipping
ltplnkpartnerLinkType nameshippingLTgt
ltplnkrole nameshippingServicegt
ltplnkinterface nameposshippingIf/gt
lt/plnkrolegt ltplnkrole nameshippingRequester
gt ltplnkinterface nameposshippingCallBac
kIf/gt lt/plnkrolegt lt/plnkpartnerLinkTypegt ltpa
rtnerLink nameshippingProvider
partnerLinkTypelnsshippingLT
myRoleshippingRequester
partnerRoleshippingService/gt
WSDL
BPEL
34Handling Shipping (BPEL)
contains input message
ltsequencegt ltassigngt ltcopygt
ltfrom variablePO partcustInfo /gt
ltto variableshippingReq
partcustInfo /gt lt/copygt
lt/assigngt ltinvoke partnerLinkshippingProv
ider interfacelnsshippingIf
operationrequestShipping
inputVariableshippingReq
outputVariableshippingInfo gt lt/invokegt
ltreceive
partnerLinkshippingProvider
interfacelnsshippingCallbackPT
operationsendSchedule variableshippingSc
hedule/gt lt/sequencegt
35Links (BPEL) Synchronizing Concurrent Activities
w/I a BP
- Production scheduling cannot be completed until
logistics have been arranged
Concurrent sequence activities in flow
data produced by arrange logistics is needed
by complete production scheduling data
communicated through globally shared variable
decide on shipper
initiate production scheduling
arrange logistics
complete production scheduling
link
source
target
36Links
ltflowgt ltlinksgt ltlink nameship-sched/gt
lt/linksgt ltsequencegt
ltassigngt . lt/assigngt ltinvoke
partnerLink .gt lt/invokegt
ltreceive partnerLink .
variableshippingSchedgt ltsource
linkNameship-sched/gt lt/receivegt
lt/sequencegt ltsequencegt ltinvoke
partnerLink.gt lt/invokegt ltinvoke
partnerLink. inputVariableshippi
ngSchedgt lttarget linkNameship-sched
/gt lt/invokegt lt/sequencegt . lt/flowgt
decide on shipper
shipping
arrange logistics
complete production scheduling
scheduling
37Properties (WSDL)
- Some message data is protocol-relevant.
- Used in conditional behavior of BP
- Used to relate messages sent to a particular
instance of a BP - A property declares a global name that can be
assigned to data items that may be parts of
several different message types and carry the
same meaning - taxpayerID might be a part of one message type in
one namespace (e.g., Internal Revenue), ssn might
be a part of another in a different namespace
(e.g., Social Sec. Admin) - Both might represent the same information of type
txtypSSN
ltbpwsproperty namecustomerID
typetxtypSSN/gt
38Property Alias (WSDL)
- Used to associate a property name with a field in
message part - A particular property can be associated with
different fields in different messages
ltbpwsproperty namecustomerID
typetxtypSSN/gt ltbpwspropertyAlias
propertyNamecustomerID
messageTypetxmsgtaxpayerInfo
parttaxpayerID
query/socialSecNum /gt lt/bpwspropertyAliasgt
query string specified in XPath - to locate the
field in the part
39Correlation Sets (BPEL)
- A web service might be configured with multiple
instances of a BP to concurrently handle
(stateful) conversations with multiple clients. - All receive requests over the same port
- With SOAP over HTTP, messages arrive on port 80
- A mechanism is needed to
- Route an arriving message that is part of a
particular conversation to the correct BP
instance - Messages of a particular conversation can be
recognized by the fact that they will generally
all carry some identifying value(s) (e.g.,
customerID and orderNum)
40Correlation Sets
- A correlation set is a set of properties whose
value is shared by all messages in a particular
conversation. - Hence, an address is really
(host address, port, correlation
set) - A correlation set identifies the BP instance
ltcorrelationSet namePurchaseOrder
propertiescorcustomerID
cororderNum/gt
aliased to items of information contained in
the messages of a conversation
41Using Correlation Sets
- A particular receive operation can be used in a
BP to accept the start of a new conversation - All subsequently arriving messages with same
value of PurchaseOrder will be directed to this BP
asynchronous purchase requst
ltreceive partnerLink Buyer
interfaceSPPurchasingIf
operationasynchPurchase
variablePOgt ltcorrelationsgt
ltcorrelation setPurchaseOrder
initiateyes/gt lt/correlationsgt lt/receivegt
create a new correlation set value for BP
instance
42Using Correlation Sets
- Response returns the correlation set value
- Asynchronous (callback) response to previous
invocation - A reply to a synchronous invocation would be
similar
ltinvoke partnerLink Buyer
interfaceSPBuyerIf
operationasynchPurchaseResp
variablePOgt ltcorrelationsgt
ltcorrelation setPurchaseOrder
initiateno/gt lt/correlationsgt lt/invokegt
use the set to address the message
43Multiple Correlation Sets
messages of a single conversation
buyer
server invoke(corrSetPO inityes)
receive(corrSetPO inityes) receive(c
orrSetPO initno
invoke(corrSetPO initno
corrSetinv inityes)
corrSetinv inityes)
subsequent messages sent and received
use
correlation set inv
messsage contains both correlation sets
44Multiple Correlation Sets
- With synchronous invocation two messages are
involved the pattern attribute associates a
correlation set with a message.
invoke (partnerLinkBuyer interfaceSPBuyerIf
operationsynchPurchaseResp
inputVariablePO
outputVariableinvoicegt ltcorrelationsgt
ltcorrelation setPurchaseOrder
initiateyes
patternout/gt (initiated in outbound msg)
ltcorrelation setInvoiceResp
initiateyes
patternin/gt (initiated in inbound msg,
which contains both sets)
lt/correlationsgt lt/invokegt
45Data Manipulation
- Data (state) stored in variables (used for
messages and local storage) - Expressions use expression language (XPath
default) to access data in variables - Executable processes can use
- All processes can use
- Returns the part (or, if the locationPath is
specified the field within the part) in the named
variable. - If a single node is not specified, a fault is
returned.
bpwsgetVariableData (variableName, partName,
locationPath?)
query string
bpwsgetVariableProperty(variableName,
propertyName)
property alias contains query string
46Assignment
- Allows copying of data
- One form (for executable processes)
- query is an absolute expression (if XPath is the
query language) that identifies a single node w/i
the document fragment specified by part - from child can also contain a literal value or a
simple arithmetic expression (for data
transformation)
ltassigngt ltcopygt ltfrom variablev1
partp1 queryq1/gt ltto variablev2
partp2 queryq2/gt lt/copygt lt/assigngt
47Assignment in Abstract Process
- A non-deterministic value from a propertys
domain can be assigned to the property by an
abstract process using opaque assignment - Allows simulation of execution traces
ltassigngt ltcopygt ltfrom opaqueyes/gt
ltto variablev2 propertyp2/gt
lt/copygt lt/assigngt
48Invoking Web Service Operations
- invoke might have child elements related to
faults and compensation (discussed
subsequently), and links and correlation
(discussed previously) - invoke specifies a partnerLink since an interface
can be associated with several partnerLinkTypes
connected to different BPs
ltinvoke partnerLinkshippingProvider
interfacelnsshippingIf
operationrequestShipping
inputVariableshippingRequest
ouputVariableshippingInfogt lt/invokegt
49Invoking Web Service Operations
- invoke can be
- Synchronous
- input and output variables specified
- waits for a response
- Asynchronous
- no output variable specified
- no waiting
ltinvoke partnerLinkinvoiceProvider
interfacelnscomputePriceIf
operationinitiatePriceCalc
inputVariablePOgt lt/invokegt
50Synchronous Vs. Asynchronous Invocation
- Web service communication characterized by
- Services are not always available.
- Loads tend to be unpredictable.
- Attempts to handle too many requests in real time
can lead to thrashing and failure. - Many requests cant be handled instantly even
with low loads. - Asynchronous invocation will play an increasingly
important role.
51Providing Web Service Operations
- receive waits for an invocation to arrive
- specifies a partnerLink since an interface can be
associated with several partnerLinkTypes
connected to different BPs
ltreceive partnerLinkcustomer
interfacelnspurchOrIf
operationsendPurchOr variablePOmsg/gt
lt/receivegt
52Providing Web Service Operations
- Initiating a new instance of a BP
- createInstanceyes gt a new instance of the BP
is created and this is its initial activity. - The receive should be the first activity in the
BP (since prior activities will not be executed
within the new instance) - If the message is the start of a conversation
then a correlation child element should be
specified
ltreceive partnerLinkcustomer
interfacelnspurchOrIf
operationsendPurchOr variablePOmsg
createInstanceyes/gt lt/receivegt
ltcorrelation setPurchaseOrder
initiationyes/gt
53Providing Web Service Operations
- reply is used to respond to a synchronous
invocation. - connection between receive and reply based on
constraint that not more than one synchronous
request from a particular (partnerLink,
interface, operation) can be outstanding at a
time - Response to an asynchronous invocation is made
using an invoke on a callback operation - partnerLink between requestor and requestee must
have two roles
ltreply partnerLinkcustomer interfacelnspurch
OrIf operationsendPurchOr
variableInvoice/gt
54Other Basic Activities
- ltterminategt
- ltwait untildeadlinegt
- or
- ltwait fordurationgt
- ltemptygt
55Structured Activities
- ltsequencegt
- lt!-- list of activities --gt
- lt/sequencegt
- ltswitchgt
- ltcase conditionbool-exprgt
- lt!-- activity --gt
- lt/casegt
- ltotherwisegt
- lt!-- activity --gt
- lt/otherwisegt
- lt/switchgt
Involves only properties if process is abstract
at least one case element conditions evaluated
in order
if present, executed if all conditions fail, else
an empty otherwise is assumed
56Structured Activities
- ltwhile conditionbool-expgt
- lt!-- iteratively executed activity --gt
- lt/whilegt
- ltpickgt -- waits for the
occurrence of first event - ltonMessage partnerLink..
interface.. - operation..
variable..gt - lt!-- activity to process
message --gt - lt/onMessagegt
- ltonAlarm fordurationExp
untildeadlineExpgt - lt!-- timeout activity
--gt - lt/onAlarmgt
- lt/pickgt
at least one, acts like receive
zero or more
57Structured Activities
- ltflowgt concurrently executes nested (child)
activities - Terminates when all children terminate
ltsequencegt ltflowgt ltinvoke
partnerLink /gt ltinvoke partnerLink
/gt lt/flowgt ltinvoke partnerLink../gt
lt/sequencegt
58WSDL Review
- WHAT interface describes abstract functionality
(operations, messages) - HOW binding describes how elements of an
interface (operations, messages) are mapped to a
particular transport protocol (e.g., SOAP over
HTTP, data encoding) - WHERE endpoint maps a binding to an address
(particular server at a URL) - service is a collection of related endpoints
59Endpoint References
- A BP is statically dependent on the interfaces
with which it communicates - However, the endpoints associated with those
interfaces (and hence the identity of the BP
instances with which it communicates) can change
dynamically - Endpoints can be sent in messages
- A BP can dynamically select a provider
- Example client can send a callback interface to
which server can send response
60Endpoint References
- A message part of EndpointReferenceType can hold
addressing information - Every role in a partnerLink has an associated
EndpointReference (of that type) that identifies
an endpoint (address) and an associated process
instance - An EndpointReference element is an alternative to
a service element
61WS-Addressing Specification for Endpoint Reference
ltwsaEndpointReference namespace declarations
gt ltwsaAddressgt a URI lt/wsaAddressgt
-- required ltwsaReferenceProper
tiesgt properties (child elements)
are inserted here . lt/wsaReferenceProperti
esgt ltwsaInterfacegt lt/wsaInterfacegt
ltwsaServiceNamegt lt/wsaServiceNamegt
ltwsaPolicygt lt/wsaPolicygt lt/wsaEndpointReferen
cegt
wsa identifies WSDL extension namespace for
endpoint references Information to identify a
particular instance of a BP can also be
supplied
62Endpoint Reference
- Properties mapped literally to SOAP headers
- MessageId
- Action action to be taken by destination
- ReplyTo
- Interface identifies the associated interface
- ServiceName identifies the associated service
63Endpoint Reference Example
ltmessage namebuyerDatagt . ltpart
nameserviceReference typewsaEndpointRefer
enceType/gt ltpart . /gt lt/messagegt ltinterface
namebuyerIfgt ltoperation namesubmitgt
ltinput messagetnsbuyerData/gt
lt/operationgt lt/interfacegt ltinterface
namebuyerCallbackIfgt ltoperation nameanswer
. lt/interfacegt ltplnkpartnerLinkType
namebuyerStoreLTgt ltplnkrole namestoregt
ltplnkinterface nametnsbuyerIf/gt
lt/plnkrolegt ltplnkrole namebuyer/gt
ltplnkinterface namebuyerCallbackIf/gt
lt/plnkrolegt lt/plnkpartnerLinkTypegt
64Endpoint Reference Example
ltpartnerLink namebuyer
partnerLinkTypeasbuyerStoreLT
myRolestore partnerRolebuyer/gt ltvariable
namebuyerData messageTypeasbuyerData/gt
ltsequencegt ltreceive nameacceptFromBuyer
partnerLinkbuyer
interfaceasbuyerIf operationsubmit
variablebuyerData/gt .. ltassigngt
ltcopygt ltfrom variablebuyerData
partendpointReference/gt ltto
partnerLinkbuyer/gt lt/copygt
lt/assigngt ltinvoke namerespondToBuyer
partnerLinkbuyer
interfaceasbuyerCallbackIf
operationanswer
inputVariable /gt lt/sequencegt
65Assignment and Endpoint References
- Sending an address from child can have the form
- A BP might want to send its own address (e.g.,
for a callback) or its partners address - Receiving an address to child must be associated
with partnerRole (cant change your own address)
ltfrom partnerLink
endpointReferencemyRolepartnerRole /gt
ltto partnerLink /gt
66Links Synchronizing Flow Activities
ltflowgt ltlinksgt ltlink nameXtoY /gt
ltlink nameCtoD/gt lt/linksgt
ltsequence nameXgt ltsource
linkNameXtoY/gt ltinvoke nameA/gt
lt/sequencegt ltsequence nameYgt lttarget
linkNameXtoY/gt ltreceive nameCgt
ltsource linkNameCtoD/gt
lt/receivegt lt/sequencegt ltinvoke
nameDgt lttarget linkNameCtoD/gt
lt/invokegt lt/flowgt
- any activity can have a source
- or target child element
- every link must have exactly
- one activity w/i the flow as
- its source and one as its target
- sequence Y cant start until
- sequence X completes
- source and target need not be
- nested at same level (CtoD)
- link must not cross a while
- boundary
- - links must not create a loop
67Link Semantics at the Source
- Each source child of an activity has an
implicit or explicit transitionCondition whose
value is - - Implicit true when activity terminates
- - Explicit the value of the
transitionCondition when the activity terminates - ltsource linkNameAtoB
- transitionConditiongetVariablePrope
rty(eval, risk) low /gt - - The transitionCondition determines the
link status (positive or negative) when the
activity terminates -
variable name
property name
68Link Semantics at the Target
- Without considering links, an activity is
ready to execute in accordance with normal
flow-of-control rules (sequence, switch, etc.) - In addition, an activity might be the target
of several links. - - Every such activity has a joinCondition
which can be - evaluated when the status of all
incoming links has been - determined. Execution starts when the
activity is ready and its - joinCondition is true.
- Default joinCondition status of at least one
incoming link is true -
ltsequence nameX gt lttarget
linkNameAtoX/gt lttarget linkNameBtoX/gt
. lt/sequencegt
69Link Semantics at the Target
- joinCondition can be explicitly provided as
an attribute using getLinkStatus() function.
ltsequence nameX joinConditionbpwsgetLi
nkStatus(AtoX) AND bpwsgetLinkStatus(BtoX)gt
lttarget linkNameAtoX/gt lttarget
linkNameBtoX/gt . lt/sequencegt
must specify an incoming link for activity X
70Link Semantics at the Target
- If the joinCondition evaluates to false a
joinFailure fault is thrown, else the activity is
started - If an activity, X, will not be executed (e.g. a
case in a switch, an activity that does not
complete due to a fault) then the status of all
outgoing links from X is set to negative.
71Link Semantics
ltflowgt
ltlink nameAtoC/gt
ltlink nameBtoC/gt ltseque
ncegt ltswitchgt
ltsequence nameCgt ltcase
conditionC1gt
lttarget nameAtoC/gt ltsequence
nameAgt
lttarget nameBtoC/gt ltsource
linkNameAtoC/gt
. lt/sequencegt lt/casegt ltcase
conditionC2gt ltsequence nameBgt
ltsource linkNameBtoC/gt .
lt/sequencegt lt/casegt lt/switchgt .
lt/flowgt
- only one case is executed
- joinCondition at C cannot
- be evaluated until status of
- both links are determined
- if C1 is chosen for execution
- the status of BtoC is set to
- negative (if that were not
- done C would never start)
- default joinCondition at C is
- true when either C1 or C2
- completes - since their (default)
- transitionCondition is true
72Link Semantics
- Problem in some cases a false joinCondition is
not a fault it is an indication that the
activity should not be performed in at a
particular point in the execution - In that case the status of all outgoing links
should be set to false so that the joinCondition
of other activities can be evaluated - Solution use activity attribute
suppressJoinFailure
73Link Semantics
- If value of the suppressJoinFailure attribute of
an activity, A, is yes, then if the joinCondition
of A or any nested activity has value false when
it is ready to execute - status of all of its outgoing links is set to
negative - it is skipped and execution continues (as if it
had terminated without raising a fault) - referred to as dead-path-elimination
74Link Semantics
ltflow
suppressJoinFailureyesgt
ltlink nameAtoC/gt ltsequencegt ltswitchgt
ltsequence nameCgt ltcase
conditionC1gt
lttarget nameAtoC/gt ltsequence
nameAgt
ltsource linkNameAtoC/gt
. lt/sequencegt lt/casegt
ltcase conditionC2gt ltsequence
nameBgt . lt/sequencegt
lt/casegt lt/switchgt .
lt/flowgt
- C is executed if C1 is chosen
- if C1 is not chosen
- the status of AtoC is set to
- negative and a joinFailure
- would occur
- suppressing joinFailure allows
- C to be silently skipped
75Scope
- Nested scoping is provided through the scope
activity in the conventional way. - Variables, fault and compensation handlers, and
correlation sets can be declared. - Properties are global since they are mapped to
data in messages.
76Faults
- Fault has a unique name and an (optional) fault
variable describing the event - Sources of faults
- Explicit raising of a fault
- ltthrow faultNametrouble
faultVariabledescr/gt - Standard BPEL faults
- bpwsjoinFailure - joinCondition has
value false - bpwsconflictingReceive two receives for
same partnerLink, interface and
operation pending within a flow at
the same time
77Faults
- Source of faults (cont)
- Fault response to an invoke. The reply
- raises the fault unableToHandleRequest in
customer - that has synchronously invoked request on
interface
ltreply partnerLinkcustomer interfacelnsloan
ServiceIf operationrequest
variableerror faultNameunableToHan
dleRequest/gt
ltinterface nameloanServiceIfgt ltoperation
namerequest
patternhttp//www.w3.org/2003/06/wsdl/in-outgt
ltinput messagelnscreditInfoMsg/gt
ltoutput messagelnsapprovalMsg/gt
ltfault nameunableToHandleRequest
messageerrorMsg/gt lt/operationgt lt/interfacegt
78Faults
- The reply raises the unableToHandleRequest
fault in customer which is handled by
ltfaultHandlersgt ltcatch faultNameunableToHand
leRequest faultVariableerrorgt
. handle the fault .
lt/catchgt lt/faultHandlersgt
Re-throw the same fault and/or clean-up and/or
invoke a compensation handler
79Handlers
- Handler is associated with an implicit or
explicit scope catches faults that occur in that
scope
ltscopegt ltfaultHandlersgt ltcatch
faultNameunable faultVariableerrorgt
. handle the fault lt/catchgt
other handlers lt/faultHandlersgt
activities ltinvoke partnerLinkloanApprovPro
c interfacelnsloanserviceIf
operationrequest gt lt/invokegt
activities lt/scopegt
ltinvoke partnerLinkloanApprovProc
interfacelnsloanserviceIf
operationrequest .. gt
ltcatch faultNameunable
faultVariableerrorgt . handle the
fault. lt/catchgt lt/invokegt
or
80Fault Flow of Control
- When a fault f occurs in some scope, B
- Execution of activities within are terminated
- If a fault handler for f or a catchAll handler
has been declared local to B, it is executed and
execution resumes in the next enclosing scope at
the activity following B - Else f is thrown in the next enclosing scope
- In both cases B is said to have exited abnormally
- The handler might reverse changes it has made to
variables global to B and invoke compensation
handlers for scopes nested in B that have
completed normally.
81Fault Flow of Control
A
B
catch f throw g or exit
abnormal exit
throw f
82Atomicity
- A BP is a long running process involving
invocations of operations at a number of web
services. - It is unrealistic to treat a BP as a single
transaction, since a particular service will not
hold locks for the duration of the BP - Instead, a single operation at a service might be
treated as a transaction that commits when it
sends reply - BPEL does not support global atomicity (e.g.,
two-phase commit) over multiple invocations by a
BP
83Long-Running Business Transactions (LRT)
- Reversing the effect of a BP relies on
compensation - a web service might offer a compensating
operation for a synchronous operation - Ex. CancelPurchase compensates for Purchase
- BPEL supports an LRT by providing compensation
handlers - Allows application to specify a recovery strategy
using compensating operations - No guarantee of atomicity or isolation
- Future work in this direction is being carried
out in the context of the WS-Transaction
specification
84Compensation Handler
- Handler can be in the immediate scope of invoke
or declared local to scope - Undoes the effect of the scoped activities
ltinvoke nameinvSeller partnerLinkseller
interfaceSPPurch
operationsyncPurch inputVariablesendPO
outputVariablegetResponsegt
ltcorrelationsgt ltcorrelation setPurchOr
initiateyes patternout/gt
lt/correlationsgt --
patternout indicates set applies to request
msg ltcompensationHandlergt ltinvoke
partnerLinkseller interfaceSPPurch
operationcancelPurch
inputVariablegetResponse outputVariablegetCo
nfirmgt ltcorrelationsgt
ltcorrelation setPurchOr patternout/gt
lt/correlationsgt lt/invokegt
lt/compensationHandlergt lt/invokegt
-- invSeller is name of scope
85Invoking Compensation
- Compensation can only be performed for scope
(e.g., invoke, scope) that has completed
normally - A compensation handler is not installed until
the associated scope has completed normally. - Hence handler must be invoked from outside the
scope - Compensation occurs when a failure is detected
- Hence handler is invoked from a global fault or
compensation handler
86Invoking Compensation
- At most one compensation handler can be
explicitly declared local to a scope (in contrast
to fault handlers) - Scope has a name handler is invoked using
- ltcompensate namescopeName/gt
- Handler is installed when scope is exited
normally (at that point compensation is
meaningful)
87Handler Invocation
fault handler for f
A
catch f compensate B
B
compensation handler for B
compensate C compensate D
C
compensation handler for C
compensation handler for D
D
Although B, C and D may have exited normally, A
will exit abnormally in this case
throw f
88Compensation
ltscopegt ltfaultHandlersgt ltcatch
faultNameunable faultVariableerrorgt
ltcompensate scopeinvBank/gt lt/catchgt
lt/faultHandlersgt ltsequencegt ltinvoke
nameinvBank partnerLinkmyBank
interfacebankIf operationOp .gt
ltcompensationHandlergt
ltinvoke partnerLinkmyBank interfacebankIf
operationcancelOP
..gt lt/invokegt
lt/compensationHandlergt lt/invokegt
ltinvoke partnerLinkloanApprovProc
interfacelnsloanserviceIf
operationrequest .. gt lt/invokegt
fault
compensate
normal exit
abnormal exit
89Default Handlers
A
- Problem Suppose a fault handler is not declared
- Compensation handler for C cannot be called from
within A - Solution default fault handlers automatically
invoke declared compensation handlers of
immediately enclosed scopes and then rethrow the
fault
B
default handler for f
C
compensation handler for C
throw f
90Default Handlers
catch f compensate B
fault handler for f
A
- Problem Suppose a compensation handler
is not declared - Compensation handler for C cannot be called from
within A - Solution default compensation handler
automatically invokes declared compensation
handlers of immediately enclosed scopes
B
default compensation handler
C
compensation handler for C
throw f
91Structure of a BP
ltprocess name abstractProcessyesno
/gt ltpartnerLinksgt lt/partnerLinksgt
ltvariablesgt lt/variablesgt ltcorrelationSetsgt
lt/correlationSetsgt ltfaultHandlersgt
lt/faultHandlersgt ltcompensationHandlersgt
lt/compensationHandlersgt activity lt/processgt