I also have problem with this and I have a bad solution for the moment.
Set the parameter DrillDownToRootCauseForFaultReason to true in the axis2.xml 
configuration file at the server side.
Then you can see the Exception in the AxisFault message. I think it is 
getDetails().
 
 
/Pär
 
 
 
 
> Subject: Exception handling - AxisFault> Date: Tue, 2 Oct 2007 09:57:08 
> +0200> From: [EMAIL PROTECTED]> To: [email protected]> > Hi,> > I am 
> desperate since 2 weeks, because I keep hanging on this problem: I do not 
> know how AxisFault is handled, and why my custom exception is not serialized 
> and passed back to the client side, where it should be re-instantiated by 
> reflection, as it should be, according to the Axis2 tools. > > To be honest, 
> I am not sure anymore if this works at all, and I am only 1 step before 
> implementing my own webservice handling classes and quit the Axis framework, 
> or look for something else - the framework is unfortunately _completely_ 
> useless if something as basic as that does not function or is poorly 
> documented. I would of course also appreciate verbose documentation on how 
> exceptions are passed, how AxisFault is handled, instantiated, passed back, 
> serialized, etc. etc.> > So I repost my problem here, in hope for help or 
> advice. If I do not get any until tomorrow, I will have to recommend using 
> something else. > > My problem: I can invoke web services without problems, 
> but I do not get back customized exceptions on my Java client side.> > Here 
> is my generation procedure and source:> 1) I write a class AService, in which 
> I define one simple operation (add(int,int,int)), it returns a result of type 
> long, if the third argument is 0. If the 3rd int is not 0, it will throw 
> "CustomException".> 2) "CustomException" is a class defined as extending 
> java.lang.Exception and implements java.io.Serializable> 3) I generate the 
> service with Axis2 tools, and deploy the service.> 4) I generate the wsdl. 
> The wsdl correctly includes the fault element named <wsdl:fault 
> name="CustomException">> <soap:fault use="literal" name="CustomException"/>> 
> 5) I generate the java client with the axis2 codegen wizard.> 6) I invoke the 
> web service with it, without exception testing: works.> 7) I invoke it to 
> throw the exception (3rd int = 1): doesn't work. I only get an AxisFault. But 
> the generated client should throw a CustomException. AxisFault.getDetail() is 
> empty. > > What is wrong ?> I include the 2 simple java files from which I 
> started here:> package com.foo.bar;> > > public class AService {> public long 
> Add(int a, int b, int exceptionThrown) throws CustomException {> > if 
> (exceptionThrown != 0) {> System.out.println("CustomException to b 
> instantiated"); > > CustomException e = new CustomException();> 
> e.setCustomMsg("bar");> throw e;> }> > > return a+b;}> > }> > Here the 
> exception class:> package com.foo.bar;> > import java.io.Serializable;> > 
> public class CustomException extends java.lang.Exception implements 
> Serializable {> > private static final long serialVersionUID = 
> 1542353156105984960L;> private String customMsg;> > public String 
> getCustomMsg() {return customMsg;}> public void setCustomMsg(String 
> customMsg) {this.customMsg=customMsg;}> > > }> > > Here is the generated 
> WSDL:> <wsdl:definitions 
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; 
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
> xmlns:xsd="http://bar.foo.com/xsd"; xmlns:ns="http://bar.foo.com"; 
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
> targetNamespace="http://bar.foo.com";><wsdl:types><xs:schema 
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; attributeFormDefault="qualified" 
> elementFormDefault="qualified" targetNamespace="http://bar.foo.com/xsd";>> 
> <xs:element name="CustomExceptionFault">> <xs:complexType>> <xs:sequence>> 
> <xs:element name="CustomException" nillable="true" type="xsd:CustomException" 
> />> </xs:sequence>> </xs:complexType>> </xs:element>> <xs:element 
> name="CustomException" type="xsd:CustomException" />> <xs:complexType 
> name="CustomException">> <xs:complexContent>> <xs:extension 
> base="xs:Exception">> <xs:sequence>> <xs:element name="customMsg" 
> nillable="true" type="xs:string" />> </xs:sequence>> </xs:extension>> 
> </xs:complexContent>> </xs:complexType>> <xs:element name="Add">> 
> <xs:complexType>> <xs:sequence>> <xs:element name="a" nillable="true" 
> type="xs:int" />> <xs:element name="b" nillable="true" type="xs:int" />> 
> <xs:element name="exceptionThrown" nillable="true" type="xs:int" />> 
> </xs:sequence>> </xs:complexType>> </xs:element>> <xs:element 
> name="AddResponse">> <xs:complexType>> <xs:sequence>> <xs:element 
> name="return" nillable="true" type="xs:long" />> </xs:sequence>> 
> </xs:complexType>> </xs:element>> </xs:schema></wsdl:types><wsdl:message 
> name="AddMessage"><wsdl:part name="part1" element="xsd:Add" 
> /></wsdl:message><wsdl:message name="AddResponseMessage"><wsdl:part 
> name="part1" element="xsd:AddResponse" /></wsdl:message><wsdl:message 
> name="CustomException"><wsdl:part name="part1" element="xsd:CustomException" 
> /></wsdl:message><wsdl:portType name="AServicePortType"><wsdl:operation 
> name="Add"><wsdl:input xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
> wsaw:Action="urn:Add" message="ns:AddMessage" /><wsdl:output 
> xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; 
> message="ns:AddResponseMessage" wsaw:Action="urn:Add" /><wsdl:fault 
> message="ns:CustomException" name="CustomException" 
> /></wsdl:operation></wsdl:portType><wsdl:binding name="AServiceSOAP11Binding" 
> type="ns:AServicePortType"><soap:binding 
> transport="http://schemas.xmlsoap.org/soap/http"; style="document" 
> /><wsdl:operation name="Add"><soap:operation soapAction="urn:Add" 
> style="document" /><wsdl:input><soap:body use="literal" 
> /></wsdl:input><wsdl:output><soap:body use="literal" 
> /></wsdl:output><wsdl:fault name="CustomException"><soap:body use="literal" 
> /></wsdl:fault></wsdl:operation></wsdl:binding><wsdl:binding 
> name="AServiceSOAP12Binding" type="ns:AServicePortType"><soap12:binding 
> transport="http://schemas.xmlsoap.org/soap/http"; style="document" 
> /><wsdl:operation name="Add"><soap12:operation soapAction="urn:Add" 
> style="document" /><wsdl:input><soap12:body use="literal" 
> /></wsdl:input><wsdl:output><soap12:body use="literal" 
> /></wsdl:output><wsdl:fault name="CustomException"><soap12:body use="literal" 
> /></wsdl:fault></wsdl:operation></wsdl:binding><wsdl:service 
> name="AService"><wsdl:port name="AServiceSOAP11port" 
> binding="ns:AServiceSOAP11Binding"><soap:address 
> location="http://localhost:8080/axis2/services/AService"; 
> /></wsdl:port><wsdl:port name="AServiceSOAP12port" 
> binding="ns:AServiceSOAP12Binding"><soap12:address 
> location="http://localhost:8080/axis2/services/AService"; 
> /></wsdl:port></wsdl:service></wsdl:definitions>> > Thanks in advance for 
> help,> > Jay> > > 
> ---------------------------------------------------------------------> To 
> unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: 
> [EMAIL PROTECTED]> 
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

Reply via email to