Introduction and application of BPEL language

Source: Internet
Author: User
Tags wsdl

Overview

BPEL: All called business Process Execution Language, the Orchestration execution language, is a programming language written using XML. Used to automate business processes, also known as Wsbpel and BPEL4WS. Widely used in Web services-related project development, the advantages are portability and effective protection of investment.
BPEL is a formal specification language for automating business processes. The process of writing to BPEL with an XML document can be carefully organized between Web services in a standardized way. These processes can be executed on any platform or product that conforms to the BPEL specification. So, by allowing customers to move these processes between various authoring tools and execution platforms, BPEL enables them to protect their investment in process automation. Although previously wanted to standardize business process definitions, BPEL has attracted unprecedented interest, and it has gained a lot of recognition from software vendors.

Abstract and executable process

An executable procedure is a procedure that can be performed on a computer. The abstract process is used to describe the reaction of a process. It is used on the surface of an executable process to disguise the internal behavior of the process from being visible to business objects.

Development status

The current version is 2.0, which was launched by Oasis on April 11, 2007.

BPEL activity

Some of the basic activities commonly used in BPEL are those that are basic, that is, activities that are not based on other activities:

        • assign--Assignment Value
        • invoke--to call a Web service synchronously or asynchronously
        • receive/reply--provides an interface for synchronizing or asynchronously calling a Web service
        • throw--prompts for an error, and a fault handling can handle such an error. If an error is not handled, it eventually reaches the highest level and causes the process to terminate.
        • wait--wait for a moment or some time
        • empty--do nothing, for example, to eliminate this error after a mistake has been made without reacting.

Structured activities, which include other activities that can be used to create complex processes:

        • sequence--processes a series of activities according to a sequence
        • while--handling an activity in a condition where it is met
        • switch--handling different activities according to different conditions
        • flow--parallel or in random order to process activities
        • pick--selection from the angle of the procedure according to the external event

scopes--Use this structure to organize a set of activities together as a processing unit. Through this organization method, multiple activities can use the same fault handling, incident handling, and compensation processing. Processing BPEL with compensation can handle long periods of processing.

1.Receive (Reception)/Reply (answer)

The activity gets the data from the external partner of the process and saves it to the process variable. Typically a receive is the initial point of a process that blocks execution until the arrival of a matching message.

The activity sends a message to the partner to answer the message received through the receive activity. The combination of receive and reply corresponds to a request-response operation defined on the WSDL porttype. If the receive activity corresponds to a one-way (one-way) operation, the corresponding reply activity cannot be defined in the process.

2.Invoke Request

The activity allows a business process to synchronously or asynchronously invoke a service provided by a partner, which can be a one-way or request-response operation. The Invoke activity uses "Partnerlink" to refer to the partner service. The corresponding WSDL interfaces and operations are specified with "PortType" and "Operation".

3.Assign Value Assignment

The purpose of the activity is to update the value of the variable with new data. Assign activities can include any number of basic replication operations.

4.Wait Waiting

The activity pauses the execution of the process, waits for a given time, or waits until a moment before it continues to run. In WebSphere Process Server 6.0, developers have the flexibility to specify the expiration criteria in wait, such as how many seconds to wait, when to wait for a particular date, or to use the built-in date representation. You can also use Java code to dynamically specify the wait time.

BPEL also provides a wealth of structured activities that give you the flexibility to control process execution.

5.Sequence Order

The activity defines a set of activities that are executed sequentially. The order of execution is the sequence of nested activities in the sequence activity. When the last activity in sequence is completed, the sequence activity is completed.

6.Flow process

activities can describe a more complex sequence of activity executions. We can use flow to specify one or more activities that are executed in parallel. In order to define arbitrary control structures, links can be used in parallel activities.

Flow can further express the synchronization correlation between activities that are nested directly or indirectly, and link is used to express this synchronization dependency.

All the link that appears in the flow activity must be defined separately in the flow activity and identified by name. Activities nested within the flow activity need to indicate the source or target activity of which link the activity is based on by using the source or the target property. In the flow activity, there must be and only one activity as its source activity for each link, and there is only one activity as its target activity. The target activity is executed after the source activity is completed. In this way, the activities within the flow can form a forward graph through activities.

We can also define the transition (transition) condition on the link's source, and when the source activity is complete, the BPEL engine checks to see if the transition condition is met and executes if the link's transition condition satisfies the target activity.

7.Switch Branch

The activity is similar to the functionality of a traditional structured language, and is executed by selecting a specific active branch from a set of branching cases. Switch consists of an ordered list of one or more conditional branches that are defined by the case element, followed by or without a otherwise branch. In the order in which the case branches appear, the first condition is that the branch of True is selected and executed as an activity. If the conditional branch is not selected, then the otherwise branch is selected.

8.while--while Cycle

The activity also inherits from the traditional structured programming idea, and provides support for the WHILE-DO loop structure. It can contain one or more activities. It specifies that its internal activities are performed repeatedly until the success condition is not met. In WPS, it is allowed to use Java code to describe conditional expressions.

9.Pick selection (referred to as receive Choice in WPS)

The activity waits for an event in a set of mutually exclusive events to occur, and then executes the activity associated with the event that occurred. It blocks business process execution to wait for a particular event to occur, such as receiving an appropriate message or a timeout alert. When any one of these events is triggered, the orchestration continues to execute, and the pick is completed, no longer waiting for other events to occur.

Each pick activity must include at least one OnMessage event. The semantics of the OnMessage event is equivalent to the receive activity for an optional type of variable property. The pick activity can also define a Onalarm event for specifying a timeout alert.

The following is a simple state machine workflow process that is customized with BPEL:

xmlns:xsd= "Http://www.w3.org/2001/XMLSchema" >    <partnerLinks>    
 partnerrole= "Employeeparterrole"/> <partnerlink name= "managestate" partnerlinktype= "Lns:ManageStat E "myrole=" Managerole "
 partnerrole= "Manageparterrole"/> <partnerlink name= "donestate" partnerlinktype= "Lns:DoneState" myRole= "Don Erole "partnerrole=" Doneparterrole "/> <partnerlink name=" refusestate "partnerlinktype=" Lns:RefuseState "my Role= "Refuserole" partnerrole= "Refuseparterrole"/> </partnerLinks> <variables> <variab Le messagetype= "xsd:string" name= "employeeoperation"/><variable messagetype= "xsd:string" Name= " Manageoperation "/><variable messagetype=" xsd:string "name=" Remarkmessage "/> </variables> < sequence> <invoke name= "Common" partnerlink= "Commonstate" porttype= "employeeaction" operation= "StateOperation " 
inputvariable= "Employeeoperation"/>        <switch name= "employeeaction" >            <case condition= "Submit" >                <sequence>                   
inputvariable= "Manageoperation"/>                </sequence>            </case> <case condition= "Resubmit" >                <sequence>                   
inputvariable= "Manageoperation"/>                </sequence>            </case>            <case condition= "Save" >                <sequence>                   
inputvariable= "Employeeoperation"/>                </sequence>            </case> <case condition= "Revoke" >                <sequence>                   
inputvariable= "Employeeoperation"/>                </sequence>            </case>        </switch>        
Inputvariable= "Manageoperation"/><switch name= "manageaction" >            <case condition= "Approve" >                <sequence>                   
inputvariable= "Remarkmessage"/>                </sequence>            </case>            <case condition= "Reject" >                <sequence>                   
inputvariable= "Remarkmessage"/>                </sequence>            </case>        
inputvariable= "Remarkmessage"/>    </sequence></process>

This flowchart means:

is a simple BPEL language design state machine workflow.

Introduction and application of BPEL language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.