0

My interface that is implemented by my impl class looks something like this

@POST
@Path("/callA/{A}")
public FObj invokeA(@PathParam("A") int a,FObj fobj);

And my customRouteBuilder is routing the request to the above exposed service

.choice().when().simple("${header.operationName} == 'CallA'")
        .to("bean:BeanA?method=invokeA")

But when I hit the service from Rest client by setting the object from payload and also path param i get 500 Internal server error.

org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange Caused by: org.apache.camel.InvalidPayloadException: No body available of type: int but has value: com.dev.tp.FObj

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
Rajeshwar
  • 391
  • 1
  • 5
  • 19

1 Answers1

0

When you hit the service, a value to be set to header.operationName would be invokeA, if you are using CXFRS Component (i guess you are). @PathParam is from jaxrs specification. Camel knows nothing about it. When you invoke a method with two parameters, it tries to cast body payload to first parameter, and you see an exception.

I recomment you to take a look at this article

Rostislav V
  • 1,706
  • 1
  • 19
  • 31