axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jarmo Doc" <jar...@hotmail.com>
Subject RE: Exceptions are killing me
Date Thu, 12 Jan 2006 19:46:15 GMT
Apologies, I attached the wrong serialization -- that one was from an 
exception that derived from Exception rather thanAxisFault (I've tried both 
and neither works unless you happening to be talking to an Axis cleint).

Here's the serialization (that's still wrong) derving from AxisFault:

<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <faultcode>soapenv:Server.generalException</faultcode>
   <faultstring/>
   <detail>
    <ns1:fault xmlns:ns1="mypackage">
     <ns2:mytext xmlns:ns2="mypackage">testing exceptions</ns2:mytext>
    </ns1:fault>
    <ns4:exceptionName 
xmlns:ns4="http://xml.apache.org/axis/">mypackage.MyException</ns4:exceptionName>
    <ns5:stackTrace xmlns:ns5="http://xml.apache.org/axis/">
    ... stack trace here ...
    </ns5:stackTrace>
    <ns6:hostname 
xmlns:ns6="http://xml.apache.org/axis/">myhostname</ns6:hostname>
   </detail>
</soapenv:Fault>

Aside from 'exceptionName' which I believe is an old hack to allow Axis 
clients (and only Axis clients) to work out what type the exception is, this 
fault does not indicate the type of the embedded exception.

Should not:

  <ns1:fault xmlns:ns1="mypackage">

instead be something like this:

  <ns1:fault xmlns:ns1="mypackage" type="MyException">

How do I correct this behavior?

>From: "Jarmo Doc" <jarmod@hotmail.com>
>Reply-To: axis-user@ws.apache.org
>To: axis-user@ws.apache.org
>Subject: Exceptions are killing me
>Date: Thu, 12 Jan 2006 11:16:15 -0800
>
>My Axis 1.3 server operations throw MyException which is defined something 
>like this (though in reality it's more complex):
>
>public class MyException extends AxisFault implements Serializable
>{
>  private String mytext;
>  public String getMytext() {return mytext;}
>  public void setMytext(String mytext) {this.mytext = mytext;}
>  // the normal wsdl2java generated stuff such
>  // as constructor, getSerializer(), getDeserializer()
>}
>
>I see this serialized on the line as:
>
><soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>   <faultcode>soapenv:Server.userException</faultcode>
>   <faultstring>mypackage.MyException</faultstring>
>   <detail>
>    <faultData>
>     <mytext>testing exceptions</mytext>
>    </faultData>
>    <ns1:stackTrace
>    ... stack trace here ...
>    </ns1:stackTrace>
>    <ns2:hostname 
>xmlns:ns2="http://xml.apache.org/axis/">myhostname</ns2:hostname>
>    </detail>
></soapenv:Fault>
>
>I'm not an expert here, obviously, but I'm pretty sure that this 
>serialization is wrong.  In particular:
>
>1. the fault string is the name of the exception class, which is odd
>2. it refers to <faultData> when I'd expect to see <ns1:MyException> or 
>similar
>3. it should not contain a server-side stack trace
>
>As it stands, a client that attempts to deserialize this has no clue what 
>type the contained exception is and thus fails.
>
>My cubicle wall now has a large hole from me banging my head into it on a 
>regular basis ;-) so could someone please offer a clue as to what could be 
>going wrong.  What could cause Axis to serialize my exception in this way?
>
>Thanks.

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement


Mime
View raw message