• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Web Services - Business Process Execution Language

Web Services - Business Process Execution Language






Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Web Services - Business Process Execution Language Web Services - Business Process Execution Language Presentation Transcript

    • Web Services (NSWI145)Lecture 09: WS BPELMartin Nečaský, Ph.D.Faculty of Mathematics and PhysicsCharles University in Prague, Czech RepublicSummer 2013
    • Core WS Technologies SOAP defines XML messaging protocol for basic webservice interoperability WSDL introduces common grammar for describing webservicesSummer 2013
    • Business Process Automation ordering of activities with beginning and endperformed to achieve business outcome has inputs and outputsSummer 2013
    • Business Process Automation WSDL provides only stateless model forparticular request-response message exchange, or uncorrelated one-way message exchange typical model of business interaction sequence of particular peer-to-peer messageexchanges• request-response and/or one-way stateful, long running interactions involving two ormore partiesSummer 2013
    • Business Process Automation core WS technologies allow automation ofonly particular message exchange we need additional WS technologies tosupport automation of whole businessprocesses core terms WS orchestration WS choreographySummer 2013
    • WS Orchestration specifies an executable process result is a web service view of one party that controls the process WS-BPEL: Web Services Business ProcessExecution LanguageSummer 2013
    • WS Choreography specifies a sequence of messages between collaboratingpartners and resources how they should communicate with each other not an executable process no particular view of particular partner WS-CDL: Web Services Choreography DescriptionLanguageSummer 2013
    • BPEL XML based language for orchestrating WebServices BPEL has two parts extensions to WSDL business process execution constructs BPEL script (internal process specification) +WSDL document (external process specification) define new Web Service implemented asorchestration of other Web Services requires WSDL 1.1 (WSDL 2.0 not supported)Summer 2013
    • Sample ProcessReceive Purchase OrderSend InvoiceCheck Credit CardProcess PaymentCalculate PurchaseOrder PriceArrange LogisticsSummer 2013
    • BPEL BPEL process = Abstract Web Service has WSDL description• port types composed of operations with inputs andoutputs• operates only on the level of WSDL portTypes– no binding to concrete services specified by WS-BPEL processdescription orchestrates other web servicesSummer 2013
    • Process Exposition with WSDL exposes BPEL process as a web servicedescribed with WSDL WSDL 1.1 file with few restrictions andextensions restrictions• no service and binding is defined• only types, messages, port types with operationsSummer 2013
    • Process Exposition with WSDLPurchaseOrderProcessPurchaseOrderPortTypesendPurchaseOrderOperationCustomerPurchase OrderInvoiceSummer 2013
    • Process Exposition with WSDL<wsdl:description targetNamespace="http://purchase" ...>...<wsdl:portType name="PurchaseOrderPortType"><wsdl:operation name="sendPurchaseOrderOperation"><wsdl:input name="pos:PurchaseOrder" /><wsdl:output name="pos:Invoice" /></wsdl:operation></wsdl:portType></wsdl:description>Summer 2013
    • Process Exposition with WSDL WSDL 1.1 file with few restrictions andextensions extensions• partner link type– characterization of conversational relationships betweenprocess and its partner• partner link type between process and web serviceutilized by process– two participants (process and web service) each with own role• partner link type between process and its client– one participant (process) with own roleSummer 2013
    • CreditCardServiceCreditCardPortTypecheckCreditCardOperationProcess Exposition with WSDLPurchaseOrderProcessCreditCardCallbackPortTypeprocessPaymentOperationconfirmCreditCardOperationCreditCardConfirmationconfirmPaymentOperationPaymentConfirmationpartner linktypeCreditCardPaymentSummer 2013
    • Process Exposition with WSDL<wsdl:description targetNamespace="http://purchase" ...>...<wsdl:portType name="CreditCardCallbackPortType"><wsdl:operation name="confirmCreditCardOperation"><wsdl:input name="cc:CreditCardConfirmation" /></wsdl:operation><wsdl:operation name="confirmPaymentOperation"><wsdl:input name="cc:PaymentConfirmation" /></wsdl:operation></wsdl:portType></wsdl:description>Summer 2013
    • Process Exposition with WSDL<wsdl:descriptiontargetNamespace="http://creditcard" ...>...<wsdl:portType name="CreditCardPortType"><wsdl:operation name="checkCreditCardOperation"><wsdl:input name="cc:CreditCard" /><wsdl:output name="cc:CreditCardConfirmation" /></wsdl:operation><wsdl:operation name="processPaymentOperation"><wsdl:input name="cc:Payment" /><wsdl:output name="cc:PaymentConfirmation" /></wsdl:operation></wsdl:portType></wsdl:description>Summer 2013
    • Process Exposition with WSDL element partnerLinkType WSDL extension specifies WSDL port types the process offers to and requiresfrom a partner service attribute name• unique name of the partner link type within the scope of theWSDL description two (typically) or one element role• each specifies role one of the communicating services acts• attribute name– unique name of the role within the partner link type• attribute portType– specifies WSDL port type the service acting in this role must offerSummer 2013
    • Process Exposition with WSDL<wsdl:description xmlns:plnk ="http://docs.oasis-open.org/wsbpel/2.0/plnktype">...<plnk:partnerLinkType name="CreditCardLinkType"><plnk:role name="CreditCardServiceRole"portType="cc:CreditCardPortType" /><plnk:role name="CreditCardClientRole"portType="pos:CreditCardCallbackPortType" /></plnk:partnerLinkType></wsdl:description>Summer 2013
    • Process Exposition with WSDL<wsdl:description xmlns:plnk ="http://docs.oasis-open.org/wsbpel/2.0/plnktype">...<plnk:partnerLinkType name="PurchaseOrderRequestLinkType"><plnk:role name="PurchaseOrderServiceRole"portType="pos:PurchaseOrderPortType" /></plnk:partnerLinkType></wsdl:description>Summer 2013
    • Process Definition root element process with four major sections: partnerLinks section• relationships from process to external partner services variables section• declaration of process data faultHandlers section• handlers for processing faults main activity• activity to be executed by the processSummer 2013
    • Process Exposition with WSDL<process xmlns ="http://docs.oasis-open.org/wsbpel/2.0/process/executable"><partnerLinks>...</partnerLinks><variables>...</variables><faultHandlers>...</faultHandlers><!–- {MAIN ACTIVITY} --></process>Summer 2013
    • Process Definition – Partner Link specified by element partnerLink models a link between the process and apartner service instance of a partner link type attribute name unique name of the partner link within theprocess attribute partnerLinkType reference to the partner link typeSummer 2013
    • Process Definition – Partner Link attribute myRole references the role in the partner link type actedby the process attribute partnerRole references the role in the partner link type actedby the partner serviceSummer 2013
    • Process Definition – Partner Link<process><partnerLinks><partnerLink name="CreditCardLink"partnerLinkType="pos:CreditCardLinkType"myRole="CreditCardClientRole"partnerRole="CreditCardServiceRole" />...</partnerLinks>...</process>Summer 2013
    • Process Definition – Partner Link<process><partnerLinks>...<partnerLink name="PurchaseOrderRequestLink"partnerLinkType="pos:PurchaseOrderRequestLinkType"myRole="PurchaseOrderServerRole" />...</partnerLinks>...</process>Summer 2013
    • Process Definition – Variable element variable variables hold data that constitute the state of theprocess attribute name• unique variable name content type of the variable specified as WSDLmessage type, XSD element or XSD simple/complextype• attribute messageType– reference to WSDL message type• attribute element– reference to XSD element declaration• attribute type– reference to XSD simple/complex type definitionSummer 2013
    • Process Definition – Variable<process><variables><variable name="PurchaseOrderMessage"messageType="pos:PurchaseOrder" /><variable name="CreditCardMessage"messageType="cc:CreditCard" /><variable name="CreditCardConfirmationMessage"messageType="cc:CreditCardConfirmation" /><variable name="InvoiceMessage"messageType="pos:Invoice" />... </variables>... </process>Summer 2013
    • Process Definition - Activities specify the process itself (main activity) or fault handling several types of activities: messaging activities• invoke, receive, reply, assign, … structured activities• sequence, flow, if, while, … fault activities• throw, exit, … compensation activities• compensate, …Summer 2013
    • Process Definition – invoke allows business process to call a partner service invokes one-way or request-response operation on a partners porttype attribute partnerLink specifies invoked partner port type attribute operation specifies invoked operation of the partner port type attribute inputVariable specifies variable with the input message can be replaced by toParts element with toPart child elements ifthe input message has more parts attribute outputVariable specifies variable with the output message can be replaced by fromParts element with fromPart childelements if the output message has more partsSummer 2013
    • Process Definition – invoke<process><invokename="CreditCardCheckInvoke"partnerLink="CreditCardLink"operation="checkCreditCard"inputVariable="CreditCardMessage"outputVariable="CreditCardConfirmationMessage" /></process>Summer 2013
    • Process Definition – receive allows business process to receive a messagefrom a partner service blocking activity attribute partnerLink specifies port type of the process that is awaitedto be invoked by the partner attribute operation specifies operation of the port type that is awaitedto be invoked by the partnerSummer 2013
    • Process Definition – receive attribute variable specifies variable where the arrival message willbe assigned attribute createInstance "yes"/"no" value if "yes" the activity creates new processinstanceSummer 2013
    • Process Definition – receive<process><receivename="PurchaseOrderRequestFromCustomer"partnerLink="PurchaseOrderRequestLink"operation="processPurchaseOrder"variable="PurchaseOrderMessage"createInstance="yes" /></process>Summer 2013
    • Process Definition – reply allows business process to send a message ina reply to a message that was received byreceive similar structure to invokeSummer 2013
    • Process Definition – reply<process><replyname="InvoiceReplyToCustomer"partnerLink="PurchaseOrderRequestLink"operation="processPurchaseOrder"variable="InvoiceMessage" /></process>Summer 2013
    • Process Definition – receive/reply implements request/response messageexchange pattern it is a pair if there are more pairs, distinguish them byattribute messageExchangeSummer 2013
    • Process Definition – assign allows updating values of variables with newdata copying data from one variable to another construct new data and copy them to a variable type validity checked element copy element from element toSummer 2013
    • Process Definition – assign several variants of from and to:1. from variable to variable<assign><copy><from variable="c1" /><to variable="c2" /></copy></assign>Summer 2013
    • Process Definition – assign several variants of from and to:2. from variable part to variable<assign><copy><from>$c1/lines/line[1]</from><to variable="c2" /></copy></assign>Summer 2013
    • Process Definition – assign several variants of from and to:3. from XSLT script to variable<assign><copy><from>bpel:doXslTransform(".../t.xsl", $c1)</from><to variable="c2" /></copy></assign>Summer 2013
    • Process Definition – sequence specifies activities to be performedsequentiallySummer 2013
    • Process Definition – sequence<process><sequence><receive name="PurchaseOrderRequestFromCustomer" ... /><assign><copy><from>$PurchaseOrderMessage/creditCard</from><to variable="CreditCardMessage" /></copy></assign><invoke name="CreditCardCheckInvoke" ... /><assign>...</assign><reply name="InvokeReplyToCustomer /></sequence> </process>Summer 2013
    • Process Definition – flow specifies one or more activities to beperformed concurrentlySummer 2013
    • Process Definition – flow<process><flow><sequence><invoke name="CreditCardCheckInvoke" ... /><invoke name="ProcessPaymentInvoke" ... /></sequence><invoke name="CalculatePriceInvoke" ... /><invoke name="LogisticsInvoke" ... /></flow></process>Summer 2013
    • Process Definition – flow element link declares synchronization dependency for flow attribute name• identifies dependency within flowSummer 2013
    • Process Definition – flow<process><flow><links><link name="PriceToPaymentLink" /></links>...</flow></process>Summer 2013
    • Process Definition – flow each activity may contain sources with one or moresource and targets with one or more target establish synchronization relations via links element source attribute linkName - specifies that the activity is sourceactivity of the link element target attribute linkName - specifies that the activity is targetactivity of the linkSummer 2013
    • Process Definition – flow for a given link, its target activities must waituntil its source activities have finishedSummer 2013
    • Process Definition – flow<process><flow>...<invoke name="CalculatePriceInvoke" ... ><sources><source name="PriceToPaymentLink" /></sources></invoke>...</flow></process>Summer 2013
    • Process Definition – flow<process><flow>...<sequence><invoke name="CreditCardCheckInvoke" ... /><invoke name="ProcessPaymentInvoke" ... ><targets><target name="PriceToPaymentLink" /></target></invoke></sequence>...</flow></process>Summer 2013
    • Process Definition – flow element joinCondition in targets contains logical expression specifying waitingconditionSummer 2013
    • Process Definition – flow<flow><links>...</links><sequence name="W"><targets><joinCondition>$XtoW and $YtoW</joinCondition><target linkName="XtoW" /><target linkName="YtoW" /></targets>...</sequence></flow>Summer 2013
    • Process Definition – flow element transitionCondition insource contains logical expression specifying condition forsetting the link to true (additional condition to"being finished")Summer 2013
    • Process Definition – flow<flow><links>...</links><sequence name="X"><sources><source linkName="XtoV"><transitionCondition>$c &gt; 1000</transitionCondition></source><source linkName="XtoW"><transitionCondition>$c &le; 1000</transitionCondition></source></sources>...</sequence></flow>Summer 2013
    • Process Definition – scope allows definition of local partnerlinks, variables and activitiesSummer 2013
    • Process Definition – if used to select exactly one activity from given branches branch = activity first branch is directly as child element condition contains logical expression condition for first branch activity element elseif element condition other branch activity under a condition element else last branchSummer 2013
    • Process Definition – if<if><invoke>...</invoke><condition>$PaymentMessage/price &gt; 1000</condition><elseif><invoke>...</invoke><condition>$PaymentMessage/price&gt;500</condition></elseif><else><invoke>...</invoke></else></if>Summer 2013
    • Process Definition – while used to define that the child activity is to berepeated as long as the specified condition istrue element condition contains logical expressionSummer 2013
    • Process Definition – while<while><condition>$c1 &gt; 1000</condition><sequence><invoke>...</invoke><assign><from>...</from><to>$c1</to></assign></sequence></while>Summer 2013
    • Process Definition – forEach iterates its child scope exactly N+1 timeswhere N is given by finalCounterValuechild element minus startCounterValuechild element iterated activity is in the child scope attribute parallel "yes"/"no" value if "yes" iterations are performed in parallel  flow with N+1 activities each for one iterationSummer 2013
    • Process Definition – forEach<forEach parallel="yes" countername="n"><startCounterValue>1</startCounterValue><finalCounterValue>count($PurchaseOrder//item)</finalCounterValue><scope>... variable $n with actual counter value ...... iterated activity ...</scope></forEach>Summer 2013
    • Advanced Concepts not presented in this lecture: fault handling event handling terminating processes undoing completed work (i.e. compensations) message correlation dynamic partner resolution abstract processesSummer 2013