Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-3504

Annotation @XQuery does not work in POJO

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 2.4.0
    • 2.6.0
    • camel-saxon
    • None

    Description

      When we try to extract content from XML using a XQuery annotation in the method signature, we receive the full XML message and not the content defined by the XQuery expression

      1) camel route

          <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
      
              <route>
                  <from uri="cxf:bean:busServicesFinder?dataFormat=MESSAGE"/>
                  <convertBodyTo type="String"/>
                  <log message="WebService called" loggingLevel="INFO"/>
                  <choice>
                      <when>
                          <xpath>//serviceName = 'service1'</xpath>
                          <log message="Service = service1" loggingLevel="INFO"/>
                          <bean ref="soapBean"/>
                      </when>
                      <otherwise>
                          <log message="Service not equal to service1" loggingLevel="INFO"/>
                      </otherwise>
                  </choice>
      
                  <log message="Reply to client" loggingLevel="INFO"/>
                  <transform>
                      <simple>OK</simple>
                  </transform>
      
              </route>
          </camelContext>
      

      2) POJO

      public String generateSoapMessage(@XQuery("//payload") String payload)

      3) XML received

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="http://proxy.client.fr">
         <soapenv:Header/>
         <soapenv:Body>
            <prox:getServiceFromBus>
               <serviceName>service1</serviceName>
               <payload>
                          <inputReportIncident>
                             <incidentId>01</incidentId>
                             <incidentDate>2010-10-04</incidentDate>
                            <givenName>Charles</givenName>
                            <familyName>Moulliard</familyName>
                            <summary>This is a test repart</summary>
                            <details>server is down</details>
                            <email>cmoulliard@fusesource.com</email>
                            <phone>+32 473 604 014</phone>
                          </inputReportIncident>
               </payload>
            </prox:getServiceFromBus>
         </soapenv:Body>
      </soapenv:Envelope>
      

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            cmoulliard Moulliard Charles
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: