You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Patrick Peralta <pa...@veritas.com> on 2002/11/04 19:39:36 UTC

Custom Exception handling

Hello List,

I have a question about Axis and exception handling.  I defined a service
that throws my own custom exception as follows:

public interface PtrBroker extends Remote {
  public abstract Ptr getPtr(long id) throws PtrException, RemoteException;
}

PtrException is a simple class that extends java.lang.Exception.

When I run java2WSDL to generate the wsdl, and I run WSDL2java to generate
the client classes, all of the generated classes refer to the PtrException
class, and PtrException is one of the classes that is generated.

My problem is that when this exception is thrown on the server, the client
does not see it as a PtrException...instead it sees it as an AxisFault.

I have been looking through archives and I believe it was mentioned that
Axis was modified after the 1.0 release so that the client sees the custom
exception instead of the Axis fault.  Is this true?  Is there a workaround
in Axis 1.0, or will it be better to wait for the next release?

Thanks in advance,
Patrick

Re: Custom Exception handling

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Patrick Peralta" <pa...@veritas.com>
To: <ax...@xml.apache.org>
Sent: Monday, November 04, 2002 10:39 AM
Subject: Custom Exception handling


> Hello List,
>
> I have a question about Axis and exception handling.  I defined a service
> that throws my own custom exception as follows:
>
> public interface PtrBroker extends Remote {
>   public abstract Ptr getPtr(long id) throws PtrException,
RemoteException;
> }
>
> PtrException is a simple class that extends java.lang.Exception.
>
> When I run java2WSDL to generate the wsdl, and I run WSDL2java to generate
> the client classes, all of the generated classes refer to the PtrException
> class, and PtrException is one of the classes that is generated.
>
> My problem is that when this exception is thrown on the server, the client
> does not see it as a PtrException...instead it sees it as an AxisFault.

Everything goes over the wire as a SOAPFault; JAX-RPC has extra stuff to
make it possible to send other exceptions over the wire, but I dont know
what the interop implications for that are

> I have been looking through archives and I believe it was mentioned that
> Axis was modified after the 1.0 release so that the client sees the custom
> exception instead of the Axis fault.  Is this true?  Is there a workaround
> in Axis 1.0, or will it be better to wait for the next release?

Feel free to download and build up axis yourself, it isnt that hard or
complex and may work for you.

The workaround is to throw AxisFaults, and expect them at the far end...