You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/07/23 07:14:27 UTC

[GitHub] [camel-quarkus] kesavkolla opened a new issue #1497: setting namspace for xml route

kesavkolla opened a new issue #1497:
URL: https://github.com/apache/camel-quarkus/issues/1497


   Hi I'm trying to use xml based route using routes. I've a xpath expression which uses namespace and it's not taking defined namespaces in routes xml. How do I define namespaces? Here is my route xml
   
   ```xml
   <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns="http://camel.apache.org/schema/spring"
           xmlns:soap-env="http://www.w3.org/2003/05/soap-envelope"
           xsi:schemaLocation="
               http://camel.apache.org/schema/spring
               http://camel.apache.org/schema/spring/camel-spring-3.4.2.xsd">
       <route id="myroute">
           <from uri="platform-http:/handler?httpMethodRestrict=POST"/>
           <setProperty name="MessageType">
               <xpath resultType="java.lang.String" logNamespaces="true">
                   local-name(/soap-env:Envelope/soap-env:Body/*[1])
               </xpath>
           </setProperty>
           <log message="${exchangeProperty.MessageType}"/>
           <setBody>
               <simple>
                   Hello ${body}
               </simple>
           </setBody>
       </route>
   </routes>
   ```
   
   When I try to post XML file to handler endpoint I get the following error:
   
   ```java
   org.apache.camel.language.xpath.InvalidXPathException: Invalid xpath: local-name(/soap-env:Envelope/soap-env:Body/*[1]). Reason: javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: soap-env
       at org.apache.camel.language.xpath.XPathBuilder.evaluateAs(XPathBuilder.java:943)
       at org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:921)
       at org.apache.camel.language.xpath.XPathBuilder.evaluate(XPathBuilder.java:240)
       at org.apache.camel.processor.SetPropertyProcessor.process(SetPropertyProcessor.java:47)
       at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$SimpleTask.run(RedeliveryErrorHandler.java:395)
       at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
       at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60)
       at org.apache.camel.processor.Pipeline.process(Pipeline.java:147)
       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:286)
       at org.apache.camel.quarkus.component.platform.http.runtime.QuarkusPlatformHttpConsumer.lambda$doStart$2(QuarkusPlatformHttpConsumer.java:123)
   .....................
   Caused by: javax.xml.xpath.XPathExpressionException: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: soap-env
       at java.xml/com.sun.org.apache.xpath.internal.jaxp.XPathImpl.compile(XPathImpl.java:170)
       at org.apache.camel.language.xpath.XPathBuilder.createXPathExpression(XPathBuilder.java:1170)
       at org.apache.camel.language.xpath.XPathBuilder.evaluateAs(XPathBuilder.java:941)
       ... 29 more
   Caused by: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: soap-env
       at java.xml/com.sun.org.apache.xpath.internal.compiler.XPathParser.error(XPathParser.java:621)
       at java.xml/com.sun.org.apache.xpath.internal.compiler.Lexer.mapNSTokens(Lexer.java:637)
       at java.xml/com.sun.org.apache.xpath.internal.compiler.Lexer.tokenize(Lexer.java:269)
   ```
   
   Can anyone point me how to define custom namespaces?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga closed issue #1497: [Camel 3.5/3.4.3] xml-io should pass namespace info to NamespaceAware elements

Posted by GitBox <gi...@apache.org>.
ppalaga closed issue #1497:
URL: https://github.com/apache/camel-quarkus/issues/1497


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #1497: [Camel 3.5/3.4.3] xml-io should pass namespace info to NamespaceAware elements

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #1497:
URL: https://github.com/apache/camel-quarkus/issues/1497#issuecomment-676472318


   No, the fix was done in the upcoming Camel 3.5.0 and also in the recently released Camel 3.4.3. So you'll have to wait for Camel Quarkus 1.1.0 or 1.0.1. 
   1.0.1 may appear within 10 days or so.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on issue #1497: setting namspace for xml route

Posted by GitBox <gi...@apache.org>.
ppalaga commented on issue #1497:
URL: https://github.com/apache/camel-quarkus/issues/1497#issuecomment-664948064






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] kesavkolla commented on issue #1497: [Camel 3.5] xml-io should pass namespace info to NamespaceAware elements

Posted by GitBox <gi...@apache.org>.
kesavkolla commented on issue #1497:
URL: https://github.com/apache/camel-quarkus/issues/1497#issuecomment-665121307


   If I remove camel-quarkus-xml-io with camel-quarkus-xml-jaxb I get the following exception:
   
   ```java
   2020-07-28 08:49:55,033 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (main) Failed to start application: java.lang.UnsupportedOperationException: Please add a dependency to camel-quarkus-xml-io
   	at org.apache.camel.quarkus.core.DisabledXMLRoutesDefinitionLoader.loadRoutesDefinition(DisabledXMLRoutesDefinitionLoader.java:28)
   	at org.apache.camel.quarkus.main.CamelMainRoutesCollector.collectXmlRoutesFromDirectory(CamelMainRoutesCollector.java:74)
   	at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:97)
   	at org.apache.camel.main.BaseMainSupport.configureRoutes(BaseMainSupport.java:556)
   	at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:576)
   	at org.apache.camel.quarkus.main.CamelMain.initCamelContext(CamelMain.java:91)
   	at org.apache.camel.quarkus.main.CamelMain.doInit(CamelMain.java:61)
   	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
   	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:112)
   	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:46)
   	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
   	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:97)
   	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:36)
   	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:644)
   	at io.quarkus.runtime.Application.start(Application.java:90)
   	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:91)
   	at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
   	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
   	at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
   	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
   
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] kesavkolla commented on issue #1497: [Camel 3.5/3.4.3] xml-io should pass namespace info to NamespaceAware elements

Posted by GitBox <gi...@apache.org>.
kesavkolla commented on issue #1497:
URL: https://github.com/apache/camel-quarkus/issues/1497#issuecomment-676442331


   Is this issue fixed in latest 1.0.0 version?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org