I put my fault out interceptor into the PRE_PROTOCOL phase and after SOAPHandlerFaultOutInterceptor, so I get the default processing and then step on the result of it as I find fit depending on what comes my way..
Mike O'Neil-2 wrote: > > Thanks for your response. I gave this a shot and it seems to work > pretty well, though is a lot more cumbersome, seeing as how we need to > handle the marshalling directly. Unfortunately this also introduces a > different place where an exception is not properly handled: when > trying to find the target method in JAXRSUtils, if not found, a > WebApplicationException is thrown but the custom fault out interceptor > is not invoked. This results in an empty body in the HTTP response. > Have you run into that? > > Thanks for your help, > Mike > > On Thu, Dec 17, 2009 at 3:25 PM, vickatvuuch <vlisov...@gmail.com> wrote: >> >> I have had a similar problem and worked it around by building a >> CustomFaultOutInterceptor, >> which handles everything that gets thrown for both REST and SOAP. Once >> you >> have a single place to do it >> you can translate Exception into HTTP response codes as well as you can >> enchance >> the default Soap fault as appropriate. >> >> >> Mike O'Neil-2 wrote: >>> >>> I have an ExceptionMapper which handles exceptions from my Rest >>> service just fine. However when my "In" Interceptor throws a Fault, >>> the ExceptionMapper does not handle it. Instead I get the standard >>> (ugly) XML, e.g.: >>> >>> <ns1:XMLFault><ns1:faultstring>error >>> message</ns1:faultstring></ns1:XMLFault> >>> >>> Is that the expected behavior? My server is set up like: >>> >>> <jaxrs:server id="service" address="/rest"> >>> <jaxrs:serviceBeans> >>> <bean parent="myService" /> >>> </jaxrs:serviceBeans> >>> <jaxrs:inInterceptors> >>> <ref bean="myInterceptor"/> >>> </jaxrs:inInterceptors> >>> <jaxrs:providers> >>> <ref bean="restExceptionMapper"/> >>> </jaxrs:providers> >>> </jaxrs:server> >>> >>> >>> And my interceptor looks like: >>> >>> public class MyInterceptor extends AbstractPhaseInterceptor<Message> { >>> public FormatSettingInterceptor() { >>> super(Phase.PRE_STREAM); >>> } >>> >>> @Override >>> public void handleMessage(Message message) throws Fault { >>> throw new Fault("Not handled by ExceptionMapper!"); >>> } >>> } >>> >>> Any insight or help would be appreciated. >>> >>> Much thanks, >>> Mike >>> >>> >> >> -- >> View this message in context: >> http://old.nabble.com/Fault-thrown-in-Rest-In-Interceptor-not-handled-by-ExceptionMapper-tp26833555p26834406.html >> Sent from the cxf-user mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://old.nabble.com/Fault-thrown-in-Rest-In-Interceptor-not-handled-by-ExceptionMapper-tp26833555p26836730.html Sent from the cxf-user mailing list archive at Nabble.com.