You are on page 1of 29

SOA 11g- BPEL

Objective
Understanding what is orchestration of process.

Understanding the Architecture, basic concepts &


terminologies of BPEL.

BPEL-Definition & Purpose


Definition-

BPEL is a XML-based language used to define & orchestrate business processes exposed as Web Services

Why BPEL? Developing the web services and exposing the functionality is not sufficient. We also need a way to orchestrate this functionality in the right order. Example: Concert ticket purchase Web service has 3 operations, which need to be performed in the following order
1. Getting a price quote

2.
3.

Purchase a ticket
Confirmation and cancellation

Here Business Process Needs to orchestrate the 3 processes in right order inorder to provide a single overall functionality of purchasing a ticket

Other Salient features


Business Process Execution Language can

Co-ordinate asynchronous communication between services Implement parallel processing of activities Implement compensation logic (Undo operations) Manipulate/transform data between partner interactions Support for long running business transactions and activities Handle exception handling Need for universal data model for message exchange

Orchestration & Choreography


Orchestration: The control over the web services that are involved and coordinating the execution of different operations on the web services involved in the operation is taken by the central process in orchestration as per the requirements. The involved web services are unaware of this process. With operations that are explicitly defined and the order of invocation of the web services, the orchestration is centralized

WS-BPEL is a language for defining processes that can be executed on an orchestration engine

Orchestration & Choreography Contd.


Choreography: Choreography does not rely on a central coordinator. The web services involved in the choreography is aware exactly the execution of its operations and whom to interact with. Choreography is a collaborative effort. It focuses on messages exchange. The awareness of business process, operations to execute, messages to exchange, and the time of message exchange are needed for all participants of choreography WS-CDL is a language for describing multi-party contracts and is somewhat like an extension of WSDL. WSDL describes web services interfaces, WS-CDL describes collaborations between web services.

BPEL: Relationship to Partners


Sample BPEL Orchestration

What can we orchestrate through BPEL?


BPEL is basically a language to define and implement a new Web service by
combining a set of existing services. The interface of the composite service is just like any other Web service.

The composition is called a process. The service that a process interacts with is called a partner.
The relationship between the process and its partner is called a partnerLinkType

Architecture & Deployment in 11g

Commonly Used BPEL Activities


Basic Activities Structured Activities

<invoke> <receive> <reply> <assign> <throw> <wait> <empty>

<sequence> <while> <pick> <flow> <scope> <compensate> <switch>

Basic Activities
<invoke>
-To invoke a one-way or request/response operation on a portType offered by a partner

<receive>
-To do a blocking wait for a matching message to arrive -Instantiates the business process

<reply>
-To send a message in reply to a message that was received through a receive activity -The combination of a <receive> and a <reply> forms a request-response operation on the WSDL portType for the process

<assign>
-Can be used to update the values of variables with new data

<throw>
-Generates a fault from inside the business process

<wait>
-Allows you to wait for a given time period or until a certain time has passed

<empty>
-Allows you to insert a "no-op" instruction into a business

Structured Activities
<sequence>
-Perform activities in sequential order

<while>
-Supports repeated performance of a specified iterative activity -Iterative activity is repeated until the given while condition is no longer true.

<flow>
-Perform activities in parallel -Completes when all sequences in the flow are finished

<switch>
-Consists of one or more ordered <case> branches, each of them allow to specify a condition to be evaluated -Case branches are processed in their order of appearance, and the first branch with a true condition is processed -Each case branch may contain a sequence of activities -May have one <otherwise> branch, which is processed if all <case> conditions are false

<compensate>
-To undo & backtrack previously completed transactions

<scope>
-Enclose multiple activities in a single scope

Design & Source view of a Business Process

BPEL Document Structure


BPEL is basically a language to define and implement a new Web service by composing a set of existing services. The interface of the composite service is just like any other Web service (collection WSDL portTypes). The composition is called a process. The service that a process interacts with is called a partner. The relationship between the process and its partner is called a partnerLinkType

Developing BPEL Service


A BPEL process is a service that can be invoked by other services.

A BPEL service can be developed by


1. 2. Using visual design tool such as Oracle Jdeveloper studio Editing the BPEL elements using a simple text editor

Oracle Jdeveloper provides different templates for developing BPEL Web services. The most commonly used templates are1. 2. 3. Synchronous Service Asynchronous Service Define Interface later or Empty Service

Synchronous Web Service


In Synchronous web service the requestor receives an immediate response or acknowledgement from the invoked service. Below diagrams show how synchronous BPEL process look initially (left) & post implementation (right).

Steps involved in BPEL process development


Define process variables
-Process variables communicate data between activities & processes.

Importing a user defined schema-Structures tab

Steps Contd.
Setting the BPEL Process Variable Message Types-Structures tab

Creating a Partnerlink-Partnerlink swim lane

Steps Contd.
Configuring Partnerlink to invoke a BPEL webservice

Configuring the partner link

Steps Contd.
Assigning the data-Drag an assign activity from the component palette

Invoking a service

Synchronous Web Service Example


Invoking a credit rating web service

Asynchronous Web Service


In Asynchronous Web Service the requestor does not wait for a response or
acknowledgement from the invoked service. The service does complex processing which might take several minutes, days or even a year. implementation (right).

Below diagrams show how asynchronous BPEL process look initially (left) & post

Challenges with Asynchronous service



How to correlate request and response? How to exchange the co-relation information? Where the response should be sent? How to inform the service provider of this destination? How to generate the response as a separate transaction separate from the request? How does the client receive the asynchronous response? How does the client and service provider correlate the request and response?

Problem Solution
Solution:

Application should take care of message correlation Generate correlation information Pass correlation information in the message Use correlation Information to match the request to response

Example for Asynchronous service Invoking a Rapid Distributor service

What is correlation id? Correlation id enables requestor to correlate the response sent by the provider

Define Interface later or Empty Service


Empty Service is useful to design a process flow as a client to initiate other services.
With this developer as an option to define the service type at a later point of time based on the requirements

Below diagram show how Empty BPEL process look initially

Fault handling in BPEL

Exceptions are handled depends on the type of exceptions that can possibly occur. Exceptions that occur in a service-oriented composite application can be broadly classified into two categories-System Faults and Business Faults.

System Faults:

System faults are predefined. Most commonly used system faults are Remote, Binding, selection failure faults. These faults can be browsed & selected when configuring Throw/Catch activity. The system faults supported by BPEL engine are listed below

Fault handling in BPEL Contd.

All the system faults share the same fault schema & contains following elements
1. 2. 3. Fault summary Fault detail Fault code

Business Faults:

A custom fault can be created by defining the same in bindings tag. SOAP fault structure is normally used to define a business fault & it will have following elements.
1.
2. 3. 4.

Fault Code
Fault String Fault Actor Fault detail

Example:

BPEL Activities used during Fault handling: Scope, Catch, CatchAll, Throw.

BPEL vs. Mediator


Primarily BPEL is used for Orchestration, data enrichment and also for
Human interaction whereas mediator is used for mere routing/ transport of data. whereas mediator can perform only simple transformations. mediators do not facilitate to use this. exception handling capabilities

BPEL data transformations enrich and perform complex changes

BPEL can use Business rules, Human Workflow and Notifications,


Exception handling can be done in BPEL, mediator has limited Mediator does not have the Sensors which can be used to monitor the
activities that can send actions to Business Activity Monitoring (BAM) or database/jms.

Q&A

29

You might also like