introduction and advanced concepts of bpel
DESCRIPTION
BPEL is the de-facto standard for modeling executable Web services orchestrations. The XML-based language is used for the definition and execution of business processes, as well as scientific workflows using Web services. WSO2 Business Process Server (WSO2 BPS) and Apache Orchestration Director Engine (ODE) are two WS-BPEL-compliant business process executable workflow engines that support the composition of Web services by orchestrating service interactions.This tutorial will explore advanced concepts in WS-BPEL 2.0 and extensibility in WSO2 BPS, including: * Fault handling * Compensation handling * Selective, multiple, and concurrent event processing * Message correlation * Parallel processing * An introduction to ODE extensions * Future improvements with the extensionsTRANSCRIPT
![Page 1: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/1.jpg)
Introduction and Advanced
Concepts of BPEL
Denis Weerasiri & Waruna Ranasinghe
![Page 2: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/2.jpg)
Overview
• What is BPEL
• WSO2 Business Process Server
• Introduction to BPEL
• HelloWorld Sample
• Advanced Concepts of BPEL
• Fault Handling
• Compensation Handling
• Correlation and Async processes
• Extending WSO2 BPS
![Page 3: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/3.jpg)
What is BPEL
• An OASIS standard executable language for
business processes
• More or less a service composition language
• Enables composition of (business) services into
business processes
• XML based language
![Page 4: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/4.jpg)
Why Automate Business Processes
• Increase Efficiency
• No need to worry about the coordination of the
process
• Improve Responsiveness
• Business processes are agile
• Improve the process
• Adapt to the change of business needs
![Page 5: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/5.jpg)
Business Process wrt BPEL
Business Process is a collection of coordinated
service invocations and related activities that
produce a result, either within a single organization
or across several organizations
![Page 6: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/6.jpg)
Why BPEL
• Agility
• No need to worry about low level programming stuff.
• Native support for long running processes
• Compose larger business processes out of smaller
processes and services
• Handle message-related and time-related events
• Industry standard language for expressing
business processes
• Leverage common skill set
![Page 7: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/7.jpg)
Why BPEL
• Portability
• Managed execution
• Monitor the progress of the process
• Start, stop, suspend, resume process instance
![Page 8: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/8.jpg)
WSO2 Business Process Server
• Executes business processes written using WS-
BPEL standard
• Powered by Apache ODE
• Provide a web-based management console
• Deploy processes
• Manage and view business processes
• Manage and view process instances
• Configure QoS and many more…
![Page 9: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/9.jpg)
Why WSO2 BPS
• WSO2 Carbon Studio – BPEL Editor
• Drag and drop process modeler
• Native BPEL support
• XPath editor
• Deploy processes to WSO2 BPS
• Support both BPEL4WS 1.1 and WS-BPEL 2.0
• Graphical Management Console to:
• Deploy and manage business processes
• Manage and monitor process instances
• Configure QoS perameters
![Page 10: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/10.jpg)
Why WSO2 BPS
• Process dehydration
• Process versioning
• Follow open standards – avoid vender lock-in
• Support XQuery and Xpath, XSLT
• Support BPEL Extensions
• Features from WSO2 Carbon
![Page 11: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/11.jpg)
Want to implement Business Processes?
• What you should already know
• XML
• XML Namespaces
• XML Schema
• WSDL
• XPath
• XSLT and XQuery (optional)
![Page 12: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/12.jpg)
Introduction to BPEL
• BPEL Concepts
• Activities
• Basic Activities
• Structured Activities
• HelloWorld sample process
![Page 13: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/13.jpg)
BPEL Concepts
![Page 14: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/14.jpg)
Partner Links
• Defines the “Contact channels” between
external world (clients/partner services)
![Page 15: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/15.jpg)
Partner Links
• Associates interfaces (WSDL ports) with roles,
using PartnerLinkTypes
![Page 16: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/16.jpg)
PartnerLinkType
• Characterizes the conversational relationship
between two services
• Define the roles played by each of the services in
the conversation
<plnk:partnerLinkType name="BuyerSellerLink">
<plnk:role name="Buyer" portType="buy:BuyerPortType" />
<plnk:role name="Seller" portType="sell:SellerPortType" />
</plnk:partnerLinkType>
![Page 17: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/17.jpg)
PartnerLynkType
Seller Buyer
Process Partner Service
Invoke Seller
Send response to Buyer’s Callback
Seller Buyer
Process Partner Service
Invoke Seller
Async Sync
![Page 18: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/18.jpg)
Partner Link
• Associates with a partnerLinkType
<partnerLinks>
<partnerLink name=“BuyerSellerPL”
partnerLinkType=“BuyerSellerLink”
myRole=“Buyer”
partnerRole=“Seller”/>
</partnerLinks>
• Defines which role should be played by the
process itself and the partner service
![Page 19: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/19.jpg)
Variables and Data Manipulation
• Variables
• Statically typed(via WSDL Messages, XSD elements
and XSD types)
• Assigning values to variables
• When message is received from a partner
• Manipulate variables inside <assign> activity
• Require knowledge about XPath, XQuery, XSLT
![Page 20: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/20.jpg)
Activities in BPEL
• Basic Activities
• Structured Activities
![Page 21: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/21.jpg)
Basic Activities
• Receive
• Reply
• Invoke
• Assign
• Wait
• Empty
• Compensate
• Catch
• Throw
• Rethrow
• Exit
![Page 22: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/22.jpg)
Receive
• Act as the entry point to the business process
• Receives messages from an external partner
• Associated with
• PartnerLink with myRole
• WSDL operation
• Variable for the incoming message
• createInstance="yes" to create a new process
instance, otherwise the incoming message will be
consumed by the (already running) process
instance
![Page 23: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/23.jpg)
Reply
• Sends the response back to the client
• Always relates to a “receive” activity
• Associated with
• Same PartnerLink for the “receive”
• Same operation for the “receive”
• Variable for the output message
![Page 24: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/24.jpg)
Invoke
• Used to consume partner services
• Associated with
• PartnerLink with at least a “partnerRole”
• WSDL operation of the partner service
• Input variable
• Output variable, if the operation is request-
response
![Page 25: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/25.jpg)
Assign
• Used to manipulate variables
![Page 26: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/26.jpg)
Initializing Variables
• Variables contain a piece of XML
• Manipulated using Xpath
• XPath is evaluated on XML
• The variable should be initialized before copying
values to the internal elements.
![Page 27: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/27.jpg)
What we want
myProfile =
<profile>
<name>Waruna</name>
</profile>
![Page 28: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/28.jpg)
What we got
• String variable “name” – “Waruna”
• Variable “myProfile” – “”
• “myProfile” variable should be initialized before
copying the “name” variable into the “name”
element of “myProfile” variable
• $myProfile/profile/name
![Page 29: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/29.jpg)
Initialization
• myProfile =
<profile>
<name></name>
</profile>
• Then copy the “name” into “name” element of
the “myProfile” variable.
• $myProfile/profile/name
![Page 30: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/30.jpg)
Activities in BPEL
• Basic Activities
• Structured Activities
![Page 31: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/31.jpg)
Structured Activities
• Sequence
• Flow
• While
• RepeatUntil
• ForEach
• If
• Pick
• Scope
![Page 32: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/32.jpg)
Sequence
• Contained activities will be executed in an
ordered manner
![Page 33: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/33.jpg)
Flow
• Execute contained activities in parallel
![Page 34: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/34.jpg)
Looping
• While, RepeatUntil, ForEach
• Provides repeated execution of the contained
activity
![Page 35: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/35.jpg)
If
• Provides conditional behavior
![Page 36: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/36.jpg)
Pick
• Waits for the occurrence of exactly one event
from a set of events.
• OnMessage
• OnAlarm
![Page 37: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/37.jpg)
Scope
• Group activities into logical scopes
• Variables
• Partner Links
• Fault Handlers and Compensation Handlers
![Page 38: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/38.jpg)
HelloWorld Sample
![Page 39: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/39.jpg)
HelloWorld Sample
![Page 40: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/40.jpg)
Advanced Concepts
• Fault Handling
• Compensation
• Correlation and Async processes
• Extending WSO2 BPS
![Page 41: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/41.jpg)
Fault Handling
• Exceptional condition that can alter the normal
processing of a business process.
• Fault need not result in an immediate process
ending.
• If a fault is not handled, it will lead to
unexpected conditions and outcomes.
• Handle faults, so that failures lead to predictable
outcomes.
![Page 42: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/42.jpg)
Activities for Handling Faults
• Catch
• CatchAll
• Rethrow
• Throw
![Page 43: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/43.jpg)
Catch/CatchAll
• BPEL specific runtime faults
• SOAP faults
• Standard SOAP faults
• Application specific SOAP faults
• After catching a fault
• Try to correct
• Throw a new fault
• Rethrow the fault
• Reply with a fault message
![Page 44: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/44.jpg)
Catch/CatchAll
• Handle different types of faults in different ways.
• Multiple catch statements to catch different
types of faults.
• CatchAll activity to handle any type of Fault.
![Page 45: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/45.jpg)
Rethrow
• If the current fault handler cannot handle the
fault
• Propagate the fault to an outer-scoped fault
handler
• Available only within a fault handler
![Page 46: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/46.jpg)
Throw
• Indicates a problem that a business process flow
cannot handle
• Can be used any where within the process
• Can be thrown
• Standard BPEL faults
• Custom faults
• Variable can be associated to send fault
information
![Page 47: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/47.jpg)
Fault Handlers Attached to Invoke Activity
• Handle faults specific to Invoke activity
• SOAP faults
![Page 48: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/48.jpg)
Fault Handlers attached to Scope
• Catches faults resulting from activities within a
scope.
![Page 49: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/49.jpg)
Global Fault Handler
• Last place for a fault to be captured.
• Faults propagate from the inner scopes to the
outer scopes
![Page 50: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/50.jpg)
Fault Types in Invoke Activity
• Faults
• BPEL standard faults
• SOAP faults
• Failures
• Connection refused
• Service not found
![Page 51: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/51.jpg)
Fault Handling Sample
![Page 52: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/52.jpg)
Compensation
• Undoing the steps in business process that have
been already completed
![Page 53: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/53.jpg)
Activities for Compensation Handling
• compensationHandler – defines the compensation
logic per each scope
• compensateScope and compensate - used to
trigger the compensationHandler.
![Page 54: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/54.jpg)
Compensation Handling Sample
![Page 55: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/55.jpg)
Asynchronous Invocation
• What Asynchrony is.
• Different asynchronous transport protocols
eg – JMS, SMTP, XMPP
• Modeling asynchronous behavior in WSDLs
eg – by two one-way operations
![Page 56: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/56.jpg)
Asynchronous Invocations in BPELs
• Invoke activity to invoke the partner-service
• Receive activity to act as the call-back handler
• So how these two messages get correlated?
![Page 57: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/57.jpg)
Message Correlation
• Building block for stateful conversations in BPELs
• Determine to which conversation a message
belongs
![Page 58: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/58.jpg)
Message Correlation Sets
• correlationSet - defines the element(s) in
message to act as a unique-id for each message
• correlation - handles the message correlation
between each conversation
![Page 59: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/59.jpg)
Correlation sample
![Page 60: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/60.jpg)
Extending WSO2 BPS
• BPEL extensions
• Enable to define new BPEL activities
• peopleActivity for BPEL4People
• BPEL event listeners
• Enables to listen to events fired by BPEL engine
• Gather information for BAM
• Message exchange interceptors
• Enables to intercept through the message exchanges
• XPath extensions
![Page 61: Introduction and Advanced Concepts of BPEL](https://reader034.vdocument.in/reader034/viewer/2022051513/5472db4eb4af9f9d0a8b5092/html5/thumbnails/61.jpg)
Q & A