Thank you very much for your quick help, Sergey!
I tried your solution and now get the following exception:
[Camel (rraaCamelContext) thread #2 - seda://from_rraa] ERROR
org.apache.cxf.jaxrs.utils.JAXRSUtils - No message body reader has been found
for class my.class.path.CrewServiceDeniedError, ContentType: application/json
The code I have is:
InvocationTargetException exception =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
InvocationTargetException.class);
NotFoundException orig = (NotFoundException)(exception.getCause());
CrewServiceDeniedError err =
orig.getResponse().readEntity(CrewServiceDeniedError.class);
I created this class for the payload:
public class CrewServiceDeniedError {
private String employeeID;
private String reason;
public String getEmployeeID()
{ return employeeID; }
public void setEmployeeID(String id)
{ employeeID = id; }
public String getReason()
{ return reason; }
public void setReason(String r)
{ reason = r; }
}
-Steve
> On Nov 2, 2015, at 11:24 AM, Sergey Beryozkin <[email protected]> wrote:
>
> Hi
> If you can access NotFoundException then what you can do next is to do
>
> ErrorInfo errorInfo = exception.getResponse().readEntity(ErrorInfo.class)
>
> where ErrorInfo is a custom class capturing a JSON error response, you'd also
> need to register Jackson or other provider to get it converted. Or read it as
> String.class and parse manually
>
> HTH, Sergey
> On 02/11/15 16:15, Steve Huston wrote:
>> I put this up on stackoverflow... if you have cxfrs expertise, could you
>> please read this?
>>
>> How to access payload from REST 404 response in Camel cxfrs?
>> http://stackoverflow.com/q/33445686/240342?sem=2
>>
>> Thanks,
>> -Steve
>>
>