You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Luc Dewavrin <lu...@gmail.com> on 2010/09/22 23:26:20 UTC

Exception serialization

Hi,

i am using CXF 2.2.10 with JAXWS/JAXB binding and when an exception is
thrown in a method of @WebService annotated class,
the exception is not serialized in the SOAP:Fault detail (even if it's
annotated with JAXB annotations) .

I searched on the internet and i have seen that it's a known issue :
http://i-proving.ca/space/Technologies/Apache+CXF/Adding+an+interceptor+to+the+CXF+fault+chain

I created my own out fault interceptor that serializes the exception in the
SOAP:Fault detail element. Actually
it creates a DOM element from the exception class. It works
I had hard time to make it work due to this other issue with JAXB
http://forums.java.net/jive/thread.jspa?threadID=31582
that is unable to serialize a Throwable and due to the fact that the web
service is deployed in an OSGI bundle (i had
to play with the context classloader).

My only problem now is that when the WSDL is retrieved (using the endpoint's
address with the ?WSDL parameter),
the type for the exception does not reflect the Java properties defined in
the exception's class.

Is there a way to control the dynamic WSDL generation ? Have you faced the
same issue with the JAXWS/JAXB binding
of CXF regarding the exceptions ?

Thanks in advance,
Luc

Re: Exception serialization

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 24 September 2010 11:58:30 am Luc Dewavrin wrote:
> Hi all,
> I have found my problem it was simply due to the fact that the
> @XmlAccessorType(XmlAccessType.FIELD)
> was missing in my custom exception class (my properties did not have
> setters).
> So my soap fault out interceptor is now useless.

Ah.  But did you learn something?  ;-)

Seriously, thanks for the follow up.

Dan




> 
> Luc
> 
> On Wed, Sep 22, 2010 at 5:26 PM, Luc Dewavrin <lu...@gmail.com>wrote:
> > Hi,
> > 
> > i am using CXF 2.2.10 with JAXWS/JAXB binding and when an exception is
> > thrown in a method of @WebService annotated class,
> > the exception is not serialized in the SOAP:Fault detail (even if it's
> > annotated with JAXB annotations) .
> > 
> > I searched on the internet and i have seen that it's a known issue :
> > 
> > http://i-proving.ca/space/Technologies/Apache+CXF/Adding+an+interceptor+t
> > o+the+CXF+fault+chain
> > 
> > I created my own out fault interceptor that serializes the exception in
> > the SOAP:Fault detail element. Actually
> > it creates a DOM element from the exception class. It works
> > I had hard time to make it work due to this other issue with JAXB
> > http://forums.java.net/jive/thread.jspa?threadID=31582
> > that is unable to serialize a Throwable and due to the fact that the web
> > service is deployed in an OSGI bundle (i had
> > to play with the context classloader).
> > 
> > My only problem now is that when the WSDL is retrieved (using the
> > endpoint's address with the ?WSDL parameter),
> > the type for the exception does not reflect the Java properties defined
> > in the exception's class.
> > 
> > Is there a way to control the dynamic WSDL generation ? Have you faced
> > the same issue with the JAXWS/JAXB binding
> > of CXF regarding the exceptions ?
> > 
> > Thanks in advance,
> > Luc

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

Re: Exception serialization

Posted by Luc Dewavrin <lu...@gmail.com>.
Hi all,
I have found my problem it was simply due to the fact that the
@XmlAccessorType(XmlAccessType.FIELD)
was missing in my custom exception class (my properties did not have
setters).
So my soap fault out interceptor is now useless.

Luc
On Wed, Sep 22, 2010 at 5:26 PM, Luc Dewavrin <lu...@gmail.com>wrote:

> Hi,
>
> i am using CXF 2.2.10 with JAXWS/JAXB binding and when an exception is
> thrown in a method of @WebService annotated class,
> the exception is not serialized in the SOAP:Fault detail (even if it's
> annotated with JAXB annotations) .
>
> I searched on the internet and i have seen that it's a known issue :
>
> http://i-proving.ca/space/Technologies/Apache+CXF/Adding+an+interceptor+to+the+CXF+fault+chain
>
> I created my own out fault interceptor that serializes the exception in the
> SOAP:Fault detail element. Actually
> it creates a DOM element from the exception class. It works
> I had hard time to make it work due to this other issue with JAXB
> http://forums.java.net/jive/thread.jspa?threadID=31582
> that is unable to serialize a Throwable and due to the fact that the web
> service is deployed in an OSGI bundle (i had
> to play with the context classloader).
>
> My only problem now is that when the WSDL is retrieved (using the
> endpoint's address with the ?WSDL parameter),
> the type for the exception does not reflect the Java properties defined in
> the exception's class.
>
> Is there a way to control the dynamic WSDL generation ? Have you faced the
> same issue with the JAXWS/JAXB binding
> of CXF regarding the exceptions ?
>
> Thanks in advance,
> Luc
>
>