BPEL language introduction and application

Outline

BPEL: Full called Business Process Execution Language, Business Process Execution Language, a programming language written using XML. For automating business processes, it has also been referred to as WSBPEL and BPEL4WS. Widespread use of project development for Web-related services, the advantages of portability and effective protection for the investment.
BPEL is a formal specification language for automating business processes. BPEL processes are written in XML documents can be obtained in a standardized way of interacting between the well-organized Web services. These processes can be executed on any platform or in line with the BPEL specification products. Therefore, by allowing customers to move between these processes in a variety of authoring tools and execution platforms, BPEL allows them to protect their investment in process automation. Although previously thought to make business process definition standardized, BPEL has attracted unprecedented interest, but also get a lot of it was first recognized in the software suppliers.

Abstract and executable processes

Executable process is a process that can be executed on a computer. Abstraction is used to describe a process of the reaction. It is used in the surface of an executable process to the internal behavior of this process not to cover up the business objects to see.

process status

The current version is 2.0, this version is OASIS, 2007 April 11 launch.

BPEL activities

BPEL used some of the basic activities, which is the most basic, that is not based on the activities of other activities:

    • assign-- assignment
    • invoke-- synchronously or asynchronously call a Web service
    • receive / reply-- provides an interface synchronously or asynchronously call a Web service
    • throw-- prompt an error, a fault handler can handle this error. If an error is not handled, then it eventually arrived at the highest levels result in the termination process
    • wait-- wait a period of time or opportunity
    • empty-- idle, such as when an error occurs can do to eliminate this error reaction

Structured activities, which include other activities that can build this complex process:

  • sequence-- processing sequence according to a series of events
  • while-- process in a case where the event a condition is satisfied
  • switch-- according to different conditions to deal with different activities
  • flow-- parallel or randomly in accordance with the order of processing activities
  • pick-- values ​​selected according to an external event from the perspective of the process variable

scopes-- use this structure can be grouped together as a set of activities one processing unit. You can use the same troubleshooting activities by multiple organizations this method, incident handling and compensation process. BPEL may be processed by the compensation process of processing time.

1.Receive (received) / Reply (Answer)

<Receive> activity to obtain data from external partners that process, and save it to process variables. Receive a starting point is usually a process, until it reaches the matching blocks execution message.

Transmitting the <reply> message to the partner to the response message received by the receive activity. Combination of receive and reply to a request corresponding to the defined WSDL portType - response operation. If receive activity corresponds to a unidirectional (one-way) operation corresponding to the reply activity can not be defined in the process.

2.Invoke request

<Invoke> activity allows business processes synchronous or asynchronous invocation services provided by partners, service implementation can be one-way or request - response operation. Invoke activity using "partnerLink" to refer to the partner services. With too "portType" and "operation" specify the WSDL interface and operation.

3.Assign assignment

Effect <assign> activity is to use the new data to update the value of the variable. Assign activity may include any number of basic copy operation.

4.Wait wait

<Wait> activity suspend process execution, waiting for a given period of time or until a certain moment before continuing to run. In WebSphere Process Server 6.0, developers can very flexibly specify an expiration condition in wait, like how many seconds to wait until a certain date, or use the built-date performance method. You can also use Java code to dynamically specify the wait time.

BPEL also provides a wealth of structured activities, the flexibility to control the flow of execution.

5.Sequence order

<Sequence> activity defines a set of activities performed successively in the order. Order of execution sequence activity in the sequence of nested activities. When the last event in the sequence is complete, the sequence activity is complete.

6.Flow process

<Flow> activity can be described in more complex sequence of activities performed. We can use flow specify one or more activities in parallel. To define any control structures, may be used in the parallel link activities.

Expression synchronous flow can be further direct or indirect correlation between nested therein activity, link (link) to express such synchronization correlation.

All link flow activities appear to be defined separately in the flow activities, and identified by name. flow activities nested activities required to indicate the source or target activities through which link the properties of the source or target activities. In the event flow for each link must be one and only one active source as its activity, and also have only one active target as its activity. Target activity will be executed after the source activity is completed. Such activities can flow through the interior of the activities constitute a directed graph.

We can also define transition (transition) conditions on the source link, and when the source activity is completed, BPEL engine will check the transition condition is satisfied, if the transfer conditions link the activities to meet the target will be executed.

7.Switch branch

<Switch> traditional functional activities similar to structured language, to select a particular branch of activity to be performed from a set of branch case. Ordered list of one or more conditional branch switch elements defined by the case, may be followed otherwise may not be followed by a branch. In case the branch in order of appearance inspection, the first condition is true and branches are selected as the activity is performed. If the conditional branching are not selected, then the otherwise branch will be selected.

8.While——While循环

<While> activities inherited from traditional structured programming ideas, provide support while-do loop structure. It may contain one or more activities. It specifies the repeated execution of its internal activities, until the success criteria are not met. In WPS allows Java code to describe its conditional expressions.

9.Pick select (referred to In WPS Receive Choice)

<Pick> activity will wait for an event to occur a set of mutually exclusive events, activities and events associated with the execution occurs. It will block the execution of business processes to wait for a specific event occurs, such as a suitable message is received or a timeout alarm sounded. When an event is triggered any business process will continue, pick also completed immediately and will not wait for the occurrence of other events.

Each activity must include at least one pick onMessage event. Semantic onMessage event is equivalent to alternative types of activities related to receive variable attributes. pick activity can also define onAlarm event is used to specify a timeout alarm.

The following is a custom BPEL simple state machine workflow process process:

 

<process name="TestStateWorkFlow" targetNamespace="http://BusinessProcessDiagram1" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:Pool="http://mypool" xmlns:tns=http://BusinessProcessDiagram1 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <partnerLinks>
	    <partnerLink name="CommonState" partnerLinkType="lns:CommonState" myRole="EmployeeRole" 
       partnerRole="EmployeeParterRole" />
          <partnerLink name="ManageState" partnerLinkType="lns:ManageState" myRole="ManageRole" 
       partnerRole="ManageParterRole" />
	  <partnerLink name="DoneState" partnerLinkType="lns:DoneState" myRole="DoneRole" partnerRole="DoneParterRole" />
          <partnerLink name="RefuseState" partnerLinkType="lns:RefuseState" myRole="RefuseRole" partnerRole="RefuseParterRole" />
    </partnerLinks>
    <variables>
            <variable 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>
                   <invoke name="Manage" partnerLink="ManageState" portType="ManageAction" operation="StateOperation" 
           inputVariable="ManageOperation" />
                </sequence>
            </case>
	  <case condition="Resubmit">
                <sequence>
                   <invoke name="Manage" partnerLink="ManageState" portType="ManageAction" operation="StateOperation" 
           inputVariable="ManageOperation" />
                </sequence>
            </case>
            <case condition="Save">
                <sequence>
                   <invoke name="Common" partnerLink="CommonState" portType="EmployeeAction" operation="StateOperation" 
           inputVariable="EmployeeOperation" />
                </sequence>
            </case>
	  <case condition="Revoke">
                <sequence>
                   <invoke name="Common" partnerLink="CommonState" portType="EmployeeAction" operation="StateOperation" 
           inputVariable="EmployeeOperation" />
                </sequence>
            </case>
        </switch>
        <invoke name="Manage" partnerLink="ManageState" portType="ManageAction" operation="StateOperation" 
     inputVariable="ManageOperation" />
	<switch name="ManageAction">
            <case condition="Approve">
                <sequence>
                   <invoke name="Done" partnerLink="DoneState" portType="None" operation="StateOperation" 
           inputVariable="RemarkMessage" />
                </sequence>
            </case>
            <case condition="Reject">
                <sequence>
                   <invoke name="Refuse" partnerLink="RefuseState" portType="None" operation="StateOperation" 
           inputVariable="RemarkMessage" />
                </sequence>
            </case>
        </switch>
		<invoke name="Done" partnerLink="DoneState" portType="None" operation="StateOperation" 
         inputVariable="RemarkMessage" />
		<invoke name="Refuse" partnerLink="RefuseState" portType="None" operation="StateOperation" 
         inputVariable="RemarkMessage" />
    </sequence>
</process>

 

 

The meaning of the expression is a flow chart:

StateWorkFlowStateDiagram

 

BPEL language is a simple state machine design workflow.

Welcome you to participate in the discussion, if you feel you have help, click on     the recommendation, thank you very much.image

Author: the Spring Yang

Source: http://www.cnblogs.com/springyangwc/

This article belongs to the author and blog Park total, welcome to reprint, but without the author's consent declared by this section must be retained, and given the original connection in the apparent position of the article page, otherwise the right to pursue legal responsibilities.

Reproduced in: https: //www.cnblogs.com/springyangwc/archive/2013/03/11/2953880.html

Guess you like

Origin blog.csdn.net/weixin_33895016/article/details/93376041