Click OK to close the Specify Key dialog.

6-12 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite

6.3.2 How to Convert from XML to SDO

Oracle BPEL Process Manager supports dual data forms: DOM and SDO. You can interchange the usage of DOM-based and SDO-based variables within the same business process, even within the same expression. The Oracle BPEL Process Manager data framework automatically converts back and forth between DOM and SDO forms. By using the entity variable XPath rewrite capabilities, Oracle BPEL Process Manager enables some XPath features for example, variable reference and function calls that the basic SDO specification does not support. However, there are other limitations on the XPath used with SDO-based variables for example, there is no support for and, or, and not. Example 6–7 provides a simple example of converting from XML to SDO. Example 6–7 XML-to-SDO Conversion assign copy from ns0:dept xmlns:ns0=http:sdo.sample.servicetypes xmlns:xsi=http:www.w3.org2001XMLSchema-instance ns0:Deptno10ns0:Deptno ns0:DnameACCOUNTINGns0:Dname ns0:LocNEW YORKns0:Loc ns0:Emp ns0:Empno7782ns0:Empno ns0:EnameCLARKns0:Ename ns0:JobMANAGERns0:Job ns0:Mgr7839ns0:Mgr ns0:Hiredate1981-06-09ns0:Hiredate ns0:Sal2450ns0:Sal ns0:Deptno10ns0:Deptno ns0:Emp ns0:Emp ns0:Empno7839ns0:Empno ns0:EnameKINGns0:Ename ns0:JobPRESIDENTns0:Job ns0:Hiredate1981-11-17ns0:Hiredate ns0:Sal5000ns0:Sal ns0:Deptno10ns0:Deptno ns0:Emp ns0:Emp ns0:Empno7934ns0:Empno ns0:EnameMILLERns0:Ename ns0:JobCLERKns0:Job ns0:Mgr7782ns0:Mgr ns0:Hiredate1982-01-23ns0:Hiredate ns0:Sal1300ns0:Sal ns0:Deptno10ns0:Deptno ns0:Emp ns0:dept from to variable=deptVar_s copy assign Example 6–8 provides an example of copying from an XPath expression of an SDO variable to a DOM variable. 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.