Databases Reference
In-Depth Information
Assigning values to variables
In our previous step, we created the variable
QuoteInput
, which we pass to our
invocation of
GetSingleQuote
. However, we have yet to initialize the variable or
assign any value to it.
To do this, BPEL provides the
<assign>
activity, which is used to update the values
of variables with new data. The
<assign>
activity typically consists of one or more
copy operations. Each copy consists of a target variable, that is, the variable that you
wish to assign a value to and a source (this can either be another variable or an
XPath expression).
For our purposes, we want to assign the stock symbol passed into our BPEL process
to our
QuoteInput
variable.
To do this, drag an
Assign
activity from the
Component Palette
on to your BPEL
process at the point just before our
Invoke
activity. Then double-click on it to open
up the
Assign
configuration window. Click on the green plus sign and select
Copy Operation…
.
This will present us with the
Create Copy Operation
window, as shown in the
following screenshot:
On the left-hand side, we specify the
From
variable (that is, the source). Here we
want to specify the stock symbol passed in as part of the input variable to the
BPEL process. So expand the
inputVariable
tree, and select
/ns2:getQuote/ns2:
stockSymbol
.