axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jerome moliere" <jmoli...@nerim.net>
Subject Re: How to send custom exception through SOAP message ?
Date Thu, 22 Jan 2004 11:00:39 GMT

> Hello,
>
>
> I'm using WebService with JBoss and Axis 1.0.
> My EJBs throw RemoteException, as usual, but alse custom exceptions,
> extending java.lang.Exception.
>
> This exception appears in the .wsdd file like this :
>
> <wsdl:message name="RemoteFonctionnelException">
>  <wsdl:part name="silo" type="xsd:int"/>
> </wsdl:message>
>
> Everything is working fine with system exception (seen as remoteException,
> so ...)
>
>
> But, when my EJBs throw this kind of custom exception, I never get
> reference of this exception in soap envelope. I get a kind of
> myException.toString() message ...
>
>
> Here is a response :
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
>  <SOAP-ENV:Body>
>   <SOAP-ENV:Fault>
>    <faultcode
> xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.userException</faultcode>
>
> <faultstring>fr.gouv.dgi.adelie.silocommun.RemoteFonctionnelException</faultstring>
>    <detail>
>     <ns2:stackTrace
> xmlns:ns2="http://xml.apache.org/axis/">fr.gouv.dgi.adelie.silocommun.RemoteFonctionnelException
>
>         <... SNIP STACKTRACE>
>
>         </ns2:stackTrace>
>    </detail>
>   </SOAP-ENV:Fault>
>  </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
>
> How can I unserialize this exception if the structure of the exception is
> not respected in the reponse ?
>

Hi damien,
I guess that your custom exceptions may be child from remote exceptions
because they must serialized....
However I cannot encourage you to use such practices because you must not
forget that SOAP messages could be used in environements where the
exception concept doesn't exist....It's one from the design usage I
suggest whend ealing with SOAP..Like avoid using your own serializers
because they could be useless when used with a non Java target language...

HTH
-- 
Auteur cahier du programmeur Java tome 2 - Eyrolles 10/2003
http://www.eyrolles.com/php.informatique/Ouvrages/ouvrage.php3?ouv_ean13=9782212111941


Mime
View raw message