Viraj
Viraj

Reputation: 5381

Get Rest Response from Camel Route

I'm using camel to route from SOAP web service to Rest Service. My route is like following.

SOAP Service --> Processor A --> Rest --> Processor B .

I'm using Exchange pattern and Rest is hosted in Jboss Server. My problem is how to get Rest Response ( json string ). When i get in message in Processor B it contains the output message or processor A.

  <camelContext xmlns="http://camel.apache.org/schema/spring" trace="true">
    <route>
        <from uri="cxf:bean:serviceA"/>
        <process ref="processorA" /> 
        <to uri="cxfrs:bean:serviceRest"/>
        <process ref="processorB"/>
    </route>
  </camelContxt>

I'm new to camel. any help would be appreciated.

Upvotes: 0

Views: 1845

Answers (2)

Viraj
Viraj

Reputation: 5381

Finally found the answer with the help of friends. It was error in fasterxml jason provider. I changed the json provider to codehaus

<cxf:rsClient id="serviceRest" address="http://localhost:8080/rest-test/rest"
              serviceClass="org.apache.cxf.jaxrs.client.WebClient" loggingFeatureEnabled="true" >
    <cxf:providers>
        <ref bean="jasonProvider"/>
    </cxf:providers>
</cxf:rsClient> 

<bean id="jasonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />

Now i have the json response in exchange.

Upvotes: 0

Willem Jiang
Willem Jiang

Reputation: 3291

You should be able to the REST response in the proxessorB by referencing the exchange in message.

Upvotes: 1

Related Questions