Hello All,
I am using camel RestDSL to get Json and conver it to pojo by
.post().type(Schema.class)
but i got below exception
org.apache.camel.InvalidPayloadException: No body available of type:
java.io.InputStream but has value: < *srroy i need to hide package name
here* >Schema
below is the snippet of my code. i could not find any problem. Did I miss
anything?
Any suggestion or hints are welcome!
WY100
// it tells Camel how to configure the REST service
restConfiguration()
.component("servlet")
.bindingMode(RestBindingMode.auto);
// Now define the REST API (POST, GET, etc.)
rest().path("/api") // This makes the API available at http://host:port
/$CONTEXT_ROOT/api
.consumes("application/json").produces("application/json")
// HTTP: POST /api
.post().type(Schema.class)
.route()
.process(exchange->{
if(isforwardtosap) {
exchange.getIn().setHeader("forward2sap", Boolean.TRUE);
LOG.info("forward2sap -> {}",exchange.getIn().getHeader("forward2sap"));
}
if(isforwardtorest) {
exchange.getIn().setHeader("forward2rest", Boolean.TRUE);
LOG.info("forward2rest ->
{}",exchange.getIn().getHeader("forward2rest"));
}
})