How to capture error code while calling rest service through cxfrs client ?
Issue
- User need some help regarding how to capture error codes while calling rest web services using
cxfrs
client. - Below is the route user is using to do so in
blueprint
. User can see the control navigated todoCatch
block, user is unable to find the exact error code in the route or inside handler bean. - Everytime Error code is printed on the log as Payload though.
- User need to check some business conditions based on these error codes.
<to uri="bean:myServiceCaller" />
<doTry>
<loadBalance>
<failover />
<to uri="cxfrs:bean:myService" />
<to uri="cxfrs:bean:myService" />
<to uri="cxfrs:bean:myService" />
</loadBalance>
<log message="myservice is called Successfully" />
<to uri="bean:mySeriviceProcessor" />
<doCatch>
<exception>java.lang.Exception</exception>
<log message="..... BODY .....${body}" />
<log message="..... exception.message .....${exception.message}" />
<to uri="bean:myServiceHandler" />
</doCatch>
</doTry>
- This is how user is throwing error codes on the rest provider side.
throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity("ERROR001").type(MediaType.TEXT_PLAIN).build());
Environment
- Red Hat JBoss Fuse
- 6.1.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.