Upload
cady
View
30
Download
1
Embed Size (px)
DESCRIPTION
Introduction to WS-BPEL and WSO2 BPS. Kasun Indrasiri Associate Technical Lead PMC, Apache Synapse Member, Integration MC WSO2 Inc. May 2013. Agenda. What is a Business Process / WS-BPEL WSO2 Business Process Server Introduction to BPEL - PowerPoint PPT Presentation
Citation preview
Kasun IndrasiriAssociate Technical LeadPMC, Apache SynapseMember, Integration MCWSO2 Inc.May 2013
Introduction to WS-BPEL and WSO2 BPS
Agenda
• What is a Business Process / WS-BPEL• WSO2 Business Process Server• Introduction to BPEL• Developing Business Processes with WSO2 Developer Studio
Business Process
• Business process is a set of logically related activities• These activities are performed in a predefined order to achieve a
business goal
Example process
Orchestration vs. Choreography
• Orchestration– Business process with central
coordinator– WS-BPEL
• Choreography– Business collaboration
WS-BPEL
• Business Process Execution Language• An Oasis standard• XML based language for service composition • BPEL defines xml based grammar for describing the logic to
coordinate and control interactions between Web Services• Create, Consume and Aggregate services
Why use WS-BPEL
• Increase efficiency of business– No need to worry about the coordination of the process
• Portable business processes– Built on top of standard compliant web services infrastructure
• Industry wide language for implementing business processes– Common skill set
• Native support for long running processes– Execute asynchronous processes that takes days to complete
• Managed execution
WSO2 Business Process Server
• Executes business processes written using WS-BPEL standard• Powered by Apache ODE ( ode.apache.org )• WS-Human Tasks and BPEL4People• Provides a Management Console to
– View and Manage Processes / Human Tasks– View and Manage Instances / Tasks – Configure QOS …
Introduction to WS-BPEL
Want to implement a BPEL Process ?
• You should have some knowledge on – XML– XML Namespaces– XML Schema– WSDL– XPath– XSLT
Structure of a WSDL
• <types> • <message/>+• <portType><operation>+</portType>• <binding/>+• <service><port/></service>
BPEL Document Structure
<process><partnerLinks><partnerLinks><variables></variables><messageExchanges></messageExchanges><correlationSets></correlationSets><faultHandlers></faultHandlers><compensationHandlers></compensationHandlers><eventHandlers></eventHandlers>(activities)*</process>
BPEL Process
<process name="NCName" targetNamespace="anyURI"queryLanguage="anyURI"?expressionLanguage="anyURI"?suppressJoinFailure="yes|no"?exitOnStandardFault="yes|no"?xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/
executable"></process>
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>
PartnerLinkType
SellerBuyer
Process Partner Service
Invoke Seller
Send response to Buyer’s Callback
SellerBuyer
Process Partner Service
Invoke Seller
Async Sync
PartnerLinks
• Define the relationship between the participating web services ( partners ) and the business process– myrole “business process’s role”– partnerRole “partner service’s role”
• Associates interfaces (WSDL ports) with roles, using PartnerLinkTypes
Partner Links
Partner Link
• Partner Link Associates with a partner link type<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
Variables
• Variables used by the process to keep the state• Statically typed via
– WSDL Message Types– XML Schema Types– XML Schema elements
• Variables can be “global” to the process or “local” to the scope
Variables
• Assigning values to variables– When message is received from a partner– Manipulate variables inside <assign> activity– Require knowledge about Xpath , XSLT
Activities
• Activities perform the process logic• Basic Activities
– describe elemental steps in the process behavior• Structured Activities
– control-flow logic – may contain other basic or structured activities
Basic Activities
• Receive• Reply• Invoke• Assign• Empty• Compensate• Catch
• Throw• Rethrow• Exit
Receive
• Receive messages from an external party– Could be an external partner or the initiator of the business process
• Acts as the entry point to the process. • Associated with
– PartnerLink with MyRole– WSDL operation– Variable for the incoming message
• createInstance=“yes” to create a new process instance. Otherwise, the message will be consumed by an already running process instance
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
Invoke
• Used to consume (invoke) 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
Assign
• Used to manipulate variables
Initializing Variables
• Variables contain a piece of XML• Manipulated using XPath• XPath is evaluated on XML• A variable should be initialized before copying values to the internal
elements.
Expected Content
• echoRequest= <p:echoString xmlns:p="http://echo.services.core.carbon.wso2.org">
<in>HelloWorld</in> </p:echoString>• First we should initialize the variable ‘echoRequest’ before copying
the string value “HelloWorld” to it. • $echoRequest/p:echoString/in
Structured Activities
• Sequence• While• Pick• Flow• Scope• If• ForEach• RepeatUntil• Compensate• Link
Sequence
• Used to define a set of activities to be executed in a strict ordered sequence
• Can contain both basic and structured activities nested to arbitrary depth<sequence standard-attributes>
standard-elementsactivity+
</sequence>• Contained activities are executed in the order they are defined• Completes when the last activity has completed
Sequence
Flow
• Used to define a set of activities that will execute concurrently• Further allows synchronization of dependencies between activities
– When one activity finishes, another activity starts• Directly nested activities are started concurrently as soon as the flow
activity is started• Flow activity completes when all nested activities complete
Flow
If
• Used to express a service of alternative choices of which exactly one is executed– Primary conditional branch specified by condition element – followed by• Unlimited number of elseif branches
– Each with its own condition expression
• One else branch
If
Looping
• Looping executes a subset of the process multiple times in a controlled manner– ForEach– repeatUntil– while
ForEach
While
RepeatUntil
Pick
• Waits for the occurrence of exactly one event from a set of events.
Pick
• Used to have the process wait until one of a set of events is triggered – Message events via onMessage element– Alarm events via onAlarm element
• Can be used to initiate a process instance– If createInstance=“yes” , a new process instance is create upon the reception of
one of a set of possible messages– Each on message is equivalent to a receive activity with the
createInstance=“yes”– No alarms are permitted in the case
Scope
• Used to group activities into logically organized sections– Encapsulates a possibly compensatable, recoverable unit of work
• Provide processing context for– Variables– PartnerLinks– FaultHandlers and Compensation handlers
Scope
Developing BPEL Process
Contents of a BPEL Package
• Process definition file ( .bpel file )• Related WSDL files• Process deployment descriptor ( deploy.xml )• Optional files
– Unified endpoint files ( .epr )– Service QOS file (services.xml)– XSL files
Deploy.xml
HelloWorld Sample
• Generate a Synchronous BPEL Process using Developer studio wizard• Implement ‘assign’ Logic
Invoking an External Partner
Invoking a Partner Service
• Generate BPEL process using the synchronous process template• Add an invoke activity with two assign activities• Create a PartnerLink and PartnerLinkType• Use echo service that comes with the BPS as the external service• Deploy and execute the process
Invoking a Partner Service
Q & A
Thank You