400 likes | 416 Views
This workshop explores the motivations, main concepts, examples, status, and support of WS-BPEL 2.0, a language for orchestrating web services in business processes.
E N D
www.oasis-open.org WS-BPEL 2.0 Web ServicesBusiness Process Execution Language Workshop Dieter König, IBM Senior Technical Staff Member (dieterkoenig@de.ibm.com) Charlton Barreto, Adobe Senior Computer Scientist/Architect (charltonb@adobe.com)
WS-BPEL 2.0 • Motivation • OASIS and WS-BPEL • Main Concepts • Examples • Status and support
Motivation • Integration continues to be a key problem facing businesses • Intra-enterprise integration (Enterprise Application Integration) • Integrating with partners (Business-to-Business Integration) • Syndication • Web services move towards service-oriented computing • Applications are viewed as “services” • Loosely coupled, dynamic interactions • Heterogeneous platforms • No single party has complete control • Service composition • How do you compose services in this domain?
Concerns addressed by BPEL • BPEL processes can automate both simple and complex interactions between Web services • Supporting long running business transactions • Correlating message exchanges • Implementing parallel processing of activities • Mapping data between partner interactions • Providing consistent exception and recovery handling
Why the Need For BPEL? • WSDL defined Web services have a stateless interaction model • Messages are exchanged using • Synchronous invocation • Uncorrelated asynchronous invocations • Most “real-world” business processes require a more robust interaction model • Messages exchanged in a two-way, peer-to-peer conversation lasting minutes, hours, days, etc. • BPEL provides the ability to express stateful, long-running interactions
Two programming models • Programming in the large • Non-programmers implementing flows • Flow logic deals with combining functions in order to solve a more complex problem (such as processing an order) • Programming in the small • Programmers implementing functions • Function logic deals with a discrete fine-grained task (such as retrieving an order document or updating a customer record)
Process Usage Patterns • Aiming for a single approach for both • Executable processes • Contain the partner’s business logic behind an external protocol • Abstract processes • Define the publicly visible behavior of some or all of the services an executable process offers • Define a process template embodying domain-specific best practices
Process Model Requirements • Portability and Interoperability • Flexible Integration • Rich, and easily adaptable to changes in underlying services • Recursive, type-based composition, enables • Third-party composition of existing services • Providing different views on a composition to different parties • Increased scalability and reuse • Stateful conversations and lifecycle management • Supports multiple stateful long-running conversations • Recoverability • Long running business processes need fault handling and compensation mechanisms to manage and recover from errors
Benefits of BPEL • Industry standard language for expressing business processes • Leverage a common skill set and language • Designed to fit naturally into the Web services stack • Expressed entirely in XML • Uses and extends WSDL 1.1 • Uses XML Schema 1.0 for the data model • Portable across platform and vendor • Will run on any BPEL-compliant engine • Interoperable between interacting processes • Layering on top of Web services stack
WS-BPEL 2.0 BPEL Historical Timeline Dec 2000 Microsoft publishes XLANG March 2001 IBM publishes WSFL July 2002 IBM, Microsoft and BEA converge WSFL & XLANG into BPEL4WS 1.0 March 2003 BPEL4WS is submitted to OASIS May 2003 OASIS publishes BPEL4WS 1.1 1stH 2007 WS-BPEL 2.0 released • BPEL is the Web Services Orchestration standard from OASIS • bee•pel’, beep’•uhl, bip’•uhl • An XML-based grammar for describing the logic to orchestrate the interaction between Web services in a business process
WS-BPEL in the WS-* Stack WS-BPEL Business Processes You are here WSDL, Policy, UDDI, Inspection Description Security Reliable Messaging Transactions Quality Of Service Coordination SOAP (Logical Messaging) Other protocols Transport and Encoding Other services XML, Encoding
WS-BPEL 2.0 • Motivation • OASIS and WS-BPEL • Main Concepts • Examples • Status and support
Getting the Players Together (*) BPEL 1.1 WS-BPEL 2.0 (*) BPEL 1.1 authors, May 2003
WS-BPEL 2.0 • Motivation • OASIS and WS-BPEL • Main Concepts • Examples • Status and support
WS-BPEL Language Structure • Process • Partner links • Data handling • Properties and correlation • Basic and structured activities • Scopes
Variables WSDL Message Partner Links Basic Activities receive exit 42 reply throw XML Schema Type XML Schema Element partner link partner link invoke rethrow assign wait validate compensate Partner Link Type MyProcess Port Type 1 Port Type 2 empty compensateScope receive extensionActivity invoke receive invoke Structured Activities Handlers flow pick invoke event handler fault handler event handler fault handler forEach sequence Properties Correlation Sets if-else while compensation handler termination handler repeatUntil scope Property 1 Property 2 WS-BPEL 2.0
Declare dependencies on external XML Schema or WSDL definitions Declare namespaces of WS-BPEL extension attributes and elements extensions imports Relationship between inbound and outbound message activities Relationships that a WS-BPEL process will employ in its behavior partner links message exchanges Application data fields that together identify a conversation Data holding state of a business process or exchanged with partners correlation sets variables Concurrently process inbound messages or timer alarms fault handlers event handlers Deal with exceptional situations in a process WSDL definitions Perform the process logic – any number of activities may be recursively nested primary activity XML schemas WS-BPEL Process Definition process
Relationship with WSDL • BPEL is layered on top of and extends the WSDL service model • WSDL defines the specific operations allowed • BPEL defines how WSDL operations are orchestrated to satisfy a business process • BPEL also specifies extensions to WSDL in support of long-running asynchronous business processes BPEL 2.0 WSDL 1.1 BPEL-defined WSDL extensions
Recursive Composition • BPEL processes interact with WSDL services exposed by business partners Interfaces exposed by the BPEL process Interfaces consumed by the BPEL process WSDL Loan Approval PortType Web Service Web Service Loan Approval Process receive Financial Institution‘s Web Service (Loan Approver) invoke reply
Composition of Web Services Service A Service P Service B receive invoke receive invoke invoke A’s WSDL P’s WSDL B’s WSDL Partner Link Type Partner Link Type
process Peer-to-peer conversational partner relationship partner link invoke receive Outbound request – service required by the process Inbound request – service provided by the process partner link type WSDL port type myRole WSDL port type partnerRole Provided port type Required port type Partner Links
Variables defined using WSDL messages request request invoke receive response 42 response reply assign WSDL messages XML Schema elements / types 42 WSDL message XML schemas WSDL message Variables defined using XML schema elements or types Variables process xsl:transform
A property creates a name that has semantic significance beyond an XML schema type Properties isolate the process logic from the details of a variable definition getVariableProperty( variable, property ) WSDL message property alias ... property part part part Typed properties are mapped (aliased) to parts of WSDL messages or XML schema elements XML schema element property alias property Variable Properties process
Submit purchase order process instance 1 purchaseOrder cId = 0815 orderNo = 42 process instance 2 receive correlation set customerId customerId orderNumber orderNumber locate process instance 3 process instance 3 receive queryOrderStatus custId = 0815 Messages in long-running conversations are correlated to the correct process instance (0311, 33) 1 oNo = 42 process instance 4 (0707, 11) 2 (0815, 42) 3 (0815, 49) 4 Query order status Properties and Correlation Sets How to identify stateful instances via stateless Web service interfaces? process initiate
Do a blocking wait for a matching message to arrive / send a message in reply Immediately terminate execution of a business process instance receive reply exit Invoke compensation on all completed child scopes in default order Invoke a one-way or request-response operation invoke compensate Update the values of variables or partner links with new data Invoke compensation on one completed child scope assign compensateScope Wait for a given time period or until a certain time has passed Validate XML data stored in variables wait validate Generate a fault from inside the business process throw empty No-op instruction fora business process Wrapper for language extensions Forward a fault from inside a fault handler rethrow extensionActivity Basic Activities process
Contained activities are executed in parallel, partially ordered through control links flow pick Block and wait for a suitable message to arrive (or time out) A C M1 M2 A B Contained activities are performed sequentially in lexical order sequence Contained activity is performed sequentially or in parallel, controlled by a specified counter variable forEach … … 1. 2. N. 1. 2. N. Contained activity is repeated while a predicate holds while if-elseif-else Select exactly one branch of activity from a set of choices c c1 c2 Contained activity is repeated until a predicate holds repeatUntil scope Associate contained activity with its own local variables, partner links, etc., and handlers c Structured Activities process … …
Nesting Structured Activities sequence <sequence> <receive .../> <flow> <sequence> <invoke .../> <while ... > <assign>...</assign> </while> </sequence> <sequence> <receive .../> <invoke ... /> </sequence> </flow> <reply .../> </sequence> receive flow sequence sequence invoke receive invoke while assign reply
scope scope Local declarations – partner links, message exchanges, variables, correlation sets scope scope Local handlers – event handlers, fault handlers, a termination handler, and a compensation handler primary activity scope scope scope Termination handler to deal with forced scope termination (external faults) scope scope Compensation handler to undo persisted effects of already completed activities Scopes Scopes provide a context which influences the execution behavior of its enclosed activities process Isolated scopes provide control of concurrent access to shared resources
Process Instance Lifecycle • Business processes defined in BPEL represent stateful Web services • When a process is started, a new instance is created according to the process definition • The creation and destruction of BPEL process instances is by design implicit Process receive invoke invoke invoke reply
WS-BPEL 2.0 • Motivation • OASIS and WS-BPEL • Main Concepts • Examples • Status and support
Graph-Oriented Authoring Style flow riskAssessmentPT loanApprovalPT amount < 10000 amount >= 10000 receive loan assessor loan approver risk = "high" invoke invoke assign risk = "low" approved = "true" approved = "false" reply 1. A customer asks for a loan, providing name and amount info 2. Two services are involved: a) A risk assessor which can approve the loan if the risk is low b) A loan approver which checks the name and approves/disapproves the loan 3. The reply is returned to the customer
scope event handler scope scope event handler event handler scope scope event handler scope event handler scope scope event handler event handler event handler event handler event handler event handler Parallel Processing flow parallel forEach scope . . . . . . . . . . . . . . . . . .
Fault Handling & Compensation Process sequence fault handler notify manager scope scope compensation handler fault handler compensate charge credit card refund customer rethrow ship goods
assign EPR B-role assign EPR Partner Link Type partner link partner link A-role Dynamic Partner Link Assignment Process A Process B PortType-B invoke service receive request receive response invoke callback PortType-A
Abstract & Executable Processes • Executable Processes • Contain the partner’s business logic behind an external protocol • Model actual behavior of a participant in a business interaction • Encompass enough detail to fully specify execution
Abstract & Executable Processes • Abstract Processes • Partially specified processes that are not intended to be executed • May hide some of the required concrete operational details • Serve a descriptive role • Used to guide executable processes • More than one possible use case
plan trip select airline reserve seats charge credit card Travel Reservation - Example Abstract Process View Executable Processes View Traveler Process Agent Process Airline Process get itinerary get order submit to agent order tickets receive confirmation receive tickets receive confirmation confirm flight send confirmation send tickets
Abstract Profiles • Profiles address varying requirements among Abstract Processes • Two profiles provided in WS-BPEL • Observable Behavior • Process Template
Abstract Profiles & Use Cases • Use cases • Constraints on message exchange • Specify order in which messages are consumed or produced • View on internal processes • Only projection of internal (executable) process is visible • Bridge model to executable • Provide hooks to executable for model definition to enable abstraction • Template as “best practice” • Specification of common activities, major data structures, and main control flow