I think I have a simple question, but it seems he cannot understand.
I am calling POJO with a class created from unmarshalling JSON as a parameter to a method. The question is, how can I return a return from a method back to JSON?
My route is lower;
from("direct:start")
.choice()
.when(header("methodname").isEqualTo("listCases"))
.unmarshal().json(JsonLibrary.Jackson, UserDetails.class)
.to("bean:com.xxx.BeanA")
.when(header("methodName").isEqualTo("listPersons"))
.unmarshal().json(JsonLibrary.Jackson, CaseDetails.class)
.to("bean:com.xxx.BeanB");
... and I call the route below:
ProducerTemplate template = camelContext.createProducerTemplate();
template.setDefaultEndpoint(camelContext.getEndpoint("direct:start"));
InvocationResult result = (InvocationResult)template.requestBodyAndHeader(payload, "methodName", methodName);
The payload is JSON, and methodName is either listCases or listPersons in this example.
The class My InvocationResult is general and contains the String attribute returnCode, as well as a reference to the object that I would like to convert to JSON. This object will differ depending on whether listCases or listPersons is running.
Thank,
Bic