Java Reference
In-Depth Information
Manipulating Data with BPEL Variables
Problem
You want to reference incoming XML data within a message, or define a new variable.
Solution
Use the <variable> construct.
Discussion
The following sections describe the different ways you can use the <variable> construct to
manipulate data.
Creating variables
The variables section of the process defines local variables that will be used during process
execution. It looks like this:
<variables>
<variable name="myVar" messageType="test:HelloMessage"/>
<variable name="tmpVar" type="xsd:string"/>
</variables>
When the execution starts, following the <sequence> element, a message coming into the
process will need to be assigned a name and some memory space so that the process can refer
to it. Once defined, these variables can be assigned to other variables, queried using XPath
expressions, transformed, and used as input to service invocations (partner links).
Variables must be WSDL message types or XML Schema types or elements. Using variables,
a process can keep state between activities, much like fields in a Java object.
In this example, there are two variables created, “myVar” and “tmpVar”. The “myVar” vari-
able has a type of HelloMessage in the test namespace. That type is defined as a WSDL mes-
sage type in HelloWorld2.wsdl. It looks like this:
<wsdl:message name="HelloMessage">
<wsdl:part name="TestPart" type="xsd:string"/>
</wsdl:message>
So a HelloMessage has a TestPart that is a string. This is used by the <receive> activity,
which we'll look at shortly.
Search WWH ::




Custom Search