[ https://issues.apache.org/jira/browse/CAMEL-13038?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
W.Y updated CAMEL-13038: ------------------------ Attachment: (was: xquerytest.zip) > Type Convert Problem for XQuery Build In founction > -------------------------------------------------- > > Key: CAMEL-13038 > URL: https://issues.apache.org/jira/browse/CAMEL-13038 > Project: Camel > Issue Type: Bug > Components: camel-saxon > Affects Versions: 2.22.2 > Reporter: W.Y > Priority: Major > Attachments: xquerytest.zip, xquerytest.zip > > > when we send XML message to XQuery endpoint, it has problem with XML parsing > Im XQuery the build in function looks like below : > declare variable $in.body as element(*) external; > return xf:my_xquery_function($request) > > the exception we got looks like > > org.apache.camel.RuntimeExpressionException: > net.sf.saxon.trans.XPathException: Required item type of value of variable > $in.body is element(); supplied value has item type > Q{http://saxon.sf.net/java-t > ype}org.apache.camel.converter.stream.CachedOutputStream-WrappedInputStream > at > org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:155) > ~[classes!/:na] > at > org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:120) > ~[classes!/:na] > at > org.apache.camel.processor.TransformProcessor.process(TransformProcessor.java:50) > ~[camel-core-2.22.1.jar!/:2.22.1] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) > [camel-core-2.22.1.jar!/:2.22.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > [camel-core-2.22.1.jar!/:2.22.1] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) > [camel-core-2.22.1.jar!/:2.22.1] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) > [camel-core-2.22.1.jar!/:2.22.1] > at > org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:117) > [camel-core-2.22.1.jar!/:2.22.1] > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) > [camel-core-2.22.1.jar!/:2.22.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > [camel-core-2.22.1.jar!/:2.22.1] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) > [camel-core-2.22.1.jar!/:2.22.1] > at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) > [camel-core-2.22.1.jar!/:2.22.1] > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > [camel-core-2.22.1.jar!/:2.22.1] > at > org.apache.camel.component.cxf.CxfConsumer$CxfConsumerInvoker.asyncInvoke(CxfConsumer.java:185) > [camel-cxf-2.22.1.jar!/:2.22.1] > at > org.apache.camel.component.cxf.CxfConsumer$CxfConsumerInvoker.invoke(CxfConsumer.java:161) > [camel-cxf-2.22.1.jar!/:2.22.1] > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) > [cxf-core-3.2.5.jar!/:3.2.5] > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > [na:1.8.0_121] > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > [na:1.8.0_121] > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126) > [cxf-core-3.2.5.jar!/:3.2.5] > at > org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) > [cxf-core-3.2.5.jar!/:3.2.5] > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131) > [cxf-core-3.2.5.jar!/:3.2.5] > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) > [cxf-core-3.2.5.jar!/:3.2.5] > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > [cxf-core-3.2.5.jar!/:3.2.5] > at > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) > [cxf-rt-transports-http-3.2.5.jar!/:3.2.5] > at > org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247) > [cxf-rt-transports-http-jetty-3.2.5.jar!/:3.2.5] > at > org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79) > [cxf-rt-transports-http-jetty-3.2.5.jar!/:3.2.5] > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1317) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:205) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at org.eclipse.jetty.server.Server.handle(Server.java:531) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) > [jetty-server-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) > [jetty-io-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) > [jetty-io-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) > [jetty-io-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762) > [jetty-util-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at > org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680) > [jetty-util-9.4.11.v20180605.jar!/:9.4.11.v20180605] > at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121] > Caused by: net.sf.saxon.trans.XPathException: Required item type of value of > variable $in.body is element(); supplied value has item type > Q\{http://saxon.sf.net/java-type}org.apache.camel.converter.str > eam.CachedOutputStream-WrappedInputStream > at > net.sf.saxon.expr.ItemTypeCheckingFunction.testConformance(ItemTypeCheckingFunction.java:76) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.ItemTypeCheckingFunction.mapItem(ItemTypeCheckingFunction.java:48) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.ItemMappingIterator.next(ItemMappingIterator.java:113) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.CardinalityCheckingIterator.<init>(CardinalityCheckingIterator.java:52) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.type.TypeHierarchy.applyFunctionConversionRules(TypeHierarchy.java:239) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.instruct.GlobalParameterSet.convertParameterValue(GlobalParameterSet.java:106) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at net.sf.saxon.Controller.getConvertedParameter(Controller.java:394) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.instruct.GlobalParam.evaluateVariable(GlobalParam.java:64) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.GlobalVariableReference.evaluateVariable(GlobalVariableReference.java:130) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:320) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:625) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:605) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:509) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.UserFunctionCall.evaluateItem(UserFunctionCall.java:470) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.parser.ExpressionTool.evaluate(ExpressionTool.java:328) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:625) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.UserFunctionCall.evaluateArguments(UserFunctionCall.java:605) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.expr.UserFunctionCall.process(UserFunctionCall.java:567) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:411) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > net.sf.saxon.query.XQueryExpression.pull(XQueryExpression.java:485) > ~[Saxon-HE-9.8.0-12.jar!/:na] > at > org.apache.camel.component.xquery.XQueryBuilder.evaluateAsDOM(XQueryBuilder.java:189) > ~[classes!/:na] > at > org.apache.camel.component.xquery.XQueryBuilder.evaluate(XQueryBuilder.java:145) > ~[classes!/:na] > ... 42 common frames omitted -- This message was sent by Atlassian JIRA (v7.6.3#76005)