SOA 11g Training BPEL

29
SOA 11g- BPEL

Transcript of SOA 11g Training BPEL

Page 1: SOA 11g Training BPEL

SOA 11g- BPELSOA 11g- BPEL

Page 2: SOA 11g Training BPEL

Objective

• Understanding what is orchestration of process.

• Understanding the Architecture, basic concepts &

terminologies of BPEL.

Page 3: SOA 11g Training 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. Purchase a ticket

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

Page 4: SOA 11g Training BPEL

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

Page 5: SOA 11g Training BPEL

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

Page 6: SOA 11g Training BPEL

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.

Page 7: SOA 11g Training BPEL

BPEL: Relationship to Partners

Sample BPEL Orchestration

Page 8: SOA 11g Training BPEL

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 it’s partner is called a “partnerLinkType”

Page 9: SOA 11g Training BPEL

Architecture & Deployment in 11g

Page 10: SOA 11g Training BPEL

Commonly Used BPEL Activities

Basic Activities Structured Activities

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

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

Page 11: SOA 11g Training BPEL

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

Page 12: SOA 11g Training BPEL

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

Page 13: SOA 11g Training BPEL

Design & Source view of a Business Process

Page 14: SOA 11g Training BPEL

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 it’s partner is called a “partnerLinkType

BPEL Document Structure

Page 15: SOA 11g Training BPEL

Developing BPEL Service

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

• A BPEL service can be developed by

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

• Oracle Jdeveloper provides different templates for developing BPEL Web services. The most commonly used templates are-

1. Synchronous Service2. Asynchronous Service3. Define Interface later or Empty Service

Page 16: SOA 11g Training BPEL

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

Page 17: SOA 11g Training BPEL

Steps involved in BPEL process development

• Importing a user defined schema-Structures tab

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

Page 18: SOA 11g Training BPEL

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

• Creating a Partnerlink-Partnerlink swim lane

Page 19: SOA 11g Training BPEL

Steps Contd.• Configuring Partnerlink to invoke a BPEL webservice

• Configuring the partner link

Page 20: SOA 11g Training BPEL

Steps Contd.

• Assigning the data-Drag an assign activity from the component palette

• Invoking a service

Page 21: SOA 11g Training BPEL

Synchronous Web Service Example

Invoking a credit rating web service

Page 22: SOA 11g Training BPEL

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.

• Below diagrams show how asynchronous BPEL process look initially (left) & post implementation (right).

Page 23: SOA 11g Training BPEL

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?

Page 24: SOA 11g Training BPEL

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 serviceInvoking a Rapid Distributor service

What is correlation id?

Correlation id enables requestor to correlate the response sent by the provider

 

Page 25: SOA 11g Training BPEL

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

Page 26: SOA 11g Training BPEL

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

Page 27: SOA 11g Training BPEL

Fault handling in BPEL Contd.

• All the system faults share the same fault schema & contains following elements

1. Fault summary

2. Fault detail

3. 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. Fault Code

2. Fault String

3. Fault Actor

4. Fault detail

• Example:

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

Page 28: SOA 11g Training BPEL

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.

• BPEL data transformations enrich and perform complex changes whereas mediator can perform only simple transformations.

• BPEL can use Business rules, Human Workflow and Notifications, mediators do not facilitate to use this.

• Exception handling can be done in BPEL, mediator has limited exception handling capabilities

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

Page 29: SOA 11g Training BPEL

Q&A

29