Ignoring missing elements with Assign

An assignment may fail with a selectionFailure fault that can be caused by attempting to select a nonexistent element. In this recipe, we will show how to deal with missing elements in an assign so that we avoid the selectionFailure fault.

Getting ready

Open an assignment that causes selectionFailure faults when an element is not present in the input. It is possible that the source element might actually be an optional element in the input document, and the XML element marker being in square brackets will indicate this.

How to do it...

  1. Right-click to the left-hand side of the assignment that causes the selectionFailure fault and select the ignoreMissingFromData menu item. This will cause the assignment to be ignored if the source element does not exist:
    How to do it...

How it works...

When the ignoreMissingFromData attribute is set on a copy statement in Assign, it causes that copy statement to be skipped if the from query were to cause a selectionFailure fault.

There's more...

The ignoreMissingFromData attribute also works with all other Assign subelements, such as insertAfter, insertBefore, copyList, and append.

The MiscMappings project in the code samples has a sample BPEL process called MappingBPELProcess.bpel demonstrating this.

See also

  • The Ignoring missing elements with XSLT recipe in this chapter
  • The Ignoring a Java property recipe in this chapter
..................Content has been hidden....................

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