What I said before is only for exceptions thrown by interceptors. Received faults are not thrown until it gets back to the ClientImpl. If you want to intercept and act on those, you'll need an INFAULT interceptor, Phase.USER_LOGICAL (any phase after UNMARSHAL), that checks message.getContent(Exception.class) from its handleMessage method.
-----Original Message----- From: KARR, DAVID (ATTSI) [mailto:[email protected]] Sent: Friday, November 12, 2010 11:12 AM To: [email protected] Subject: RE: How to have an interceptor execute on an exception in an earlier interceptor? > -----Original Message----- > From: Sven Zethelius [mailto:[email protected]] > Sent: Friday, November 12, 2010 10:10 AM > To: [email protected] > Subject: RE: How to have an interceptor execute on an exception in an > earlier interceptor? > > If you put an interceptor earlier in the same chain (e.g. Phase.SETUP > in the OUT chain), and override its handleFault with the logic you > want, it will get called during the unwinding of the phase interceptor > chain. I implemented this, but the current test case I'm looking at is returning a soap fault, but it's not hitting this "handleFault()" method. It goes through the "In" interceptor chain, and the fault appears to be otherwise properly processed, but it never gets to "handleFault()". Will it only follow this path if I get a severe connection failure? > -----Original Message----- > From: KARR, DAVID (ATTSI) [mailto:[email protected]] > Sent: Thursday, November 11, 2010 7:24 PM > To: [email protected] > Subject: How to have an interceptor execute on an exception in an > earlier interceptor? > > I'm working on replacing a custom soap client. One thing the old code > did was wrap the eventual sending of the message in a "try/finally" > block so that it could do work in the try block that was guaranteed to > match with code in the finally block. The two matching blocks are very > simple, just making a single function call. With CXF, the closest > analogue is a matching "Out" and "In" interceptor. However, I'm > finding > that if certain bad things happen, like a connection timeout, it > appears > that the "In" interceptor in the "RECEIVE" phase is never executed. Is > there some way I can do something analogous to the old code?
