Re: Can interfaces thrown exceptions? (Other than RemoteException ?)

From: Arun Gupta <arun.gupta_at_Sun.COM>
Date: Fri, 12 Apr 2002 10:51:37 -0700

Hi Michael,

Please refer to JAX-RPC release notes at

Sspecific exceptions must have only one public constructor that has one argument.
The type of this constructor must match at least one method which has a name
that starts with get, takes no arguments, nd returns the same type as the
constructor. For example:

public class MyException extends Exception {

    private MyType type;

    public MyException(MyType type) {
        this.type = type;

    public MyType getType() {
        return type;

This limitation will be relaxed in the upcoming JAX-RPC release. Also,
Java Web Services Developer Pack EA2 is based on 0.7 version of JAX-RPC
specification. Please refer to 0.7 version of the specification for the
list of features in the JAX-RPC implementation.

Thanks for your interest in JAX-RPC.


YAWN,MICHAEL (HP-Cupertino,ex1) wrote:

>OK, that makes sense. I'll avoid RuntimeException subclasses.
>But I get the same error if I just add Exception to my method
>signatures -- xrpcc reports 'java.lang.Exception not supported'.
>Any ideas? I've been working with the EA1 release, but just
>updated to EA2 to see if it would help with this and other
>problems I'm having. Doesn't seem to affect this one (haven't
>yet tried the others).
>>-----Original Message-----
>>From: Hrishikesh Bhagwat [mailto:Hrishikesh.Bhagwat_at_XORIANT.COM]
>>Sent: Wednesday, April 10, 2002 9:05 PM
>>Subject: Re: Can interfaces thrown exceptions? (Other than
>>RemoteException ?)
>>Hi Mike,
>>Refer the following lines from JAX-RPC 0.8 spec (Section 5.2.1)
>>"A service specific exception declared in a remote method
>>signature must be
>>a checked
>>exception. It must extend java.lang.Exception either directly
>>or indirectly
>>but must
>>not be a RuntimeException."
>>IllegalArgumentException extends from a RuntimeException.
>>Thats your problem
>>-----Original Message-----
>>From: YAWN,MICHAEL (HP-Cupertino,ex1) [mailto:mike_yawn_at_HP.COM]
>>Sent: Wednesday, April 10, 2002 10:39 PM
>>Subject: Can interfaces thrown exceptions? (Other than
>>I thought that JAX-RPC interfaces could throw exceptions other than
>>RemoteException, and that these exceptions would be mapped to SOAP
>>Faults. But if I add a 'throws IllegalArgumentException' to
>>my interface,
>>xrpcc balks saying that the exception isn't supported.
>>Section 14.3.6 shows some mappings between SOAP faults and
>>Java exceptions. Are these the only legal exceptions that an RPC
>>service can throw? If I want to indicate an illegal argument was
>>passed, how to I create a RemoteException that is mapped onto
>>the rpc:BadArguments SOAP fault, since RemoteException also
>>maps onto rpc:ProcedureNotPresent? (Or should I even care
>>how it gets mapped -- will the client see any difference between
>>the two?)

There is only one me, I must live myself!
There is only one today, I must live itself!