Expressions
Expressions allow us to access parts of the variables. In the <assign>
activities, we can use expressions to copy parts of variables or specific elements. We specify the expressions within the <from>
and <to>
elements. Expressions are written in the selected expression language; the default is XPath 1.0. The XPath language allows us to address XML in a similar way that we address files and folders in the filesystem. For detailed information on XPath, please refer to http://www.w3.org/TR/xpath/.
We access BPEL variables in XPath using the $
operator. This is particularly useful in the <copy>
assignments, where we would like to access specific nested elements.
To write the copy assignment from the previous example with expression, we can use the $
operator to access the variable instead of the variable
attribute. The code would look as follows:
<assign> <copy> <from>$BookstoreAResponse<from/> <to>$BookStoreWithLowestQuantity...