IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Developing business processes > Building BPEL processes > Defining BPEL process logic > Work with XPath in the BPEL process editor

XPath extension functions

This topic describes the various XPath extension functions that you can use in the BPEL process editor.

In addition to standard XPath functions described in the XPath 1.0 specification (http://www.w3.org/TR/xpath), you can use the following functions – called extension functions – in your XPath expressions and conditions.


XPath extension functions defined by BPEL

The BPEL specification defines the following XPath extension functions, which are also supported in IBM Process Server. The namespace for these functions is: http://schemas.xmlsoap.org/ws/2004/03/business-process/

BPEL processes designed in IBM Integration Designer already contain this namespace, bound to the prefix ‘bpws'.

bpws:getVariableData( variableName)

Returns the BPEL variable with the indicated name.

bpws:getVariableData( variableName , partName or XPath expression )

If the variable indicated by variableName specifies a WSDL message, this function returns the indicated part of this BPEL variable. Otherwise, it evaluates the XPath expression on the BPEL variable variableName.

bpws:getVariableData( variableNam , partName, XPath )

Returns the evaluation result of the XPath expression applied to part partName of the WSDL message stored in the BPEL variable variableName.

bpws:getVariableProperty( variableName , propertyName )

This function is used to extract the property value propertyName from BPEL variable variableName. If that the property value must be a qualified name.

bpws:getLinkStatus( linkName )

This function is only available in join conditions of arbitrary activities. For linkName, you may only use names of incoming links for the activity associated with the join condition.

If a transition condition exists on the link, this method returns the result of this transition condition. If there is no transition condition, this function returns true if this link was navigated, and returns false, if this link was not navigated because of dead-path elimination, such as a previous link returned false in a transition condition, therefore all subsequent links were not navigated.


XPath extension functions for Business Objects

For easier work with Business Objects, the following functions are available. The namespace for these functions is: http://www.ibm.com/xmlns/prod/websphere/wbi/BusinessObject/6.0.0

BPEL processes designed in IBM Integration Designer already contain this namespace, bound to the prefix ‘bo'.

bo:create( typeNamespace , typeName )

Returns an empty instance of the XSD complex type indicated by typeNamespace and typeName.

You get these values by opening the appropriate data type with the Business Object Editor. Review these values in the properties view.

bo:equals( variable1 , variable2 )

Returns true if variable1 and variable2 are equal, otherwise false. If the type of variable1 is a simple type, the equals() function of the corresponding Java™ type is used. If both variables are represented by Business Objects, that is they are either interface type or refer to a complex type or element, the extension function delegates the evaluation to isEqual() operation of the system SCA service BOEqual. In all other cases, false will be returned.


Miscellaneous XPath extension functions

Furthermore, there are some extension functions to provide access to several objects within a BPEL process. The namespace for these functions is: http://www.ibm.com/xmlns/prod/websphere/business-process/6.0.0

In BPEL processes designed in IBM Integration Designer, this namespace is already bound to the prefix ‘wpc'.

wpc:getCustomProperty ( propertyName)

Returns the value of the custom property propertyName defined on the process level.

wpc:getCustomProperty( propertyName , activityName )

Returns the value of the custom property propertyName defined on the activity activityName. If parameter activityName is null, the custom property defined on the process level is returned. activityName is the name of an activity, not the display name. As the name of an activity is optional in BPEL, you need to specify it if you want to access its custom properties. BPEL lets you use the same name on several activities. Nevertheless, if you try to access the custom properties of such an activity, you will get an exception as the name is ambiguous. Therefore, avoid using the same name for different activities.

For activities within while loops, you will get the custom property of the last execution of the activity, that is if you access the custom property within a while loop, you always get the current instance of the indicated activity. If you access the custom property of an activity within a while loop from outside the while loop, you get the instance of the last while iteration.

Arbitrary activities within event handlers and forEach activities can only be accessed from within the same event handler.

wpc:getServiceRefForProcessTemplate( processTemplateName , portTypeNamespace , portTypeName )

Returns a service reference to the port type portTypeNamespace, portTypeName of the process specified by processTemplateName. If multiple versions of a process template are available, you get the service reference to the current valid version. Verify that you have added an export with SCA binding for the corresponding process component in the assembly editor. Otherwise, no service reference can be returned.

You can use this function for example on the from part of an assign activity and assign the result to an partner link.

Work with XPath in the BPEL process editor


Related concepts:
Choose between XPath and Java in your BPEL process
XPath usage overview