You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by kazarian <mk...@alservices.com> on 2009/03/13 23:35:49 UTC

Fault to standard Response

My service catches all Throwable exceptions and wraps them in a
ResponseContext element in my Response object.  I would like to be able to
intercept Faults that occur outside of my implementation code (schema
validation faults) and wrap them in the aforementioned ResponseContext.

This allows me to create a simpler (in my view) interface for consumers of
my service(s).  The problem is that I'm not certain how to intercept a
fault, grab the details I'm interested in out of the fault, set the
appropriate state in my ResponseContext object, then return my response
rather than a fault to the consumer.

Thanks,
mk

** I've posted a similar message on the IONA forum, but this forum seems to
have more activity
-- 
View this message in context: http://www.nabble.com/Fault-to-standard-Response-tp22506179p22506179.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Fault to standard Response

Posted by Sean O'Callaghan <SE...@progress.com>.
Hi Kazarian,

You could use an interceptor to do this, http://cwiki.apache.org/CXF20DOC/interceptors.html.

Seán

** I've also replied on the FUSE forums.


-----Original Message-----
From: kazarian [mailto:mkazaria@alservices.com] 
Sent: 13 March 2009 22:36
To: users@cxf.apache.org
Subject: Fault to standard Response


My service catches all Throwable exceptions and wraps them in a
ResponseContext element in my Response object.  I would like to be able to
intercept Faults that occur outside of my implementation code (schema
validation faults) and wrap them in the aforementioned ResponseContext.

This allows me to create a simpler (in my view) interface for consumers of
my service(s).  The problem is that I'm not certain how to intercept a
fault, grab the details I'm interested in out of the fault, set the
appropriate state in my ResponseContext object, then return my response
rather than a fault to the consumer.

Thanks,
mk

** I've posted a similar message on the IONA forum, but this forum seems to
have more activity
-- 
View this message in context: http://www.nabble.com/Fault-to-standard-Response-tp22506179p22506179.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Fault to standard Response

Posted by kazarian <mk...@alservices.com>.
I'm using Http POST for my request/response to the service (no restful calls
here).  What it comes down to is that I didn't want to client to have a
bunch of catch blocks for all the different Faults that could be returned
from my service(s).  My "Response" object is actually just the out message
(return value) for the service operation.  

The affect I was leaning towards is something like how Spring handles the
catching all lower level errors and wrapping them in a Runtime exception
that can be introspected for root cause details.  So in my service(s),
instead of throwing a Fault I was bundling the exception in a custom
ResponseContext element (schema defined) in my soap response that a user can
use or ignore.

I've attached a copy of my ResponseContext.xsd.  It is used in the following
manner:

<complexType name="someMethodResponse">
    <sequence>
        <element name="responseContext" type="resp:responseContext"
maxOccurs="1" minOccurs="1"/>
        <element name="foo" type="string"/>
    </sequence>
</complexType> 



Sergey Beryozkin-2 wrote:
> 
> Hi - is it a JAXRS related query? You mention 'Response' object so
> perhaps
> it's related 
> 
> Cheers, Sergey
> -----Original Message-----
> From: kazarian [mailto:mkazaria@alservices.com] 
> Sent: 13 March 2009 22:36
> To: users@cxf.apache.org
> Subject: Fault to standard Response
> 
> 
> My service catches all Throwable exceptions and wraps them in a
> ResponseContext element in my Response object.  I would like to be able
> to
> intercept Faults that occur outside of my implementation code (schema
> validation faults) and wrap them in the aforementioned ResponseContext.
> 
> This allows me to create a simpler (in my view) interface for consumers
> of
> my service(s).  The problem is that I'm not certain how to intercept a
> fault, grab the details I'm interested in out of the fault, set the
> appropriate state in my ResponseContext object, then return my response
> rather than a fault to the consumer.
> 
> Thanks,
> mk
> 
> ** I've posted a similar message on the IONA forum, but this forum seems
> to
> have more activity
> -- 
> View this message in context:
> http://www.nabble.com/Fault-to-standard-Response-tp22506179p22506179.htm
> l
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
> 
http://www.nabble.com/file/p22539083/ResponseContext.xsd ResponseContext.xsd 
-- 
View this message in context: http://www.nabble.com/Fault-to-standard-Response-tp22506179p22539083.html
Sent from the cxf-user mailing list archive at Nabble.com.


RE: Fault to standard Response

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi - is it a JAXRS related query? You mention 'Response' object so
perhaps
it's related 

Cheers, Sergey
-----Original Message-----
From: kazarian [mailto:mkazaria@alservices.com] 
Sent: 13 March 2009 22:36
To: users@cxf.apache.org
Subject: Fault to standard Response


My service catches all Throwable exceptions and wraps them in a
ResponseContext element in my Response object.  I would like to be able
to
intercept Faults that occur outside of my implementation code (schema
validation faults) and wrap them in the aforementioned ResponseContext.

This allows me to create a simpler (in my view) interface for consumers
of
my service(s).  The problem is that I'm not certain how to intercept a
fault, grab the details I'm interested in out of the fault, set the
appropriate state in my ResponseContext object, then return my response
rather than a fault to the consumer.

Thanks,
mk

** I've posted a similar message on the IONA forum, but this forum seems
to
have more activity
-- 
View this message in context:
http://www.nabble.com/Fault-to-standard-Response-tp22506179p22506179.htm
l
Sent from the cxf-user mailing list archive at Nabble.com.