1 / 45

Service Composition

Service Composition. Contents. Service composition Purchase Order process overview Main concepts in BPEL Advanced concepts in BPEL. Web services. The goal of the Web Services effort is to achieve interoperability between applications by using Web standards. business-to-consumer

clover
Download Presentation

Service Composition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Service Composition

  2. Contents • Service composition • Purchase Order process overview • Main concepts in BPEL • Advanced concepts in BPEL

  3. Web services • The goal of the Web Services effort is to achieve interoperability between applications by using Web standards. • business-to-consumer • business-to-business • enterprise application integration • Building blocks • SOAP • WSDL • UDDI

  4. Service composition • Systems integration requires more than the ability to conduct simple interactions by using standard protocols. • The full potential of Web Services as an integration platform will be achieved only when applications and business processes are able to integrate their complex interactions by using a standard process integration model.

  5. Service composition Tourism Agent Hotel Airlines Car rental

  6. Composition types Orchestration Choreography

  7. Composition middleware Company B Company A Web service Web service Composite WS Company C Composition engine Web service WS middleware Company D Web service

  8. Main elements of composition middleware • A composition model and language • A development environment • A run-time environment

  9. BPEL • Business Process Execution Language • OASIS standard executable language for specifying actions within business processes with web services Developed using BPEL

  10. BPEL BPEL specification defines • The different roles taking part in the messages exchanges with the process • The port types that must be supported by the different roles and by the process itself • The orchestration and the other different aspect • Correlation information, defining how messages can be routed to the correct composition instances

  11. BPEL Tools&Engines • Apache ODE • AvtiveVOS • Open ESB • WSO2 • BizTalk Server • Oracle BPEL Process Manager

  12. Example: Purchase Order (PO) Service receive purchase order concurrency sequencing initiate price calculation decide on shipper initiate production scheduling complete price calculation arrange logistics complete production scheduling synchronization invoice processing, reply

  13. PO Service PO Service receive synchronous invocation POMesssage Body of PO Service customer operation sendPurchOr on interface purchOrIf InvMessage reply

  14. PO Service Interface • <wsdl:definitions targetNamespace="http://manufacturing.org/wsdl/purchase" xmlns:sns="http://manufacturing.org/xsd/purchase" xmlns:pos="http://manufacturing.org/wsdl/purchase" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> … • </wsdl:definitions>

  15. PO Service Interface <wsdl:messagename="POMessage"> <wsdl:partname="customerInfo" type="sns:customerInfoType" /> <wsdl:partname="purchaseOrder" type="sns:purchaseOrderType" /> </wsdl:message> <wsdl:messagename="InvMessage"> <wsdl:partname="IVC" type="sns:InvoiceType" /> </wsdl:message> <wsdl:messagename="orderFaultType"> <wsdl:partname="problemInfo" element=”sns:OrderFault" /> </wsdl:message> <wsdl:portType name="purchaseOrderPT"> <wsdl:operation name="sendPurchaseOrder"> <wsdl:input message="pos:POMessage" /> <wsdl:output message="pos:InvMessage" /> <wsdl:fault name="cannotCompleteOrder" message="pos:orderFaultType" /> </wsdl:operation> </wsdl:portType> interface exported by PO Service

  16. Partner Link Type <partnerLinkType> describes the way two services interact: - names an interface that must be declared in each - associates <role> with each end of the interaction <plnk:partnerLinkTypename="purchasingLT"> <plnk:rolename="purchaseService" portType="pos:purchaseOrderPT" /> </plnk:partnerLinkType>

  17. Partner Link Type <plnk:partnerLinkType name="invoicingLT"> <plnk:role name="invoiceService" portType="pos:computePricePT" /> <plnk:role name="invoiceRequester" portType="pos:invoiceCallbackPT" /> </plnk:partnerLinkType> description of a possible relationship between two services Invoice requester Invoice service invoiceCallbackPT computePricePT

  18. Process Name Each BP is assigned a name in the <process> tag <process name="purchaseOrderProcess" targetNamespace="http://example.com/ws-bp/purchase" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:lns="http://manufacturing.org/wsdl/purchase"> … • </process>

  19. Partner Link <partnerLink> construct in BPEL names a process and associates it with a role in that link. • <partnerLinks> • <partnerLink name="purchasing" • partnerLinkType="lns:purchasingLT" myRole="purchaseService" /> • <!-- other partnerLink’s go here --> • </partnerLinks>

  20. Linkage: Customer to PO Service <plnk:partnerLinkType name="purchasingLT"> <plnk:role name="purchaseService" portType="pos:purchaseOrderPT" /> </plnk:partnerLinkType> WSDL inter- face exported by PO Service partner specification in customer process <partnerLinkname=“linkToPurchase" partnerLinkType="lns:purchasingLT" partnerRole="purchaseService" /> partner specification in PO Service <partnerLink name="purchasingLink” partnerLinkType="lns:purchasingLT" myRole="purchaseService" />

  21. Partners • In general: • A partnerLinkTypeis not specific to a particular BP; it is a global, bilateral (WSDL) description of the interaction between two BPs. • A partnerLink declaration (BPEL) describes how the local BP interacts with other BPs through a partnerLinkType. <partnerLinks> <partnerLink name="purchasing" partnerLinkType="lns:purchasingLT" myRole="purchaseService" /> <partnerLink name="shipping" partnerLinkType="lns:shippingLT" myRole="shippingRequester" partnerRole="shippingService" /> </partnerLinks>

  22. State of a BPEL Process Variables <variables> <variable name="myVar1" messageType="myNS:myWSDLMessageDataType" /> <variable name="myVar1" element="myNS:myXMLElement" /> <variable name="myVar2" type="xsd:string" /> <variable name="myVar2" type="myNS:myComplexType" /> </variables>

  23. Behavior of a BPEL Process Providing and Consuming Web Services Receive activity <receive name="ReceiveRequestFromPartner" createInstance="yes" partnerLink="ClientStartUpPLT" operation="StartProcess" ... /> Reply activity <reply name="ReplyResponseToPartner" partnerLink="ClientStartUpPLT" operation="StartProcess" ... /> Invoke activity <invoke name="RequestResponseInvoke" partnerLink="BusinessPartnerServiceLink" operation="RequestResponseOperation" inputVariable="Input" outputVariable="Output" />

  24. Behavior of a BPEL Process Structuring the Process Logic Sequence activity <sequence name="InvertMessageOrder"> <receive name="receiveOrder" ... /> <invoke name="checkPayment" ... /> <invoke name="shippingService" ... /> <reply name="sendConfirmation" ... /> </sequence> Flow activity <flow ...> <invoke name="checkFlight" ... /> <invoke name="checkHotel" ... /> <invoke name="checkRentalCar" ... /> </flow>

  25. Behavior of a BPEL Process If-else activity <if name="isOrderBiggerThan5000Dollars"> <condition> $order &gt; 5000 </condition> <invoke name="calculateTenPercentDiscount" ... /> <elseif> <condition> $order &gt; 2500 </condition> <invoke name="calculateFivePercentDiscount" ... /> </elseif> <else> <reply name="sendNoDiscountInformation" ... /> </else> </if>

  26. Behavior of a BPEL Process Data Manipulation Assign activity <assign> <copy> <from variable="Input" part="operation1Parameter"> <query> creditCardInformation </query> </from> <to variable="CreditCardServiceInput" /> </copy> </assign>

  27. PO Service (BPEL) <variables> <variable name="PO" messageType="lns:POMessage" /> <variable name="Invoice" messageType="lns:InvMessage" /> </variables> <sequence> <receive partnerLink="purchasing" portType="lns:purchaseOrderPT" operation="sendPurchaseOrder" variable="PO“> </receive> • <flow> … concurrent body ….</flow> <reply partnerLink="purchasing" portType="lns:purchaseOrderPT" operation="sendPurchaseOrder" variable="Invoice"> </reply> </sequence>

  28. Interaction with Shipping Provider operation requestShipping on interface shippingPT decide on shipper (invoke) shippingRequestMessage shippingProvider shippingInfoMessage scheduleMessage arrange logisitics (receive) role = shippingService operation sendSchedule on port shippingCallbackPT role = shippingRequester

  29. Handling Shipping <wsdl:portTypename="shippingCallbackPT"> <wsdl:operationname="sendSchedule"> <wsdl:inputmessage="pos:scheduleMessage" /> </wsdl:operation> </wsdl:portType> interface exported by PO Service <wsdl:portTypename="shippingPT"> <wsdl:operationname="requestShipping"> <wsdl:inputmessage="pos:shippingRequestMessage" /> <wsdl:outputmessage="pos:shippingInfoMessage" /> • </wsdl:operation> </wsdl:portType> interface imported from shipping service

  30. Handling Shipping <plnk:partnerLinkType name="shippingLT"> <plnk:role name="shippingService“ portType="pos:shippingPT" /> <plnk:role name="shippingRequester“ portType="pos:shippingCallbackPT" /> </plnk:partnerLinkType> WSDL <partnerLinks> <partnerLink name="shipping" partnerLinkType="lns:shippingLT" myRole="shippingRequester" partnerRole="shippingService" /> </partnerLinks> BPEL

  31. Handling Shipping <sequence> <assign> <copy> <from>$PO.customerInfo</from> <to>$shippingRequest.customerInfo</to> </copy> </assign> <invoke partnerLink="shipping" portType="lns:shippingPT" operation="requestShipping" inputVariable="shippingRequest" outputVariable="shippingInfo"> </invoke> <receive partnerLink="shipping" portType="lns:shippingCallbackPT" operation="sendSchedule" variable="shippingSchedule"> </receive> </sequence>

  32. Links Production scheduling cannot be completed until logistics have been arranged Concurrent sequence activities in flow • data produced by arrange logistics is needed by complete production scheduling • data communicated through globally shared variable decide on shipper initiate production scheduling arrange logistics complete production scheduling link source target

  33. Links • <flow> • <links> • <link name="ship-to-scheduling" /> • </links> • <sequence> • <assign> … </assign> • <receive partnerLink="shipping“ …> • <sources> • <source linkName="ship-to-scheduling”/> • </sources> • </receive> • </sequence> • <sequence> • <invoke partnerLink="scheduling“ …> • <targets> • <target linkName="ship-to-scheduling" /> • </targets> • </invoke> • </sequence> • </flow>

  34. Links Transition condition • <source linkName="request-to-approve"> • <transitionCondition> • $creditVariable/value &lt; 5000 • </transitionCondition> • </source> Join condition • <targets> • <joinCondition> • $approve-to-notify or $decline-to-notify • </joinCondition> • <target linkName="approve-to-notify" /> • <target linkName="decline-to-notify" /> • </targets>

  35. <flow ...> • <links> • <link name="request-to-approve" /> • <link name="request-to-decline" /> • <link name="approve-to-notify" /> • <link name="decline-to-notify" /> • </links> • <receive name="ReceiveCreditRequest" • createInstance="yes" • partnerLink="creditRequestPLT" • operation="creditRequest" • variable="creditVariable"> • <sources> • <source linkName="request-to-approve"> • <transitionCondition> • $creditVariable/value &lt; 5000 • </transitionCondition> • </source> • <source linkName="request-to-decline"> • <transitionCondition> • $creditVariable/value &ge; 5000 • </transitionCondition> • </source> • </sources> • </receive> <invoke name="approveCredit" ...> <source linkName="approve-to-notify" /> <targets> <target linkName="request-to-approve" /> </targets> </invoke> <invoke name="declineCredit" ...> <source linkName=“decline-to-notify" /> <targets> <target linkName="request-to-decline" /> </targets> </invoke> <reply name="notifyApplicant" ...> <targets> <joinCondition> $approve-to-notify or $decline-to-notify </joinCondition> <target linkName="approve-to-notify" /> <target linkName="decline-to-notify" /> </targets> </invoke> </reply> </flow>

  36. Exception Handling <faultHandlers> <catch faultName="lns:cannotCompleteOrder" faultVariable="POFault" faultMessageType="lns:orderFaultType"> <reply partnerLink="purchasing" portType="lns:purchaseOrderPT" operation="sendPurchaseOrder" variable="POFault" faultName="cannotCompleteOrder" /> </catch> </faultHandlers>

  37. Process Structure • A business process is a hierarchy of nested scope • Each scope may have • definitions of variables • partner links • message exchanges • correlation sets • handlers

  38. Lifecycle of a Scope • Lifecycle of a scope begins with the following initializations • Initialize variables and partner links • Instantiate correlation sets • Install fault handlers, termination handler, and event handlers • A scope finishes its work either successfully or unsuccessfully • Normal completion • Internal fault • External termination

  39. Scoped Fault Handling <scope> <faultHandlers> <catch faultName="xyz:anExpectedError">...</catch> <catchAll><!-- deal with other errors --> ... </catchAll> </faultHandlers> <sequence> <!-- do work --> </sequence> </scope>

  40. Undoing Completed Work <scope name="S1"> <faultHandlers> <catchAll> <compensateScope target="S2" /> </catchAll> </faultHandlers> <sequence> <scope name="S2"> <compensationHandler> <!-- undo work --> </compensationHandler> <!-- do some work --> </scope> <!-- do more work --> <!-- a fault is thrown here; results of S2 must be undone --> </sequence> </scope>

  41. Correlation Sets • A web service might be configured with multiple instances of a BP to concurrently handle (stateful) conversations with multiple clients. • A mechanism is needed to: • Route an arriving message that is part of a particular conversation to the correct BP instance • Messages of a particular conversation can be recognized by the fact that they will generally all carry some identifying value(s) (e.g., customerID and orderNum)

  42. Correlation Sets • A correlation set is a set of properties whose value is shared by all messages in a particular conversation. • A correlation set identifies the BP instance <correlationSet name=“PurchaseOrder” properties=“cor:customerID cor:orderNum”/> aliased to items of information contained in the messages of a conversation

  43. Correlation Sets <flow> <links> <link name="buyToSettle" /> <link name="sellToSettle" /> </links> <receive name="receiveBuyerInformation" createInstance="yes" ...> <sources> <source linkName="buyToSettle" /> </sources> <correlations> <correlation set="tradeID" initiate="join" /> </correlations> </receive> • <receive name="receiveSellerInformation" createInstance="yes" ...> • <sources> • <source linkName="sellToSettle" /> • </sources> • <correlations> • <correlation set="tradeID" initiate="join" /> • </correlations> • </receive> • <invoke name="settleTrade" ...> • <targets> • <joinCondition>$buyToSettle and • $sellToSettle</joinCondition> • <target linkName="buyToSettle" /> • <target linkName="sellToSettle" /> • </targets> • </invoke> • ... • </flow>

  44. Summary • Service composition • Purchase Order process overview • Main concepts in BPEL • Advanced concepts in BPEL

More Related