HI all
 i have a  Jetty-Json route in my camel-app

i submit JSON via python client, and i should return JSON back.

i am using this configuration:

<camel:route id="Jetty_Sample">
            <camel:from uri="jetty:http://localhost:8888/myJettyService"; />
            <!-- camel:log logName="HTTP LOG" loggingLevel="INFO"
message="HTTP REQUEST:
                ${in.header.bookid}" / -->
            <camel:process ref="myJettyService" />
            <camel:marshal ref="jsonFormatter" />
 </camel:route>

<bean id="jsonFormatter"
class="org.apache.camel.model.dataformat.JsonDataFormat">
        <property name="library" value="Jackson" />
    </bean>


THe problem i have is the bean 'myJettyService' is returning a  'complex'
POJO which is not being marshalled correcly (here's output of my python
json client)
org.codehaus.jackson.map.ObjectMapper@11167f3

instead of a json string

here's my java code in the processor

        ObjectMapper mapper = new ObjectMapper();
        ObjectNode node = mapper.createObjectNode();

        node.put("ticker" , item.getShare().getTicker());
        node.put("name", item.getShare().getName());
        node.put("price", item.getShare().getPrice());
        node.put("latest", item.getLatestPrice().getLatestPrice());



        if(ptfData != null) {
            exchange.getOut().setBody(mapper.toString());

Clearly , i am missing something because my ObjectMapper just get
marshalled into this
org.codehaus.jackson.map.ObjectMapper@11167f3

instead of

{'ticker': 'myticker', 'name': 'shareName' .... }

could anyone tell me what am i missing?

w/kindest regards
 marco

Reply via email to