Home arrow Web Services arrow Flow and Web Services

Flow and Web Services

Last week, we looked at process lifecycles. This week, we'll take a look at the assign and other basic activities, and study flow. This article, the fourth in a series, 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).

Author Info:
By: Sams Publishing
Rating: 4 stars4 stars4 stars4 stars4 stars / 5
August 24, 2006
  1. · Flow and Web Services
  2. · XPath Extension Functions
  3. · Flows
  4. · Link Semantics
  5. · Putting Together the Flow Sample

print this article

Flow and Web Services
(Page 1 of 5 )

The assign Activity

Now let's look at how data can be manipulated and assigned as part of the process logic. BPEL provides a special activity type for updating variables: the assign activity. It lets you copy type-compatible data from one variable to another; you can also construct and insert new data using general XPath expressions. Expressions also provide for simple computations—for example, to prepare data for the invocation of Web services.

The following snippets depict samples of various usages of assign activities. The first shows the copying of an entire variable:

<from variable="poSubmissionRequest"/>
<to variable="trueCopyOfPoSubmissionRequest"/>

The next sample only copies a selected part from one variable to another variable:

<from variable="poSubmissionRequest"
part="purchaseOrder"/> <to variable="orderSuppliesRequest"
part="orderSupplies"/> </copy> </assign>

In the following, you see a more complex assign activity that copies two selected elements from one variable to another. This assignment is performed as an atomic operation. The selection of elements involves queries expressed in XPath as the query language:

<from variable="poSubmissionRequest" 
<to  variable="poSubmissionFaultInvalidPO" 
<from variable="poSubmissionRequest" 
<to  variable="poSubmissionFaultInvalidPO" 

The next snippet initializes a variable using a literal value:

<to variable="itemCount"/>

The final assign sample uses an expression to perform a simple computation:

expression="bpws:getVariableData('itemCount')+1"/> <to variable="itemCount"/> </copy> </assign>

The assign activity can also copy endpoint references to and from partner links. This aspect is useful whenever endpoint references are to be treated as data—for example, to exchange endpoint references with business partners as part of messages, or to compute endpoint references.

SkatesTown uses this feature to send its endpoint reference to the supplier. It requests additional supplies using the orderSupplies operation. As part of this request, SkatesTown provides its endpoint reference. This enables the supplier to asynchronously respond to the request without the need to be statically bound to one particular seller. The supplier uses this endpoint reference to submit its response—for example, to invoke the seller's orderSuppliesOk operation. The following BPEL snippet depicts how SkatesTown's endpoint reference is copied to the request message. The assign activity copies the endpoint reference from role myRole of partner link supplier to the orderSuppliesRequest variable. This variable then serves as input for the orderSupplies operation:

<from partnerLink="supplier"
endpointReference="myRole"/> <to variable="orderSuppliesRequest"
part="endpointReferenceOfSeller"/> </copy> </assign>

blog comments powered by Disqus

- Dealing with Loose Coupling in a Service-Ori...
- Loose Coupling in a Service-Oriented Archite...
- Safety, Idempotence, and the Resource-Orient...
- The Resource-Oriented Architecture in Action
- Features of the Resource-Oriented Architectu...
- The Resource-Oriented Architecture
- Getting Started with Flex
- Automated Billing and Faxing for the Web
- An Introduction to Web Services
- The Foundations of Web Services: From Novice...
- Web Services Reengineering: Finishing Touches
- Fault Handling with Web Services
- Flow and Web Services
- Process Lifecycles and Web Services
- Business Processes and Web Services

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials