4 Replies Latest reply on Mar 24, 2013 7:30 AM by Robert Budźko

    Camel implementation - xquery transformation.

    Robert Budźko Newbie

      Hello again.

       

      What has happened to Apache Camel XQuery transformation? Tbh, I'm not able to make such a route be deployed succesfully due to the fact that language is not known.  Even the trivial transformation breaks deployment:

       

      <transform>

           <xquery/>

      </transform>

       

      due to the org.apache.camel.NoSuchLanguageException exception. It is thrown when artifact "camel-saxon" is not available or when schemas are not mapped properly. Nevertheless in case of SY I cannot make it work. Other languages like XPath are resolved (by org.apache.camel.impl.DefaultLanguageResolver) successfully.

        • 1. Re: Camel implementation - xquery transformation.
          Łukasz Dywicki Novice

          XQuery transfomation is not part of camel core, and as you found it's because camel-saxon is absent. The problem comes from fact that camel DSL is split from component providing it. This causes that some DSL elements are available even if there is no implementation provided. That's true also for languages, data formats and so on. As workaround - you may package camel-saxon as AS7 module and then declare dependency on it for your deployment unit using Dependencies manifest header or jboss-modules xml.

          • 2. Re: Camel implementation - xquery transformation.
            Robert Budźko Newbie

            Thanks for the direction. Any way, even with camel-sacon AS7 module deployed and added as a apache camel core module dependency or maven plugin which you recommended for my deployment unit, language is not recognized. Are you sure that it is sufficient?

            • 3. Re: Camel implementation - xquery transformation.
              Łukasz Dywicki Novice

              Yes,

              I'm sure it should work with custom descriptor. I tested it and the configuration which works for me:

               

              META-INF/jboss-deployment-structure.xml for deployment unit

              <?xml version="1.0" encoding="UTF-8"?>
              <jboss-deployment-structure>
                  <deployment>
                      <dependencies>
                          <module name="org.apache.camel.saxon" services="import" export="true">
                              <imports>
                                  <include path="META-INF/services/org/apache/camel/component" />
                                  <include path="META-INF/services/org/apache/camel/language" />
                              </imports>
                              <exports>
                                  <include path="META-INF/services/org/apache/camel/component" />
                                  <include path="META-INF/services/org/apache/camel/language" />
                              </exports>
                          </module>
                      </dependencies>
                  </deployment>
              </jboss-deployment-structure>
              

               

              camel-saxon module.xml

              <?xml version="1.0" encoding="UTF-8"?>
              <module xmlns="urn:jboss:module:1.0" name="org.apache.camel.saxon">
                  <resources>
                      <resource-root path="camel-saxon-2.10.0.jar"/>
                      <resource-root path="saxon9he-9.3.0.11.jar"/>
                  </resources>
                   <dependencies>
                      <module name="javax.api"/>
                      <module name="org.slf4j"/>
                      <module name="org.apache.camel.core"/>
                  </dependencies>
               </module>
              

               

              Then I was able to use XQuery (I adapted soap-proxy quickstar):

              <route xmlns="http://camel.apache.org/schema/spring">
                  <from uri="switchyard://ProxyService"/>
                  <to uri="log:xq?showAll=true" />
                  <convertBodyTo type="org.w3c.dom.Document" />
                  <filter>
                      <xquery>//*[local-name() = 'test']/text() != 'exception'</xquery>
                      <to uri="switchyard://ReverseService"/>
                  </filter>
              </route>
              

               

               

              (when contents of incoming query is different than exception then external web service is called)

               

              Cheers,

              Lukasz

              • 4. Re: Camel implementation - xquery transformation.
                Robert Budźko Newbie

                Thanks. It was my fault indeed - languages were not exported.