How to Use bpelx:rename and XSD Type Casting

Manipulating XML Data in a BPEL Process 6-31 e:firstNameMarye:firstNamee:lastNameSmithe:lastName e:emp e:empList The employee data of Peter Smith is now invalid, because approvalLimit and managing are missing. Therefore, append is used to add that information. Example 6–62 provides an example. Example 6–62 Use of append Extension to Add Information bpel:assign bpelx:rename typeCastTo=e:ManagerType bpelx:target variable=empListVar query=e:empListe:emp[.e:firstName=Peter and .e:lastName=Smith bpelx:rename bpelx:append bpelx:from e:approvalLimit2500e:approvalLimit e:managing bpelx:from bpelx:to variable=empListVar query=e:empListe:emp[.e:firstName=Peter and .e:lastName=Smith bpelx:append bpel:assign With the execution of both rename and append, the corresponding data looks as shown in Example 6–63 : Example 6–63 rename and append Execution e:emp xsi:type=e:ManagerType e:firstNamePetere:firstNamee:lastNameSmithe:lastName e:approvalLimit2500e:approvalLimit e:managing e:emp

6.14.5.2 bpelx:rename in BPEL 2.0

Example 6–64 provides an example of bpelx:rename syntax in a BPEL project that supports BPEL version 2.0. In BPEL 2.0, the functionality is the same as described in Section 6.14.5.1, bpelx:rename in BPEL 1.1, but the syntax is slightly different. An extensionAssignOperation element wraps the bpelx:rename. Example 6–64 bpelx:rename Extension in BPEL 2.0 bpel:assign extensionAssignOperation bpelx:rename elementTo=QName1? typeCastTo=QName2? bpelx:targetncname[.ncname][xpath_str]bpelx:target bpelx:rename extensionAssignOperation bpel:assign

6.14.6 How to Use bpelx:copyList

The bpelx:copyList extension in an assign activity enables a BPEL process service component to perform a copyList operation of the contents of one variable, expression, or XML fragment to another variable. 6-32 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite To use this extension in BPEL 1.1, you select a copy rule at the bottom of the Copy Rules tab, then select copyList from the dropdown list, as shown in Figure 6–6 . To use this extension in BPEL 2.0, you right-click a copy rule, select Change rule type, and select CopyList, as shown in Figure 6–7 .

6.14.6.1 bpelx:copyList in BPEL 1.1

Example 6–65 provides an example of bpelx:copyList in a BPEL project that supports BPEL version 1.1. Example 6–65 bpelx:copyList Extension in BPEL 1.1 bpel:assign bpelx:copyList bpelx:from ... bpelx:to ... bpelx:copyList bpel:assign The from-spec query can yield a list of either all attribute nodes or all element nodes. The to-spec query can yield a list of L-value nodes: either all attribute nodes or all element nodes. All the element nodes returned by the to-spec query must have the same parent element. If the to-spec query returns a list of element nodes, all element nodes must be contiguous. If the from-spec query returns attribute nodes, then the to-spec query must return attribute nodes. Likewise, if the from-spec query returns element nodes, then the to-spec query must return element nodes. Otherwise, a bpws:mismatchedAssignmentFailure fault is thrown. The from-spec query can return zero nodes, while the to-spec query must return at least one node. If the from-spec query returns zero nodes, the effect of the copyList operation is similar to the remove operation. The copylist operation provides the following features: ■ Removes all the nodes pointed to by the to-spec query. ■ If the to-spec query returns a list of element nodes and there are leftover child nodes after removal of those nodes, the nodes returned by the from-spec query are inserted before the next sibling of the last element specified by the to-spec query. If there are no leftover child nodes, an append operation is performed. ■ If the to-spec query returns a list of attribute nodes, those attributes are removed from the parent element. The attributes returned by the from-spec query are then appended to the parent element. For example, assume a schema is defined as shown in Example 6–66 . Example 6–66 Schema schema attributeFormDefault=unqualified elementFormDefault=qualified targetNamespace=http:xmlns.oracle.comEvent_jwsEventEventTest xmlns=http:www.w3.org2001XMLSchema element name=process complexType sequence element name=payload type=string maxOccurs=unbounded Manipulating XML Data in a BPEL Process 6-33 sequence complexType element element name=processResponse complexType sequence element name=payload type=string maxOccurs=unbounded sequence complexType element schema The from variable contains the content shown in Example 6–67 . Example 6–67 Variable Content ns1:process xmlns:ns1=http:xmlns.oracle.comEvent_jwsEventEventTest ns1: payload ans1: payload ns1: payload bns1: payload ns1:process The to variable contains the content shown in Example 6–68 . Example 6–68 Variable Content ns1:processResponse xmlns:ns1=http:xmlns.oracle.comEvent_ jwsEventEventTest ns1: payload cns1: payload ns1:process The bpelx:copyList operation looks as shown in Example 6–69 . Example 6–69 bpelx:copyList assign bpelx:copyList bpelx:from variable=inputVariable part=payload query=client:processclient:payload bpelx:to variable=outputVariable part=payload query=client:processResponseclient:payload bpelx:copyList assign This makes the to variable as shown in Example 6–70 . Example 6–70 Variable Content ns1:processResponse xmlns:ns1=http:xmlns.oracle.comEvent_ jwsEventEventTest ns1: payload ans1: payload ns1: payload bns1: payload ns1:process

6.14.6.2 bpelx:copyList in BPEL 2.0

Example 6–71 provides an example of bpelx:copyList syntax in a BPEL project that supports BPEL version 2.0. In BPEL 2.0, the functionality is the same as described in Section 6.14.6.1, bpelx:copyList in BPEL 1.1, but the syntax is slightly different. An extensionAssignOperation element wraps the bpelx:copyList extension.