What is wrong with this XPath count expression
627949Dec 29 2010 — edited Feb 27 2020I have an input message with a list of desired part codes.
>
<Message>
...<order_id>1234</order_id>
...<project_id>5678</project_id>
...<partCodeList>
......<partCode>xxxxxx</partCode>
......<partCode>yyyyyyyy</partCode>
..</partCodeList>
</Message>
>
I attempting to count the partCodes that match a particular string. I have stored the desired string in a simple variable called devicePartCode. The Xpath expression statement looks like:
>
count(bpws:getVariableData('inputVariable','payload','/client:Message/client:partCodeList')/client:partCode = bpws:getVariableData('devicePartCode')) > 0
>
The execution error I get is:
>
ORABPEL-05002
Message handle error.
An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.invoke.InvokeInstanceMessage"; the exception is: Invalid xpath expression.
Error while parsing xpath expression "count(bpws:getVariableData('inputVariable','payload','/client:Message/client:partCodeList')/client:partCode = bpws:getVariableData('devicePartCode')) > 0", the reason is Expected ')' instead of '='..
Please verify the xpath query "count(bpws:getVariableData('inputVariable','payload','/client:Message/client:partCodeList')/client:partCode = bpws:getVariableData('devicePartCode')) > 0" which is defined in BPEL process.
>
The BPEL process I guess never gets started because there is no recorded instance when executed. Instead, the error is only found in the domain's log.
It seems like the internal bpws:getVariableData(...) are not being evaluated before the XPath count expression is evaluated.
Any suggestions on how to rewrite the XPath search would be appreciated.