You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by sur04sep <su...@gmail.com> on 2010/06/01 17:08:42 UTC

Exception handling

Hi,
I need to send custom error codes for all kind of exceptions(even run time
exception).
For this I wrote a OutInterceptor extending AbstractSoapInterceptor with
super(Phase.MARSHAL) constructor.
But control is not going to this interceptor in case of any run time
exception. Only in case of successful processing control is coming to this
interceptor.
I have overridden both handleMessage  and handleFault methods.
What I could be doing wrong?
And what is the correct approach to handle exception?

Regards,
seshu
-- 
View this message in context: http://old.nabble.com/Exception-handling-tp28743320p28743320.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Exception handling

Posted by Glen Mazza <gl...@gmail.com>.
Oops, I forgot that interceptors also have fault chains, thanks for the
correction.

Glen


dkulp wrote:
> 
> On Tuesday 01 June 2010 11:21:46 am Glen Mazza wrote:
>> When exceptions occur, the interceptor chain is processed in reverse
>> direction (same with JAX-WS handlers).  You'll need to do your error
>> handling towards the beginning of the service-side interceptor chain, not
>> at the end of it.
> 
> Well, the other thing thing to do would be to add an interceptor at the
> start 
> of the server side "FaultOut" chain that would take the fault in the
> message 
> and do whatever needs to be done to it.   That's probably the preferred
> route 
> as the interceptor would only get called for the faults.
> 
> Dan
> 

-- 
View this message in context: http://old.nabble.com/Exception-handling-tp28743320p28744937.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Exception handling

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 01 June 2010 11:21:46 am Glen Mazza wrote:
> When exceptions occur, the interceptor chain is processed in reverse
> direction (same with JAX-WS handlers).  You'll need to do your error
> handling towards the beginning of the service-side interceptor chain, not
> at the end of it.

Well, the other thing thing to do would be to add an interceptor at the start 
of the server side "FaultOut" chain that would take the fault in the message 
and do whatever needs to be done to it.   That's probably the preferred route 
as the interceptor would only get called for the faults.

Dan



> HTH,
> Glen
> 
> sur04sep wrote:
> > Hi,
> > I need to send custom error codes for all kind of exceptions(even run
> > time exception).
> > For this I wrote a OutInterceptor extending AbstractSoapInterceptor with
> > super(Phase.MARSHAL) constructor.
> > But control is not going to this interceptor in case of any run time
> > exception. Only in case of successful processing control is coming to
> > this interceptor.
> > I have overridden both handleMessage  and handleFault methods.
> > What I could be doing wrong?
> > And what is the correct approach to handle exception?
> > 
> > Regards,
> > seshu

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Exception handling

Posted by Glen Mazza <gl...@gmail.com>.
When exceptions occur, the interceptor chain is processed in reverse
direction (same with JAX-WS handlers).  You'll need to do your error
handling towards the beginning of the service-side interceptor chain, not at
the end of it.

HTH,
Glen


sur04sep wrote:
> 
> Hi,
> I need to send custom error codes for all kind of exceptions(even run time
> exception).
> For this I wrote a OutInterceptor extending AbstractSoapInterceptor with
> super(Phase.MARSHAL) constructor.
> But control is not going to this interceptor in case of any run time
> exception. Only in case of successful processing control is coming to this
> interceptor.
> I have overridden both handleMessage  and handleFault methods.
> What I could be doing wrong?
> And what is the correct approach to handle exception?
> 
> Regards,
> seshu
> 

-- 
View this message in context: http://old.nabble.com/Exception-handling-tp28743320p28743501.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Exception handling

Posted by sur04sep <su...@gmail.com>.
Thanks to both of you. It helped. Actually I was using outinterceptor instead
of outFaultInterceptors. My mistake.


sur04sep wrote:
> 
> Hi,
> I need to send custom error codes for all kind of exceptions(even run time
> exception).
> For this I wrote a OutInterceptor extending AbstractSoapInterceptor with
> super(Phase.MARSHAL) constructor.
> But control is not going to this interceptor in case of any run time
> exception. Only in case of successful processing control is coming to this
> interceptor.
> I have overridden both handleMessage  and handleFault methods.
> What I could be doing wrong?
> And what is the correct approach to handle exception?
> 
> Regards,
> seshu
> 

-- 
View this message in context: http://old.nabble.com/Exception-handling-tp28743320p28751252.html
Sent from the cxf-user mailing list archive at Nabble.com.