You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by ti...@adinet.com.uy on 2004/06/17 00:03:24 UTC

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 &quot;text/html; charset=ISO-8859-1&quot;, must be: &quot;text/xml&quot;.
Response was:
&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/5.0.18 - Informe de Error&lt;/title&gt;&lt;style&gt;&lt;!--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;}--&gt;&lt;/style&gt;
&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Estado HTTP 500 - &lt;/h1&gt;&lt;HR size=&quot;1&quot;
noshade&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Informe de Excepción&lt;/p&gt;&lt;p&gt;&lt;b&gt;mensaje&lt;/b&gt;
&lt;u&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;descripción&lt;/b&gt; &lt;u&gt;El
servidor encontró un error interno () que hizo que no pudiera rellenar este
requerimiento.&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;excepción&lt;/b&gt;
&lt;pre&gt;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)
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;nota&lt;/b&gt; &lt;u&gt;La traza
completa de la causa de este error se encuentra en los archivos de diario
de Tomcat.&lt;/u&gt;&lt;/p&gt;&lt;HR size=&quot;1&quot; noshade&gt;&lt;h3&gt;Apache
Tomcat/5.0.18&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;

_____________________________________________________________________________________

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


Re: ExceptionFaultListener

Posted by Scott Nichol <sn...@scottnichol.com>.
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: <ti...@adinet.com.uy>
To: <so...@ws.apache.org>
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 &quot;text/html; charset=ISO-8859-1&quot;, must be: &quot;text/xml&quot;.
Response was:
&lt;html&gt;&lt;head&gt;&lt;title&gt;Apache Tomcat/5.0.18 - Informe de Error&lt;/title&gt;&lt;style&gt;&lt;!--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;}--&gt;&lt;/style&gt;
&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Estado HTTP 500 - &lt;/h1&gt;&lt;HR size=&quot;1&quot;
noshade&gt;&lt;p&gt;&lt;b&gt;type&lt;/b&gt; Informe de Excepción&lt;/p&gt;&lt;p&gt;&lt;b&gt;mensaje&lt;/b&gt;
&lt;u&gt;&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;descripción&lt;/b&gt; &lt;u&gt;El
servidor encontró un error interno () que hizo que no pudiera rellenar este
requerimiento.&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;excepción&lt;/b&gt;
&lt;pre&gt;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)
&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;nota&lt;/b&gt; &lt;u&gt;La traza
completa de la causa de este error se encuentra en los archivos de diario
de Tomcat.&lt;/u&gt;&lt;/p&gt;&lt;HR size=&quot;1&quot; noshade&gt;&lt;h3&gt;Apache
Tomcat/5.0.18&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;

_____________________________________________________________________________________

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



Re: attachments: managed memory datasource

Posted by Scott Nichol <sn...@scottnichol.com>.
Axis questions should go to axis-user@ws.apache.org.

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: "murugesh dour" <mu...@yahoo.com>
To: <so...@ws.apache.org>
Sent: Friday, June 18, 2004 4:59 AM
Subject: axis: attachments: managed memory datasource


> halo,
> I terribly need someones assistance to solve this.........
> I am using one of the axis application "attachments". Here the ServiceClass receives the attachements and 'caches' in memory (as below)., I want to see the contents (files-attachments) in the disk on service side. So tried the method flushToDisk();and other methods from the 'Managed memory data source class', but i gives me only an empty file. Can someone help me see the attachments in disk.
>  
> merci d'avance.
>  
> ----------------------------------------------------------------------------------------------------------------------------
>  /**This class should store all attachment data in memory */
>  static class MemoryOnlyDataSource extends org.apache.axis.attachments.ManagedMemoryDataSource{
>     
>        MemoryOnlyDataSource( byte [] in, String contentType) throws java.io.IOException{
>          super( new java.io.ByteArrayInputStream( in) , Integer.MAX_VALUE -2, contentType, true); 
>        }
>        MemoryOnlyDataSource( String in, String contentType)throws java.io.IOException{
>          this( in.getBytes() ,  contentType); 
>        }
>     }
> --------------------------------------------------------------------------------------------------------------------------------
> 
> 
> ---------------------------------
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.

axis: attachments: managed memory datasource

Posted by murugesh dour <mu...@yahoo.com>.
halo,
I terribly need someones assistance to solve this.........
I am using one of the axis application "attachments". Here the ServiceClass receives the attachements and 'caches' in memory (as below)., I want to see the contents (files-attachments) in the disk on service side. So tried the method flushToDisk();and other methods from the 'Managed memory data source class', but i gives me only an empty file. Can someone help me see the attachments in disk.
 
merci d'avance.
 
----------------------------------------------------------------------------------------------------------------------------
 /**This class should store all attachment data in memory */
 static class MemoryOnlyDataSource extends org.apache.axis.attachments.ManagedMemoryDataSource{
    
       MemoryOnlyDataSource( byte [] in, String contentType) throws java.io.IOException{
         super( new java.io.ByteArrayInputStream( in) , Integer.MAX_VALUE -2, contentType, true); 
       }
       MemoryOnlyDataSource( String in, String contentType)throws java.io.IOException{
         this( in.getBytes() ,  contentType); 
       }
    }
--------------------------------------------------------------------------------------------------------------------------------

		
---------------------------------
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.

axis: attachments: managed memory datasource

Posted by murugesh dour <mu...@yahoo.com>.
halo,
I terribly need someones assistance to solve this.........
I am using one of the axis application "attachments". Here the ServiceClass receives the attachements and 'caches' in memory (as below)., I want to see the contents (files-attachments) in the disk on service side. So tried the method flushToDisk();and other methods from the 'Managed memory data source class', but i gives me only an empty file. Can someone help me see the attachments in disk.
 
merci d'avance.
 
----------------------------------------------------------------------------------------------------------------------------
 /**This class should store all attachment data in memory */
 static class MemoryOnlyDataSource extends org.apache.axis.attachments.ManagedMemoryDataSource{
    
       MemoryOnlyDataSource( byte [] in, String contentType) throws java.io.IOException{
         super( new java.io.ByteArrayInputStream( in) , Integer.MAX_VALUE -2, contentType, true); 
       }
       MemoryOnlyDataSource( String in, String contentType)throws java.io.IOException{
         this( in.getBytes() ,  contentType); 
       }
    }
--------------------------------------------------------------------------------------------------------------------------------


		
---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!