ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "tcorbet" <tcor...@ix.netcom.com>
Subject Generating Server Exception and Catching on Client
Date Sun, 15 May 2005 17:55:18 GMT
I am using this library for both client-side and server-side processing.
On the server side, I have followed the example for incorporation as a
Servlet, and am using Tomcat 5.5.

I thought it would be *nice* to be able to return an Exception from the
Servlet when the service cannot return the desired result.  The HTTPServlet
service method has a signature which throws ServletException and
IOException.  I thought I should try to throw an XmlRpcException, but
the compiler won't let me get away with that.

So, I throw a ServletException, but my catch block inside XmlRpcClientLite's
execute method does not catch the ServletException.  Even if I try to
catch Exception, something at a lower layer catches the ServletException
and shuts me down.

Is there a snippet or other tutorial describing how to communicate between
the server and the client via an exception?  Not being able to solve the
problem, I have resorted to the ugly, but functional, solution of sending back
error codes wrapped in XML.  It means lots of 'instanceof' checks so that
any given RPC call can check for an error before it checks for the type of
object that it will receive when the execute is successful.

Thank you.

Mime
View raw message