The following expression works fine locally in Studio, but when deployed to Cloudhub it fails with the below error:
Its basically just a simple path expression that uses the null safe ? operator before invoke the .text method. Why doesn't this work in Cloudhub?
<set-variable variableName="country"
value="#[xpath('//ns1:root/ns1:Country').?text]"
doc:name="Set Country" />
Message : Execution of the expression "xpath('//ns1:root/ns1:Country').?text" failed. (org.mule.api.expression.ExpressionRuntimeException). Message payload is of type: DefaultDocument
Code : MULE_ERROR--2
Exception stack is: 1. null (java.lang.NullPointerException) org.mule.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer:363 (null) 2. [Error: null pointer:
Older post but I hope the solution is useful.
Use it this way man:
<set-variable variableName="country" value="#[?xpath('//ns1:root/ns1:Country').text]" doc:name="Set Country" />