Apache ODE goes above and beyond the WS-BPEL specification by allowing the use of XQuery 1.0 in queries and expressions.
Unless specified otherwise, WS-BPEL considers XPath 1.0 to be the query/expression language, which is denoted by the default value of the "queryLanguage" and "expressionLanguage" attributes, viz. "urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0". In addition, we have out-of-the-box support for XPath 2.0.
To use XQuery 1.0 in your processes just use the following queryLanguage and expressionLanguage attributes:
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0" expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0"
If you want support at the process just add these attributes to your root process element. If you want to stick with XPath 1.0 but want XQuery 1.0 support for a specific assignment you can also define these attributes on an assign element.
For your convenience, all of the functions and variables, standard or otherwise, that are available in XPath 2.0 have been exposed in XQuery 1.0 as well.
The following snippet illustrates how to use XQuery 1.0 in assign activities. Needless to say, you may use XQuery 1.0 anywhere an expression is permitted, such as in a while, if, repeatUntil or forEach activity.
<process name="HelloXQueryWorld" targetNamespace="http://ode/bpel/unit-test" xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:tns="http://ode/bpel/unit-test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:types="http://ode/bpel/types" xmlns:test="http://ode/bpel/unit-test.wsdl" xmlns:ode="http://www.apache.org/ode/type/extension" queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0" expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xquery1.0"> ... <assign name="assign1"> <copy> <from variable="myVar" part="TestPart"/> <to variable="otherVar"/> </copy> <copy> <from><![CDATA[<test:content>Hello</test:content>]]></from> <to variable="tempVar"/> </copy> <copy> <from> typeswitch ($myVar.TestPart) case $a as xs:string return "test" default return "default" </from> <to variable="otherVar"/> </copy> <copy> <from><![CDATA[ typeswitch ($myVar.TestPart) case $a as text() return <test:content/> default return <test:content/> ]]> </from> <to variable="otherVar"/> </copy> <copy> <from> for $loopOnce in (1) return concat(bpws:getVariableProperty("myVar", "test:content"), "XQuery World") </from> <to variable="myVar" part="TestPart"/> </copy> </assign> ... </sequence> </process>
Currently, we do not support: The use of modules in XQuery. The use of update expressions in XQuery.