Stitch Editor Use Cases

Review the following stitch editor use cases.

Use the Three Stitch Operations (Assign, Remove, and Append) in an Integration

The following use case shows an integration that includes two stitch actions. All three stitch operations (assign, remove, and append) are used in this integration. This use case also describes how global variables are created and added to a stitch action.



  1. In the integration canvas, click Global Variables icon. For this example, two global variables are defined for the stitch action to use:
    • The Count scalar variable maintains the count in a for-each loop in the integration.
    • The GV_bookstore complex variable stores book information.


  2. If you want to create additional global variables, click the plus sign.
  3. From the Type list, select Object to define a complex type variable. All other available selections (String, Boolean, and so on) are used for creating scalar type variables.
    Type list with selections for String, Boolean, Date, DateType, Object, and Number

    The Sources schema tree is displayed to show all data structures used in the integration.

  4. Name the variable (for this example, gv_sample is used) and expand the schema tree to select the element to use (for this example, book is selected). You can also drag book to the Type field of gv_sample.

    You are now ready to define complex assignments in the stitch editor.

  5. Return to the integration and open the first stitch action.

    Note that two assignments are defined to perform different operations for this example.

  6. Click Switch to Developer view icon to view the complete XPath expression of the book variable. The book information is appended to the book list.

  7. Click X in the upper right corner to close the first stitch action.
  8. Click the second stitch action, which is executed inside the for-each loop. This stitch action removes price information from each book during the looping iteration. The count index is executed in the for-each loop until the entire book list is read.

  9. Activate and invoke the integration. For this example, the payload removes the price details and appends additional author details (for this example, Joe Smith).
    <?xml version="1.0" encoding="utf-8"?>
    <bookstore xsl:noNamespaceSchemaLocation="schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <book>
       <title lang="en">Java</title>
       <price>100USD</price>
       <author>
         <firstName>Joe</firstName>
         <lastName>Smith</lastName>
       </author>
     </book>
    </bookstore>
  10. View the results of the integration execution in the activity stream.

TO Element Does Not Exist in the Variable DOM

The following TO element use cases and their expected results are described.

ASSIGN into an Unbounded Element that Does Not Exist in the TO DOM

  • Expected Result: The TO element is created and the FROM element is assigned.
  • Assignment: ($OutputVarNameOnEB/ns0:root/ns0:b[1]/ns0:bch1).ASSIGN($V1/ns0:root/ns0:b[1]/ns0:bch1)
$OutputVarNameOnEB before assign $V1Content $OutputVarNameOnEB Result
<root xmlns="uri://ics/examples">  
   <a>I am original</a>
   <d>
     <dch1>I am original too</dch1>
   </d>
</root>
<root xmlns="uri://ics/examples">  
 <b>
    <bch1>79</bch1>
</b>
</root>
<root xmlns="uri://ics/examples">  
   <a>I am original</a>
   <b>
     <bch1>79</bch1>
   </b>
   <d>
     <dch1>I am original too</dch1>
   </d>
</root>

APPEND a List into an Unbounded Element that Does Not Exist in the TO DOM

  • Expected Result: The FROM list is inserted in the TO DOM at the right location, conforming with the schema.
  • Assignment: ($OutputVarNameOnEB/ns0:root/ns0:b[1]/bch3).APPEND($V1/ns0:root/ns0:b[1]/ns0:bch3)
$OutputVarNameOnEB before assign $V1Content $OutputVarNameOnEB Result
<root xmlns="uri://ics/examples">  
   <a>I am original</a>
   <d>
     <dch1>I am original too</dch1>
   </d>
</root>
<root xmlns="uri://ics/examples">  
 <b>
    <bch3>
        <w>1.00</w>
    </bch3>
    <bch3>
        <y>I'm second</y>
    </bch3>
    <bch3>
        <w>3</w>
        <y>3rd</y>
    </bch3>
 </b>
 
 <b>
    <bch3>
        <w>99.99</w>
    </bch3>
</b>
</root>
<root xmlns="uri://ics/examples">  
   <a>I am original</a>
   <b>
    <bch3>
        <w>1.00</w><
    </bch3>
    <bch3>
        <y>I'm second</y>
    </bch3>
    <bch3>
        <w>3</w>
        <y>3rd</y>
    </bch3>
 </b>
   <d>
     <dch1>I am original too</dch1>
   </d>
</root>

Predicate Usage

The following predicate use cases and their expected results are described.

Assign or Append - The FROM Predicate Selects Zero Nodes (Out of Bounds)

  • Expected Result: An exception is thrown at runtime. At design time, the system cannot detect if the predicate can select data.
  • Runtime Error Assignment Example: ($t1).ASSIGN($v1/globalElement/element2[count(.)+1])

    Note:

    The [count(.)+1] predicate is always out of bounds.

    This assignment fails at runtime and an exception is thrown.

Append to an Indexed TO - The TO Element Has a Predicate for an APPEND Operation - Not Supported

  • Expected Result: The system at design time does not enable you to predicate the repeating element where the APPEND happens (last step on the TO). The APPEND always appends at the end of the list.
  • Example: ($OutputVarNameOnEB/client:processResponse/client:c[2]).APPEND($InputVarNameOnEB/client:process/client:c)
    • Not Supported: "Predicated TO".APPEND() (Assignment example 1)
      ($<OutputVarNameOnEB>/client:processResponse/client:c[@attr1='some existing value']).APPEND($InputVarNameOnEB/client:process/client:c[1])

      Note:

      The [@attr1='some existing value'] predicate filters/selects a subset of nodes. Appending into a subset of nodes makes no intuitive sense.
    • Not Supported: "APPEND After" (Assignment example 2)
      ($OutputVarNameOnEB/client:processResponse/client:c[2]).APPEND($<InputVarNameOnEB>/client:process/client:c)

      Note:

      The [2] predicate is not intuitive. Do you APPEND to single instance 2, APPEND after instance 2, or APPEND before instance 2.

      Design-time error: The system throws an error at design time for both examples.

Assign to Predicated TO - The Predicate References an Existing Node

  • Expected Result: The assignment is done into the TO element referenced by the predicate.

Assign to Indexed TO - The TO Indexed Predicate References a Node that Does Not Exist

  • Expected Result: The system creates the missing nodes, but the missing nodes are created empty.
  • Example: ($v1/ns0:po/ns0:header/ns0:customer/ns0:email[2]).ASSIGN("jim@yahoo.com")

    Note:

    The indexed predicate refers to a predicate whose execution resolved into a positive number.
  • Missing TO Nodes Assignment Example: ($OutputVarNameOnEB/client:processResponse/client:c[count(.)+4]).assign($InputVarNameOnEB/client:process/client:c[1])

    Note:

    The [count(.)+4] predicate is always out of bounds.
$OutputVarNameOnEB before assign $InputVarNameOnEB Content $OutputVarNameOnEB Result
<processResponse xmlns="http://xmlns.oracle.com/SOA/ComplexAssignment/BPELProcess1">
   <a/>
   <b attr1="" attr2="">
      <x/>
   </b>
   <c attr1="Old Value" attr2="Old Value">
      <x>Old Value</x>
      <y>Old Value</y>
      <z>Old Value</z>
   </c>
   <d/>
   <e/>
</processResponse>
<c attr1="New Value" attr2="New Value">
      <x>New Value</x>
      <y>New Value</y>
      <z>New Value</z>
   </c>
<processResponse xmlns="http://xmlns.oracle.com/SOA/ComplexAssignment/BPELProcess1">
   <a/>
   <b attr1="" attr2="">
      <x/>
   </b>
   <c attr1="Old Value" attr2="Old Value">
      <x>Old Value</x>
      <y>Old Value</y>
      <z>Old Value</z>
   </c>
   <c/>
   <c/>
   <c/>
   <c attr1="New Value" attr2="New Value">
      <x>New Value</x>
      <y>New Value</y>
      <z>New Value</z>
   </c>
   <d/>
   <e/>
</processResponse>

Assign to Indexed Ancestor TO - The TO Indexed Predicate References a Node that Does Not Exist

  • Expected Result: The system creates the ancestor instances up to the index if they do not exist and then performs the assignment.
  • Example: ($v1/ns0:po/ns0:details/ns0:item[$i]/itemName).ASSIGN("iPhone X") ...whereas $i is a number having value 4
$v1 before assign $v1 after assignment
<ns0:po>
   <ns0:details>
      <ns0:item code='ip100'>
         <ns0:itemName>iPad</ns0:itemName>
      </ns0:item>
   <ns0:details>
</ns0:po>
<ns0:po>
   <ns0:details>
      <ns0:item code='ip100'>
         <ns0:itemName>iPad</ns0:itemName>
      </ns0:item>
      <ns0:item />
      <ns0:item />
      <ns0:item code='ip100'>
         <ns0:itemName>iPhone X</ns0:itemName>
      </ns0:item>
   <ns0:details>
</ns0:po>

Assign - The TO Logical Predicate References a Node that Does Not Exist

  • Expected Result: An exception at runtime is thrown.
  • Definition: A logical predicate is a predicate whose execution resolves into a boolean result: true or false. This case refers to when the result becomes false. Therefore, there is no TO element selected.
  • Runtime Error Assignment Example: ($OutputVarNameOnEB/client:processResponse/client:c[@attr1='eng']).assign($InputVarNameOnEB/client:process/client:c[1])

    Note:

    Below the DOM, there is no c node with its attr1 having eng as a value.
$OutputVarNameOnEB before assign Result
<processResponse xmlns="http://xmlns.oracle.com/SOA/ComplexAssignment/BPELProcess1">
   <a/>
   <b attr1="" attr2="">
      <x/>
   </b>
   <c attr1="Old Value" attr2="Old Value">
      <x>Old Value</x>
      <y>Old Value</y>
      <z>Old Value</z>
   </c>
   <d/>
   <e/>
</processResponse>
This assignment fails at runtime with an exception.
  • Runtime Error Assignment Example:($OutputVarNameOnEB/client:processResponse/client:c[ns05:aCustomFunction(.)]).assign($InputVarNameOnEB/client:process/client:c[1])
  • Details: At runtime, the ns05:aCustomFunction(.) may return false or a number. Using the following DOM:
$OutputVarNameOnEB before assign Result
<processResponse xmlns="http://xmlns.oracle.com/SOA/ComplexAssignment/BPELProcess1">
   <a/>
   <b attr1="" attr2="">
      <x/>
   </b>
   <c attr1="Old Value" attr2="Old Value">
      <x>Old Value</x>
      <y>Old Value</y>
      <z>Old Value</z>
   </c>
   <d/>
   <e/>
</processResponse>
This assignment fails at runtime with an exception.

Extended Data Types

The following extended data types use cases and their expected results are described.

Schema Validation when <xsd:any> or xsd:anyType are in the location path - Use Case - ASSIGN - The "FROM" and/or "TO"

  • Expected Result: You cannot type the location path steps after the xsd:anyType (or <xsd:any>'s parent). The location path is accepted, as long as the syntax is valid.
  • Example Details: Populating the AnyType Element with complex content.
    ($v1/globalElement/element3AnyType).ASSIGN($list/ns1:items/ns1:item_Undoulded)
    $v1 before assign $list content outputVariable expected result
    <globalElement xmlns="http://jorge.com/AssignAnyType2">
        <element1 lang="esperanto"/>
        <element4>2017-09-27T14:31:00</element4>
    </globalElement>example
    <items xmlns="http://xmlns.XYZ.com">
      <item_Unboulded>
        <name>Music</name>
        <price>98.99</price>
      </item_Unboulded>
      <item_Unboulded>
        <name>Fighter</name>
        <price>300.99</price>
      </item_Unboulded>
      <item_Unboulded>
        <name>Lover</name>
        <price>20.99</price>
      </item_Unboulded>
    </items>example
    <globalElement xmlns="http://jorge.com/AssignAnyType2">
        <element1 lang="esperanto"/>
        <element3AnyType>
            <item_Unboulded xmlns="http://xmlns.XYZ.com">
                <name>Music</name>
                <price>98.99</price>
            </item_Unboulded>
            <item_Unboulded xmlns="http://xmlns.XYZ.com">
                <name>Fighter</name>
                <price>300.99</price>
            </item_Unboulded>
            <item_Unboulded xmlns="http://xmlns.XYZ.com">
                <name>Lover</name>
                <price>20.99</price>
            </item_Unboulded>
        </element3AnyType>
        <element4>2017-09-27T14:31:00</element4>
    </globalElement>
  • Example Details: Referencing data within the any Type.
    If you now want to reference the price of item_Unboulded 2:
    ($vFigtherPrice).ASSIGN($v1/ns0:globalElement/ns0:element3AnyType/ns1:item_Unboulded[2]/ns1:price)
    • $vFighterPeice resultExample:
      300.99
    If you now want to assign the name of element 2:
    ($v1/ns0:globalElement/ns0:element3AnyType/ns1:item_Unboulded[2]/ns1:name).ASSIGN("Me Ma Mu")
    • outputVariable expected result:
      <!-- note the instance 2 name is changed from fighter to Me Ma Mu
      <globalElement xmlns="http://jorge.com/AssignAnyType2">
          <element1 lang="esperanto"/>
          <element3AnyType>
              <price xmlns="http://jorge.com/price">300</price>
          </element3AnyType>
          <element3AnyType>
              <item_Unboulded xmlns="http://xmlns.XYZ.com">
                  <name>Music</name>
                  <price>98.99</price>
              </item_Unboulded>
              <item_Unboulded xmlns="http://xmlns.XYZ.com">
                  <name>Me Ma Mu</name>
                  <price>300.99</price>
              </item_Unboulded>
              <item_Unboulded xmlns="http://xmlns.XYZ.com">
                  <name>Lover</name>
                  <price>20.99</price>
              </item_Unboulded>
          </element3AnyType>
          <element4>2017-09-27T14:31:00</element4>
      </globalElement>

Use Cases for <xsd:anyType>, <xsd:any>, and xsd:Any Defined in the Schema

The following XSD use cases and their expected results are described.

  • For <xsd:anyType> and <xsd:any>:
    Error rendering macro 'excerpt-include'
    No link could be created for 'Expected Result - xsd:anyType and xsd:any'.
  • For xsd:Any defined in the schema:
    Error rendering macro 'excerpt-include'
    No link could be created for 'Expected Result - 2 XSD:ANY'.