I have added a sample demonstrating ExceptionFaultListener. The sample directory name is excfault. It is available through CVS right now, and will be included in the next nightly build.
The key to making the ExceptionFaultListener class work is that the Exception (Throwable, actually) that is thrown must have a serializer registered on the server and a deserializer registered on the client. The sample uses ExcFaultException and ExcFaultExceptionSerializer. Scott Nichol Do not send e-mail directly to this e-mail address, because it is filtered to accept only mail from specific mail lists. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 16, 2004 6:03 PM Subject: ExceptionFaultListener Scott, Well, I have made a simple test about the ExceptionFaultListener problem. I have emailed Eric M. Dashofy (one of the authors of ExceptionFaultListener), and he said that he has't done any SOAP work in many years, and he doubt that any of the code he have still works. _____________________________________________________________________________________ For the test, I wrote a simple server, that all it does, is throw an Exception: public class Server { public void test() throws Exception { throw new Exception("This is a test of the server throwing an Exception"); } } _____________________________________________________________________________________ I also wrote a simple client, that tries to invoke the test method, and display an exception, if one is caught trying to make the invoke, or the fault otherwise. The code is: public class Client { public static void main(String args[]) { org.apache.soap.rpc.Call RPCCall = new org.apache.soap.rpc.Call(); String URLSoap; java.net.URL url = null; java.util.Vector parameters = new java.util.Vector(); URLSoap = "http://localhost:8080/soap/servlet/rpcrouter"; RPCCall.setTargetObjectURI("Server") ; RPCCall.setMethodName("test"); RPCCall.setEncodingStyleURI(org.apache.soap.Constants.NS_URI_SOAP_ENC); RPCCall.setParams(parameters); org.apache.soap.rpc.Response r = null; try{ url = new java.net.URL(URLSoap);} catch(Exception e) { System.out.println("Exception trying to construct the URL: " + e.getMessage()); System.exit(0); } try{ r = RPCCall.invoke(url, "");} catch(Exception e) { System.out.println("\nException captured trying to inovke a service: " + e.getMessage()); System.exit(0); } if (r.generatedFault()) { org.apache.soap.Fault f = r.getFault(); java.util.Vector v = f.getDetailEntries(); System.out.println("SOAP Fault captured\nNumber of elements in the detail entries vector: " + v.size() + "\n"); for (int i = 0; i < v.size(); i++) System.out.println("Class of detail entry " + i + ": " + v.get(i).getClass()); System.out.println("\nFault toString: " + f.toString()); } } } _____________________________________________________________________________________ The deployment descriptor is the following: <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="Server"> <isd:provider type="java" scope="Application" methods="test"> <isd:java class="Server" static="false"/> </isd:provider> <isd:faultListener>org.apache.soap.server.ExceptionFaultListner</isd:faultListener> </isd:service> _____________________________________________________________________________________ Using the client with SOAP 2.3.1 (production), I obtained the following result: Exception captured trying to inovke a service: Unsupported response content type "text/html; charset=ISO-8859-1", must be: "text/xml". Response was: <html><head><title>Apache Tomcat/5.0.18 - Informe de Error</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>Estado HTTP 500 - </h1><HR size="1" noshade><p><b>type</b> Informe de Excepción</p><p><b>mensaje</b> <u></u></p><p><b>descripción</b> <u>El servidor encontró un error interno () que hizo que no pudiera rellenar este requerimiento.</u></p><p><b>excepción</b> <pre>javax.servlet.ServletException: Error building response envelope: java.lang.NullPointerException org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:418) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) </pre></p><p><b>nota</b> <u>La traza completa de la causa de este error se encuentra en los archivos de diario de Tomcat.</u></p><HR size="1" noshade><h3>Apache Tomcat/5.0.18</h3></body></html> _____________________________________________________________________________________ And using the SOAP nightly build (2004-04-07), I obatined the following result: SOAP Fault captured Number of elements in the detail entries vector: 1 Class of detail entry 0: class org.apache.crimson.tree.ElementNode2 Fault toString: [Attributes={}] [faultCode=SOAP-ENV:Server] [faultString=Exception from service object: This is a test of the server throwing an Exception] [faultActorURI=/soap/servlet/rpcrouter] [DetailEntries= [(0)=<stackTrace>java.lang.Exception: This is a test of the server throwing an Exception at Server.test(Server.java:5) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.soap.server.RPCRouter.invoke(Unknown Source) at org.apache.soap.providers.RPCJavaProvider.invoke(Unknown Source) at org.apache.soap.server.http.RPCRouterServlet.doPost(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534) </stackTrace>] ] [FaultEntries=] _____________________________________________________________________________________ Sorry about the extension of the email. I really don't know anything how Apache SOAP works internally, but if you give me an idea of where can I start studying to get to the bottom of the matter of the problem, and it doesn't take too long, I could do it. Thanks very much, tizo