ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel <dant...@yorku.ca>
Subject Re: Newbie question on method matching
Date Fri, 09 Jan 2004 23:48:31 GMT

Hi Yoav,

First I'd like to welcome you to the xml-rpc list! :)  Your help to
everyone on the tomcat list have been amazing to say the least.

Anyhow, the answer to your question is it's failing because when you call
your client, it's calling the "echo" method that is supposed to
be associated with the "$default" handler but you didn't register any
default handlers in your server - you registered a handler called "echo"!
:)  You probably know the answer by now...

So, two ways of getting it to work:
1. instead of calling "echo", make a call to "echo.echo" (xmlrpc will
treat the first name before the period as a reference to a handler).
2. instead of webServer.addHandler("echo", new Echo()), use:
  webServer.addHandler("$default", new Echo())
  - note the default handler has a special name of "$default"

(All of this assumes your Echo class has a callable "echo" method that
matches the passed arguments.)

Regards,
Daniel

On Fri, 9 Jan 2004, Shapira, Yoav wrote:

>
> Hi,
> I've just downloaded and installed xmlrpc v1.2-b1.  The quick
> installation test works fine, i.e.
>
> java org.apache.xmlrpc.WebServer
> java org.apache.xmlrpc.XmlRpcClient http://localhost:8080 echo test 123
> indeed returns [test, 123].
>
> I'm trying to replicate this simple functionality, so I wrote:
>
> public class TestServer {
>   public static void main(String[] args) throws Exception {
>     WebServer webServer = new WebServer(8080);
>     webServer.addHandler("echo", new Echo());
>     webServer.start();
>   }
> }
>
> public class TestClient {
>   public static void main(String[] args) throws Exception {
>     XmlRpcClient client = new XmlRpcClient("http://localhost:8080");
>     Vector params = new Vector();
>     params.add("test");
>
>     System.out.println(client.execute("echo", params));
>   }
> }
>
> Both compile fine.  I start TestServer, then run TestClient, and to my
> surprise I get:
> Exception in thread "main" org.apache.xmlrpc.XmlRpcException:
> java.lang.Exception: RPC handler object not found for "echo": No default
> handler registered
> at org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:457)
> ...
>
> Why am I getting this exception?  It seems like the method name, "echo"
> matches in the client and the server.  I know there's no default method
> -- must there be one?
>
> Thanks, and have a good weekend,
>
> Yoav Shapira
> Millennium ChemInformatics
>
>
>
>
>
> This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged.  This e-mail
is intended only for the individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the sender.  Thank you.
>
>

Mime
View raw message