1 Reply Latest reply on May 27, 2013 7:33 AM by Claus Ibsen

    How to convert a table record to xml format?

    axw1234 Newbie

      Hi all,


      I am newer to camel and fuse. I have a route to select a record from database then convert to xml file or stream.

      my route is:


      <route id="calls-route">

              <from uri="timer:foo?period=5s"/>

              <to uri="sql:{{sql.selectCalls}}"/>

              <convertBodyTo type="java.util.Map"/>

              <to uri="bean:callsBean?method=processCalls"/>

              <to uri="log:foo"/>



      I always get exception like

      org.apache.camel.InvalidPayloadException: No body available of type: java.util.Map but has value: [{local_callkey=181695, server_id=902}


      It will get the similiar error if change  <convertBodyTo type="java.util.Map"/> to  <convertBodyTo type="javax.xml.transform.stream.StreamSource"/> or

      <convertBodyTo type="javax.xml.transform.Source"/>.


      but it works if I using  <convertBodyTo type="java.lang.String"/>. It will not have any advantage if I convert a string to xml.