java - How to access payload from REST 404 response in Camel cxfrs? -
i have camel route accesses rest service. things work ok if rest response 200 ok. however, if response 404, rest service returns additional info in payload, cannot find way access.
this part of debug log running it:
[camel (rraacamelcontext) thread #2 - seda://from_rraa] info org.apache.cxf.interceptor.loggingininterceptor - inbound message ---------------------------- id: 2 response-code: 404 encoding: iso-8859-1 content-type: application/json headers: {accept=[application/json], breadcrumbid=[id-steves-macbook-pro-local-53701-1446241733043-1-7], content-type=[application/json], originalheader=[{name=verifyemployeerequest, version=1, scac=rraa, timesent=null, uuid=abcd-1234}], pin=[1234], reason=[init], server=[jetty(9.2.11.v20150529)], transfer-encoding=[chunked], user-agent=[apache cxf 3.1.2]} payload: { "employeeid": "bad-name", "message": "id not found" }
my route set as:
<route id="rraaiss"> <from uri="seda:from_rraa"/> <process ref="isspreprocessor"/> <unmarshal ref="issrequest"/> <process ref="webserviceprocessor"/> <to uri="cxfrs:bean:webservice"/> <onexception> <exception>javax.ws.rs.notfoundexception</exception> <handled><constant>true</constant></handled> <to uri="bean:crewservicenotfoundprocessor"/> </onexception> <process ref="packagewebservicereplyforiss"/> <to uri="seda:to_rraa"/> </route>
my crewservicenotfoundprocessor
bean gets called when response 404 , can see exception, how can payload original http response?
i have working now. main issue defined rest operation as:
@get @path(value="/authentication/{scac}/employees/{id}") @produces({ mediatype.application_json }) public string verifyemployee(@pathparam("scac") string scac, @pathparam("id") string id, @queryparam("pin") string pin, @queryparam("reason") string reason);
when changed return type string response, complete response available, , throwexceptiononfailure=false option worked also. so, newbie error.
Comments
Post a Comment