Web Services Business Process Execution Language Version 2.0

Committee Draft, 01 September 2005

Document identifier:

wsbpel-specification-draft-01

Location:

http://www.oasis-open.org/apps/org/workgroup/wsbpel/

Editors:

Assaf Arkin <arkin@intalio.com>

Sid Askary <saskary@nuperus.com>
Ben Bloch
<ben_b54@hotmail.com>
Francisco Curbera, IBM 
<curbera@us.ibm.com>
Yaron Goland, BEA 
<ygoland@bea.com>
Neelakantan Kartha, Sterling Commerce 
<N_Kartha@stercomm.com>
Canyang Kevin Liu, SAP 
<kevin.liu@sap.com>
Satish Thatte, Microsoft 
<satisht@microsoft.com>
Prasad Yendluri, webMethods 
<pyendluri@webmethods.com>

Alex Yiu, Oracle <alex.yiu@oracle.com>

Contributors:

{FirstName} {Last Name}, {Organization}

Editor’s Notes – KevinL – this section should be consolidated with Appendix H

Abstract:

This document defines a notation for specifying business process behavior based on Web Services. This notation is called Web Services Business Process Execution Language (abbreviated to WS-BPEL in the rest of this document). Processes in WS-BPEL export and import functionality by using Web Service interfaces exclusively.

Business processes can be described in two ways. Executable business processes model actual behavior of a participant in a business interaction. Business protocols, in contrast, use process descriptions that specify the mutually visible message exchange behavior of each of the parties involved in the protocol, without revealing their internal behavior. The process descriptions for business protocols are called abstract processes. WS-BPEL is meant to be used to model the behavior of both executable and abstract processes.

WS-BPEL provides a language for the formal specification of business processes and business interaction protocols. By doing so, it extends the Web Services interaction model and enables it to support business transactions. WS-BPEL defines an interoperable integration model that should facilitate the expansion of automated process integration in both the intra-corporate and the business-to-business spaces.

Status:

This is a draft version of the WS-BPEL TC specification, updated from the origninal BPEL4WS V1.1 specification dated May 5, 2003 that was submitted to the WS BPEL TC. See: http://www.oasis-open.org/apps/org/workgroup/wsbpel/download.php/2046/BPEL%20V1-1%20May%205%202003%20Final.pdf

If you are on the <wsbpel@lists.oasis-open.org> list for committee members, send comments there. If you are not on that list, subscribe to the <wsbpel-comment@lists.oasis-open.org> list and send comments there. To subscribe, send an email message to <mailto:wsbpel-comment-request@lists.oasis-open.org> with the word "subscribe"as the body of the message.

For information on whether any patents have been disclosed that may be essential to implementing this specification, and any offers of patent licensing terms, please refer to the Intellectual Property Rights section of the WS-BPEL TC web page http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wsbpel


Table of Contents

1. Introduction

2. Notational Conventions

3. Relationship with Other Specifications

4. This Section Has Been Deleted

5. Core Concepts and Usage Patterns

6. Defining a Business Process

6.1. Initial Example

6.2. The Structure of a Business Process

6.3. Language Extensibility

6.4. The Lifecycle of a Business Process

7. Partner Link Types, Partner Links, and Endpoint References

7.1. Partner Link Types

7.2. Partner Links

7.3. This Section Has Been Deleted

7.4. Endpoint References

8. Message Properties

8.1. Motivation

8.2. Defining Properties

9. Data Handling

9.1. Expressions

9.2. Variables

9.3. Assignment

10. Correlation

10.1. Message Correlation

10.2. Defining and Using Correlation Sets

11. Basic Activities

11.1. Standard Attributes for Each Activity

11.2. Standard Elements for Each Activity

11.3. Invoking Web Service Operations

11.4. Providing Web Service Operations

11.5. Updating Variable Contents

11.6. Signaling Faults

11.7. Waiting

11.8. Doing Nothing

12. Structured Activities

12.1. Sequence

12.2. If

12.3. While

12.4. Pick

12.5. Flow

13. Scopes

13.1. Data Handling and Partner Links  

13.2. Error Handling in Business Processes

13.3. Compensation Handlers

13.4. Fault Handlers

13.5. Event Handlers

13.6. Isolated Scopes

14. Extensions for Executable Processes

14.1. Expressions

14.2. Variables

14.3. Assignment

14.4. Correlation

14.5. Web Service Operations

14.6. Terminating a Service Instance

14.7. Compensation

14.8. Event Handlers

15. Extensions for Business Protocols

15.1. Variables

15.2. Assignment

16. Examples

16.1. Shipping Service

16.2. Loan Approval

16.3. Multiple Start Activities

17. Security Considerations

Appendixes

A. Standard Faults

B. Attributes and Defaults

C. XSD Schemas

D. Notices

E. Intellectual Property Rights

F. Revision History

G. References

H. Committee Members (Non-Normative)


1. Introduction

The goal of the Web Services effort is to achieve universal interoperability between applications by using Web standards. Web Services use a loosely coupled integration model to allow flexible integration of heterogeneous systems in a variety of domains including business-to-consumer, business-to-business and enterprise application integration. The following basic specifications originally defined the Web Services space: SOAP, Web Services Description Language (WSDL), and Universal Description, Discovery, and Integration (UDDI). SOAP defines an XML messaging protocol for basic service interoperability. WSDL introduces a common grammar for describing services. UDDI provides the infrastructure required to publish and discover services in a systematic way. Together, these specifications allow applications to find each other and interact following a loosely coupled, platformindependent model.

Systems integration requires more than the ability to conduct simple interactions by using standard protocols. The full potential of Web Services as an integration platform will be achieved only when applications and business processes are able to integrate their complex interactions by using a standard process integration model. The interaction model that is directly supported by WSDL is essentially a stateless model of synchronous or uncorrelated asynchronous interactions. Models for business interactions typically assume sequences of peer-to-peer message exchanges, both synchronous and asynchronous, within stateful, long-running interactions involving two or more parties. To define such business interactions, a formal description of the message exchange protocols used by business processes in their interactions is needed. The definition of such business protocols involves precisely specifying the mutually visible message exchange behavior of each of the parties involved in the protocol, without revealing their internal implementation. There are two good reasons to separate the public aspects of business process behavior from internal or private aspects. One is that businesses obviously do not want to reveal all their internal decision making and data management to their business partners. The other is that, even where this is not the case, separating public from private process provides the freedom to change private aspects of the process implementation without affecting the public business protocol.

Business protocols must clearly be described in a platform-independent manner and must capture all behavioral aspects that have cross-enterprise business significance. Each participant can then understand and plan for conformance to the business protocol without engaging in the process of human agreement that adds so much to the difficulty of establishing cross-enterprise automated business processes today.

What are the concepts required to describe business protocols? And what is the relationship of these concepts to those required to describe executable processes? To answer these questions, consider the following::

·         Business protocols invariably include data-dependent behavior. For example, a supply-chain protocol depends on data such as the number of line items in an order, the total value of an order, or a deliver-by deadline. Defining business intent in these cases requires the use of conditional and time-out constructs.

·         The ability to specify exceptional conditions and their consequences, including recovery sequences, is at least as important for business protocols as the ability to define the behavior in the "all goes well" case.

·         Long-running interactions include multiple, often nested units of work, each with its own data requirements. Business protocols frequently require cross-partner coordination of the outcome (success or failure) of units of work at various levels of granularity.

If we wish to provide precise predictable descriptions of service behavior for crossenterprise business protocols, we need a rich process description notation with many features reminiscent of an executable language. The key distinction between public message exchange protocols and executable internal processes is that internal processes handle data in rich private ways that need not be described in public protocols.

In thinking about the data handling aspects of business protocols it is instructive to consider the analogy with network communication protocols. Network protocols define the shape and content of the protocol envelopes that flow on the wire, and the protocol behavior they describe is driven solely by the data in these envelopes. In other words, there is a clear physical separation between protocol-relevant data and "payload" data. The separation is far less clear cut in business protocols because the protocol-relevant data tends to be embedded in other application data.

WS-BPEL uses a notion of message properties , which are a type of variable property, to identify protocol-relevant data embedded in messages. Properties can be viewed as "transparent" data relevant to public aspects as opposed to the "opaque" data that internal/private functions use. Transparent data affects the public business protocol in a direct way, whereas opaque data is significant primarily to back-end systems and affects the business protocol only by creating nondeterminism because the way it affects decisions is opaque. We take it as a principle that any data that is used to affect the behavior of a business protocol must be transparent and hence viewed as a property.

The implicit effect of opaque data manifests itself through nondeterminism in the behavior of services involved in business protocols. Consider the example of a purchasing protocol. The seller has a service that receives a purchase order and responds with either acceptance or rejection based on a number of criteria, including availability of the goods and the credit of the buyer. Obviously, the decision processes are opaque, but the fact of the decision must be reflected as behavior alternatives in the external business protocol. In other words, the protocol requires something like an if activity in the behavior of the seller's service but the selection of the branch taken is nondeterministic. Such nondeterminism can be modeled by allowing the assignment of a nondeterministic or opaque value to a message property, typically from an enumerated set of possibilities. The property can then be used in defining conditional behavior that captures behavioral alternatives without revealing actual decision processes. WS-BPEL explicitly allows the use of nondeterministic data values to make it possible to capture the essence of public behavior while hiding private aspects.

The basic concepts of WS-BPEL can be applied in one of two ways. A WS-BPEL process can define a business protocol role, using the notion of abstract process. For example, in a supply-chain protocol, the buyer and the seller are two distinct roles, each with its own abstract process. Their relationship is typically modeled as a partner link. Abstract processes use all the concepts of WS-BPEL but approach data handling in a way that reflects the level of abstraction required to describe public aspects of the business protocol. Specifically, abstract processes handle only protocol-relevant data. WS-BPEL provides a way to identify protocol-relevant data as message properties. In addition, abstract processes use nondeterministic data values to hide private aspects of behavior.

It is also possible to use WS-BPEL to define an executable business process. The logic and state of the process determine the nature and sequence of the Web Service interactions conducted at each business partner, and thus the interaction protocols. While a WS-BPEL process definition is not required to be complete from a private implementation point of view, the language effectively defines a portable execution format for business processes that rely exclusively on Web Service resources and XML data. Moreover, such processes execute and interact with their partners in a consistent way regardless of the supporting platform or programming model used by the implementation of the hosting environment.

Even where private implementation aspects use platform-dependent functionality, which is likely in many if not most realistic cases, the continuity of the basic conceptual model between abstract and executable processes in WS-BPEL makes it possible to export and import the public aspects embodied in business protocols as process or role templates while maintaining the intent and structure of the protocols. This is arguably the most attractive prospect for the use of WS-BPEL from the viewpoint of unlocking the potential of Web Services because it allows the development of tools and other technologies that greatly increase the level of automation and thereby lower the cost in establishing cross-enterprise automated business processes.

In summary, we believe that the two usage patterns of business protocol description and executable business process description require a common core of process description concepts. In this specification we clearly separate the core concepts from the extensions required specifically for the two usage patterns. The WS-BPEL specification is focused on defining the common core, and adds only the essential extensions required for each usage pattern.

WS-BPEL defines a model and a grammar for describing the behavior of a business process based on interactions between the process and its partners. The interaction with each partner occurs through Web Service interfaces, and the structure of the relationship at the interface level is encapsulated in what we call a partner link. The WS-BPEL process defines how multiple service interactions with these partners are coordinated to achieve a business goal, as well as the state and the logic necessary for this coordination. WS-BPEL also introduces systematic mechanisms for dealing with business exceptions and processing faults. Finally, WS-BPEL introduces a mechanism to define how individual or composite activities within a process are to be compensated in cases where exceptions occur or a partner requests reversal.

WS-BPEL is layered on top of several XML specifications: WSDL 1.1, XML Schema 1.0, and XPath1.0. WSDL messages and XML Schema type definitions provide the data model used by WS-BPEL processes. XPath provides support for data manipulation. All external resources and partners are represented as WSDL services. WS-BPEL provides extensibility to accommodate future versions of these standards, specifically the XPath and related standards used in XML computation.

2. Notational Conventions

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119].

Namespace URIs of the general form "some-URI" represent some application-dependent or context-dependent URI as defined in [RFC 2396].

This specification uses an informal syntax to describe the XML grammar of the XML fragments that follow:

·         The syntax appears as an XML instance, but the values indicate the data types instead of values.

·         Grammar in bold has not been introduced earlier in the document, or is of particular interest in an example.

·         <-- description --> is a placeholder for elements from some "other" namespace (like ##other in XSD).

·         Characters are appended to elements, attributes, and as follows: "?" (0 or 1), "*" (0 or more), "+" (1 or more). The characters "[" and "]" are used to indicate that contained items are to be treated as a group with respect to the "?", "*", or "+" characters.

·         Elements and attributes separated by "|" and grouped by "(" and ")" are meant to be syntactic alternatives.

·         The XML namespace prefixes (defined below) are used to indicate the namespace of the element being defined.

·         Examples starting with <?xml contain enough information to conform to this specification; other examples are fragments and require additional information to be specified in order to conform.

·         XSD schemas and WSDL definitions are provided as a formal definition of grammars [XML Schema Part 1] and [WSDL 1.1].

This specification uses a number of namespace prefixes throughout; their associated URIs are listed below. Note that the choice of any namespace prefix is arbitrary and not semantically significant.

·        xsi - "http://www.w3.org/2001/XMLSchema-instance"

·        xsd - "http://www.w3.org/2001/XMLSchema"

·        wsdl - "http://schemas.xmlsoap.org/wsdl/"

·        plnk – http://schemas.xmlsoap.org/ws/2004/03/partner-link/”

·        bpws – “http://schemas.xmlsoap.org/ws/2004/03/business-process/

 

3. Relationship with Other Specifications

WS-BPEL depends on the following XML-based specifications: WSDL 1.1, XML Schema 1.0 and XPath 1.0.

Among these, WSDL has the most influence on the WS-BPEL language. The WS-BPEL process model is layered on top of the service model defined by WSDL 1.1. At the core of the WS-BPEL process model is the notion of peer-to-peer interaction between services described in WSDL; both the process and its partners are modeled as WSDL services. A business process defines how to coordinate the interactions between a process instance and its partners. In this sense, a WS-BPEL process definition provides and/or uses one or more WSDL services, and provides the description of the behavior and interactions of a process instance relative to its partners and resources through Web Service interfaces. That is, WS-BPEL defines the message exchange protocols followed by the business process of a specific role in the interaction.

The definition of a WS-BPEL business process also follows the WSDL model of separation between the abstract message contents used by the business process and deployment information (messages and portType versus binding and address information). In particular, a WS-BPEL process represents all partners and interactions with these partners in terms of abstract WSDL interfaces (portTypes and operations); no references are made to the actual services used by a process instance.

However, the abstract part of WSDL does not define the constraints imposed on the communication patterns supported by the concrete bindings. Therefore a WS-BPEL process may define behavior relative to a partner service that is not supported by all possible bindings, and it may happen that some bindings are invalid for a WS-BPEL process definition.

While WS-BPEL attempts to provide as much compatibility with WSDL 1.1 as possible there are three areas where such compatibility has proven impossible. One area, discussed later in this document, is in fault naming. Another area is in support for overloaded operation names in WSDL portTypes. A BPEL processor MUST reject any WSDL portType definition that includes overloaded operation names. This restriction was deemed appropriate as overloaded operations are rare, they are actually banned in the WS-I Basic Profile and supporting them was felt to introduce more complexity than benefit.  Finally a WS-BPEL processor MUST reject a WS-BPEL that refers to a portType that contain solicit-response or notification operations as defined in the WSDL 1.1 specification, this requirement MUST be statically enforced.

BPEL does not make any assumptions about the WSDL binding. Constraints, ambiguities, provided or missing capabilities of WSDL bindings are out of scope of this specification.

A WS-BPEL process is a reusable definition that can be deployed in different ways and in different scenarios, while maintaining a uniform application-level behavior across all of them. Note that the description of the deployment of a WS-BPEL process is out of scope for this specification.

Introduction of service reference container (“bpws:service-ref”) is meant to avoid inventing a private WS-BPEL mechanism for web service endpoint references and to provide pluggability of different versions of service referencing or endpoint addressing schemes being used within a BPEL program without having explicit dependency to a particular version of specification.

With respect to [WS-I Basic Profile] (Basic Profile 1.1) all BPEL implementations SHOULD be configurable such that they can participate in Basic Profile 1.1 compliant interactions. A BPEL implementation MAY allow the Basic Profile 1.1 configuration to be disabled, even for scenarios encompassed by the Basic Profile 1.1. At the time this specification was completed, the WSDL v2.0 work was ongoing and not ready for consideration for WS-BPEL v2.0. Future versions of WS-BPEL may provide support for WSDL v2.0.

4.  This Section Has Been Deleted

5. Core Concepts and Usage Patterns

As noted in the introduction, we believe that the two usage patterns of business protocol description and executable business process description require a common core of process description concepts. In this specification we clearly separate the core concepts from the extensions required specifically for the two usage patterns. The WS-BPEL specification is focused on defining the common core, and adds only the essential extensions required for each usage pattern. These extensions are described in separate sections (Extensions for Executable Processes and Extensions for Business Protocols).

In a number of cases, the behavior of a process in a certain combination of circumstances is undefined, e.g., when a variable is used before being initialized. In the definition of the core concepts we simply note that the semantics in such cases is not defined.

WS-BPEL takes it as a general principle that compliant implementations MAY choose to perform static analysis to detect and reject process definitions that may have undefined semantics. Such analysis is necessarily pessimistic and therefore might in some cases prevent the use of processes that would not, in fact, create situations with undefined semantics, either in specific uses or in any use.

In the executable usage pattern for WS-BPEL, situations of undefined semantics always result in standard faults in the WS-BPEL namespace. These cases will be described as part of the Extensions for Executable Processes in the specification. However, it is important to note that WS-BPEL uses exactly one standard internal fault for its core control semantics, namely, bpws:joinFailure. This is the only standard fault that plays a role in the core concepts of WS-BPEL. Of course, the occurrence of faults specified in WSDL portType definitions during web service invocation is accounted for in the core concepts as well.

6. Defining a Business Process

6.1. Initial Example

Before describing the structure of business processes in detail, this section presents a simple example of a WS-BPEL process for handling a purchase order. The aim is to introduce the most basic structures and some of the fundamental concepts of the language.

The operation of the process is very simple, and is represented in the following figure. Dotted lines represent sequencing. Free grouping of sequences represents concurrent sequences. Solid arrows represent control links used for synchronization across concurrent activities. Note that this is not meant to be a definitive graphical notation for WS-BPEL processes. It is used here informally as an aid to understanding.

On receiving the purchase order from a customer, the process initiates three tasks concurrently: calculating the final price for the order, selecting a shipper, and scheduling the production and shipment for the order. While some of the processing can proceed concurrently, there are control and data dependencies between the three tasks. In particular, the shipping price is required to finalize the price calculation, and the shipping date is required for the complete fulfillment schedule. When the three tasks are completed, invoice processing can proceed and the invoice is sent to the customer.

The WSDL portType offered by the service to its customers (purchaseOrderPT) is shown in the following WSDL document. Other WSDL definitions required by the business process are included in the same WSDL document for simplicity; in particular, the portTypes for the Web Services providing price calculation, shipping selection and scheduling, and production scheduling functions are also defined there. Observe that there are no bindings or service elements in the WSDL document. A WS-BPEL process is defined "in the abstract" by referencing only the portTypes of the services involved in the process, and not their possible deployments. Defining business processes in this way allows the reuse of business process definitions over multiple deployments of compatible services.

The partner link types included at the bottom of the WSDL document represent the interaction between the purchase order service and each of the parties with which it interacts (see Partner Link Types, Partner Links, and Endpoint References). Partner link types can be used to represent dependencies between services, regardless of whether a WS-BPEL business process is defined for one or more of those services. Each partner link type defines up to two "role" names, and lists the portTypes that each role must support for the interaction to be carried out successfully. In this example, two partner link types, "purchasingLT" and "schedulingLT", list a single role because, in the corresponding service interactions, one of the parties provides all the invoked operations: The "purchasingLT" partner link represents the connection between the process and the requesting customer, where only the purchase order service needs to offers a service operation ("sendPurchaseOrder"); the "schedulingLT" partner link represents the interaction between the purchase order service and the scheduling service, in which only operations of the latter are invoked. The two other partner link types, "invoicingLT" and "shippingLT", define two roles because both the user of the invoice calculation and the user of the shipping service (the invoice or the shipping schedule) must provide callback operations to enable asynchronous notifications to be asynchronously sent ("invoiceCallbackPT" and "shippingCallbackPT" portTypes).

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
<definitions targetNamespace="http://manufacturing.org/wsdl/purchase"
        xmlns:sns="http://manufacturing.org/xsd/purchase"
        xmlns:pos="http://manufacturing.org/wsdl/purchase"
        xmlns="http://schemas.xmlsoap.org/wsdl/">
       
        <types>
          <xsd:schema >
           <xsd:import        
               namespace="http://manufacturing.org/xsd/purchase"
          schemalocation="http://manufacturing.org/xsd/purchase.xsd"/>
         </xsd:schema>
        </types>
       
        <message name="POMessage">
             <part name="customerInfo" type="sns:customerInfo"/>
             <part name="purchaseOrder" type="sns:purchaseOrder"/>
        </message>
        <message name="InvMessage">
             <part name="IVC" type="sns:Invoice"/>
        </message>
        <message name="orderFaultType">
              <part name="problemInfo" element=”sns:OrderFault"/>
        </message>
        <message name="shippingRequestMessage">
              <part name="customerInfo" element="sns:customerInfo"/>
        </message>
        <message name="shippingInfoMessage">
              <part name="shippingInfo" element="sns:shippingInfo"/>
        </message>
        <message name="scheduleMessage">
             <part name="schedule" element="sns:scheduleInfo"/>
        </message>

<!-- portTypes supported by the purchase order process -->
        <portType name="purchaseOrderPT">
             <operation name="sendPurchaseOrder">
               <input message="pos:POMessage"/>
               <output message="pos:InvMessage"/>
               <fault name="cannotCompleteOrder"
                  message="pos:orderFaultType"/>
             </operation>
        </portType>
        <portType name="invoiceCallbackPT">
              <operation name="sendInvoice">
        <input message="pos:InvMessage"/>
        </operation>
        </portType>
        <portType name="shippingCallbackPT">
             <operation name="sendSchedule">
               <input message="pos:scheduleMessage"/>
             </operation>
        </portType>
       
<!-- portType supported by the invoice services -->
        <portType name="computePricePT">
             <operation name="initiatePriceCalculation">
               <input message="pos:POMessage"/>
             </operation>
             <operation name="sendShippingPrice">
               <input message="pos:shippingInfoMessage"/>
             </operation>
        </portType>
       
<!-- portType supported by the shipping service -->
        <portType name="shippingPT">
             <operation name="requestShipping">
               <input message="pos:shippingRequestMessage"/>
               <output message="pos:shippingInfoMessage"/>
               <fault name="cannotCompleteOrder"
                     message="pos:orderFaultType"/>
             </operation>
        </portType>
       
<!-- portType supported by the production scheduling process -->
        <portType name="schedulingPT">
              <operation name="requestProductionScheduling">
               <input message="pos:POMessage"/>
              </operation>
             <operation name="sendShipingSchedule">
               <input message="pos:scheduleMessage"/>
             </operation>
        </portType>
       
<plnk:partnerLinkType name="purchasingLT">
     <plnk:role name="purchaseService"
                portType="pos:purchaseOrderPT"/>
</plnk:partnerLinkType>

<plnk:partnerLinkType name="invoicingLT">
     <plnk:role name="invoiceService"
               portType="pos:computePricePT"/>
    
     <plnk:role name="invoiceRequester"
               portType="pos:invoiceCallbackPT"/>

</plnk:partnerLinkType>

<plnk:partnerLinkType name="shippingLT">
     <plnk:role name="shippingService"
               portType="pos:shippingPT"/>

     <plnk:role name="shippingRequester"
               portType="pos:shippingCallbackPT"/>

</plnk:partnerLinkType>

<plnk:partnerLinkType name="schedulingLT">
     <plnk:role name="schedulingService"
               portType="pos:schedulingPT"/>
 
</plnk:partnerLinkType>
</definitions>

The business process for the order service is defined next. There are four major sections in this process definition:

·         The <variables> section defines the data variables used by the process, providing their definitions in terms of WSDL message types, XML Schema types (simple or complex), or XML Schema elements. Variables allow processes to maintain state data and process history based on messages exchanged.

·         The <partnerLinks> section defines the different parties that interact with the business process in the course of processing the order. The four partnerLinks shown here correspond to the sender of the order (customer), as well as the providers of price (invoicingProvider), shipment (shippingProvider), and manufacturing scheduling services (schedulingProvider). Each partner link is characterized by a partner link type and a role name. This information identifies the functionality that must be provided by the business process and by the partner service for the relationship to succeed, that is, the portTypes that the purchase order process and the partner need to implement.

·         The <faultHandlers> section contains fault handlers defining the activities that must be performed in response to faults resulting from the invocation of the assessment and approval services. In WS-BPEL, all faults, whether internal or resulting from a service invocation, are identified by a qualified name. In particular, each WSDL fault is identified in WS-BPEL by a qualified name formed by the target namespace of the WSDL document in which the relevant portType and fault are defined, and the ncname of the fault. It is important to note, however, that because WSDL 1.1 does not require that fault names be unique within the namespace where the operation is defined, all faults sharing a common name and defined in the same namespace are indistinguishable. In spite of this serious WSDL limitation, WS-BPEL provides a uniform naming model for faults, in the expectation that future versions of WSDL will provide a better fault-naming model.

·         The rest of the process definition contains the description of the normal behavior for handling a purchase request. The major elements of this description are explained in the section following the process definition.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6

<process name="purchaseOrderProcess"
        targetNamespace="http://acme.com/ws-bp/purchase"
        xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
        xmlns:lns="http://manufacturing.org/wsdl/purchase">

<documentation xml:lang="EN">A simple example of a WS-BPEL process for handling a purchase order.</documentation>
       
<partnerLinks>
     <partnerLink name="purchasing"
        partnerLinkType="lns:purchasingLT"
        myRole="purchaseService"/>
     <partnerLink name="invoicing"
        partnerLinkType="lns:invoicingLT"
        myRole="invoiceRequester"
        partnerRole="invoiceService"/>
     <partnerLink name="shipping"
        partnerLinkType="lns:shippingLT"
        myRole="shippingRequester"
        partnerRole="shippingService"/>
     <partnerLink name="scheduling"
        partnerLinkType="lns:schedulingLT"
        partnerRole="schedulingService"/>
</partnerLinks>

<variables>
        <variable name="PO" messageType="lns:POMessage"/>
        <variable name="Invoice"  messageType="lns:InvMessage"/>
        <variable name="POFault"  messageType="lns:orderFaultType"/>
        <variable name="shippingRequest" messageType="lns:shippingRequestMessage"/>
        <variable name="shippingInfo" messageType="lns:shippingInfoMessage"/>
        <variable name="shippingSchedule" messageType="lns:scheduleMessage"/>
</variables>

<faultHandlers>
     <catch faultName="lns:cannotCompleteOrder"
            faultVariable="POFault" 
            faultMessageType="lns:orderFaultType">
        <reply partnerLink="purchasing"
           portType="lns:purchaseOrderPT"
           operation="sendPurchaseOrder"
           variable="POFault"
           faultName="cannotCompleteOrder"/>
     </catch>
</faultHandlers>

<sequence>
     <receive partnerLink="purchasing"
        portType="lns:purchaseOrderPT"
        operation="sendPurchaseOrder"
        variable="PO">
     </receive>
    
     <flow>
        <documentation>
          A parallel flow to handle shipping, invoicing and scheduling
        </documentation>
        <links>
            <link name="ship-to-invoice"/>
            <link name="ship-to-scheduling"/>
        </links>
        <sequence>
            <assign>
               <copy>
                   <from>$PO.customerInfo</from>
                   <to>$shippingRequest.customerInfo</to>
               </copy>
            </assign>
            <invoke partnerLink="shipping"
               portType="lns:shippingPT"
               operation="requestShipping"
               inputVariable="shippingRequest"
               outputVariable="shippingInfo">
               <sources>
                   <source linkName="ship-to-invoice"/>
               </sources>
            </invoke>
            <receive partnerLink="shipping"
               portType="lns:shippingCallbackPT"
               operation="sendSchedule"
               variable="shippingSchedule">
               <sources>
                   <source linkName="ship-to-scheduling"/>
               </sources>
            </receive>
        </sequence>
        <sequence>
            <invoke partnerLink="invoicing"
               portType="lns:computePricePT"
               operation="initiatePriceCalculation"
               inputVariable="PO">
            </invoke>
            <invoke partnerLink="invoicing"
               portType="lns:computePricePT"
               operation="sendShippingPrice"
               inputVariable="shippingInfo">
               <targets>
                   <target linkName="ship-to-invoice"/>
               </targets>
            </invoke>
            <receive partnerLink="invoicing"
               portType="lns:invoiceCallbackPT"
               operation="sendInvoice"
               variable="Invoice"/>
        </sequence>
        <sequence>
            <invoke partnerLink="scheduling"
               portType="lns:schedulingPT"
               operation="requestProductionScheduling"
               inputVariable="PO">
            </invoke>
            <invoke partnerLink="scheduling"
               portType="lns:schedulingPT"
               operation="sendShippingSchedule"
               inputVariable="shippingSchedule">
               <targets>
                   <target linkName="ship-to-scheduling"/>
               </targets>
            </invoke>
        </sequence>
     </flow>
     <reply partnerLink="purchasing"
        portType="lns:purchaseOrderPT"
        operation="sendPurchaseOrder"
        variable="Invoice"/>
    </sequence>
</process>

6.2. The Structure of a Business Process

This section provides a quick summary of the WS-BPEL syntax. It provides only a brief overview; the details of each language construct are described in the rest of this document.

The basic structure of the language is:

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6

<process name="ncname" targetNamespace="uri"
        queryLanguage="anyURI"?
        expressionLanguage="anyURI"?
        suppressJoinFailure="yes|no"?
        abstractProcess="yes|no"?
       
xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/">

<import namespace="uri" location="uri" importType="uri"/>*
        
<partnerLinks>?
<!-- Note: At least one role must be specified. -->
    <partnerLink name="ncname" partnerLinkType="qname"
        myRole="ncname"? partnerRole="ncname"?>+
    </partnerLink>
</partnerLinks>

<variables>?
     <variable name="ncname" messageType="qname"?
        type="qname"? element="qname"?/>+
</variables>

<correlationSets>?
      <correlationSet name="ncname" properties="qname-list"/>+
</correlationSets>

<faultHandlers>?
<!-- Note: There must be at least one fault handler or default. -->
     <catch faultName="qname"? faultVariable="ncname"?
                               faultMessageType="qname"?
                               faultElement="qname"?>*
        activity
    </catch>
    <catchAll>?
        activity
    </catchAll>
</faultHandlers>

<eventHandlers>?
<!-- Note: There must be at least one onEvent or onAlarm handler. -->
       <onEvent partnerLink="ncname" portType="qname"?
         operation="ncname" messageType="qname" variable="ncname"
         messageExchange="ncname"? >*
             <correlationSets>?
                   <correlationSet name="ncname" 
                      properties="qname-list"/>+
             </correlationSets>
             <correlations>?
               <correlation set="ncname"
                       initiate="yes|join|no"?/>+
             </correlations>
             activity
        </onEvent>
        <onAlarm>*
          ( <for expressionLanguage="anyURI"?>duration-expr</for> |
            <until expressionLanguage="anyURI"?>deadline-expr</until> )
            <repeatEvery expressionLanguage="anyURI"?>
              duration-expr
            </repeatEvery>?
             activity
        </onAlarm>
</eventHandlers>
        activity
</process>

The top-level attributes are as follows:

·         queryLanguage. This attribute specifies the default XML query language used for selection of nodes in assignment, property definition, and other uses. The default value for this attribute is: "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0", which represents the usage of XPath 1.0 within WS-BPEL 2.0. The URI of the corresponding XPath 1.0 specification is: http://www.w3.org/TR/1999/REC-xpath-19991116.

·         expressionLanguage. This attribute specifies the expression language used in the process. The default value for this attribute is: "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0", which represents the usage of XPath 1.0 within WS-BPEL 2.0. The URI of the corresponding XPath 1.0 specification is: http://www.w3.org/TR/1999/REC-xpath-19991116.

·         suppressJoinFailure. This attribute determines whether the joinFailure fault will be suppressed for all activities in the process. The effect of the attribute at the process level can be overridden by an activity using a different value for the attribute. The default for this attribute is "no" at the process level.  When this attribute is not specified for an activity, it inherits its value from its closest enclosing activity or from the process if no enclosing activity specifies this attribute.

·         exitOnStandardFault. This attribute specifies if the process must exit if a WS-BPEL standard fault other than bpws:joinFailure is encountered[1]. If the value of this attribute is set to “yes”, then the process MUST exit immediately as if an <exit> activity has been reached, when a WS-BPEL standard fault other than bpws:joinFailure is enountered. If the value of this attribute is set to “no”, then the process can handle a standard fault using a fault handler. The default value for this attribute is “no”. When this attribute is not specified on a <scope> it inherits its value from its enclosing <scope> or <process>.

If the value of exitOnStandardFault of a <scope> or <process> is set to “yes”, then a fault handler that explicitly targets the WS-BPEL standard faults MUST NOT be used in that scope. A process definition that violates this condition MUST be detected  and rejected by static analysis. 

·         abstractProcess. This attribute specifies whether the process being defined is abstract (rather than executable). The default for this attribute is "no".

The value of the queryLanguage and expressionLanguage attributes on the

<process> element are global defaults and can be overridden on

specific activities like <assign> using the mechanisms defined later in

this specification. In addition the queryLanguage attribute is also

available for use in defining BPEL property aliases in WSDL. BPEL processors

MUST:

·         statically determine which languages are referenced by queryLanguage or expressionLanguage attributes either in the BPEL process definition itself or in any BPEL property definitions in associated WSDLs and

·         if any referenced language is unsupported by the BPEL processor then the processor MUST NOT process the submitted BPEL process definition.

Note that: <documentation> construct may be added to virtually all WS-BPEL constructs as the formal way to annotate processes definition with human documentation. Examples of <documentation> construct can be found in previous section. Detailed description of <documention> is provided in next section, as it is a part of “Language Extensibility”.

The token "activity" can be any of the following:

·         <receive>

·         <reply>

·         <invoke>

·         <assign>

·         <throw>

·         <exit>

·         <wait>

·         <empty>

·         <sequence>

·         <if>

·         <while>

·         <repeatUntil>

·         <pick>

·         <flow>

·         <scope>

·         <compensate>

·         <rethrow>

·         <validate>

·         <extensionActivity>

The syntax of each of these elements, except <exit>, <compensate> and <rethrow>, is considered in the following paragraphs.

·        Although <exit> is permitted as an interpretation of the token activity, it is only available in executable processes and as such is defined in the section on Extensions for Executable Processes.

·        <compensate> activity can be used ONLY within a fault handler or a compensation handler (i.e. <catch>, <catchAll> and <compensationHandler> elements).

·        <rethrow> activity can be used ONLY within a fault handler (i.e. <catch> and <catchAll> elements).

The <receive> construct allows the business process to do a blocking wait for a matching message to arrive. The portType attribute on the <receive> activity is optional. If the portType attribute is included for readability, the value of the portType attribute MUST match the portType value implied by the combination of the specified partnerLink and the role implicitly specified by the activity (See also partnerLink description in the next section). The optional messageExchange attribute is used to associate a <reply> activity with a <receive> activity. (For details of messageExchange, please see “Providing Web Service Operations” section).

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6

<receive partnerLink="ncname" portType="qname"? operation="ncname"
    variable="ncname"? createInstance="yes|no"?
     messageExchange="ncname"?
    standard-attributes>
    standard-elements
    <correlations>?
        <correlation set="ncname" initiate="yes|join|no"?/>+
    </correlations>
    <fromPart part="ncname" toVariable="ncname"/>*
</receive>

The <reply> construct allows the business process to send a message in reply to a message that was received through a <receive>. The combination of a <receive> and a <reply> forms a request-response operation on the WSDL portType for the process. The portType attribute on the <reply> activity is optional. If the portType attribute is included for readability, the value of the portType attribute MUST match the portType value implied by the combination of the specified partnerLink and the role implicitly specified by the activity (See also partnerLink description in the next section). The optional messageExchange attribute is used to associate a <reply> activity with an inbound message activity, such as, <receive>, <onMessage> and <onEvent>. (For details of messageExchange, please see “Providing Web Service Operations” section).

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6

<reply partnerLink="ncname" portType="qname"? operation="ncname"
    variable="ncname"? faultName="qname"?
    messageExchange="ncname"?
    standard-attributes>
    standard-elements
    <correlations>?
        <correlation set="ncname" initiate="yes|join|no"?/>+
    </correlations>
    <toPart part="ncname" fromVariable="ncname"/>*
</reply>

The <invoke> construct allows the business process to invoke a one-way or requestresponse operation on a portType offered by a partner. The portType attribute on the <invoke> activity is optional. If the portType attribute is included for readability, the value of the portType attribute MUST match the portType value implied by the combination of the specified partnerLink and the role implicitly specified by the activity (See also partnerLink description in the next section).

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<invoke partnerLink="ncname" portType="qname"? operation="ncname"
    inputVariable="ncname"? outputVariable="ncname"?
    standard-attributes>
    standard-elements
    <correlations>?
        <correlation set="ncname" initiate="yes|join|no"?
            pattern="in|out|out-in"/>+
    </correlations>
    <catch faultName=“qname”? faultVariable="ncname"?
                             faultMessageType="qname"?>*
        activity
    </catch>
    <catchAll>?
        activity
    </catchAll>
    <compensationHandler>?
        activity
    </compensationHandler>
    <toPart part="ncname" fromVariable="ncname"/>*
    <fromPart part="ncname" toVariable="ncname"/>*
</invoke>

The <assign> construct can be used to update the values of variables with new data. An <assign> construct can contain any number of elementary assignments, including <copy> assign elements or data update operations defined as extension under other namespaces. The syntax of the assignment activity is:

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<assign validate="yes|no"? standard-attributes>
    standard-elements
    (<copy>
       from-spec
        to-spec
    </copy> |
    <extensibleAssign>
       ...assign-element-of-other-namespace...
    </extensibleAssign>) +
</assign>

The <validate> construct can be used to validate the values of variables against their associated XML and WSDL data definition. The construct has a variables attribute, which points to the variables being validated. The syntax of the validate activity is:

<validate variables="ncnames" />

The <throw> construct generates a fault from inside the business process.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<throw faultName="qname" faultVariable="ncname"? standard-attributes>
     standard-elements
</throw>

The <wait> construct allows you to wait for a given time period or until a certain time has passed. Exactly one of the expiration criteria must be specified.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<wait standard-attributes>
     standard-elements
        ( <for expressionLanguage="anyURI"?>duration-expr</for> |
          <until expressionLanguage="anyURI"?>deadline-expr</until> )
</wait>

The <empty> construct allows you to insert a "no-op" instruction into a business process. This is useful for synchronization of concurrent activities, for instance.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<empty standard-attributes>
        standard-elements
</empty>

New activities can be introduced for use in BPEL by placing them inside of the extensionActivity element. The contents of an extensionActivity element MUST be a single element that MUST make available BPEL's standard-attributes and standard-elements.

<extensionActivity>
    <???? standard-attributes>
       standard-elements
    </????>
</extensionActivity>

The <sequence> construct allows you to define a collection of activities to be performed sequentially in lexical order.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<sequence standard-attributes>
     standard-elements
     activity+
</sequence>

The <if> construct allows you to select exactly one branch of activity from a set of potential choices.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
<if standard-attributes>
     standard-elements
     <condition expressionLanguage="anyURI"?>
          ... bool-expr ... 
     </condition>
     <then>
          activity
     </then>
     <elseif>*
        <condition expressionLanguage="anyURI"?>
          ... bool-expr ... 
        </condition>
        activity
     </elseif>
     <else>?
        activity
     </else>
</if>
                       

The <while> construct allows you to indicate that an activity is to be repeated until a certain success criteria has been met.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<while standard-attributes>
   standard-elements
   <condition expressionLanguage="anyURI"?>
     ... bool-expr ... 
   </condition>
 
     activity
</while>

The <repeatUntil> constructs allows you to indicate the repeated performance of a specified iterative activity. The iterative activity will continue to be performed so long as after it executes the given Boolean <repeatUntil> condition holds true.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<repeatUntil standard-attributes>
       standard-elements
       activity
       <condition expressionLanguage="anyURI"?>
          ... bool-expr ...
       </condition>
</repeatUntil>

The <pick> construct allows you to block and wait for a suitable message to arrive or for a time-out alarm to go off. When one of these triggers occurs, the associated activity is performed and the pick completes.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<pick createInstance="yes|no"? standard-attributes>
     standard-elements
     <onMessage partnerLink="ncname" portType="qname"?
          operation="ncname" variable="ncname"?
          messageExchange="ncname"? >+
         <correlations>?
             <correlation set="ncname" initiate="yes|join|no"?/>+
        </correlations>
        <fromPart part="ncname" toVariable="ncname"/>*
        activity
    </onMessage>
    <onAlarm>*
          ( <for expressionLanguage="anyURI"?>duration-expr</for> |
            <until expressionLanguage="anyURI"?>deadline-expr</until> )

         activity
    </onAlarm>
</pick>

The portType attribute on the <onMessage> activity is optional. If the portType attribute is included for readability, the value of the portType attribute MUST match the portType value implied by the combination of the specified partnerLink and the role implicitly specified by the activity (See also partnerLink description in the next section). The optional messageExchange attribute is used to associate a <reply> activity with a <onMessage> activity. (For details of messageExchange, please see “Providing Web Service Operations” section).

The <flow> construct allows you to specify one or more activities to be performed concurrently. Links can be used within concurrent activities to define arbitrary control structures.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<flow standard-attributes>
     standard-elements
     <links>?
          <link name="ncname">+
     </links>
     activity+
</flow>

The <scope> construct allows you to define a nested activity with its own associated variables, fault handlers, and compensation handler.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<scope isolated="yes|no" standard-attributes>
    standard-elements
    <partnerLinks>?
         ... see above under <process> for syntax ...
    </partnerLinks>
    <variables>?
         ... see above under <process> for syntax ...
    </variables>
    <correlationSets>?
         ... see above under <process> for syntax ...
    </correlationSets>
    <faultHandlers>?
         ... see above under <process> for syntax ...
    </faultHandlers>
    <compensationHandler>?
         ... see above under <process> for syntax ...
    </compensationHandler>
    <terminationHandler>?
         ...
    </terminationHandler>
    <eventHandlers>?
          ...
    </eventHandlers>
    activity
</scope>
1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      

The <compensate> construct is used to invoke compensation on an inner scope that has already completed normally. This construct can be invoked only from within a fault handler or another compensation handler.

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<compensate scope="ncname"? standard-attributes>
        standard-elements
</compensate>

Note that the "standard-attributes" referred to above are:

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
name="ncname"? suppressJoinFailure="yes|no"?

where the default values are as follows:

·         name: No default value (that is, the default is unnamed)

·        suppressJoinFailure: When this attribute is not specified for an activity, it inherits its value from its closest enclosing activity or from the process if no enclosing activity specifies this attribute.

 

and that the "standard-elements" referred to above are:

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
<targets>?
   <joinCondition expressionLanguage="anyURI"?>?
     ... bool-expr ... 
   </joinCondition>                   
   <target linkName="ncname" />+
</targets>
<sources>?
   <source linkName="ncname">+
      <transitionCondition expressionLanguage="anyURI"?>?
        ... bool-expr ... 
      </transitionCondition>
   </source>
</sources>

6.3. Language Extensibility

WS-BPEL contains constructs that are generally sufficient for expressing abstract and executable business processes. In some cases, however, it might be necessary to “extend” the WS-BPEL language with additional constructs from other XML namespaces.

WS-BPEL supports extensibility by allowing namespace-qualified attributes to appear on any WS-BPEL element and by allowing elements from other namespaces to appear within WS-BPEL defined elements. This is allowed in the XML Schema specifications for WS-BPEL.

If, during the processing of a BPEL process an element is encountered that is not recognized by the processor then the element and its children MUST be treated as if they were not present in the BPEL process instance. The previously defined ignore semantics make it possible to add optional attributes or elements to BPEL that can be safely ignored if not recognized. In the case of unsupported mandatory extensions (see section 13.7) the previous logic is unnecessary as the entire process instance will be rejected.

Extensions MUST NOT contradict the semantics of any element or attribute defined by the WS-BPEL specification. Extensions that affect the semantics of WS-BPEL processes MUST appear in the WS-BPEL process definition or its directly referenced WSDL portTypes, property alias definitions or property definitions.

Apart from core WS-BPEL process constructs, extensions are also allowed in WSDL-based WS-BPEL constructs, such as, <partnerLinkType>, <role>, <property> and <propertyAlias>. The same syntax pattern and semantic rules for extensions of core BPEL constructs are applied to these extensions as well. Particularly, <extension> directives of a WS-BPEL process are applied to all extensions used in WSDL-based WS-BPEL constructs, of which the WSDL definitions are transitively referenced by the process.

The <documentation> construct is designed to be an integral part of Language Extensibility. The content of <documentation> are for human-consumption. Example types for those content are: plain text, HTML and XHTML. Tool-implementation specific information (e.g. the graphical layout details) should be added through elements and attributes of other namespaces, using the general WS-BPEL Language Extensibility mechanism.

6.4. Document Linking

A WS-BPEL process definition relies on XML Schema and WSDL 1.1 for the definition of  datatypes and service interfaces. Process definitions also rely on other constructs such as partner link types, variable properties and property aliases (defined later in this specification) which are defined within WSDL 1.1 documents using the WSDL 1.1 language extensibility feature.

The <import> element is used within a WS-BPEL process to explicitly indicate a dependency on external XML Schema or WSDL definitions. Any number of <import> elements may appear as initial children of the <process> element, before any other child element. Each <import> element contains three mandatory attributes

·         namespace. The namespace attribute specifies the URI namespace of the imported definitions.

·         location. The location attribute contains a URI indicating the location of a document that contains relevant definitions in the namespace specified. The document located at the URI MUST contain definitions belonging to the same namespace as indicated by the namespace attribute.

·         importType. The importType attribute identifies the type of document being imported by providing the URI of the encoding language. The value MUST be set to "http://www.w3.org/2001/XMLSchema" when importing XML Schema 1.0 documents, and to "http://schemas.xmlsoap.org/wsdl/" when importing WSDL 1.1 documents.

The presence of an <import> element should be interpreted as a hint to the WS-BPEL processor. In particular, processors are not required to retrieve the imported document from the location specified on the <import> element.

6.5 The Lifecycle of a Business Process

As noted in the introduction, the interaction model that is directly supported by WSDL is essentially a stateless client-server model of synchronous or uncorrelated asynchronous interactions. WS-BPEL, builds on WSDL by assuming that all external interactions of the business process occur through Web Service operations. However, WS-BPEL business processes represent stateful long-running interactions in which each interaction has a beginning, defined behavior during its lifetime, and an end. For example, in a supply chain, a seller's business process might offer a service that begins an interaction by accepting a purchase order through an input message, and then returns an acknowledgement to the buyer if the order can be fulfilled. It might later send further messages to the buyer, such as shipping notices and invoices. The seller's business process remembers the state of each such purchase order interaction separately from other similar interactions. This is necessary because a buyer might be carrying on many simultaneous purchase processes with the same seller. In short, a WS-BPEL business process definition can be thought of as a template for creating business process instances.

The creation of a process instance in WS-BPEL is always implicit; activities that receive messages (that is, receive activities and pick activities) can be annotated to indicate that the occurrence of that activity causes a new instance of the business process to be created. This is done by setting the createInstance attribute of such an activity to "yes". When a message is received by such an activity, an instance of the business process is created if it does not already exist (see Providing Web Service Operations and Pick).

To be instantiated, each business process must contain at least one such "start activity." That is, a receive/pick activity annotated with a createInstance="yes" attribute. See section 11.4 for more details on start activities.

If more than one start activity is enabled concurrently, then all such activities MUST share at least one common correlation set (see Correlation and the Multiple Start Activities example).

If a process contains exactly one start activity then the use of

correlation sets is unconstrained. This includes a pick with multiple onMessage branches; each such branch can use different correlation sets or no correlation sets.

A business process instance is terminated in one of the following ways:

·         When the activity that defines the behavior of the process as a whole completes. In this case the termination is normal.

·         When a fault reaches the process scope, and is either handled or not handled. In this case the termination is considered abnormal even if the fault is handled and the fault handler does not rethrow any fault. A compensation handler is never installed for a scope that terminates abnormally.

·         When a process instance is explicitly terminated by an exit activity (see Terminating the Service Instance). In this case the termination is abnormal.

The structure of the main processing section is defined by the outer <sequence> element, which states that the three activities contained inside are performed in order. The customer request is received (<receive> element), then processed (inside a <flow> section that enables concurrent behavior), and a reply message with the final approval status of the request is sent back to the customer (<reply>). Note that the <receive> and <reply> elements are matched respectively to the <input> and <output> messages of the "sendPurchaseOrder" operation invoked by the customer, while the activities performed by the process between these elements represent the actions taken in response to the customer request, from the time the request is received to the time the response is sent back (reply).

A receive activity for an inbound request/response operation is said to be open if that activity has been performed and no corresponding reply activity has been performed.  If the process instance reaches the end of its behavior, and one or more receive activities remain open, then the status of the instance becomes undefined. This condition indicates a modeling error that was not detected by static analysis.

The example makes the implicit assumption that the customer request can be processed in a reasonable amount of time, justifying the requirement that the invoker wait for a synchronous response (because this service is offered as a request-response operation). When that assumption does not hold, the interaction with the customer is better modeled as a pair of asynchronous message exchanges. In that case, the "sendPurchaseOrder" operation is a one-way operation and the asynchronous response is sent by invoking a second one-way operation on a customer "callback" interface. In addition to changing the signature of "sendPurchaseOrder" and defining a new portType to represent the customer callback interface, two modifications need to be made in the preceding example to support an asynchronous response to the customer. First, the partner link type "purchasingLT" that represents the process-customer connection needs to include a second role ("customer") listing the customer callback portType. Second, the <reply> activity in the process needs to be replaced by an <invoke> on the customer callback operation.

The processing taking place inside the <flow> element consists of three <sequence> blocks running concurrently. The synchronization dependencies between activities in the three concurrent sequences are expressed by using "links" to connect them. The links are defined inside the flow and are used to connect a source activity to a target activity. (Note that each activity declares itself as the source or target of a link by using the nested <source> and <target> elements.) In the absence of links, the activities nested directly inside a flow proceed concurrently. In the example, however, the presence of two links introduces control dependencies between the activities performed inside each sequence. For example, while the price calculation can be started immediately after the request is received, shipping price can only be added to the invoice after the shipper information has been obtained; this dependency is represented by the link (named "ship-to-invoice") that connects the first call on the shipping provider ("requestShipping") with sending shipping information to the price calculation service ("sendShippingPrice"). Likewise, shipping scheduling information can only be sent to the manufacturing scheduling service after it has been received from the shipper service; thus the need for the second link ("ship-to-scheduling").

Observe that information is passed between the different activities in an implicit way through the sharing of globally visible data variables. In this example, the control dependencies represented by links are related to corresponding data dependencies, in one case on the availability of the shipper rates and in another on the availability of a shipping schedule. The information is passed from the activity that generates it to the activity that uses it by means of two global data variables ("shippingInfo" and "shippingSchedule").

Certain operations can return faults, as defined in their WSDL definitions. For simplicity, it is assumed here that the two operations return the same fault ("cannotCompleteOrder"). When a fault occurs, normal processing is terminated and control is transferred to the corresponding fault handler, as defined in the <faultHandlers> section. In this example the handler uses a <reply> element to return a fault to the customer (note the "faultName" attribute in the <reply> element).

Finally, it is important to observe how an assignment activity is used to transfer information between data variables. The simple assignments shown in this example transfer a message part from a source variable to a message part in a target variable, but more complex forms of assignments are also possible.

7. Partner Link Types, Partner Links, and Endpoint References

A very important, if not the most important, use case for WS-BPEL will be in describing cross-enterprise business interactions in which the business processes of each enterprise interact through Web Service interfaces with the processes of other enterprises. An important requirement for realistic modeling of business processing in this environment is the ability to model the required relationship with a partner process. WSDL already describes the functionality of a service provided by a partner, at both the abstract and concrete levels. The relationship of a business process to a partner is typically peer-to-peer, requiring a two-way dependency at the service level. In other words, a partner represents both a consumer of a service provided by the business process and a provider of a service to the business process. This is especially the case when the interactions are based on asynchronous messaging rather than on remote procedure calls. The notion of Partner links is used to directly model peer-to-peer conversational partner relationships. Partner links define the shape of a relationship with a partner by defining the message and port types used in the interactions in both directions. However, the actual partner service may be dynamically determined within the process. WS-BPEL uses a notion of endpoint reference, manifested as a service reference container (“bpws:service-ref”), to represent the dynamic data required to describe a partner service endpoint.

It is important to emphasize that the notions of partner link and endpoint reference used here are preliminary. The specification for these concepts as they relate to Web Services is still evolving, and we expect normative definitions for them to emerge in future. The WS-BPEL specification will be updated to conform to the expected future standards.

7.1. Partner Link Types

A partner link type characterizes the conversational relationship between two services by defining the "roles" played by each of the services in the conversation and specifying the portType provided by each service to receive messages within the context of the conversation. The following example illustrates the basic syntax of a partner link type declaration:

1234567890123456789012345678901234567890123456789012345678901234567890
         1         2         3         4         5         6
                      
<partnerLinkType name="BuyerSellerLink"
     xmlns="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
     <role name="Buyer" portType="buy:BuyerPortType"/>
     <role name="Seller" p