| China |
| |
| IBM 主页 | 产品与服务 | 支持与下载 | 个性化服务 | ||
|
| Business Process Execution Language for Web Services | ||||
Version 1.09 August 2002Authors (alphabetically):Francisco Curbera, IBM Copyright_2001-2002 BEA Systems, International Business Machines Corporation, Microsoft Corporation, Inc. All rights reserved. The presentation, distribution or other dissemination of the information contained in this specification is not a license, either expressly or impliedly, to any intellectual property owned or controlled by BEA or IBM or Microsoft and\or any other third party._BEA, IBM, Microsoft, and\or any other third party may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document._The furnishing of this document does not give you any license to BEA's or IBM's or Microsoft's or any other third party's patents, trademarks, copyrights, or other intellectual property._The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted herein are fictitious._No association with any real company, organization, product, domain name, email address, logo, person, places, or events is intended or should be inferred. This specification and the information contained herein is provided on an "AS IS" basis and to the maximum extent permitted by applicable law, BEA, IBM and Microsoft provides the document AS IS AND WITH ALL FAULTS, and hereby disclaims all other warranties and conditions, either express, implied or statutory, including, but not limited to, any (if any) implied warranties, duties or conditions of merchantability, of fitness for a particular purpose, of accuracy or completeness of responses, of results, of workmanlike effort, of lack of viruses, and of lack of negligence, all with regard to the document._ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT OF ANY INTELLECTUAL PROPERTY RIGHTS WITH REGARD TO THE DOCUMENT. IN NO EVENT WILL BEA OR IBM OR MICROSOFT BE LIABLE TO ANY OTHER PARTY FOR THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. Abstract This document defines a notation for specifying business process behavior based on Web Services. This notation is called Business Process Execution Language for Web Services (abbreviated to BPEL4WS in the rest of this document). Processes in BPEL4WS 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. BPEL4WS is meant to be used to model the behavior of both executable and abstract processes. BPEL4WS 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. BPEL4WS 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 an initial public draft release of the BPEL4WS specification. We anticipate a number of extensions to the feature set of BPEL4WS that are discussed briefly at the end of the document. BPEL4WS represents a convergence of the ideas in the XLANG and WSFL specifications. Both XLANG and WSFL are superseded by the BPEL4WS specification. BPEL4WS and related specifications are provided as-is and for review and evaluation only. BEA, IBM and Microsoft hope to solicit your contributions and suggestions in the near future. BEA, IBM and Microsoft make no warrantees or representations regarding the specifications in any manner whatsoever. Contents 1. Introduction 2. Notational Conventions 3. Relationship with WSDL 4. Defining a Business Process 4.1. Initial Example 4.2. The Structure of a Business Process 4.3. Language Extensibility 4.4. The Lifecycle of a Business Process 5. Service Linking, Partners, and Service References 5.1. Service Linking 5.2. Partners 5.3. Service References 6. Message Properties 6.1. Motivation 6.2. Defining Properties 7. Correlation 7.1. Message Correlation 7.2. Defining and Using Correlation Sets 8. Data Handling 8.1. Expressions 8.1.1. Boolean Expressions 8.1.2. Deadline-Valued Expressions 8.1.3. Duration-Valued Expressions 8.1.4. General Expressions 8.2. Containers 8.3. Assignment 8.3.1. Atomicity of Assignment 8.3.2. Assignment Example 8.4. Summary of Differences Between Abstract and Executable 8.5. Processes 9. Basic Activities 9.1. Standard Attributes for Each Activity 9.2. Standard Elements for Each Activity 9.3. Invoking Web Service Operations 9.4. Providing Web Service Operations 9.5. Updating Container Contents 9.6. Signaling Faults 9.7. Terminating the Service Instance 9.8. Waiting 9.9. Doing Nothing 10. Structured Activities 10.1. Sequence 10.2. Switch 10.3. While 10.4. Pick 10.5. Flow 10.5.1. Link Semantics 10.5.2. Dead-Path-Elimination (DPE) 10.5.3. Flow Graph Example 10.5.4. Links and Structured Activities 11. Scopes 11.1. Error Handling in Business Processes 11.2. Compensation Handlers 11.2.1. Defining a Compensation Handler 11.2.2. Invoking a Compensation Handler 11.3. Fault Handlers 11.3.1. Implicit Fault and Compensation Handlers 11.3.2. Semantics of Activity Termination 11.3.3. Handling Faults That Occur Inside Fault and Compensation Handlers 11.4. Serializable Scopes 12. Examples 12.1. Shipping Service 12.1.1. Service Description 12.1.2. Message Properties 12.1.3. Process 12.2. Loan Approval 12.2.1. Service Description 12.2.2. Process 12.3. Multiple Start Activities 12.3.1. Service Description 12.3.2. Process 13. Future Directions 13.1. Scopes 13.1.1. Containers 13.1.2. Event Handlers 13.1.3. Overlapping Scopes 13.1.4. Atomic Scopes 13.1.5. Compensation 13.2. Lifecycle and Query 13.2.1. Suspend/Resume 13.2.2. Query 13.3. Service Composition 13.4. Relationship to WS-Transaction Specification 14. Security Considerations 15. Acknowledgments 16. References Appendix A _Standard Faults Appendix B _Attributes and Defaults Appendix C _Coordination Protocol Coordination Protocol for BPEL4WS Scopes Appendix D - XSD Schemas BPEL4WS Schema Service Link Type Schema Service References Schema Message Properties Schema 1. IntroductionThe 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, platform-independent 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:
If we wish to provide precise predictable descriptions of service behavior for cross-enterprise 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 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. BPEL4WS uses a notion of message properties 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 a Defining business protocols and defining executable business processes require very similar concepts. The concepts required for defining business protocols and those required for defining executable business processes form a continuum, and BPEL4WS is designed to cover this continuum._BPEL4WS 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 service link. The BPEL4WS 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. BPEL4WS also introduces systematic mechanisms for dealing with business exceptions and processing faults. Finally, BPEL4WS 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. The basic concepts of BPEL4WS can be applied in one of two ways. A BPEL4WS 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 service link. Abstract processes use all the concepts of BPEL4WS 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. BPEL4WS 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 BPEL4WS 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 BPEL4WS 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 BPEL4WS 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 BPEL4WS 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. BPEL4WS 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 BPEL4WS processes. XPath provides support for data manipulation. All external resources and partners are represented as WSDL services. BPEL4WS provides extensibility to accommodate future versions of these standards, specifically the XPath and related standards used in XML computation. 2. Notational ConventionsThe 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 RFC2119 [13]. Namespace URIs of the general form "some-URI" represent some application-dependent or context-dependent URI as defined in RFC 2396 [14]. This specification uses an informal syntax to describe the XML grammar of the XML fragments that follow:
XSD schemas and WSDL definitions are provided as a formal definition of grammars [xml-schema1][WSDL]. 3. Relationship with WSDLBPEL4WS 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 BPEL4WS language. The BPEL4WS process model is layered on top of the service model defined by WSDL 1.1. At the core of the BPEL4WS 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 BPEL4WS 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, BPEL4WS defines the message exchange protocols followed by the business process of a specific role in the interaction. The definition of a BPEL4WS 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 BPEL4WS 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. A BPEL4WS 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 BPEL4WS process is out of scope for this specification. 4. Defining a Business ProcessBusiness processes can be described in two ways. Executable business processes model actual behavior of a participant in a business interaction. In executable processes, no attempt is made to separate externally visible or "public" aspects of a business process from its internal workings. 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 processes involved in a business protocol are called abstract processes. Abstract processes are not typically executable. They are meant to couple Web Service interface definitions with behavioral specifications that can be used to both constrain the implementation of business roles and define in precise terms the behavior that each party in a business protocol can expect from the others. BPEL4WS is meant to be used to define both kinds of processes. The difference between the two lies exclusively in the different feature sets for data handling that are available in the two kinds of processes. These differences are defined precisely in the section on Data Handling. 4.1. Initial ExampleBefore describing the structure of business processes in detail, this section presents a simple example of a BPEL4WS 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 BPEL4WS processes. It is used here informally as an aid to understanding. On receiving the purchase order from a customer, the process initiates three tasks in parallel: 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 in parallel, 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 BPEL4WS 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 service 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 Service Linking, Partners, and Service References). Service link types can be used to represent dependencies between services, regardless of whether a BPEL4WS business process is defined for one or more of those services. Each service 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 link types, "purchaseLT" and "schedulingLT", list a single role because, in the corresponding service interactions, one of the parties provides all the invoked operations: The "purchaseLT" service 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" service 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 service link types, "invoiceLT" 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). The business process for the order service is defined next. There are four major sections in this process definition:
The structure of the main processing section is defined by the outer <sequence> element, which states that the three elements contained inside are executed in order. The customer request is received (<receive> element), then processed (inside a <flow> section that enables concurrent execution), 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 executed 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). 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 service link type "purchaseLT" 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 parallel 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 execution of the activities nested directly inside a flow proceeds in parallel. In the example, however, the presence of two links introduces control dependencies between the activities executed 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 containers. 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 containers ("shippingInfo" and "shippingSchedule"). The current version of BPEL4WS supports only global data containers, but future versions will include locally scoped data as well. Moreover, in the future, data flow will be allowed through links in addition to using links to express synchronization dependencies. 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 containers. The simple assignments shown in this example transfer a message part from a source container to a message part in a target container, but more complex forms of assignments are also possible. 4.2. The Structure of a Business ProcessThis section provides a quick summary of the BPEL4WS 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: The top-level attributes are as follows:
The token "activity" can be any of the following:
The syntax of each of these elements is considered in the following paragraphs. The <receive> construct allows the business process to do a blocking wait for a matching message to arrive. 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 <invoke> construct allows the business process to invoke a one-way or request-response operation on a portType offered by a partner. The <assign> construct can be used to update the values of containers with new data. An <assign> construct can contain any number of elementary assignments assignments. The syntax of the assignment activity is: where the various options for from-spec and to-spec tokens are: The The The The <empty> construct allows you to insert a "no-op" instruction into a business process. This is useful for synchronization of parallel activities, for instance. The <sequence> construct allows you to define a collection of activities to be performed sequentially in lexical order. The <switch> construct allows you to select exactly one branch of execution from a set of choices. The <while> construct allows you to indicate that an activity is to be repeated until a certain success criteria has been met. The <pick> construct allows you to block and wait for exactly a suitable message to arrive or for a time-out alarm to go off. When one of these triggers occurs, the associated activity is executed and the pick completes. The <flow> construct allows you to specify one or more activities to be executed in parallel. Links can be used within parallel activities to define arbitrary control structures. The <scope> construct allows you to define a nested activity with its own associated fault and compensation handlers. The <compensate> construct is used to invoke compensation on an inner scope that has already completed its execution normally. This construct can be invoked only from within a fault handler or another compensation handler. Note that the "standard-attributes" referred to above are: where the default values are as follows:
and that the "standard-elements" referred to above are: where the default value of the "transitionCondition" attribute is "true()", the truth-value function from the default expression language XPath 1.0. 4.3. Language ExtensibilityBPEL4WS contains constructs that are generally sufficient for expressing abstract and executable business processes. In some cases, however, it might be necessary to "extend" the BPEL4WS language with additional constructs from other XML namespaces. BPEL4WS supports extensibility by allowing namespace-qualified attributes to appear on any BPEL4WS element and by allowing elements from other namespaces to appear within BPEL4WS defined elements. This is allowed in the XML Schema specifications for BPEL4WS. All extension namespaces used in a BPEL4WS document MUST be declared. An extension namespace is declared by using the following syntax: Extensions MUST NOT change the semantics of any element or attribute from the BPEL4WS namespace. 4.4. The Lifecycle of a Business ProcessAs 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. BPEL4WS, builds on WSDL by assuming that all external interactions of the business process occur through Web Service operations. However, BPEL4WS 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 BPEL4WS business process definition can be thought of as a template for creating business process instances. The creation of a process instance in BPEL4WS is always implicit; activities that receive messages (that is, To be instantiated, each business process must contain at least one such "start activity." This must be an initial activity in the sense that there is no basic activity that logically precedes it in execution flow. If more than one start activity is enabled for concurrent execution, then all such activities must use at least one correlation set and must use the same correlation sets (see Correlation and the Multiple Start Activities example). If exactly one start activity is expected to be executed, the use of correlation sets is unconstrained. This includes a A business process instance is terminated in one of the following ways:
5. Service Linking, Partners, and Service ReferencesA very important, if not the most important, use case for BPEL4WS 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 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 service links is used to directly model peer-to-peer partner relationships._Service 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._BPEL4WS defines a notion of service reference to represent the dynamic data required to describe a partner service. It is important to emphasize that the notions of service link and service reference used here are preliminary._There is as yet no generally agreed specification for these concepts as they relate to Web Services, and we expect standard definitions for them to emerge in future._The BPEL4WS specification will be updated to confirm to the expected future standard. 5.1. Service LinkingA service link type characterizes the relationship between two services by defining the "roles" played by each of the services in the relationship and specifying the portTypes provided by each role. The following example illustrates the basic syntax of a service link type declaration: Each role can include any number of WSDL portTypes. In the common case, portTypes of each role originate from a separate namespace. However, in some cases, both roles of a service link type can be defined in terms of portTypes from the same namespace. The latter situation occurs for service link types that define "callback" relationships between services. The service link type definition can be a separate artifact independent of either service's WSDL document. Alternatively, the service link type definition can be placed within the WSDL document defining the portTypes from which the different roles are defined. The extensibility mechanism of WSDL 1.1 is used to define serviceLinkType as a new definition type to be placed as an immediate child element of a <wsdl:definitions> element in all cases. This allows reuse of the WSDL target namespace specification and, more importantly, its import mechanism to import portTypes. For cases where a service link type declaration is linking the portTypes of two different services, the service link type declaration can be placed in a separate WSDL document (with its own targetNamespace). The syntax for defining a service link type is: This defines a service link type in the namespace indicated by the value of the "targetNamespace" attribute of the WSDL document element. The portTypes identified within <slnk:role> are referenced by using QNames as for all top-level WSDL definitions. Note that in some cases it can be meaningful to define a service link type containing exactly one role instead of two. That defines a service linking scenario where one service expresses a willingness to link with any other service, without placing any requirements on the other service. Examples of serviceLinkType declarations are found in various business process examples in this specification. 5.2. PartnersThe services with which a business process interacts are modeled as partners in BPEL4WS. Each partner is characterized by a serviceLinkType. More than one partner can be characterized by the same serviceLinkType. For example, a certain procurement process might use more than one vendor for its transactions, but might use the same serviceLinkType for all vendors. Each partner is named, and this name is used for all service interactions with that partner. This is critical, for example, in correlating responses to different partners for simultaneous requests of the same kind (see Invoking Web Service Operations and Providing Web Service Operations). The role of the business process itself is indicated by the attribute Note that the partner declarations specify the static shape of the relationships that the BPEL4WS process will employ in its behavior. When such a process is deployed and executed, all the partners for whom the 5.3. Service ReferencesWSDL makes an important distinction between portTypes and ports. PortTypes define abstract functionality by using abstract messages. Ports provide actual access information, including communication endpoints and (by using extension elements) other deployment-related information such as public keys for encryption. Bindings provide the glue between the two. While the user of a service must be statically dependent on the abstract interface defined by portTypes, the information contained in port definitions can typically be discovered and used dynamically. The fundamental use of service references is to serve as the mechanism for dynamic communication of port-specific data for services. A service reference makes it possible in BPEL4WS to dynamically select a provider for a particular type of service and to invoke their operations. BPEL4WS provides a general mechanism for correlating messages to stateful instances of a service, and therefore service references that carry instance-neutral port information are often sufficient. However, in general it is necessary to carry additional instance-identification tokens in the service reference itself. A service reference is defined as a typed reference that includes port-specific data for a service, and optionally additional data regarding instance-identification tokens and other relevant properties. Relevant WSDL schemas are used wherever possible to avoid redundancy. The syntactic structure of a service reference is: At a minimum, a service reference is the qualified name of a <wsdl:service> element where that element is either inlined within the service reference or assumed to be already known by the recipient of the service reference. The following is a minimal example of a service reference: If the service is not assumed to be already known by reference, its definition can be inlined in the service reference as a way of dynamically communicating the service definition part of a WSDL document. The inlined Finally, the service reference might require additional tokens for purposes such as identifying one or more service instances of interest. The service reference schema does not assign any particular significance to these tokens. They are permitted as a convenient way to carry metadata for a variety of purposes. The key point is that this data is always associated with globally named properties (see Message Properties). As such, they have semantics that are assumed to be known by the receiver of the service reference. Every partner in a BPEL4WS process instance is assigned a unique service reference in the course of the deployment or during the execution of the process. 6. Message Properties6.1. MotivationThe data in a message consists conceptually of two parts: application data and protocol-relevant data, where the protocols can be business protocols or infrastructure protocols providing higher quality of service. An example of business protocol data is the correlation tokens that are used in correlation sets (see Correlation). Examples of infrastructure protocols are security, transaction, and reliable messaging protocols. The business protocol data is usually found embedded in the application-visible message parts, whereas the infrastructure protocols almost always add implicit extra parts to the message types to represent protocol headers that are separate from application data. Such implicit parts are often called message context because they relate to security context, transaction context, and other similar middleware context of the interaction. Business processes might need to gain access to and manipulate both kinds of protocol-relevant data. The notion of message properties is defined as a general way of naming and representing distinguished data elements within a message, whether in application-visible data or in message context. For a full accounting of the service description aspects of infrastructure protocols, it is necessary to define notions of service policies, endpoint properties, and message context. This work is outside the scope of BPEL4WS. Message properties are defined here in a sufficiently general way to cover message context consisting of implicit parts, but the use in this specification focuses on properties embedded in application-visible data that is used in the definition of business protocols and abstract business processes. 6.2. Defining PropertiesA property definition creates a globally unique name and associates it with an XML Schema type. The intent is not to create a new type. The intent is to create a name that has greater significance than the type itself. For example, a sequence number can be an integer, but the integer type does not convey this significance, whereas a globally named sequence-number property does. Properties can occur anywhere in a message, including in the message context. A typical use for a property in BPEL4WS is to name a token for correlation of service instances with messages. For example, a social security number might be used to identify an individual taxpayer in a long-running multiparty business process regarding a tax matter. A social security number can appear in many different message types, but in the context of a tax-related process it has a specific significance as a taxpayer ID. Therefore a global name is given to this use of the type by defining a property, as in the following example: In correlation, the property name must have global significance to be of any use. Properties such as price, risk, response latency, and so on, which are used in conditional behavior in a business process, have similar global and public significance. It is likely that they will be mapped to multiple messages, and therefore they need to be globally named as in the case of correlation properties. Such properties are essential, especially in abstract processes. The WSDL extensibility mechanism is used to define properties so that the target namespace and other useful aspects of WSDL are available. The BPEL4WS standard namespace, Properties used in business protocols are typically embedded in application-visible message data. The notion of aliasing is introduced to map a global property to a field in a specific message part. The property name becomes an alias for the message part and location, and can be used as such in Expressions and Assignment in abstract business processes. The The syntax for a propertyAlias definition is: The interpretation of the 7. CorrelationThe information provided so far suggests that the target for messages that are delivered to a business process service is the WSDL port of the recipient service. This is an illusion because, by their very nature, stateful business processes are instantiated to act in accordance with the history of an extended interaction. Therefore, messages sent to such processes need to be delivered not only to the correct destination port, but also to the correct instance of the business process that provides the port. The infrastructure hosting the process must do this in a generic manner, to avoid burdening every process implementation with the need to implement a custom mechanism for instance routing. Messages, which create a new business process instance, are a special case, as described in The Lifecycle of a Business Process. In the object-oriented world, such stateful interactions are mediated by object references, which intrinsically provide the ability to reach a specific object (instance) with the right state and history for the interaction. This works reasonably well in tightly coupled implementations where a dependency on the structure of the implementation is normal. In the loosely coupled world of Web Services, the use of such references would create a fragile web of implementation dependencies that would not survive the independent evolution of business process implementation details at each business partner. In this world, the answer is to rely on the business data and communication protocol headers that define the wire-level contract between partners and to avoid the use of implementation-specific tokens for instance routing whenever possible. Consider the usual supply-chain situation where a buyer sends a purchase order to a seller. Suppose that the buyer and seller have a stable business relationship and are statically configured to send documents related to the purchasing interaction to the URLs associated with the relevant WSDL service ports. The seller needs to asynchronously return an acknowledgement for the order, and the acknowledgement must be routed to the correct business process instance at the buyer. The obvious and standard mechanism to do this is to carry a business token in the order message (such as a purchase order number) that is copied into the acknowledgement for correlation. The token can be in the message envelope in a header or in the business document (purchase order) itself. In either case, the exact location and type of the token in the relevant messages is fixed and instance independent. Only the value of the token is instance dependent. Therefore, the structure and position of the correlation tokens in each message can be expressed declaratively in the business process description. The BPEL4WS notion of correlation set, described in the following section, provides this feature. The declarative information allows a BPEL4WS-compliant infrastructure to use correlation tokens to provide instance routing automatically. The declarative specification of correlation relies on declarative properties of messages. A property is simply a "field" within a message identified by a query梑y default the query language is XPath 1.0. This is only possible when the type of the message part or binding element is described by using an XML Schema. The use of correlation tokens and service references is restricted to message parts described in this way. To be clear, the actual wire format of such types can still be non-XML, for example, EDI flat files, based on different bindings for port types. 7.1. Message CorrelationDuring its lifetime, a business process instance typically holds one or more conversations with partners involved in its work. Conversations can be based on sophisticated transport infrastructure that correlates the messages involved in a conversation by using some form of conversation identity and routes them automatically to the correct service instance without the need for any annotation within the business process. However, in many cases correlated conversations involve more than two parties or use lightweight transport infrastructure with correlation tokens embedded directly in the application data being exchanged. In such cases, it is often necessary to provide additional application-level mechanisms to match messages and conversations with the business process instances for which they are intended. Correlation patterns can become quite complex. The use of a particular set of correlation tokens does not, in general, span the entire interaction between a service instance and a partner (instance), but spans a part of the interaction. Correlated exchanges can nest and overlap, and messages can carry several sets of correlation tokens. For example, a buyer might start a correlated exchange with a seller by sending a purchase order (PO) and using a PO number embedded in the PO document as the correlation token. The PO number is used in the PO acknowledgement by the seller. The seller might later send an invoice that carries the PO number, to correlate it with the PO, and also carries an invoice number so that future payment-related messages need to carry only the invoice number as the correlation token. The invoice message thus carries two separate correlation tokens and participates in two overlapping correlated exchanges. BPEL4WS addresses correlation scenarios by providing a declarative mechanism to specify correlated groups of operations within a service instance. A set of correlation tokens can be defined as a set of properties shared by all messages in the correlated group. Such a set of properties is called a correlation set. Correlation sets are instantiated within the scope of an instance of the business process. Like the instantiation of a business process, the instantiation of a correlation set is triggered by a specially marked operation. In the current version of BPEL4WS, a correlation set can be instantiated only once during the lifetime of a business process instance. Its value, once initialized, can be thought of as an alias for the identity of the business process instance. In multiparty business protocols, each participant process in a correlated message exchange acts either as the initiator or as a follower of the exchange. The initiator process sends the first message (as part of an operation invocation) that starts the conversation, and therefore defines the values of the properties in the correlation set that tag the conversation. All other participants are followers that instantiate their correlation sets in the conversation by receiving an incoming message that provides the values of the properties in the correlation set. Both initiator and followers must mark the first activity in their respective groups as the activity that initializes the correlation set. 7.2. Defining and Using Correlation SetsThe examples in this section show correlation being used on almost every messaging activity (receive, reply, and invoke). This is because BPEL4WS does not assume the use of any sophisticated conversational transport protocols for messaging. In cases where such protocols are used, the explicit use of correlation in BPEL4WS can be reduced to those activities that establish the conversational connections. Each correlation set in BPEL4WS is a named group of properties that, taken together, serve to define a way of identifying an application-level conversation within a business protocol instance. A given message can carry multiple correlation sets. After initialization, the values of the properties for a correlation set in a business process instance must be identical for all the messages in all the operations that carry the correlation set. If at execution time this constraint is violated, the standard fault Following is an extended example of correlation. It begins by defining four message properties: Note that these properties are global names with known (simple) XMLSchema types. They are abstract in the sense that their occurrence in messages needs to be separately specified (see Message Properties). The example continues by defining purchase order and invoice messages and by using the concept of aliasing to map the abstract properties to fields within the message data identified by selection. Finally, the portType used is defined, in a separate WSDL document. Both the properties and their mapping to purchase order and invoice messages will be used in the following correlation examples. Correlation sets are used in A message can carry the tokens of one or more correlation sets. The first example shows an interaction in which a purchase order is received in a one-way inbound request and a confirmation including an invoice is sent in the asynchronous response. The In the following, the prefix Alternatively, the response might have been a rejection (such as an "out-of-stock" message), which in this case terminates the conversation correlated by the correlationSet The use of correlation with synchronous Web Service invocation is illustrated by the alternative synchronous purchasing operation used by an invoke activity used in the buyer's business process. Note that an 8. Data HandlingBusiness processes model stateful interactions. The state involved consists of messages received and sent as well as other relevant data such as time-out values. The maintenance of the state of a business process requires the use of state variables, which are called containers. Furthermore, the data from the state needs to be extracted and combined in interesting ways to control the behavior of the process, which requires data expressions. Finally, state update requires a notion of assignment. BPEL4WS provides these features for XML data types and WSDL message types. The XML family of standards in these areas is still evolving, and using the process-level attributes for query and expression languages provides for the incorporation of future standards. The differences between abstract and executable processes are exclusively in the data-handling feature set available to each kind of process. Executable processes are permitted to use the full range of data manipulation and assignment features but are not permitted to use nondeterministic values. Abstract processes are restricted to limited manipulation of values contained in message properties but are permitted to use nondeterministic values to reflect the consequences of hidden private behavior. Detailed differences are specified in the following sections, and summarized at the end of the data-handling section. 8.1. ExpressionsBPEL4WS uses several types of expressions. The kinds of expressions used are as follows (relevant usage contexts are listed in parentheses):
BPEL4WS provides an extensible mechanism for the language used in these expressions. The language is specified by the http://www.w3.org/TR/1999/REC-xpath-19991116 Given an expression language, it must be possible to query data from containers, to extract property values, and to query the status of links from within expressions. This specification defines those functions for XPath 1.0 only, and it is expected that other expression-language bindings will provide equivalent functionality. The rest of this section is specific to XPath 1.0. BPEL4WS introduces several extension functions to XPath's built-in functions to enable XPath 1.0 expressions to access information from the process. The extensions are defined in the standard BPEL4WS namespace Any qualified names used within XPath expressions are resolved by using namespace declarations currently in scope in the BPEL4WS document at the location of the expression. The following functions are defined by this specification: This function extracts values from containers. The first argument names the source container for the data, the second names the part to select from that container, and the third optional argument, when present, provides an absolute location path (with '/' meaning the root of the document fragment representing the entire part) to identify the root of a subtree within the document fragment representing the part. The return value of this function is a node set containing the single node representing either an entire part (if the third argument is absent) or the result of the selection based on the locationPath. If the given locationPath selects a node set of a size other than one, then the standard fault The use of This function extracts global property values from containers. The first argument names the source container for the data and the second is the qualified name (QName) of the global property to select from that container (see Message Properties). If the given property does not appear in any of the parts of the container's message type, then the standard fault This function returns a Boolean indicating the status of the link (see Link Semantics). If the status of the link is positive the value is true, and if the status is negative the value is false. This function MUST NOT be used anywhere except in a join condition. The linkName argument MUST refer to the name of an incoming link for the activity associated with the join condition. These restrictions MUST be statically enforced. These BPEL4WS-defined extension functions are available for use within all XPath 1.0 expressions. The syntax of XPath 1.0 expressions for BPEL4WS is considered in the following paragraphs. 8.1.1. Boolean ExpressionsThese are expressions that conform to the XPath 1.0 Expr production where the evaluation results in Boolean values. 8.1.2. Deadline-Valued ExpressionsThese are expressions that conform to the XPath 1.0 Expr production where the evaluation results in values that are of the XML Schema types dateTime or date. Note that XPath 1.0 is not XML Schema aware. As such, none of the built-in functions of XPath 1.0 are capable of producing or manipulating dateTime or date values. However, it is possible to write a constant (literal) that conforms to XML Schema definitions and use that as a deadline value or to extract a field from a container (part) of one of these types and use that as a deadline value. XPath 1.0 will treat that literal as a string literal, but the result can be interpreted as a |