1 / 52

Kasun Indrasiri Associate Technical Lead PMC, Apache Synapse Member, Integration MC WSO2 Inc.

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

cady
Download Presentation

Kasun Indrasiri Associate Technical Lead PMC, Apache Synapse Member, Integration MC WSO2 Inc.

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. Introduction to WS-BPEL and WSO2 BPS Kasun Indrasiri Associate Technical Lead • PMC, Apache Synapse Member, Integration MC WSO2 Inc. May 2013

  2. Agenda • What is a Business Process / WS-BPEL • WSO2 Business Process Server • Introduction to BPEL • Developing Business Processes with WSO2 Developer Studio

  3. Business Process • Business process is a set of logically related activities • These activities are performed in a predefined order to achieve a business goal

  4. Example process

  5. Orchestration vs. Choreography • Orchestration • Business process with central coordinator • WS-BPEL • Choreography • Business collaboration

  6. 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

  7. 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

  8. 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 …

  9. Introduction to WS-BPEL

  10. Want to implement a BPEL Process ? • You should have some knowledge on • XML • XML Namespaces • XML Schema • WSDL • XPath • XSLT

  11. Structure of a WSDL • <types> • <message/>+ • <portType><operation>+</portType> • <binding/>+ • <service><port/></service>

  12. BPEL Document Structure <process> <partnerLinks><partnerLinks> <variables></variables> <messageExchanges></messageExchanges> <correlationSets></correlationSets> <faultHandlers></faultHandlers> <compensationHandlers></compensationHandlers> <eventHandlers></eventHandlers> (activities)* </process>

  13. 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>

  14. 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>

  15. PartnerLinkType Seller Buyer Seller Buyer Invoke Seller Invoke Seller Send response to Buyer’s Callback Process Partner Service Process Partner Service Sync Async

  16. 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

  17. Partner Links

  18. 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

  19. 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

  20. Variables • Assigning values to variables • When message is received from a partner • Manipulate variables inside <assign> activity • Require knowledge about Xpath , XSLT

  21. 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

  22. Basic Activities • Receive • Reply • Invoke • Assign • Empty • Compensate • Catch • Throw • Rethrow • Exit

  23. 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

  24. 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

  25. 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

  26. Assign • Used to manipulate variables

  27. Initializing Variables • Variables contain a piece of XML • Manipulated using XPath • XPath is evaluated on XML • Avariable should be initialized before copying values to the internal elements.

  28. Expected Content • echoRequest= <p:echoStringxmlns: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

  29. Structured Activities • Sequence • While • Pick • Flow • Scope • If • ForEach • RepeatUntil • Compensate • Link

  30. 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-elements activity+ </sequence> • Contained activities are executed in the order they are defined • Completes when the last activity has completed

  31. Sequence

  32. 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

  33. Flow

  34. 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

  35. If

  36. Looping • Looping executes a subset of the process multiple times in a controlled manner • ForEach • repeatUntil • while

  37. ForEach

  38. While

  39. RepeatUntil

  40. Pick • Waits for the occurrence of exactly one event from a set of events.

  41. 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

  42. 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

  43. Scope

  44. Developing BPEL Process

  45. 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

  46. Deploy.xml

  47. HelloWorld Sample • Generate a Synchronous BPEL Process using Developer studio wizard • Implement ‘assign’ Logic

  48. Invoking an External Partner

  49. 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

  50. Invoking a Partner Service

More Related