Java Reference
In-Depth Information
$Books/soa:Books[3]/@Title
Please refer to Selecting Values from an XML Document if you need a refresher on using
XPath expressions.
In-scope namespaces
This is straightforward enough, but what if you add the difficulty of dealing with in-scope
namespaces? You must use the prefix of the in-scope namespace when referencing variables.
An example makes this clear. Say you have a BPEL variable that you'd like to copy data from.
If its namespace prefix is different, you can still work with the data, but you must indicate that
in your expression:
<o:author xmlns:o="http://oreilly.com">
<o:firstName>Tim</o:firstName>
</o:author>
In order to reach the value of the first author here (despite hiding the namespace prefix), you
could use the following expression within your copy/from to return the value Tim :
<from xmlns:orm="http://oreilly.com">
$AuthorVar/orm:firstName/text()
</from>
Here the namespace prefixed has changed, and you reference the enclosing prefix within the
expression.
Comparing variables
You can compare the values extracted from variables using some standard comparison fea-
tures. For example, to see if a variable value for certain inventory is less than 10 (perhaps so
you could order more stock), you could write this:
bpel:getVariableProperty('stockResponse', 'inv:stockLevel') < 10
Validating variables
During the execution of a process, data can be validated easily—as long as your vendor sup-
ports it. You can do it using the validate activity:
<validate variables="var1 var2">
</validate>
Separate the variable names you want to validate with spaces.
Search WWH ::




Custom Search