axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Kapoor <>
Subject Re: Custom Exceptions
Date Wed, 12 Jun 2002 19:11:26 GMT
Hi Sylvain:

Yes that's what I thought too.  If I can throw an AxisFault then I 
should be able to throw a descendant.
Well actually the exception class that I have defined on my server side 
is a descendant of Exception.
EInvalidCustomer = class(Exception)

And I am throwing that on my server.
If I catch it on the client it never goes to that catch block.  It will 
however go to an AxisFault catch block.
I think that custom exception mappings is not yet supported in Axis.

Any custom Java exception is converted to an AxisFault by the Axis 
Engine and on the client you can catch an AxisFault but not an 

If you get this to work please let me know.



St-Germain, Sylvain wrote:

>I may be misunderstanding your question but since I can throw an AxiFault
>shouldn't I be able to throw a descendent of AxisFault and, assuming it is a
>known type, expect the serialization to occur?
>-----Original Message-----
>From: Bob Cotton []
>Sent: Tuesday, June 11, 2002 8:41 PM
>Subject: Re: Custom Exceptions
>>>>>>"Sam" == Sam Kapoor <> writes:
>    Sam> Hi: what I want to do is write a custom exception class and
>    Sam> propagate it from one of the methods on my Web-Service to the
>    Sam> client.  So I define a Java exception class:
>    Sam> public class EInvalidCustomer extends Exception {
>    Sam>  public EInvalidCustomer(String err){
>    Sam>   super(err);
>    Sam>  }
>    Sam> The method on my web-service throws this EInvalidCustomer
>    Sam> exception.  Now I run the WSDL2Java and I get public class
>    Sam> EInvalidCustomer extends org.apache.axis.AxisFault
>    Sam> Also in my WSDL I have a <wsdl:fault
>    Sam> message="intf:EInvalidCustomer" name="EInvalidCustomer"/>
>    Sam> So in my client when I call the method I catch 2 exceptions,
>    Sam> 1 is the RemoteException and the other is EInvalidCustomer
>    Sam> excpetion.  However, the catch is always going to the
>    Sam> RemoteException.  Now if I replace EInvalidCustomer with
>    Sam> AxisFault then the catch will go to the AxisFault.
>    Sam> I cannot find any example on Axis doc's that show how to pass
>    Sam> a custom exception class.
>    Sam> Do you have any ideas????
>Working through this same issue now. 
>Axis can describe the Exception in the WSDL (as you've discovered),
>but actually SENDING the data is not implemented.
>Until this happens I'm hacking something in using custom Handlers and
>SOAP headers to pass the data in my exception.
>Can the development guys shed some light on this? Possibly by beta3?
>- Bob

View raw message