Hi,
If you need CXF help converting the data into POJO then add
DeltaRequestPOJO into the signature, instead of String/InputStream.
This will work assuming a JAX-RS JSON provider is registered with the
endpoint.
Otherwise, if you prefer it done at the Camel level, then I guess you
will need to set up Camel Data Format...
Cheers, Sergey
On 31/03/14 07:22, bijoy wrote:
Hi Sergey,
Adding String and InputStream in the method signature making json data
available to exchange body but camel is not able to convert the json into
pojo. I'm using SimpleConsumer binding. I guess the problem is with binding,
any idea?
*camel-config.xml*
<camel:route id="httpRequest">
<camel:from
uri="cxfrs://bean://restServer?bindingStyle=SimpleConsumer"/>
<camel:to uri="log:?showAll=true"/>
<camel:process ref="validateRequest"/>
</camel:route>
*ValidateProcessor.java*
public void process(Exchange exchange) throws Exception {
String message = exchange.getIn().getBody(String.class);
System.out.println("JSON Message:"+message); //*proper json is displayed>*
DeltaRequestPOJO deltaReq =
exchange.getIn().getBody(DeltaRequestPOJO.class);
if (!deltaReq.getOrderId().isEmpty() && !deltaReq.getTimeStamp().isEmpty())
// *getting null pointer here*
{
//some logic
}
*DeltaRequestPOJO.java*
@XmlRootElement(name = "createDeltaRequest")
public class DeltaRequestPOJO {
String orderId;
String timeStamp;
// then getters and setters
*RestServices.java*
@POST
@Consumes("application/json")
@Produces("application/json")
@Path("/delta")
public Response createDelta(String jsonData) {
return null;
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Issues-with-cxfrs-using-json-tp5749474p5749552.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com