You are on page 1of 41

BPEL: Building Standards-

Based Business Processes with


Web Services
Web Services Meet Business
Processes
Web Web
Service 1 Service 4

Web Web
Service 2 Service 5

Web Web
Service 3 Service n
Example Problem Space

reeddiitt e
Cr ocnks
C
ReC
shpe Credit
Service
Purchase
Invoice
Consolidate
Order Results
InR
v
PO Service RIen eensteo
svpe rrvye
Client onnt
sery
o

Inventory
Service
Business Process Challenges

y Coordinate asynchronous y Manipulate/transform


communication between data between partner
services interactions
y Correlate message y Support for long running
exchanges between business transactions
parties and activities
y Implement parallel y Provide consistent
processing of activities exception handling
y ... y ...
Recent History of
Business Process Standards

BPML BPSS WSCI WS-Choreography


(Intallio et al) (ebXML) (Sun et al) (W3C)

2000/05 2001/03 2001/05 2001/06 2002/03 2002/06 2002/08 2003/01 2003/04

XLang WSFL WSCL BPEL4WS 1.0 BPEL4WS 1.1


(Microsoft) (IBM) (HP) (IBM, Microsoft) (OASIS)
Orchestration vs
Choreography
y Orchestration
– An executable business process describing a
flow from the perspective and under control of a
single endpoint (commonly: Workflow)
y Choreography
– The observable public exchange of messages,
rules of interaction and agreements between two
or more business process endpoints
Sample Business Process:
Purchase Order

Sample Purchase Order

Purchase Order Request

Business Business
“A” Purchase Order Acknowledgement “B”

Purchase Order Response


From a Choreography
Perspective
Public Process

Business A Business B
Send Receive
PO PO Request PO

Receive PO Send
Ack PO Ack
PO Acknowledgement

Receive PO Send PO
Response Response
PO Response

Choreography – The observable public exchange of messages


From an Orchestration
Perspective
Private Process
Business A BPEL Workflow

Send
Transform
PO PO Request
From ERP

Receive PO
Ack PO Acknowledgement

To ERP
Receive PO
Transform
Response
PO Response

Orchestration – A private executable business process


Orchestration and
Choreography Together
Business Analyst Tool

Generate BPEL Business Business Generate BPEL


Template A B Template

Business A BPEL Workflow Business B BPEL Workflow


Send Receive
Transform Transform
PO PO Request PO

Receive PO Send PO Ack


Ack
PO Acknowledgement

Receive PO Receive PO
Transform Transform
Response Response
PO Response

Two BPEL workflow templates reflecting a business agreement


Business Process Execution
Language for Web Services
• Version 1.0 released by IBM, Microsoft and BEA in
August 2002
• Accompanied by WS-Coordination, WS-Transaction which
remain unsubmitted to standards bodies
• Version 1.1 submitted to OASIS April 2003
• XML language for describing business processes
based on Web services
• Convergence of XLANG (Microsoft) and WSFL (IBM)
• Unprecendented industry consensus
• IBM, Microsoft, Oracle, Sun, BEA, SAP, Siebel …
Value Proposition

y Portable business processes


– Built on top of an interoperable infrastructure of
Web services
y Industry wide language for business processes
– Common skill set and language for developers
y Choice of process engines
– Standards lead to competitive offerings
Standards Building Blocks of
BPEL
Choreography - CDL4WS
Business
Orchestration - BPEL4WS Processes

Transactions
Quality of
WS-Reliability WS-Security Coordination
Management

Service
Context

UDDI Discovery

WSDL Description
Description

SOAP
Message
XML

HTTP,IIOP, JMS, SMTP Transport


BPEL Depends on WSDL and
WSDL Extensions
Service Service
Implementation
Definition Port

Binding

Service Port types define Operations


Interface
Definition Message

Type
BPEL Scenario Structure
<process>
<!– Definition and roles of process participants -->
<partnerLinks> ... </partnerLinks>
<!- Data/state used within the process -->
<variables> ... </variables>
<!- Properties that enable conversations -->
<correlationSets> ... </correlationSets>
<!- Exception handling -->
<faultHandlers> ... </faultHandlers>
<!- Error recovery – undoing actions -->
<compensationHandlers> ... </compensationHandlers>
<!- Concurrent events with process itself -->
<eventHandlers> ... </eventHandlers>
<!- Business process flow -->
(activities)*
</process>
BPEL Activities

Primitive Activities Structured Activities


y <invoke> y <sequence>
y <receive> y <switch>
y <assign> y <pick>
y <reply> y <flow>
y <throw> y <link>
y <terminate> y <while>
y <wait> y <scope>
Partners

y Declare the Web services and roles used by the


process
y Tied to WSDL of the process itself and the
participating Web services by service link types
Partner 1 Partner 2 Partner 3
(the process)

Purchase Credit Inventory


Service Service Service
Partners in BPEL
BPEL:
<partnerLinks>
<partnerLink name=“customer" serviceLinkType=“lns:purchasePLT”
myRole=“purchaseService”/>
<partnerLink name=“inventoryChecker” serviceLinkType=“lns:inventoryPLT”
myRole=“inventoryRequestor” partnerRole=“inventoryService”/>
<partnerLink name=“creditChecker” serviceLinkType=“lns:creditPLT”
myRole=“creditRequestor” partnerRole=“creditService”/>
</partnerLinks>

Purchase Process WSDL: Purchase Process PortType:


<plt:partnerLinkType name=“purchasePLT”> <portType name=“purchasePT”>
<plt:role name=“purchaseService”> <operation name="sendPurchase">
<plt:portType name=“tns:purchasePT”/> </operation>
</plt:role> </portType>
</plt:partnerLinkType>
Variables

y Messages sent and received from partners


– Persisted for long running interactions
– Defined in WSDL types and messages

Process
Customer <variable> <activity> <activity> <variable> Customer
Service <A> <B> Service

Persist/ Persist/ Persist/


Persist
Retrieve Retrieve Retrieve
Variables in BPEL
BPEL:
<variables>
<variable name=“PO” messageType=“lns:POMessage”/>
<variable name=“Invoice” messageType=“lns:InvMessage”/>
<variable name=“POFault” messageType=“lns:orderFaultType”/>
</variables>

Purchase Process WSDL:


<message name=“POMessage”>
<part name=“customerInfo” type=“sns:customerInfo”/>
<part name=“purchaseOrder” type=“sns:purchaseOrder”/>
</message>
<message name="InvMessage">
<part name=“IVC” type=“sns:Invoice”/>
</message>
<message name=“orderFaultType”>
<part name=“problemInfo” type=“xsd:string”/>
</message>
How is Data Manipulation
Done?
y Using <assign> and <copy>, data can be
copied and manipulated between variables
y <copy> supports XPath queries to sub-select
data
<assign>
<copy>
<from variable="PO" part="customerInfo"/>
<to variable=“creditRequest” part="customerInfo"/>
</copy>
</assign>
Simple Activities

y Receive
– Wait for a partner inbound message
– Can be the instantiator of the business process
y Reply
– Synchronous response to a receive activity
– Response to the inbound receive from a partner
y Invoke
– Issue a request synchronously *or* asynchronously
y Pick
– Specify an inbound set of messages
– Can be the instantiator of the business process
– Activity completes when one of the messages arrives
Simple Activities Combined
with Structured Activities
Receive <PO> <sequence>

Invoke <InventoryService> Invoke <CreditService> <flow>

Reply <Invoice> </sequence>


Sample Activities in BPEL
<sequence>
<receive partnerLink=“customer” portType=“lns:purchaseOrderPT"
operation=“sendPurchaseOrder” variable=“PO”
createInstance="yes" />
<flow>
<invoke partnerLink=“inventoryChecker” portType=“lns:inventoryPT”
operation="checkINV" inputVariable="inventoryRequest"
outputVariable="inventoryResponse" />

<invoke partnerLink="creditChecker" portType=“lns:creditPT"


operation="checkCRED" inputVariable="creditRequest"
outputVariable="creditResponse" />
</flow>
...
<reply partnerLink=“customer” portType=“lns:purchaseOrderPT”
operation=“sendPurchaseOrder” variable=“invoice"/>
</sequence>
Links – Control Flow
<flow>
<flow>
<links>
<link name="XtoY"/>
<link name="CtoD"/> <X>
</links>
<sequence name="X"> <A>
<source linkName="XtoY"/>
<invoke name="A" .../> <link XtoY>
<invoke name="B" .../> <B>
</sequence>
<sequence name"Y">
<target linkName="XtoY"/> <Y>
<receive name="C"/> <link CtoD>
<source linkName="CtoD"/> <C>
</receive>
<invoke name="E" .../>
</sequence> <E> <D>
<invoke partnerLink="D">
<target linkName="CtoD"/>
</invoke> </flow>
</flow>
Correlation
PO

initiate=yes Correlation: initiate=yes


<PO_CustId = 10>
<PO_OrdId = 100>

Customer Seller
• SendPurchase • AsynchPurchase
POResponse
• ProcessPurchaseResponse • AsynchPurchaseResponse

Correlations:
<PO_CustId = 10>
initiate=no <PO_OrdId = 100> initiate=no pattern=out
<Inv_VendId = 20>
initiate=yes <Inv_InvId = 200> initiate=yes pattern=out
Correlations in BPEL
<correlationSets>
<correlationSet name="POCorr" properties="cor:custId cor:ordId"/>
<correlationSet name="InvoiceCorr" properties="cor:vendId cor:invId"/>
</correlationSets> ...
<receive partnerLink=“Customer” portType="SP:PurchaseOrderPT"
operation="AsynchPurchase" variable="PO">
<correlations>
<correlation set="POCorr" initiate="yes">
</correlations>
</receive> ...
<invoke partnerLink=“Customer” portType="SP:CustomerPT"
operation=“ProcessPurchaseResponse" inputVariable="POResponse">
<correlations>
<correlation set="POCorr" initiate="no" pattern="out">
<correlation set="InvoiceCorr" initiate="yes" pattern="out">
</correlations>
</invoke> ...
Scopes in BPEL
<scope
y Provide a shared variableAccessSerializable="yes|no“
...>
context for subset of
<variables>
activities </variables>
y Can contain <correlationSets>? ...
– fault handlers </correlationSets>
– event handlers, <faultHandlers>
– compensation handler </faultHandlers>
variables <compensationHandler>? ...
– correlation sets </compensationHandler>

y Can serialize concurrent <eventHandlers>


</eventHandlers>
access to variables (activities)*

</scope>
Long Running Transactions
and Compensation
<scope> CreditService

Charge • CheckCredit
Hold Fee • ChargeHoldFee
Undo
• CancelHoldFee

InventoryService
Reserve
• ReserveInventory
Inventory Undo
• CancelReserveInv

</scope>
Compensation Handlers
in BPEL
<scope>
<compensationHandler>
<invoke partnerLink="Seller" portType="SP:Purchasing"
operation="CancelPurchase"
inputVariable="getResponse"
outputVariable="getConfirmation">
<correlations>
<correlation set="PurchaseOrder" pattern="out"/>
</correlations>
</invoke>
</compensationHandler>
<invoke partnerLink="Seller" portType="SP:Purchasing"
operation="SyncPurchase"
inputVariable="sendPO"
outputVariable="getResponse">
<correlations>
<correlation set="PurchaseOrder" initiate=“yes” pattern="out"/>
</correlations>
</invoke>
</scope>
Exception Handling in BPEL

y <faultHandlers> catch exception


– Based on WSDL port defining fault
y <faultHandlers> can perform activities upon
invocation
<faultHandlers>
<catch faultName="lns:cannotCompleteOrder"
faultVariable="POFault">
<reply partnerLink="customer"
portType="lns:purchaseOrderPT"
operation="sendPurchaseOrder"
variable="POFault"
faultName="cannotCompleteOrder"/>
</catch>
</faultHandlers>
Just Show Me How to Do it!

Process BPEL Scenario Compiled


WSDL 1. Compile BPEL Scenario
<process> 2. Package
Partner <partners> 3. Deploy
WSDL 1 <variables>
BPEL Runtime
<sequence>
... <flow>
</sequence> Application
Partner
</process> Server
WSDL n
Tooling Requirements

y IDE – build your Web services


y WSDL authoring – model your interfaces
y Schema authoring – model your messages
y Process modeling – model your orchestration
y Packaging and deployment
y Debugging
y Monitoring
y Analyzing
What Happened to Java?

y JSR 207 - Process Definition Language for


Java
y Make business processes natural for Java
programmers

Process Definition for Java

Servlet EJB

Transactions Messaging Security Naming Pooling

Application Server

Based on JSR 207 Session at JavaOne 2003


What Happened to J2EE?

y JSR 208 – Java Business Integration


y Make business processes a first class citizen
in J2EE containers
JSR 208
BPEL Transform Routing
... Machine SPI
Engine Engine Engine

Normalized
Message Bus

Binding Framework
JSR 208
Web ... Binding SPI
EDI JCA JMS
Services

Based on JSR 208 Session at JavaOne 2003


Oracle’s Strategy

y Oracle Application Server Containers for J2EE 10g


– BPEL runtime
y Oracle JDeveloper 10g
– BPEL design time
y Oracle Application Server ProcessConnect 10g
– Web service, B2B and EAI integration
Remember BPEL Does
Not Solve “World Hunger”
y No data transformation
y No data translation (EDI, binary formats …)
y No human workflow
y No trading partner agreements
y Silent on existing business protocols (ebXML,
RosettaNet …)
y Silent on non Web service interactions (e.g. java to
java)
y ...
But Remember: People Are
Trying to Solve “World Hunger”
y W3C: WS-Choreography
y Spec: WS-Transaction
y Spec: WS-Coordination
y Spec: WS-Composite Application Framework
y OASIS: WS-Reliability
y Spec: ReliableMessaging
y Spec: WS-Addressing
y OASIS: WS-Security
y …
Parting Thoughts

y Business process portability?


– Java/J2EE is portable across application servers
– BPEL is portable independent of Java
y Programming language in XML?
– Vendors, big and small, are busy building design
times and modelers…
y Is BPEL in 2003/2004 J2EE in 1998?
– Much missing but compelling foundation

You might also like