IBM Support

Evaluating XPath expressions in BPEL processes with IBM Business Process Manager

Technote (troubleshooting)


Business Process Choreographer uses different XPath implementations to evaluate XPath expressions in Business Process Execution Language (BPEL) processes depending on the business object parsing mode and the build version of the application.

Resolving the problem

This technote describes some differences that result from the use of these different XPath implementations. It does not cover the differences in business object parsing modes in general, as this is described elsewhere, but refers only to XPath-specific considerations.
XPath expressions are used to select certain parts of a data object or to create new paths inside objects. They can occur at different places in BPEL processes. For example:

  • In BPEL assign activities
  • In the evaluation of conditions and expressions in BPEL processes
  • In replacement expressions in process and activity descriptions

Supported XPath engines
Business Process Choreographer uses different XPath engines to evaluate these expressions, depending on:
  • The business object parsing mode. For more information, see the business object parsing mode documentation in the information center.
  • The deployment version of the application. This value is the product version with which the application was built or deployed.

For version 7.5 applications, that are running with the lazy business object parsing mode, an XPath engine based on the XML Cursor Interface ( XCI ) technology is used to evaluate XPath expressions. For applications modeled prior to V7.5 or applications using the eager business object parsing mode, the JXPath engine is used. Both XPath engines provide similar functionality, however, some differences exist in the results of an expression evaluation.

Note: The JXPath engine is always used for applications that were developed prior to V7.5. It is not expect that these applications are affected by these evaluation differences in a product migration scenario. However, take care when extending pre-V7.5 applications in V7.5 if you are using lazy parsing mode. Ensure that you test the results of the expression evaluations before you deploy the application to the production environment.

Differences in the behavior of the XPath engines
The following list includes the known differences in behavior of the XPath engines. This list might not be complete.

Selection failure for "null" assignments
According to the BPEL specification, a null value cannot be assigned in an assign activity. Depending on the value of the ignoreMissingData attribute, such an assignment is either ignored ( ignoreMissingData is true), or a BPEL selection failure is thrown ( ignoreMissingData is false). However, with pre-V7.5 applications or applications running in eager parsing mode, if only the last path-step or element of a from-expression is null, but the path to this element exists, the null value is assigned.

Note: ignoreMissingData is an attribute on the process model. It can be set in the BPEL Editor as a process model property. Choose the Defaults tab and check or uncheck the Ignore missing data checkbox, as shown in the picture below:

With V7.5 applications and the lazy parsing mode, the behavior is as defined in the BPEL specification. To suppress the selection failure, set the value of the   ignoreMissingData attribute to true.

The ignoreMissingData attribute is set to false.

The process variable 'Invoice' of type Invoice is set to the following value. Note that the conditions\dueDate path is not set but the conditions element exists.

<p:Invoice xmlns:p="http://XPath75Tests" xmlns:ns0="
http://XPath75Tests" xmlns:ns1="http://XPath75Tests" xmlns:ns2="
http://XPath75Tests" xmlns:ns3="http://XPath75Tests" xmlns:nsi="" xsi:type="p:Invoice">
<mode>premium payment mode</mode>

In an assign activity, the conditions\dueDate path is selected in the Assign From expression:

Pre-V7.5 applications or eager parsing mode V7.5 applications and lazy parsing mode
null is assigned to the aDate variable. The assignment fails with a selection failure:
CWWBE0069E: An error occurred during the selection of object 'conditions/dueData'. CWWBE0069E: An error occurred during the selection of object 'conditions/dueData'.
If the ignoreMissingData attribute is set to true, both implementations behave the same.

Comparison with nonexistent constants
JXPath comparisons with nonexistent constants are tolerated and evaluated to false. In the following example, the value of a leaf node of a business object is compared with a Boolean constant set to true. According to the XPath 1.0 specification, the constant does not exist. XPath defines the Boolean operators true() and false()that can be used instead.

The process variable 'Invoice' of type Invoice is set to the following value:
<p:Invoice xmlns:p="http://XPath75Tests " xmlns:ns0="
http://XPath75Tests " xmlns:ns1="http://XPath75tests "
xmlns:xsi=" "

The following expression evaluated:

Pre-V7.5 applications or eager parsing mode V7.5 applications and lazy parsing mode
The expression evaluates to false. The assignment fails with the following errors:

CWWBE0069E: An error occurred during the selection of object '$Invoice/isFinal=true'. CWWBE0069E: An error occurred during the selection of object '$Invoice/isFinal=true'.
CWWBS0072E: The XPath expression evaluation failed:
java.lang.RuntimeException: IXJXE0777E: [ERR 0696][ERR

XPDY0002] Evaluation of the context item expression '.' or an expression that implicitly refers to the context item failed
because the context item is undefined.
$Invoice/isFinal=true() should work with both XPath engine implementations.

Forcing Business Process Choreographer to use the JXPath engine for all applications

You can force the V7.0 behavior for the lazy parsing mode for all processes by setting a custom property for Business Flow Manager in the administrative console. With this option, the JXPath engine is used for all applications regardless of their business object parsing mode or build version.

Note: It is advisable to try to adapt pre-V7.5 applications running on V7.5 to use the lazy parsing mode, rather than setting the custom property. In some situations, using the JXPath engine can cause performance degradations.

This option can be enabled in the administrative console as follows:

  1. Click either Servers > Clusters > WebSphere application server clusters > cluster name or Servers > Server Types > WebSphere application servers > server name.
  2. On the Configuration tab in the Business Integration section, expand Business Process Choreographer, click Business Flow Manager .
  3. In the Additional Properties section, click Custom Properties.
  4. Click New.
  5. In the Name field, enter useJXPathForXCI, and in the Value field enter true. You can also add a description, for example: 'Use JXPath Engine for all process instances'.
  6. Click OK.
  7. Restart the server to activate the new option.

Document information

More support for: IBM Business Process Manager Standard
Business Process Execution Language (BPEL)

Software version: 7.5

Operating system(s): AIX, Linux, Solaris, Windows

Reference #: 1496012

Modified date: 04 July 2013