Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 45473 invoked from network); 22 Jan 2005 14:36:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 22 Jan 2005 14:36:10 -0000 Received: (qmail 72229 invoked by uid 500); 22 Jan 2005 14:35:52 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 72196 invoked by uid 500); 22 Jan 2005 14:35:51 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 72181 invoked by uid 99); 22 Jan 2005 14:35:51 -0000 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=RCVD_ILLEGAL_IP X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: 213.140.2.50 is neither permitted nor denied by domain of lor.dv@tiscali.it) Received: from ms005msg.fastwebnet.it (HELO ms005msg.fastwebnet.it) (213.140.2.50) by apache.org (qpsmtpd/0.28) with ESMTP; Sat, 22 Jan 2005 06:35:49 -0800 Received: from atlantis (1.50.117.49) by ms005msg.fastwebnet.it (7.2.052) id 41D18D9400489ED6 for axis-user@ws.apache.org; Sat, 22 Jan 2005 15:35:46 +0100 Message-ID: <000301c5008f$a744e280$31753201@atlantis> From: "Lorenzo Dalla Vecchia" To: References: <000f01c5007d$4071a9b0$31753201@atlantis> <001701c50087$3261c3a0$7a0a14ac@prochainsunil> Subject: Re: AxisFault with custom exception Date: Sat, 22 Jan 2005 15:35:40 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I checked the website and tried following its guidelines: nothing. Everything works: the WSDL and the WSDD are correct but at the time the exception is throwed the item of the SOAP response does not contain exception fileds but only that "hostname" thing. soapenv:Server.userException test.MyException atlantis Other ideas? It must have happened before... it almost looks like an Axis bug. -- Lorenzo -----Messaggio Originale----- Da: "Sunil Kothari" A: Data invio: sabato 22 gennaio 2005 14.35 Oggetto: Re: AxisFault with custom exception > Note that the exception class fields come under details element. And > here's > how its sent to the client: > > > > ?xml version="1.0" encoding="UTF-8"?> > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> > > > > > > soapenv:Server.generalException > > > > > > > > xmlns:ns2="http://xml.apache.org/axis/">example.MyException me> > > > > > > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xsi:type="ns3:MyException" > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:ns3="urn:banktest"> > > Invalid date format > > 1220 > > > > > > > > [CUT] > > A very good reference on exception handling is here: > > Web services programming tips and tricks: Exception Handling with JAX-RPC > URL: http://www-106.ibm.com/developerworks/xml/library/ws-tip-jaxrpc.html > > ----- Original Message ----- > From: "Lorenzo Dalla Vecchia" > To: > Sent: Saturday, January 22, 2005 5:53 PM > Subject: AxisFault with custom exception > > >> Hello everyone. >> >> I'm new to Axis and to this mailing list and I'm having a hard time >> trying >> to throw custom exceptions from my Axis web service. >> >> I'm working with a simple test project. Here's my exception class: >> >> public class MyException >> extends Exception >> { >> private String nome1; >> private String nome2; >> >> public MyException(String nome1, String nome2) >> { >> this.nome1 = nome1; >> this.nome2 = nome2; >> } >> public void setNome1(String nome1) { >> this.nome1 = nome1; >> } >> public String getNome1() { >> return nome1; >> } >> public void setNome2(String nome2) { >> this.nome2 = nome2; >> } >> public String getNome2() { >> return nome2; >> } >> } >> >> I followed the "bean" pattern to have Axis serialize it automatically. >> Java2WSDL produces the following description for the exception, which I >> think is correct. >> >> >> >> >> >> >> >> >> I then execute WSDL2Java to generate proxy client classes and WSDD >> descriptors. Here is the type binding in deply.wsdd: >> >> > xmlns:ns=http://test >> qname="ns:MyException" >> type="java:text.proxy.MyException" >> serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" >> > deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" >> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >> /> >> >> Now, the part where the problem arises. I build a simple client that >> calls > a >> method throwing MyException and here's the result: >> >> AxisFault >> faultCode: > {http://schemas.xmlsoap.org/soap/envelope/}Server.userException >> faultSubcode: >> faultString: test.MyException >> faultActor: >> faultNode: >> faultDetail: >> {http://xml.apache.org/axis/}hostname:atlantis >> >> test.MyException >> at >> > org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:2 > 21) >> at >> > org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:12 > 8) >> at >> > org.apache.axis.encoding.DeserializationContext.endElement(DeserializationCo > ntext.java:1083) >> at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) >> at org.apache.crimson.parser.Parser2.content(Unknown Source) >> at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) >> at org.apache.crimson.parser.Parser2.content(Unknown Source) >> at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source) >> at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source) >> at org.apache.crimson.parser.Parser2.parse(Unknown Source) >> at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source) >> at javax.xml.parsers.SAXParser.parse(Unknown Source) >> at >> > org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext > .java:226) >> at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645) >> at org.apache.axis.Message.getSOAPEnvelope(Message.java:424) >> at >> > org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChe > cker.java:62) >> at org.apache.axis.client.AxisClient.invoke(AxisClient.java:173) >> at org.apache.axis.client.Call.invokeEngine(Call.java:2719) >> at org.apache.axis.client.Call.invoke(Call.java:2702) >> at org.apache.axis.client.Call.invoke(Call.java:2378) >> at org.apache.axis.client.Call.invoke(Call.java:2301) >> at org.apache.axis.client.Call.invoke(Call.java:1758) >> at test.proxy.HelloStub.sayHello(HelloStub.java:147) >> at test.Client.main(Client.java:23) >> Exception in thread "main" >> >> "atlantis" is my computer netbios name. >> What is this AxisFault? I suspect it may be a problem with >> deserialization >> since the returned SOAP reply (captured with TCPMonitor) is: >> >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> >> >> >> soapenv:Server.userException >> test.MyException >> >> > xmlns:ns1="http://xml.apache.org/axis/">atlantis >> >> >> >> >> >> Since MyException carries two Strings (say "string1" and "string2"), >> shouldn't it look like test.MyException: string1, >> string2 or something like that? >> >> When I throws Exception instances (not subclasses) they got serialized > with >> java.lang.Exception: message and work. Also >> there's no problem with throwing RemoteException. >> >> I'm using the latest Axis 1.2RC2 since Axis 1.1 refused to serialize >> Exception subclasses due to the "cause" field of type Throwable that was >> added in JVM 1.4 (wich I'm using). >> >> Please help me: I'm completely lost. >> Thanks in advance. >> >> -- >> Lorenzo >> >> > >