Data manipulation and assignments

In this section, we will get familiar with data manipulation and data copying between variables. To copy data between variables, BPEL provides the <assign> activity. Within it, we can perform one or more <copy> commands. For each <copy> command, we have to specify the source (<from>) and the destination (<to>). The following listing presents the syntax of the <assign> activity:

<assign> 
  <copy> 
    <from ... /> 
    <to ... /> 
  </copy> 
  <copy> 
    <from ... /> 
    <to ... /> 
  </copy> 
  ... 
</assign> 

There are several choices for the <from> and <to> clauses. To copy values from one variable to the other, we have to specify the variable attribute in the <from> and <to> elements. The following example shows how to copy the BookstoreAResponse variable to the BookStoreWithLowestQuantity variable:

<assign>
  <copy>
    <from variable="BookstoreAResponse" />
    <to variable="BookStoreWithLowestQuantity" />
  </copy>
</assign>

This copy can be performed only if both variables are of the same type, as in our example. The copy operation can also be performed if the source type is a subtype of the destination type.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset