You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by pavigupta_intuit <pa...@yahoo.com> on 2010/08/19 21:36:19 UTC

JAX-WS Custom Exceptions

Hi,
I am having an issue where I have a Custom Exception that is defined in the
interfaces/wsdl. When I throw this exception in the application code it
comes back as a Soap fault on the client side. There is no trace of it in
the details or otherwise. I was wondering how I can access this exception:
1) Is there a way to completely bypass the Soap11FaultOutInterceptor?
2) If 1) is not feasible can I somehow have the custom exception show up in
the detail, something like:
  <soap:Fault>
    <faultcode>FailedAuthentication</faultcode>
    <faultstring>The security token could not be authenticated or
authorized</faultstring>
    <detail>
      {detail structure with the custom exception}
      [...]
    </detail>
  <soap:Fault>

I would appreciate any feedback. I have been struggling with this for a
while and it is important that we get this resolved from an app.
architecture perspective.

Thanks,
-Pavi
-- 
View this message in context: http://cxf.547215.n5.nabble.com/JAX-WS-Custom-Exceptions-tp2641442p2641442.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: JAX-WS Custom Exceptions

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 19 August 2010 3:36:19 pm pavigupta_intuit wrote:
> Hi,
> I am having an issue where I have a Custom Exception that is defined in the
> interfaces/wsdl. When I throw this exception in the application code it
> comes back as a Soap fault on the client side. There is no trace of it in
> the details or otherwise. I was wondering how I can access this exception:
> 1) Is there a way to completely bypass the Soap11FaultOutInterceptor?

You could register an Interceptor that runs before it that removes it.  But 
I'm not really sure why you want to do that.

> 2) If 1) is not feasible can I somehow have the custom exception show up in
> the detail, something like:
>   <soap:Fault>
>     <faultcode>FailedAuthentication</faultcode>
>     <faultstring>The security token could not be authenticated or
> authorized</faultstring>
>     <detail>
>       {detail structure with the custom exception}
>       [...]
>     </detail>
>   <soap:Fault>

If the exception is properly following JAX-WS rules for what it should look 
like, it should do this automatically.   My suggestion is that if you have the 
proper wsdl for this, have it generate code using wsdl2java and look at the 
generated exception.   That's exactly what you want.   Either use it directly 
or copy the ideas and structure over to your exception.

Dan



> I would appreciate any feedback. I have been struggling with this for a
> while and it is important that we get this resolved from an app.
> architecture perspective.
> 
> Thanks,
> -Pavi

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