How to Declare SDO-based Variables

Manipulating XML Data in a BPEL Process 6-13 Example 6–8 Copy from an XPath Expression of an SDO Variable to a DOM Variable assign -- copy from an XPath expression of an SDO variable to DOM variable -- copy from expression=deptVar_shrtypes:Emp[2] to variable=empVar_v copy -- copy from an XPath expression of an DOM variable to SDO variable -- copy from expression=deptVar_vhrtypes:Emp[2] to variable=empVar_s copy -- insert a DOM based data into an SDO variable -- bpelx:insertAfter bpelx:from variable=empVar_v bpelx:to variable=deptVar_s query=hrtypes:Emp bpelx:insertAfter -- insert a SDO based data into an SDO variable at particular location, no XML conversion is needed -- bpelx:insertBefore bpelx:from expression=deptVar_shrtypes:Emp[hrtypes:Sal = 1300] bpelx:to variable=deptVar_s query=hrtypes:Emp[6] bpelx:insertBefore assign Example 6–9 provides an example of removing a portion of SDO data. Example 6–9 SDO Data Removal assign bpelx:remove bpelx:target variable=deptVar_s query=hrtypes:Emp[2] bpelx:remove assign

6.4 Initializing a Variable with Expression Constants or Literal XML

It is often useful to assign literal XML to a variable in BPEL, for example, to initialize a variable before copying dynamic data into a specific field within the XML data content for the variable. This is also useful for testing purposes when you want to hard code XML data values into the process.

6.4.1 How To Assign a Literal XML Element

Example 6–10 assigns a literal result element to the payload part of the output variable: Note: The bpelx:append operation is not supported for SDO-based variables for the following reasons: ■ The copy operation on an SDO-based variable has smart update capabilities for example, you do not have to perform a bpelx:append before the copy operation. ■ The SDO data object is metadata driven and does not generally support adding a new property arbitrarily. 6-14 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Example 6–10 Literal Element Assignment assign -- copy from literal xml to the variable -- copy from result xmlns=http:samples.otn.com name symbol price12.3price quantity0quantity approved message result from to variable=output part=payload copy assign

6.5 Copying Between Variables

When you copy between variables, you copy directly from one variable or part to another variable of a compatible type, without needing to specify a particular field within either variable. In other words, you do not need to specify an XPath query.

6.5.1 How to Copy Between Variables

Example 6–11 shows two assignments being performed, first copying between two variables of the same type and then copying a variable part to another variable with the same type as that part. Example 6–11 Copying Between Variables assign copy from variable=c1 to variable=c2 copy copy from variable=c1 part = address to variable=c3 copy assign The BPEL file defines the variables shown in Example 6–12 : Example 6–12 Variable Definition variable name=c1 messageType=x:person variable name=c2 messageType=x:person variable name=c3 element=y:address The WSDL file defines the person message type shown in Example 6–13 : Example 6–13 Message Type Definition message name=person xmlns:x=http:tempuri.orgbpwsexample part name=full-name type=xsd:string part name=address element=x:address message