Hi Patrick None of my custom Exceptions extend java.rmi.RemoteException or implement Serializable.
My base exceptions extend only java.lang.Exception and all other custom exceptions extend these base exceptions. The mappings in the WSDL I created for them are correct and so is the definition in the wsdd for the <typeMapping> i.e. <typeMapping xmlns:ns="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de" qname="ns:OrderFailedException" type="java:de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedExcepti on" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> So your suggestions do not apply here. Thanx anyway Regards Steve Quoting "BLIS Webmaster (Patrick Houbaux)" <[EMAIL PROTECTED]>: > Hi Steve, > > A quick tip that I found out to work when dealing with custom exceptions > (since I was enable to use a custom exception based on the Axis sample). > > The tip is: "Do not extend java.rmi.RemoteException and don't implement > java.io.Serializable for a custom exception, but simply extend > java.lang.Exception instead, and provide the corresponding Typemapping in the > wsdd for deploying your service." > > For instance: > package com.domain.myservice.rpc.fault; > > public class MyCustomBaseException extends Exception { //extends > RemoteException implements java.io.Serializable{ > private java.lang.String info; > > private java.lang.String message; > > public MyCustomBaseException () { > } > > public MyCustomBaseException (java.lang.String info) { > this.info = info; > } > > public java.lang.String getInfo() { > return info; > } > > public void setInfo(java.lang.String info) { > this.info = info; > } > > public void setMessage(java.lang.String message){ > this.message = message; > } > > public java.lang.String getMessage(){ > return message; > } > > public String toString(){ > return this.getInfo() + " " + this.getMessage(); > } > } > > Then you may extend any other custom exception you need from this one. > > The type mapping in the wsdd looks like: > > <typeMapping > xmlns:MyNS="urn:foo.domain.com" > qname="MyNS:BaseCustomFault" > type="java:com.domain.myservice.rpc.fault.MyCustomBaseException " > serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" > deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > /> > > Hope it helps ... at least it should solve all your problems, at least for me > it did the trick :) > > Cheers, > Patrick. > > > [EMAIL PROTECTED] wrote: > > > Well good people of the list, > > > > Here are a couple of interesting problems for you to mull over and maybe > help > > me out with. > > > > 1. I have a problem with Axis regarding the WSDL returned from a service as > > > generated by Axis i.e when the ?wsdl option is specified. > > > > The auto generated wsdl is not usable with the wsdl2java tool, I get the > > following error from my ant task:- > > > > wsdl2java: > > [copy] Copying 1 file to > C:\projects\soap\src\de\viaginterkom\ca\ecrm\eself > > care\ejbserver\ejb\soap > > [axis-wsdl2java] WSDL2Java ecrm.wsdl > > Parsing XML file: ecrm.wsdl > > [axis-wsdl2java] Running Wsdl2javaAntTask with parameters: > > [axis-wsdl2java] verbose:true > > [axis-wsdl2java] debug:false > > [axis-wsdl2java] server-side:true > > [axis-wsdl2java] skeletonDeploy:false > > [axis-wsdl2java] helperGen:false > > [axis-wsdl2java] factory:null > > [axis-wsdl2java] testCase:true > > [axis-wsdl2java] noImports:false > > [axis-wsdl2java] NStoPkg:{} > > [axis-wsdl2java] output:C:\projects\soap\src > > [axis-wsdl2java] deployScope: > > [axis-wsdl2java] URL:ecrm.wsdl > > [axis-wsdl2java] all:false > > [axis-wsdl2java] typeMappingVersion:1.1 > > [axis-wsdl2java] timeout:45000 > > [axis-wsdl2java] failOnNetworkErrors:false > > [axis-wsdl2java] printStackTraceOnFailure:true > > [axis-wsdl2java] namespaceMappingFile:null > > [axis-wsdl2java] username:null > > [axis-wsdl2java] :passwordnull > > [axis-wsdl2java] http.proxyHost=null > > [axis-wsdl2java] http.proxyPort=null > > [axis-wsdl2java] http.proxyUser=null > > [axis-wsdl2java] http.proxyPassword=null > > [axis-wsdl2java] socks.proxyHost=null > > [axis-wsdl2java] socks.proxyPort=null > > [axis-wsdl2java] java.io.IOException: Error: missing type or ref attribute > for n > > ode 'unknown' > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.createTy > > peFromRef(SymbolTable.java:970) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes > > (SymbolTable.java:725) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes > > (SymbolTable.java:825) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes > > (SymbolTable.java:825) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes > > (SymbolTable.java:825) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.addTypes > > (SymbolTable.java:825) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.populate > > Types(SymbolTable.java:688) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.populate > > (SymbolTable.java:548) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.add(Symb > > olTable.java:421) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.populate > > (SymbolTable.java:408) > > [axis-wsdl2java] at > org.apache.axis.wsdl.symbolTable.SymbolTable.populate > > (SymbolTable.java:393) > > [axis-wsdl2java] at > org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Pars > > er.java:245) > > [axis-wsdl2java] at java.lang.Thread.run(Thread.java:534) > > > > BUILD FAILED > > > > There is no indication as to where this error is happening within the wsdl > > > being processed...... > > > > When I look at the wsdl that was generated it contains the following > complex > > type definition:- > > > > <complexType name="SystemFailureException"> > > <complexContent> > > <extension base=""> > > <sequence> > > <element name="sourceException" nillable="true" type="tns2:Throwable" /> > > </sequence> > > </extension> > > </complexContent> > > </complexType> > > > > It contains an element type tns2:Throwable, but NO tns2: name space has > been > > created in the wsdl at all. I also defined the sourceException as an > > xsd:anyType in my hand coded wsdl used to originally generate the service. > Also > > notice that it has an undefined <extention base=””>...</extention> element. > > > Another Exception I defined in exactly the same way in my hand coded wsdl > > defines the sourceException correctly as an xsd:anyType as shown below:- > > > > <complexType name="ApplicationException"> > > <sequence> > > <element name="message" nillable="true" type="xsd:string" /> > > <element name="sourceException" nillable="true" type="xsd:anyType" /> > > </sequence> > > </complexType> > > > > What is causing Axis to not generate the namespace and to return two > diffent > > deinitions of Exception? > > > > 2. And now the strangest thing of all. My service returns many custom > > exceptions from its methods. My auto created Junit test (modified by hand) > is > > used as a test client for the service. In some circumstances I get the > > following AxisFault :- > > > > AxisFault > > faultCode: > {http://schemas.xmlsoap.org/soap/envelope/}Server.userException > > faultSubcode: > > faultString: org.xml.sax.SAXException: Invalid element in > > de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedException - > > description > > faultActor: > > faultNode: > > faultDetail: > > {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException: > > Invalid element in > > de.viaginterkom.ca.ecrm.eselfcare.common.exception.OrderFailedException - > > description > > > > at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild > > (BeanDeserializer.java:260) > > at org.apache.axis.encoding.DeserializationContextImpl.startElement > > (DeserializationContextImpl.java:963) > > ... > > etc etc... > > > > This implies it is trying to deserialize a custom exception defined by me > as > > OrderFailedException and the bean deserializer has found a property called > > > description this it knows nothing about. My custom exception does not > define > > description as a property and neither does the exception that it extends. > It is > > also NOT the exception that was thrown from the implementation. On closer > > inspection using tcpmon the soap:fault returned, that Axis then converts to > an > > AxisFault is as follows:- > > > > HTTP/1.1 500 Internal Server Error > > Content-Type: text/xml; charset=utf-8 > > Date: Thu, 18 Mar 2004 08:23:47 GMT > > Server: Apache Coyote/1.0 > > Connection: close > > > > <?xml version="1.0" encoding="UTF-8"?> > > <soapenv:Envelope 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:Body> > > <soapenv:Fault> > > <faultcode>soapenv:Server.userException</faultcode> > > > > > <faultstring>de.viaginterkom.ca.ecrm.eselfcare.common.exception.UnknownIDExcepti > > on</faultstring> > > <detail> > > <ns2:fault xsi:type="ns1:UnknownIDException" > > xmlns:ns1="http://exception.common.eselfcare.ecrm.ca.viaginterkom.de" > > xmlns:ns2="urn:ESelfcareSoap"> > > <ns2:description xsi:type="xsd:string">msisdn</ns2:description> > > <ns2:message xsi:type="xsd:string" xsi:nil="true"/> > > <ns2:sourceException xsi:nil="true"/> > > <ns2:type xsi:type="xsd:int">1</ns2:type> > > </ns2:fault> > > </detail> > > </soapenv:Fault> > > </soapenv:Body> > > </soapenv:Envelope> > > > > As you can see from this soap:fault the exception thrown by the service is > NOT > > an OrderFailedException but an UnknownIDException which is the correct > > exception thrown by the implementation and it does have a property called > > description. OrderFailedException is one of the exceptions defined in the > > throws clause of the implementation. > > > > I have this problem in more than one client call but in general both the > > AxisFault and the soap:fault agree on the custom exception returned by the > > > implementation. > > > > So why does the Axis code try to deserialize the wrong exception in a few > cases? > > > > If anybody has answers to either of these issues please let me know. This > issue > > is serious as we have a deadline for this service to go into QA by COB > Monday > > and I do not want to have to use another SOAP service such as GLUE to get > over > > these issues. > > > > Regards > > > > Steve > > > > > > > > --------------------------------------------------- > > This message was sent using Spansurf Web Mail > > Internet access in Spain - http://www.spansurf.com/ > > --------------------------------------------------- This message was sent using Spansurf Web Mail Internet access in Spain - http://www.spansurf.com/