Last week we introduced you to the idea of using existing Web services to build more complex web services. This week, we're going to take a closer look at business processes and their role in constructing Web services. This article is excerpted from chapter 12 of Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, written by Steve Graham et al. (Sams; ISBN: 0672326418).
Business Processes and Web Services - Basic and Structured Activities (Page 4 of 4 )
Activities g are the composition primitives that implement the business logic of a BPEL process. BPEL distinguishes between basic and structured activities. Structured activities let you specify collections of nested activities and the order in which they take place. Basic activities represent atomic operations of a business process.
Let's first look at the basicactivities BPEL provides. A basic activity can be any of the following:
receive —Waits to receive a request message from a partner
invoke —Invokes an operation on a WSDL portType provided by another partner
reply —Provides a response to a request message received by a receive activity
terminate —Terminates the entire process
throw —Indicates an exceptional situation by throwing a fault from within the process
assign —Allows for data manipulation of variables
wait —Waits either for a period of time or until a specified point in time
empty —Provides a no-op instruction
compensate —Triggers compensation for a successfully completed group of activities (a so-called scope)
Some activities, such as receive and reply, correspond to operations exposed by the WSDL interface of the BPEL process: operations that the process provides to its business partners and operations that the process requires from its partners.
Basic activities can be combined into more complex constructs using structured activities. BPEL provides graph-oriented constructs (such as flow) as well as algebraic constructs (such as while and switch). Thus, BPEL supports whichever style you prefer to express the business logic of your process.
Here are the structured activities provided by the language:
while —Lets you specify a loop.
switch —Provides a structured way of making decisions: the ability to select exactly one branch out of several choices.
pick —Lets you execute one out of several branches as soon as a suitable message arrives, or when a timeout occurs.
sequence —Specifies a group of activities that are executed sequentially.
flow —Specifies a collection of activities that can be executed in parallel. Links may be used to define execution order constraints including synchronization of parallel branches.
scope —Lets you define nested activities with its own set of variables, correlation sets, and handlers such as fault handlers, a compensation handler, and event handlers.
These structured activities can be combined recursively to express arbitrarily complex aggregates of activities that implement the service provided by the process.
Basic as well as structured activities can optionally have standard attributes such as the name of an activity. Later, we'll discuss additional standard attributes and elements that are applicable, for example, to activities nested in flows.
Please check back next week for the continuation of this article.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.