You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by George Voronoff <Ge...@grassroots.com> on 2002/01/12 01:11:04 UTC

Exception Handling/Error Reporting

I'm a soap Newbie and I have some questions about soap and error reporting.

lets say I have a server side method:

public Address getAddressFromName(String name) throws IllegalArgumentException
  {
    if (name == null)
    {
      throw new IllegalArgumentException("The name argument must not be " + "null.");
    }

    return (Address)name2AddressTable.get(name);
  }

This method was copied directly from the address book example. 
If name is null the server throws an IllegalArgumenException, and and the response Fault looks like:

Generated fault:
  Fault Code   = SOAP-ENV:Server
  Fault String = Exception from service object: The name argument must not be null.

NOW, If I call the invoke() again (on the same Call ojbect) I get a different fault.

Generated fault:
  Fault Code   = SOAP-ENV:Server.BadTargetObjectURI
  Fault String = Unable to determine object id from call: is the method element namespaced?

It seems to me that throwing the first exception from a server side method caused "something bad" to
happen to the Call object.  As such, do I need to avoid throwing server side exceptions at all costs if
I want to reuse the same Call object?

Is it good practice to avoid throwing server side exceptions in the first place?

Finally, can someone point to to any documentation that discusses implementiing reporting of 
server side errors.

> George Voronoff
> Senior Software Engineer (Net Hack)
> Grassroots Enterprise, Inc
> 
> 
>