Hi,
a similar case have been discussed here, and mister Deepal Jayasinghe asked 
"John" to create a JIRA for it.
What happended with that one?
I guess it is the same problem/solution.
 
Check mailconversation below:
 
/Pär Malmqvist
 
 
Hi John,Could you please create a JIRA and attach whatever necessary to 
recreatethe issue. ThanksDeepal> Hi all,>> I'm a newbie to Axis2, though have 
used Axis1 before, and am> having trouble with exceptions on the client end.>> 
I've deployed a POJO as a service under Tomcat. I generated> the service and 
client using Eclipse WTP, so to be as brief as> possible, the service has a 
method:>> public CounterLight getCounter(Long nsuk)> throws 
CounterNotFoundException> {> :> throw new 
CounterNotFoundException("Exception!!!!") ;> }>> CounterNotFoundException is 
simply an extension of> java.lang.Exception (it implements Serializable as 
well, though I> don't think this makes any difference)>> Wsdl2java generates a 
class called> CounterNotFoundExceptionException2 alongside the stub for the 
service>> On the client side I have:>> try {> stub.getCounter(params) ; // 
Params initialised properly etc> }> catch(CounterNotFoundExceptionException2 e) 
{> e.printStackTrace() ;> }> catch (AxisFault e) {> e.printStackTrace() ;> }>> 
The AxisFault is ALWAYS the one that is received, never the> generated 
exception (though the compiler insists that I check for it).>> On the server 
side, I also get a> "java.lang.reflect.InvocationTargetException...Caused by 
CounterException">> Can anybody point me in the right direction here, am I 
missing> something? I've googled extensively, searched the list archives etc,> 
but couldn't find much of help.>> Thanks for any help!>> John>
 
 
 
 
 
 
 
> Subject: RE: Urgent - Exception Mapping with Axis2> Date: Wed, 26 Sep 2007 
> 16:34:34 +0200> From: [EMAIL PROTECTED]> To: [email protected]> > just 
> to correct: AxisFault.getDetail is not "empty", it is null.> > > 
> -----Original Message-----> > From: Jay Zawar > > Sent: mercredi 26 septembre 
> 2007 16:32> > To: [email protected]> > Subject: Urgent - Exception 
> Mapping with Axis2> > > > > > Hi people,> > > > I am really puzzled about 
> Axis Code generators and the way > > custom exceptions are passed. I do not 
> even find good > > documentation on it. I've been on this problem for almost 
> a > > week now, and still do not find any answer. 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]> > > > > > 
> ---------------------------------------------------------------------> To 
> unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: 
> [EMAIL PROTECTED]> 
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE

Reply via email to