axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject RE: (Chained) Exceptions and beanMapping
Date Wed, 13 Nov 2002 15:47:37 GMT
Hi Steven,

Thank you for your suggestion. That would work.
However the problem I'm trying to solve is to make
AXIS itself properly process all my exceptions regardless if they were
derived from AxisFault or not.
I still don't get the reason why all exceptions to be thrown in AXIS
have to be derived from AxisFault? 

Your solution would lock my code with AXIS. If I decide to move to some
other library, it would require code change.
But the biggest problem is not this, but that AXIS does not properly
serialize my exception (fields) even if it was derived from AxisFault.

I did mention this (in more detail) in my previous message in this

Thanks anyway for the suggestion,

Ruslan Zenin

-----Original Message-----
From: sgollery 
Sent: November 12, 2002 8:27 PM
To: sgollery; axis-user
Subject: Re: (Chained) Exceptions and beanMapping


Would something like this be workable for you:

Don't expose your existing class as a web service. Instead, create 
another class as a wrapper. In that class, each operation would call a 
method in your existing class, something like:

public returntype WebVersion( parameters ) {
     try {
          return RealVersion(parameters); // where RealVersion is a 
method in your existing application
    } catch (all the exceptions RealVersion might throw) {
        .. .here construct an AxisFault with the detail string set to 
the information from
       .. the actual exception, plus the name of the exception class.
       and throw the AxisFault

Then the client-side code would catch the AxisFault, extract the 
information, and throw the appropriate kind of exception. That way, code

outside the method that is invoking the SOAP service would get back 
exactly what it expects currently, including the exceptions.

Of course, I have no idea if this fits your situation. But it seems like

it might be something to consider.

Steven Gollery wrote:

>Can anyone explain clearly WHY developers are forced
>to inherit from AxisFault class?
>It is a huge problem with the AXIS product. The reality is that
>lots of developers adding WEB Services to EXISTING applications.
>And there is no way to change existing exceptions nor register custom
>AXIS should not be so strict about exceptions. It should at least have
>an INTERFACE instead of a class
>Remember Java has only single inheritance - so it is "hard" to inherit
>from two classes at the same time.
>I think this requirement should be changed to implementation of the
>AxisFault interface instead (or as an addition).
>Gladly would hear an opinion from AxisFault implementation
>In my case I becomes a showstopper to use AXIS at all, since it can't
>properly serialize my CustomExeptions at the moment.
>Ruslan Zenin
>-----Original Message-----
>From: steve.l 
>Sent: November 12, 2002 4:09 PM
>To: steve.l; axis-user
>Subject: Re: (Chained) Exceptions and beanMapping
>Exceptions are special, as they go back over the wire as soapfaults,
>intent being better interop.
>1. look at what the JAX-RPC spec has to say
>2. look at AxisFault and how exceptions are handled.
>You will probably have to sublcass AxisFault or
>anything to work
>----- Original Message -----
>From: "Hicks, SJC (Steve) " <>
>To: <>
>Sent: Tuesday, November 12, 2002 9:35 AM
>Subject: (Chained) Exceptions and beanMapping
>>I've created a custom exception in WSDL with some extra fields in it,
>>generated the Java and deployed it all successfully (including setting
>>beanMapping), but the extra fields don't seem to be serialized and
>>deserialized to XML.  The generated exception class has all the right
>>constructors and allows me to set the fields in the object, but they
>>passed in the SOAP message at all.  The schema definition for the
>><schema ...>
>> ...
>> <complexType name="MyChainedException">
>>  <sequence>
>>   <element name="chainedException" nillable="true"
>>   <element name="message" nillable="true" type="xsd:string"/>
>>  </sequence>
>> </complexType>
>> <element name="MyChainedException" nillable="true"
>>Is there something *extra* I need to do to force it to use the Bean
>>(De)Serializer?  Is it possible to do this at all for an exception?
>>else had any success using chained exceptions with Axis?

View raw message