Скачать презентацию Introduction to WS-BPEL and WSO 2 BPS Kasun Скачать презентацию Introduction to WS-BPEL and WSO 2 BPS Kasun

faff491bf1b63f9b023edd43046e1ed9.ppt

  • Количество слайдов: 52

Introduction to WS-BPEL and WSO 2 BPS Kasun Indrasiri Associate Technical Lead PMC, Apache Introduction to WS-BPEL and WSO 2 BPS Kasun Indrasiri Associate Technical Lead PMC, Apache Synapse Member, Integration MC WSO 2 Inc. May 2013

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

Business Process • Business process is a set of logically related activities • These 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 Example process

Orchestration vs. Choreography • Orchestration – Business process with central coordinator – WS-BPEL • 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 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 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

WSO 2 Business Process Server • • Executes business processes written using WS-BPEL standard WSO 2 Business Process Server • • Executes business processes written using WS-BPEL standard Powered by Apache ODE ( ode. apache. org ) WS-Human Tasks and BPEL 4 People Provides a Management Console to – View and Manage Processes / Human Tasks – View and Manage Instances / Tasks – Configure QOS …

Introduction to WS-BPEL Introduction to WS-BPEL

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

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

BPEL Document Structure <process> <partner. Links> <variables></variables> <message. Exchanges></message. Exchanges> <correlation. Sets></correlation. Sets> <fault. BPEL Document Structure (activities)*

BPEL Process <process name= BPEL Process

Partner. Link. Type • Characterizes the conversational relationship between two services • Define the Partner. Link. Type • Characterizes the conversational relationship between two services • Define the roles played by each of the services in the conversation

Partner. Link. Type Seller Buyer Invoke Seller Process Send response to Buyer’s Callback Async Partner. Link. Type Seller Buyer Invoke Seller Process Send response to Buyer’s Callback Async Seller Buyer Invoke Seller Partner Service Process Partner Service Sync

Partner. Links • Define the relationship between the participating web services ( partners ) Partner. Links • Define the relationship between the participating web services ( partners ) and the business process – myrole “business process’s role” – partner. Role “partner service’s role” • Associates interfaces (WSDL ports) with roles, using Partner. Link. Types

Partner Links Partner Links

Partner Link • Partner Link Associates with a partner link type <partner. Links> <partner. Partner Link • Partner Link Associates with a partner link type • 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 Variables • Variables used by the process to keep the state • Statically typed via – WSDL Message 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 Variables • Assigning values to variables – When message is received from a partner – Manipulate variables inside activity – Require knowledge about Xpath , XSLT

Activities • Activities perform the process logic • Basic Activities – describe elemental steps 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 • Basic Activities • • Receive Reply Invoke Assign Empty Compensate Catch • Throw • Rethrow • Exit

Receive • Receive messages from an external party – Could be an external partner 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 – Partner. Link with My. Role – WSDL operation – Variable for the incoming message • create. Instance=“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 Reply • • • Sends the response back to the client Always relates to a “receive” activity Associated with – – – Same Partner. Link for the “receive” Same operation for the “receive” Variable for the output message

Invoke • Used to consume (invoke) partner services • Associated with – – Partner. Invoke • Used to consume (invoke) partner services • Associated with – – Partner. Link with at least a “partner. Role” WSDL operation of the partner service Input variable Output variable, if the operation is request-response

Assign • Used to manipulate variables Assign • Used to manipulate variables

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

Expected Content • echo. Request= <p: echo. String xmlns: p= Expected Content • echo. Request= Hello. World • First we should initialize the variable ‘echo. Request’ before copying the string value “Hello. World” to it. • $echo. Request/p: echo. String/in

Structured Activities • • • Sequence While Pick Flow Scope If For. Each Repeat. Structured Activities • • • Sequence While Pick Flow Scope If For. Each Repeat. Until Compensate Link

Sequence • Used to define a set of activities to be executed in a 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 standard-elements activity+ • Contained activities are executed in the order they are defined • Completes when the last activity has completed

Sequence Sequence

Flow • Used to define a set of activities that will execute concurrently • 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 Flow

If • Used to express a service of alternative choices of which exactly one 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 If

Looping • Looping executes a subset of the process multiple times in a controlled Looping • Looping executes a subset of the process multiple times in a controlled manner – For. Each – repeat. Until – while

For. Each For. Each

While While

Repeat. Until Repeat. Until

Pick • Waits for the occurrence of exactly one event from a set of 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 Pick • Used to have the process wait until one of a set of events is triggered – Message events via on. Message element – Alarm events via on. Alarm element • Can be used to initiate a process instance – If create. Instance=“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 create. Instance=“yes” – No alarms are permitted in the case

Scope • Used to group activities into logically organized sections – Encapsulates a possibly Scope • Used to group activities into logically organized sections – Encapsulates a possibly compensatable, recoverable unit of work • Provide processing context for – Variables – Partner. Links – Fault. Handlers and Compensation handlers

Scope Scope

Developing BPEL Process Developing BPEL Process

Contents of a BPEL Package • • Process definition file (. bpel file ) 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 Deploy. xml

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

Invoking an External Partner Invoking an External Partner

Invoking a Partner Service • • • Generate BPEL process using the synchronous process Invoking a Partner Service • • • Generate BPEL process using the synchronous process template Add an invoke activity with two assign activities Create a Partner. Link and Partner. Link. Type Use echo service that comes with the BPS as the external service Deploy and execute the process

Invoking a Partner Service Invoking a Partner Service

Q&A Q&A

Thank You Thank You