Well, if I modify my Exception Class replacing
extends AxisException with extends RemoteException my client is able to catch the Exception and extract all the fields of my Exception. But I have another question: in the SOAPMonitor I don't see the SOAP Response. Am I missing anything? Cheers --Marco Il gio, 2003-08-28 alle 08:40, Marco Spinetti ha scritto: > Hi Cory, > > could you send an example of your fault management? > > If I write my wsdl with soap fault element, axis generates My Exception > class subclassing Axis Fault: > > public class DoMyException extends org.apache.axis.AxisFault > implements java.io.Serializable { > > ........ > } > > In your answer you said that "The exception I'm successfully serializing > does not subclass Axis fault". I'm very interested to know how you did. > > Cheers > > > --Marco > > > > Il mer, 2003-08-27 alle 17:02, Cory Wilkerson ha scritto: > > "I know that this question has been asked again and again but I can't find the > > answer." -- Sorry, didn't mean to sound terse or harsh there, just implying that > > maybe the Axis folk would like to crank out some decent documentation regarding > > the matter. I've been using Axis for 4 or 5 months and didn't know you could > > specify all the parameters as you did below -- that's all manner of interesting. > > Where did you find the documentation for *that*? > > > > Richard -- I'd refute *some* of your points, though I'm certainly glad someone has > > some decent knowledge in this realm. The exception I'm successfully serializing > > does not subclass Axis fault and the only config I did was in the wsdl (which I > > didn't generate server side ties from) and in server-config my providing a > > beanMapping entry for my service specific exception. I'm successfully catching my > > specific exception on the client side with both Axis and .NET platforms -- Axis > > manages to throw my exception type on the client side whereas with the .NET > > platform, I parse it out of the detail element returned in the fault. > > > > All that said, I am using the nightly builds as opposed to the 1.0 release. > > > > Cory > > > > > > -----Original Message----- > > From: Hansen, Richard [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, August 27, 2003 9:48 AM > > To: '[EMAIL PROTECTED]' > > Subject: RE: Soap Fault Explanation > > > > > > If you define the exceptions in your WSDL as "faults" in the appropriate > > pacles. Then wsdl2Java will generate your exception classes and create the > > required config setup in the stubs and skeletons it generates. > > > > My notes of axis fault handling: > > Faults > > - For all practical purposes a client programmer can treat Axis as if it > > only throws > > org.apache.axis.AxisFault exceptions. > > - Axis does not throw javax.xml.rpc.soap.SOAPFaultException. Axis never > > creates a SOAPFaultException itself. > > However, since SOAPFaultException is unchecked, one could leak through if > > thrown by a handler or service > > implementation. > > - The invoke methods that are likely to be called by a client programmer > > (the ones inherited from > > javax.xml.rpc.Call) return either a service specific exception or > > org.apache.axis.AxisFault. > > - A service implementation can throw any type of exception. > > - Axis faults thrown by a service implementation are returned to the client > > just as thrown. > > - A non AxisFault thrown by a service implementation but not configured as a > > service specific exception > > will be wrapped in an AxisFault on the client. A faultCode of > > Server.userException and a local stack trace > > will be included in the Axisfault. This is not the most useful thing that > > could happen as it tends to hide > > the source/cuase of the exception. The fault string included represents > > the original exception. > > - Axis must be configured to handle service specific exceptions and recreate > > them on the client. > > - Service specific exceptions can can be configured using either parameters > > in the wsdd deployment file or > > using calls to org.apache.axis.description.OperationDesc in the service > > stubs and skeletons. > > - Service specific exceptions must subclass org.apache.axis.AxisFault. > > - The WSDL to Java tools will create service specific exceptions that are > > defined in a wsdl file and > > create the required configuration code in the stubs and skeletons > > generated. > > > > > -----Original Message----- > > > From: Marco Spinetti [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, August 27, 2003 9:37 AM > > > To: [EMAIL PROTECTED] > > > Subject: RE: Soap Fault Explanation > > > > > > > > > Thanks Cory: I know that this question has been asked again and again > > > but I can't find the answer. > > > > > > My steps have been: > > > > > > - create the wsdl > > > - use org.apache.axis.wsdl.WSDL2Java with --server-side > > > - implementing MySearchBindingImpl.java > > > - copy deploy.wsdd (service part) to server-config.wsdd > > > > > > All is ok except when an axception is generated. > > > > > > My service element in server-config.wsdd is: > > > > > > <service name="MySearchPort" provider="java:RPC" style="rpc" > > > use="encoded"> > > > <parameter name="wsdlTargetNamespace" > > > value="urn:AriannaSearch"/> > > > <parameter name="wsdlServiceElement" > > > value="AriannaSearchService"/> > > > <parameter name="wsdlServicePort" value="AriannaSearchPort"/> > > > <parameter name="className" > > > value="AriannaSearch.AriannaSearchBindingImpl"/> > > > <parameter name="wsdlPortType" value="AriannaSearchPort"/> > > > <operation name="doAriannaSearch" qname="operNS:doAriannaSearch" > > > xmlns:operNS="urn:AriannaSearch" returnQName="return" > > > returnType="rtns:AriannaSearchResult" > > > xmlns:rtns="urn:AriannaSearch" > > > > <parameter name="query" type="tns:string" > > > xmlns:tns="http://www.w3.org/2001/XMLSchema"/> > > > <parameter name="pagina" type="tns:int" > > > xmlns:tns="http://www.w3.org/2001/XMLSchema"/> > > > <parameter name="service" type="tns:string" > > > xmlns:tns="http://www.w3.org/2001/XMLSchema"/> > > > <parameter name="nameparam" type="tns:ArrayOfString" > > > xmlns:tns="urn:AriannaSearch"/> > > > <parameter name="valueparam" type="tns:ArrayOfString" > > > xmlns:tns="urn:AriannaSearch"/> > > > <fault name="doAriannaException" qname="fns:fault" > > > xmlns:fns="urn:AriannaSearch" class="AriannaSearch.DoAriannaExcep > > > tion" type="tns:doAriannaException" xmlns:tns="urn:AriannaSearch"/> > > > </operation> > > > <parameter name="allowedMethods" value="doAriannaSearch"/> > > > > > > <typeMapping > > > xmlns:ns="urn:AriannaSearch" > > > qname="ns:ResultElementArray" > > > type="java:AriannaSearch.ResultElement[]" > > > > > > serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" > > > > > > deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > /> > > > <typeMapping > > > xmlns:ns="urn:AriannaSearch" > > > qname="ns:AriannaSearchResult" > > > type="java:AriannaSearch.AriannaSearchResult" > > > > > > serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" > > > > > > deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" > > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > > > > > > > > > > > > > > > Il mer, 2003-08-27 alle 16:26, Cory Wilkerson ha scritto: > > > > This question has been asked time and again and I've yet to > > > see a real definitive answer come through. For starters, you > > > might want to try some of the Axis nightly drops, I've had > > > better luck with them serializing my exceptions. > > > > > > > > In the case where I have exceptions working, I've > > > subclassed exception and according to the jax-rpc > > > specification (I don't know if Axis pays any attention here > > > at all with exceptions): > > > > > > > > 1. Provided accessors for each parameter supplied to my > > > constructor (and conversely ensured that each accessor had a > > > parameter in the constructor). > > > > 2. Ensured that the parameter type in constructor was > > > identical to return type of accessor. > > > > 3. Ensured that there was only one accessor with a given > > > return type (I actually cheated here though I would expect > > > I'll see some crazy results because of it.) > > > > > > > > I also am not sure if Axis appropriately generates fault > > > elements in your WSDL based on your exception type. If you > > > don't see it in the WSDL you're generating stubs against, > > > you'll never see an "exception" in you client code. > > > > > > > > Good luck! > > > > Cory > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: Marco Spinetti [mailto:[EMAIL PROTECTED] > > > > Sent: Wednesday, August 27, 2003 9:13 AM > > > > To: [EMAIL PROTECTED] > > > > Subject: Soap Fault Explanation > > > > > > > > > > > > Hi, > > > > > > > > I'm developing a soap web service with axis (my > > > configuration is apache > > > > + tomcat with axis). > > > > > > > > In some circumstances my web services has to create a SOAP > > > fault which > > > > has to be sent to the client. > > > > > > > > I'm a a bit confused with Axis management of SOAP fault > > > (I've tried to > > > > read email in mailing list but without success too). > > > > > > > > I've declared my Exception: > > > > > > > > public class DoMyException extends org.apache.axis.AxisFault > > > > implements java.io.Serializable { > > > > private int codice; > > > > private java.lang.String stringa; > > > > > > > > public DoMyException() { > > > > } > > > > > > > > public DoMyException( > > > > int codice, > > > > java.lang.String stringa) { > > > > this.codice = codice; > > > > this.stringa = stringa; > > > > } > > > > ....... > > > > } > > > > > > > > In my web services method, in some circumstances, I throw such > > > > exception: > > > > > > > > public MySearchResult doMySearch(java.lang.String query) throws > > > > java.rmi.RemoteException, DoMyException { > > > > > > > > ...... > > > > > > > > try { > > > > if (cond) { > > > > throw new DoMyException(1, "Description"); > > > > } > > > > } > > > > catch (DoMyException e) { > > > > ...... > > > > throw e; > > > > } > > > > ..... > > > > } > > > > > > > > > > > > When in my test client I try to generate a SOAP fault I > > > don't receive > > > > anything. With SOAPMonitor I see the request SOAP message > > > but not the > > > > response. > > > > > > > > My client: > > > > > > > > try { > > > > MySearchService service = new MySearchServiceLocator(); > > > > MySearchPort port = service.getMySearchPort(); > > > > > > > > ......... > > > > MySearchResult r = port.doMySearch(query); > > > > > > > > ..... > > > > } > > > > catch (DoMyException e) { > > > > System.err.println("Cod = " + e.getCodice()); > > > > System.err.println("String = " + e.getStringa()); > > > > System.exit(1); > > > > } > > > > > > > > > > > > Probably I'm making some mistakes but I don't see where. > > > > > > > > Any help would be very useful. > > > > > > > > Thanks > > > > > > > > > > > > Bye > > > > > > > > --Marco > > > > > > > > > > > > > > > > > > > >