Post on 07-Dec-2014
description
transcript
95-843: Service Oriented Architecture1Master of Information System
Management
Service Oriented Architecture
Lecture 7: BPELSome notes selected from “Business Process Execution
Language for Web Services” by Matjaz Juric
95-843: Service Oriented Architecture2Master of Information System
Management
We Are Here
Apps &
Info Assets
B u s i n e s s I n n o v a t i o n & O p t i m i z a t i o n S e r v i c e s
Development
Services
I n t e r a c t i o n S e r v i c e s P r o c e s s S e r v i c e s I n f o r m a t i o n S e r v i c e s
P a r t n e r S e r v i c e s B u s i n e s s A p p S e r v i c e s A c c e s s S e r v i c e s
I n t e g r a t e d
e n v i r o n m e n
t f o r d e s i g n
a n d
c r e a t i o n o f
s o l u t i o n
a s s e t s
M o n i t o r ,
m a n a g e
a n d s e c u r e
s e r v i c e s ,
a p p l i c a t i o n
s &
r e s o u r c e s
F a c i l i t a t e s b e t t e r d e c i s i o n - m a k i n g
w i t h r e a l - t i m e b u s i n e s s
i n f o r m a t i o n
E n a b l e s c o l l a b o r a t i o n
b e t w e e n p e o p l e ,
p r o c e s s & i n f o r m a t i o n
O r c h e s t r a t e a n d
a u t o m a t e b u s i n e s s
p r o c e s s e s
C o n n e c t w i t h t r a d i n g
p a r t n e r s
B u i l d o n a r o b u s t ,
s c a l e a b l e , a n d
s e c u r e s e r v i c e s
e n v i r o n m e n t
F a c i l i t a t e s i n t e r a c t i o n s
w i t h e x i s t i n g
i n f o r m a t i o n a n d
a p p l i c a t i o n a s s e t s
E S BF a c i l i t a t e s c o m m u n i c a t i o n b e t w e e n s e r v i c e s
IT Service
Management
I n f r a s t r u c t u r e S e r v i c e s
O p t i m i z e s t h r o u g h p u t ,
a v a i l a b i l i t y a n d p e r f o r m a n c e
M a n a g e s d i v e r s e
d a t a a n d c o n t e n t i n
a u n i f i e d m a n n e r
Apps &
Info Assets
B u s i n e s s I n n o v a t i o n & O p t i m i z a t i o n S e r v i c e s
Development
Services
I n t e r a c t i o n S e r v i c e s P r o c e s s S e r v i c e s I n f o r m a t i o n S e r v i c e s
P a r t n e r S e r v i c e s B u s i n e s s A p p S e r v i c e s A c c e s s S e r v i c e s
I n t e g r a t e d
e n v i r o n m e n
t f o r d e s i g n
a n d
c r e a t i o n o f
s o l u t i o n
a s s e t s
M o n i t o r ,
m a n a g e
a n d s e c u r e
s e r v i c e s ,
a p p l i c a t i o n
s &
r e s o u r c e s
F a c i l i t a t e s b e t t e r d e c i s i o n - m a k i n g
w i t h r e a l - t i m e b u s i n e s s
i n f o r m a t i o n
E n a b l e s c o l l a b o r a t i o n
b e t w e e n p e o p l e ,
p r o c e s s & i n f o r m a t i o n
O r c h e s t r a t e a n d
a u t o m a t e b u s i n e s s
p r o c e s s e s
C o n n e c t w i t h t r a d i n g
p a r t n e r s
B u i l d o n a r o b u s t ,
s c a l e a b l e , a n d
s e c u r e s e r v i c e s
e n v i r o n m e n t
F a c i l i t a t e s i n t e r a c t i o n s
w i t h e x i s t i n g
i n f o r m a t i o n a n d
a p p l i c a t i o n a s s e t s
E S BF a c i l i t a t e s c o m m u n i c a t i o n b e t w e e n s e r v i c e s
IT Service
Management
I n f r a s t r u c t u r e S e r v i c e s
O p t i m i z e s t h r o u g h p u t ,
a v a i l a b i l i t y a n d p e r f o r m a n c e
Apps &
Info Assets
Apps &
Info Assets
B u s i n e s s I n n o v a t i o n & O p t i m i z a t i o n S e r v i c e s
Development
Services
I n t e r a c t i o n S e r v i c e s P r o c e s s S e r v i c e s I n f o r m a t i o n S e r v i c e s
P a r t n e r S e r v i c e s B u s i n e s s A p p S e r v i c e s A c c e s s S e r v i c e s
I n t e g r a t e d
e n v i r o n m e n
t f o r d e s i g n
a n d
c r e a t i o n o f
s o l u t i o n
a s s e t s
M o n i t o r ,
m a n a g e
a n d s e c u r e
s e r v i c e s ,
a p p l i c a t i o n
s &
r e s o u r c e s
F a c i l i t a t e s b e t t e r d e c i s i o n - m a k i n g
w i t h r e a l - t i m e b u s i n e s s
i n f o r m a t i o n
E n a b l e s c o l l a b o r a t i o n
b e t w e e n p e o p l e ,
p r o c e s s & i n f o r m a t i o n
O r c h e s t r a t e a n d
a u t o m a t e b u s i n e s s
p r o c e s s e s
C o n n e c t w i t h t r a d i n g
p a r t n e r s
B u i l d o n a r o b u s t ,
s c a l e a b l e , a n d
s e c u r e s e r v i c e s
e n v i r o n m e n t
F a c i l i t a t e s i n t e r a c t i o n s
w i t h e x i s t i n g
i n f o r m a t i o n a n d
a p p l i c a t i o n a s s e t s
E S BF a c i l i t a t e s c o m m u n i c a t i o n b e t w e e n s e r v i c e s
E S BF a c i l i t a t e s c o m m u n i c a t i o n b e t w e e n s e r v i c e s
IT Service
Management
I n f r a s t r u c t u r e S e r v i c e s
O p t i m i z e s t h r o u g h p u t ,
a v a i l a b i l i t y a n d p e r f o r m a n c e
M a n a g e s d i v e r s e
d a t a a n d c o n t e n t i n
a u n i f i e d m a n n e r
From IBM’s High Level Reference Architecture
95-843: Service Oriented Architecture3Master of Information System
Management
BPEL
• Business Process Execution Language• Programming in the large• Processing logic to handle synchronous
and asynchronous messages• Quite different from programming in the
small - different issues to deal with • Structured programming language using while, if else, sequence, flow, …• XPATH used for addressing message parts
95-843: Service Oriented Architecture4Master of Information System
Management
Basics
• Developing web services and exposing functionalities is not sufficient.
• Need a way to compose these functionalities in the right order – a way to define business processes which will make use of the exposed functionalities.
• BPEL allows composition of web services.
95-843: Service Oriented Architecture5Master of Information System
Management
Web Service Composition Methods - Orchestration
• A central process takes control over the involved web services and coordinates the execution of different operations on the web services involved in the operation.
• This is done as per the requirements of the orchestration.
• The involved web services do not know (and do not need to know) that they are involved into a composition and that they are a part of a higher business process.
• Only the central coordinator of the orchestration knows this.
• So orchestration is centralized with explicit definitions of operations and the order of invocation of web services.
95-843: Service Oriented Architecture6Master of Information System
Management
Web Service Composition Methods - Choreography
• Choreography does not rely on a central coordinator.
• Each web service involved in the choreography knows exactly when to execute its operations and whom to interact with.
• Choreography is a collaborative effort focused on exchange of messages.
• All participants of the choreography need to be aware of the business process, operations to execute, messages to exchange, and the timing of message exchanges.
• This is a peer-to-peer approach.
95-843: Service Oriented Architecture7Master of Information System
Management
Composing web services to execute business processes
• Orchestration is the more flexible approach compared to choreography: – We know exactly who is responsible for the execution of
the whole business process. – We can incorporate web services, even those that are not
aware that they are a part of a business process. – We can also provide alternative scenarios when faults
occur. • BPEL follows the orchestration paradigm. • Choreography is covered by other standards, such as
WSCI (Web Services choreography Interface) and WS-CDL (Web Services Choreography Description Language).
• Choreography has not gained support from the industry which would be comparable to BPEL.
95-843: Service Oriented Architecture8Master of Information System
Management
Programming in the Large History
• IBM WSFL (Web Service Flow Language) defined in May 2001.• Microsoft XLANG defined around the
same time.• Joint submission to OASIS under the
name BPEL4WS.• OASIS (September 2004) WS-BPEL-2.0.• Has no standard graphical language.• The BPEL process itself is a web service.• BPEL business processes are portable.
95-843: Service Oriented Architecture9Master of Information System
Management
BPEL
• BPEL builds on top of XML and web services.
• It is an XML-based language which supports the web services technology stack, including SOAP, WSDL, UDDI, WS-Reliable Messaging, WS-Addressing, WS-Coordination and WS-Transaction.
95-843: Service Oriented Architecture10Master of Information System
Management
A typical BPEL process
• First, the BPEL business process receives a request.
• To fulfill it, the process then invokes the involved web services and finally responds to the original caller.
• Since the BPEL process communicates with other web services, it relies heavily on the WSDL description of the web services invoked by the composite web service.
95-843: Service Oriented Architecture11Master of Information System
Management
Steps in a Process
• Each step is called an activity. • BPEL supports primitive and
structure activities.• Primitive activities represent basic
constructs and are used for common tasks
95-843: Service Oriented Architecture12Master of Information System
Management
Primitive Activities• Invoking other web services, using <invoke> • Waiting for the client to invoke the business
process through sending a message, using <receive> (receiving a request)
• Generating a response for synchronous operations, using <reply>
• Manipulating data variables, using <assign> • Indicating faults and exceptions, using
<throw> • Waiting for some time, using <wait> • Terminating the entire process, using
<terminate> etc.
95-843: Service Oriented Architecture13Master of Information System
Management
Defining Processes
• Combine these and other primitive activities and define complex algorithms, which exactly specify the steps of business processes.
• To combine primitive activities BPEL supports several structured activities
95-843: Service Oriented Architecture14Master of Information System
Management
Structured Activities
• Sequence ( <sequence>), which allows us to define a set of activities that will be invoked in an ordered sequence
• Flow ( <flow>) for defining a set of activities that will be invoked in parallel
• Case-switch construct ( <switch>) for implementing branches
• While ( <while>) for defining loops • The ability to select one of a number of
alternative paths, using <pick>
95-843: Service Oriented Architecture15Master of Information System
Management
Definitions and Declarations
• BPEL processes will typically declare variables using <variable>
• BPEL processes will typically define partner links using <partnerLink>
• A BPEL process can be synchronous or asynchronous. – A synchronous BPEL process blocks the client (the
one which is using the process) until the process finishes and returns a result to the client.
– An asynchronous process does not block the client. Rather it uses a callback to return the result (if any)
95-843: Service Oriented Architecture16Master of Information System
Management
Example Process• For its clients a BPEL process looks like
any other web service. • When we define a BPEL process, we
actually define a new web service that is a composition of existing services.
• The interface of the new BPEL composite web service uses a set of port types, through which it provides operations like any other web service.
• To invoke a business process described in BPEL, we have to invoke the resulting composite web service.
95-843: Service Oriented Architecture17Master of Information System
Management
95-843: Service Oriented Architecture18Master of Information System
Management
Typical Structure (1)<process> <partnerLinks> <partnerLink> <partnerLink> </partnerLinks> <variables> <variable> <variable> </variable> <sequence> <receive> the initial client request </receive>
95-843: Service Oriented Architecture19Master of Information System
Management
Partner Links• BPEL calls the links to all parties it
interacts with as partner links• Partner links can be links to web
services that are invoked by the BPEL process
• Partner links can also be links to clients which invoke the BPEL process
• Each BPEL process has at least one client partner link, because there has to be a client that invokes the BPEL process.
95-843: Service Oriented Architecture20Master of Information System
Management
<flow> make calls in parallel <invoke> a web service </invoke> <invoke> another web service </invoke> </flow>
Typical Structure (2)
95-843: Service Oriented Architecture21Master of Information System
Management
<switch> make decisions <case condition =“…”> <assign> <copy> <from>…<to> </case> <otherwise> <assign> <copy> <from>…<to> </otherwise> </switch> <reply> reply to synchronous caller </sequence></process>
Typical Structure (3)
95-843: Service Oriented Architecture22Master of Information System
Management
Sequential Order of Activities
<process> …. <sequence> Do activities in sequential order. <receive> <invoke> <assign> <invoke> <receive> <invoke> </sequence></process>
95-843: Service Oriented Architecture23Master of Information System
Management
Parallel Activities
<process> …. <sequence> <receive> Wait to start process <flow> <invoke> The three invokes are <invoke> carried out in <invoke> parallel. </flow> </sequence></process>
95-843: Service Oriented Architecture24Master of Information System
Management
Parallel Sequences<process> …. <sequence> <receive> Wait to start process. <flow> Both sequences may run in parallel. <sequence> <invoke> These two ‘invokes’ go in order. <invoke> </sequence> <sequence> <invoke> These two ‘invokes’ go in order <invoke> </sequence> </flow> </sequence></process>
95-843: Service Oriented Architecture25Master of Information System
Management
Synchronous Web Services
The sender blocks and waits for a reply.The service should run fast. The <receive>and <reply> form a pair on B.
<receive>
<invoke>..<invoke>
<reply>
A B
<invoke>
No <receive> needed
B is a synchronousweb service and uses a BPEL reply.
95-843: Service Oriented Architecture26Master of Information System
Management
Quiz on Synchronous Web Services
What does A need to know about B? In otherwords, what is required in B’s WSDL?
<receive>
<invoke>..<invoke>
<reply>
A B
<invoke>
No <receive> needed.B is a synchronousweb service and uses a BPEL reply.
95-843: Service Oriented Architecture27Master of Information System
Management
Quiz on Synchronous Web Services
What does A need to know about B? In otherwords, what is required in B’s WSDL? A needs to know the message types and the availableoperations as well as B’s location.
<receive>
<invoke>..<invoke>
<reply>
A B
<invoke>
No <receive> needed.
B is a synchronousweb service and uses a BPEL reply.
95-843: Service Oriented Architecture28Master of Information System
Management
Asynchronous Web Services (1)
<receive>
<invoke>..<invoke>
<invoke>
A B
Most real-world processes are long running and if callbacks are needed, message correlation may be used.If callbacks are not needed, B need not perform an <invoke>.
<invoke>
Do other things…
<receive> B is an asynchronousweb service andreplies with anoptional “invoke” not a “reply”.
95-843: Service Oriented Architecture29Master of Information System
Management
Quiz on Asynchronous Web Services
<receive>
<invoke>..<invoke>
<invoke>
A B
What does A need to know in order to use B? In other words,what information must be available in B’s WSDL?
<invoke>
Do other things…
<receive> B is an asynchronousweb service andreplies with anoptional “invoke” not a “reply”.
95-843: Service Oriented Architecture30Master of Information System
Management
Quiz on Asynchronous Web Services
<receive>
<invoke>..<invoke>
<invoke>
A B
What does A need to know in order to use B? In other words,what information must be available in B’s WSDL? A needs to know the message types and the availableoperations as well as B’s location. In order to use B, A must also know exactly what operations it needsto provide and what messages will be received.
<invoke>
Do other things…
<receive> B is an asynchronousweb service andreplies with anoptional “invoke” not a “reply”.
95-843: Service Oriented Architecture31Master of Information System
Management
Example Business Process
Collect employee information (name, id, travel plans, etc.). Determine an employee’s flying status (first class or coach) and then determine the cheaper of two airlines. Return suggestedflight to the employee.
95-843: Service Oriented Architecture32Master of Information System
Management
Modified Example from Juric Text
EmployeeTravel Status WSsynchronous
AmericanAirlines WSasynchronous
DeltaAirlines WSasynchronous
Asynch Process for Business Travels
<invoke>
<receive>
<receive>
<invoke> Coach or first class
<invoke>:<receive><invoke>:<receive>
<invoke> price
price
Asynchronous web service
95-843: Service Oriented Architecture33Master of Information System
Management
Partner Links
• Partner links describe links to partners.
• Partners might be:
(1) Services that invoke the BPEL process. (2) Services invoked by the BPEL process. (3) Services that play both roles - the BPEL process invokes the service and the service invokes a callback on the BPEL process.
95-843: Service Oriented Architecture34Master of Information System
Management
PartnerLinkTypes
• PartnerLinkTypes represent interactions between the parties.
• We have three types of interactions in the airline example: (1) The client interacts with the BPEL process. (2) The BPEL process calls the employee status web service. (3) The BPEL process calls the two airline web services and expects callbacks from both.
95-843: Service Oriented Architecture35Master of Information System
Management
PartnerLinkTypes
• Within the BPEL process WSDL, we have two roles defined for one of the links:
<partnerLinkType name="travelLT">
<role name="travelService"> The interface of the <portType name="tns:TravelApprovalPT" /> BPEL service is implemented </role> at the service.
<role name="travelServiceCustomer"> The interface of the <portType name="tns:ClientCallbackPT" /> client callback is implemented</role> on the client.
</partnerLinkType> travelLTTravel Link Type
BPEL Processinterface
Client callbackinterface
95-843: Service Oriented Architecture36Master of Information System
Management
PartnerLinkTypes
• The employee status WS is synchronous so within the employee status WS WSDL we have one role defined:
<partnerLinkType name="employeeLT">
<role name="employeeTravelStatusService"> <portType name="tns:EmployeeTravelStatusPT" /></role>
</partnerLinkType> Interface of employeestatus web service.
employeeLTEmployee Link Type
95-843: Service Oriented Architecture37Master of Information System
Management
PartnerLinkTypes
• The airline web services are asynchronous and so within the airline WS WSDL’s we have two roles defined:
<partnerLinkType name="flightLT">
<role name="airlineService"> <portType name="tns:FlightAvailabilityPT" /> </role>
<role name="airlineCustomer"> <portType name="tns:FlightCallbackPT" /> </role>
</partnerLinkType>flightLTFlight LinkType
AirlineinterfaceCallee’s
callbackinterface
95-843: Service Oriented Architecture38Master of Information System
Management
PartnerLinks Are in the BPEL (1)<partnerLinks> <partnerLink name="client" partnerLinkType="trv:travelLT" myRole="travelService" partnerRole="travelServiceCustomer"/>
<partnerLink name="employeeTravelStatus" partnerLinkType="emp:employeeLT" partnerRole="employeeTravelStatusService"/>
<partnerLink name="AmericanAirlines" partnerLinkType="aln:flightLT" myRole="airlineCustomer" partnerRole="airlineService"/>
<partnerLink name="DeltaAirlines" partnerLinkType="aln:flightLT" myRole="airlineCustomer" partnerRole="airlineService"/> </partnerLinks>
95-843: Service Oriented Architecture39Master of Information System
Management
PartnerLinks Are in the BPEL(2)<partnerLinks> <partnerLink name="client" partnerLinkType="trv:travelLT" myRole="travelService" partnerRole="travelServiceCustomer"/> : :
</partnerLinks>
This partner link is oftype travelLT. So, twointerfaces are involved.This process is the travelservice part. The partnerimplements the client callbackinterface.
These names are defined in the partner link type section.
95-843: Service Oriented Architecture40Master of Information System
Management
PartnerLinks Are in the BPEL(3)<partnerLinks> : :
<partnerLink name="employeeTravelStatus" partnerLinkType="emp:employeeLT" partnerRole="employeeTravelStatusService"/> : :
</partnerLinks>
This partner link is of type employeeLT.So, one interface isinvolved, that is, theinterface of the employee status webservice.
95-843: Service Oriented Architecture41Master of Information System
Management
PartnerLinks Are in the BPEL(4)
<partnerLinks>
: :
<partnerLink name="AmericanAirlines" partnerLinkType="aln:flightLT" myRole="airlineCustomer" partnerRole="airlineService"/>
<partnerLink name="DeltaAirlines" partnerLinkType="aln:flightLT" myRole="airlineCustomer" partnerRole="airlineService"/>
</partnerLinks>
Both of these partnerlinks are of typeflightLT. As such, twointerfaces are mentioned.The role of this processis to provide the callback (FlightCallbackPT)and the role the partner is to provide the FlightAvailabilityPT.
95-843: Service Oriented Architecture42Master of Information System
Management
PartnerLinks Are in the BPEL(5)
<partnerLinks> <partnerLink name="client" partnerLinkType="trv:travelLT" myRole="travelService" partnerRole="travelServiceCustomer"/>
<partnerLinkType name="travelLT">
<role name="travelService"> The interface of the <portType name="tns:TravelApprovalPT" /> BPEL service is implemented </role> at the service.
<role name="travelServiceCustomer"> The interface of the <portType name="tns:ClientCallbackPT" /> client callback is implemented</role> on the client.
</partnerLinkType>
95-843: Service Oriented Architecture43Master of Information System
Management
PartnerLinks Are in the BPEL(6)
<partnerLink name="employeeTravelStatus" partnerLinkType="emp:employeeLT" partnerRole="employeeTravelStatusService"/>
<partnerLinkType name="employeeLT"> <role name="employeeTravelStatusService"> <portType name="tns:EmployeeTravelStatusPT" /> </role>
95-843: Service Oriented Architecture44Master of Information System
Management
PartnerLinks Are in the BPEL(7)
<partnerLink name="AmericanAirlines" partnerLinkType="aln:flightLT" myRole="airlineCustomer" partnerRole="airlineService"/>
<partnerLink name="DeltaAirlines" partnerLinkType="aln:flightLT" myRole="airlineCustomer" partnerRole="airlineService"/>
<partnerLinkType name="flightLT">
<role name="airlineService"> <portType name="tns:FlightAvailabilityPT" /> </role>
<role name="airlineCustomer"> <portType name="tns:FlightCallbackPT" /> </role>
</partnerLinkType>
95-843: Service Oriented Architecture45Master of Information System
Management
Variables in BPEL
<variables>
<!-- input for this process --> <variable name="TravelRequest" messageType="trv:TravelRequestMessage"/>
<!-- input for the Employee Travel Status Web service --> <variable name="EmployeeTravelStatusRequest" messageType="emp:EmployeeTravelStatusRequestMessage"/>
<!-- output from the Employee Travel Status Web service --> <variable name="EmployeeTravelStatusResponse" messageType="emp:EmployeeTravelStatusResponseMessage"/>
95-843: Service Oriented Architecture46Master of Information System
Management
Variables (2) <!-- input for American and Delta Web services --> <variable name="FlightDetails" messageType="aln:FlightTicketRequestMessage"/>
<!-- output from American Airlines --> <variable name="FlightResponseAA" messageType="aln:TravelResponseMessage"/>
<!-- output from Delta Airlines --> <variable name="FlightResponseDA" messageType="aln:TravelResponseMessage"/>
<!-- output from BPEL process --> <variable name="TravelResponse" messageType="aln:TravelResponseMessage"/>
</variables>
95-843: Service Oriented Architecture47Master of Information System
Management
BPEL Main Process (1)
<sequence>
<!-- Receive the initial request for business travel from client --> <receive partnerLink="client" portType="trv:TravelApprovalPT" operation="TravelApproval" variable="TravelRequest" createInstance="yes" />
95-843: Service Oriented Architecture48Master of Information System
Management
BPEL Main Process (2)
<!-- Prepare the input for the Employee Travel Status Web Service --> <assign> <copy> <from variable="TravelRequest" part="employee"/> <to variable="EmployeeTravelStatusRequest" part="employee"/> </copy> </assign>
95-843: Service Oriented Architecture49Master of Information System
Management
BPEL Main Process (3)
<!-- Synchronously invoke the Employee Travel Status Web Service --> <invoke partnerLink="employeeTravelStatus" portType="emp:EmployeeTravelStatusPT" operation="EmployeeTravelStatus" inputVariable="EmployeeTravelStatusRequest" outputVariable="EmployeeTravelStatusResponse" />
95-843: Service Oriented Architecture50Master of Information System
Management
BPEL Main Process (4)
<!-- Prepare the input for the airlines. The input comes from two variables. --> <assign> <copy> <from variable="TravelRequest" part="flightData"/> <to variable="FlightDetails" part="flightData"/> </copy> <copy> <from variable="EmployeeTravelStatusResponse" part="travelClass"/> <to variable="FlightDetails" part="travelClass"/> </copy> </assign>
95-843: Service Oriented Architecture51Master of Information System
Management
BPEL Main Process (5)
<!-- Make a concurrent invocation on both airlines. --> <flow>
<sequence> <!-- Async invoke of the AA Web service and wait for the callback-->
<invoke partnerLink="AmericanAirlines" portType="aln:FlightAvailabilityPT" operation="FlightAvailability" inputVariable="FlightDetails" />
<receive partnerLink="AmericanAirlines" portType="aln:FlightCallbackPT" operation="FlightTicketCallback" variable="FlightResponseAA" />
</sequence>
The receive operationmust occur after the invoke. Hence, thesequence tag isused.
95-843: Service Oriented Architecture52Master of Information System
Management
BPEL Main Process (6)
<sequence> <!-- Async invoke of the DA Web service and wait for the callback-->
<invoke partnerLink="DeltaAirlines" portType="aln:FlightAvailabilityPT" operation="FlightAvailability" inputVariable="FlightDetails" />
<receive partnerLink="DeltaAirlines" portType="aln:FlightCallbackPT" operation="FlightTicketCallback" variable="FlightResponseDA" />
</sequence>
</flow>
Only the flow isdone in parallel. Forthe sequence to complete, the airlinemust respond.
95-843: Service Oriented Architecture53Master of Information System
Management
BPEL Main Process (7)
<!-- The airlines have responded. Select the best offer and construct the TravelResponse --> <switch>
<case condition="bpws:getVariableData('FlightResponseAA', 'confirmationData','/confirmationData/Price') <= bpws:getVariableData('FlightResponseDA', 'confirmationData','/confirmationData/Price')">
<!-- Select American Airlines --> <assign> <copy> <from variable="FlightResponseAA" /> <to variable="TravelResponse" /> </copy> </assign> </case>
95-843: Service Oriented Architecture54Master of Information System
Management
BPEL Main Process (8)
<otherwise> <!-- Select Delta Airlines --> <assign> <copy> <from variable="FlightResponseDA" /> <to variable="TravelResponse" /> </copy> </assign> </otherwise> </switch>
95-843: Service Oriented Architecture55Master of Information System
Management
BPEL Main Process (9)
<!-- Make a callback to the client --> <invoke partnerLink="client" portType="trv:ClientCallbackPT" operation="ClientCallback" inputVariable="TravelResponse" /> </sequence>
</process>
95-843: Service Oriented Architecture56Master of Information System
Management
Sketch of Working Processsequence receive information from employee assign assign to variable invoke invoke service to determine flying status assign assign result to variable flow Do sequences in parallel sequence invoke call airline A receive get price for ticket sequence invoke call airline B receive get price for ticket switch select cheaper flight invoke inform the employee
95-843: Service Oriented Architecture57Master of Information System
Management
Would this work?sequence receive flow assign invoke assign invoke receive invoke receive switch invoke
No. The previous slide had it right.Here, we have not expressed thesynchronization dependenciesbetween activities.
However, BPEL provides for morecomplex concurrency scenariosusing links. A single link is specifiedwith a source and a target.
95-843: Service Oriented Architecture58Master of Information System
Management
We Need To Add Links
sequence receive flow assign assign before the invoke invoke invoke before the assign assign assign before the two invokes invoke invoke before receive receive receive before the switch invoke invoke before receive receive receive before the switch switch invoke
95-843: Service Oriented Architecture59Master of Information System
Management
Sources and Targets In BPEL
<sequence> <receive> <flow> <assign>… <source linkName = “A”/> </assign> <invoke>…. <target linkName = “A” /> <source linkName = “B” /> Invoke before assign </invoke> <assign> <target linkName = “B” /> <source linkName = “C” /> Assign before the two <source linkName = “D” /> invokes. </assign>
Assign before invoke.
Link names are user definedand should be well chosen.
95-843: Service Oriented Architecture60Master of Information System
Management
Sources and Targets
<invoke> <target linkName = “C”/> <source linkName = “E”/> </invoke> <receive> <target linkName = “E”/> <source linkName = “G”/> </receive> <invoke> <target linkName = “D”/> <source linkName =“F” /> </invoke>
95-843: Service Oriented Architecture61Master of Information System
Management
Sources and Targets
<receive> <target linkName = “F”/> <source linkName = “H”/> </receive> <switch> <target linkName = “G”/> <target linkName = “H”/> </switch> </flow> <invoke>
95-843: Service Oriented Architecture62Master of Information System
Management
Concurrency and Links• The flow tag provides the ability to express synchronization dependencies between activities.• In other words, we can specify what happens and when.• Link definitions are placed within the flow activity. For example,
<flow> <links> <link name = “A”/> <link name = “B” /> </links> :• Every link must be associated with exactly one source and target.• A link’s target activity may only be performed after the source activity has completed.• Transition conditions may be added for additional confusion.