Sunday, November 18, 2012

Failed to evaluate xpath expression ora:formatDate

Problem:

Using the Oracle XPath extension function ora:formatDate in your transformation in JDeveloper as shown:
ora:formatDate(/ns1:payload/ns0:OrderDate, 'mm-dd-yyyy')
Resulted in the following runtime error:
path function failed because:oracle.xml.parser.v2.XMLElement java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
at oracle.tip.pc.services.functions.datetime.FormatDateFunction.call(FormatDateFunction.java:52)
        at oracle.fabric.common.xml.xpath.FabricXPathFunctionWrapper.evaluate(FabricXPathFunctionWrapper.java:84)
        at oracle.xml.xpath.JXPathContext$JXFunction.invoke(JXPathContext.java:157)
        at oracle.xml.xpath.JXPathContext$JXFunction.invoke(JXPathContext.java:126)
        at oracle.xml.xpath.XPathExtFunction.evaluate(XPathExtFunction.java:264)
.
.
.
<Nov 7, 2012 2:51:07 PM EST> <Warning> <oracle.soa.services.workflow.persistency> <BEA-000000> <<WFTask.setFlexfieldMappingValue> Failed to evaluate xpath expression ora:formatDate(/ns1:payload/ns0:OrderDate,'mm-dd-yyyy') while performing payload mapping for OrderDate. Error was: XPath expression failed to execute.
An error occurs while processing the XPath expression; the expression is ora:formatDate(/ns1:payload/ns0:OrderDate,'mm-dd-yyyy').
The XPath expression failed to execute; the reason was: internal xpath error.
Check the detailed root cause described in the exception message text and verify that the XPath query is correct.
>

Solution:

1. The element being passed as input did not conform to the date format expected by the ora:formatDate function.

The input date format to this function should be:  yyyy-mm-ddTHH:mm:ssZ


References:


No comments: