2

i am developing an Apache Camel Route with enrich EIP. I am calling a web service and trying to convert the response to a Pojo. This is my code snippet.

from("direct:getDetailDominio")
            .setHeader(Exchange.HTTP_PATH, simple("${body.principale}"))
            .setBody(constant(null))
            .to("http4:" + dominiUrl + "?bridgeEndpoint=true&throwExceptionOnFailure=false")
            .marshal().json(JsonLibrary.Jackson)

The fact is that the Body after the service call is wrapped into a WrappedInputStream and Jackson libs seem to do not know how to map that Object. The error is:

com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.apache.camel.converter.stream.CachedOutputStream$WrappedInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )

I know that i could convert the body to String.class and then convert the POJO, but i refuse to think there is no a standard way to handle this situation. Have you any suggestion? Thanks, alessio

AplusP
  • 21
  • 2

0 Answers0