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 Steve Pannier <St...@jacada.com> on 2003/09/23 23:24:51 UTC

Soap Fault question

Axis 1.1

I'm trying to get my web service to throw a
custom exception subclassed from RemoteException.
So to start off I looked at the code under
samples/faults.  I deployed the service, ran the
supplied Axis client, everything looked good.  (I
had to 1st put a try/catch around the call.invoke
in the client to see if catching the
NoSuchEmployeeFault exception really works).

Now, my goal is to be able to support many different
types of clients (.NET, JWSDP, BEA WebLogic, etc).
So I tried JWSDP: After getting the Employee.wsdl
file from Axis, I generated the client code.  But
it wouldn't compile, because the "cause" property
in the generated exception class is defined as Object
instead of Throwable.  (Axis did inform me that "The
class java.lang.Throwable is defined in a java or
javax package and cannot be converted into an xml
schema type.  An xml schema anyType will be used to
define this class in the wsdl file", so I knew
something was amiss.)

OK.  So I moved on to VB .NET.  I retrieved the WSDL
and created my client code.  I was able to catch
System.Exception, but not a NoSuchEmployeeFault
exception.  .NET did not create an object to
represent the NoSuchEmployeeFault exception.

I tried BEA WebLogic also, but it didn't work there
either.  The NoSuchEmployeeFault class it created
does not subclass from Throwable, so it couldn't be
used in a "catch" clause.

So my questions:

- Has anyone else got the samples/faults service
  code to work correctly against a non-Axis client
  environment?

- Am I correct in assuming that my custom exception
  can be "caught" by any client, even if non-Java
  (provided my WSDL describes it correctly)?

- In order to have Axis return a Soap Fault, is it a
  requirement to add *all* the configuration information
  shown in the samples/faults deploy.wsdd file to my
  WSDD deployment file? (i.e. Do I need to define all
  operation elements, even for the methods that don't
  return a Soap fault?)

Any examples would be greatly appreciated.

Regards.

Steve Pannier



Re: Soap Fault question

Posted by Ajay Gondhiya <Aj...@accelrys.com>.
Steve,

I have experimented a bit  with SOAP faults on .NET side and server side 
exceptions on Axis side. As far as my understanding goes:
- You can access the SOAP fault from .NET client. However, that's "SOAP 
fault" view - not the "Exception" view of the server side problem. I have 
not seen SOAP faults being converted to exceptions on the .NET client 
side. In our prototype, we are just accessing SOAP fault code, string etc. 
We can convert that to appropriate exception but that's application's job 
not web services infrastructure's job (in this case .NET)
- I am not sure that a "custom" exception can be caught by non-Java (even 
non-Axis clients implemented in Java) because there is no standard (and 
hence interoperable) way of communicating that this SOAP fault maps to 
this exception so that client side web services infrastructure can 
instantiate the exception. In fact, you might consume a web service from a 
programming language which does not have any concept of exception. In Axis 
server-client scenario interoperability is not an issue. Axis client knows 
where in the SOAP fault to look for exception mapping information and as 
long as client has the exception class in the classpath it can instantiate 
the exception but achieving the same thing in a language independent way 
is difficult and I don't think web services standards address this. 
Someone please correct me if my understanding is not quite right ..

Ajay




"Steve Pannier" <St...@jacada.com> 
09/24/2003 02:54 AM
Please respond to
axis-user@ws.apache.org


To
axis-user@ws.apache.org
cc

Subject
Soap Fault question






Axis 1.1

I'm trying to get my web service to throw a
custom exception subclassed from RemoteException.
So to start off I looked at the code under
samples/faults.  I deployed the service, ran the
supplied Axis client, everything looked good.  (I
had to 1st put a try/catch around the call.invoke
in the client to see if catching the
NoSuchEmployeeFault exception really works).

Now, my goal is to be able to support many different
types of clients (.NET, JWSDP, BEA WebLogic, etc).
So I tried JWSDP: After getting the Employee.wsdl
file from Axis, I generated the client code.  But
it wouldn't compile, because the "cause" property
in the generated exception class is defined as Object
instead of Throwable.  (Axis did inform me that "The
class java.lang.Throwable is defined in a java or
javax package and cannot be converted into an xml
schema type.  An xml schema anyType will be used to
define this class in the wsdl file", so I knew
something was amiss.)

OK.  So I moved on to VB .NET.  I retrieved the WSDL
and created my client code.  I was able to catch
System.Exception, but not a NoSuchEmployeeFault
exception.  .NET did not create an object to
represent the NoSuchEmployeeFault exception.

I tried BEA WebLogic also, but it didn't work there
either.  The NoSuchEmployeeFault class it created
does not subclass from Throwable, so it couldn't be
used in a "catch" clause.

So my questions:

- Has anyone else got the samples/faults service
  code to work correctly against a non-Axis client
  environment?

- Am I correct in assuming that my custom exception
  can be "caught" by any client, even if non-Java
  (provided my WSDL describes it correctly)?

- In order to have Axis return a Soap Fault, is it a
  requirement to add *all* the configuration information
  shown in the samples/faults deploy.wsdd file to my
  WSDD deployment file? (i.e. Do I need to define all
  operation elements, even for the methods that don't
  return a Soap fault?)

Any examples would be greatly appreciated.

Regards.

Steve Pannier