On Saturday 12 June 2010 4:14:06 pm Ronald Pieterse wrote:
> Hi Dan,
>
> The first part of your reply was pretty straightforward. I created my own
> version of OutgoingChainInterceptor and at the end of handleMessage
> I did:
>
> message.getInterceptorChain().pause();
>
> This stops the current chain, right? Now I still created my new response,
> put that inside the message content.
> Now comes the bit I don't quite understand how to do. I put the interceptor
> in the SETUP phase, was that correct?
Sounds right.
> Also, how to pause the fault chain is unclear to me. The current chain IS
> the fault chain, isn't it?
Yep. So the line you put above is correct to pause it.
>
> What happens now when I invoke my call is, that my custom
> OutgoingChainInterceptor is reached but it ends there. I tried resuming the
> chain but that just shows the 'response object is null' exception which
> seems kind of logical since this is the same chain as I understand :-)
>
> Maybe you could provide me with an example on how to make this interceptor
> change from fault chain to normal chain and handle the reponse as normal
> response?
Ah. I see the confusion..
Around line 65, you see that the OutgoingChainInterceptor grabs the out
message from the exchange and then sets up the outgoing chain and has that
chain process that message.
In your case, it's likely that the out message is null since the fault was
thrown before it would have set that up. Take a look at the block that stars
around line 64 of the ServiceInvokerInterceptor (same package). That's
where the out message would normally be setup. Obviously, the
MessageContentsList that it sticks in that message would contain your custom
result bean.
Dan
> Thanx so far!
>
> Ronald
>
> dkulp wrote:
> > What you may want to try is take the code for the
> > OutgoingChainInterceptor from:
> >
> > http://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apach
> > e/cxf/interceptor/OutgoingChainInterceptor.java
> >
> > And pretty much duplicate it. the only addition would be to, at the very
> > end, grab the current chain and pause it. Stick it as the FIRST
> > interceptor
> > on the Fault chain. That should work fine as you would be setting up
> > an outgoing chain exactly like the normal responses. Don't forget to
> > stop/pause
> > the fault chain so it then doesn't try sending a fault as well. ;-)
> >
> > Dan
--
Daniel Kulp
dk...@apache.org
http://dankulp.com/blog