You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by Mailing List42 <ma...@gmail.com> on 2004/12/16 15:53:21 UTC

How to use XmlRpcClient.execute with a method()

Hi folks,

This is my first time sending to the list.  I've setup a server
application using a handler with the following:

public String pingme()
{
   return "hello world!";
}

I'm using the following client to call the server application: 
org.apache.xmlrpc.XmlRpcClient

I'm calling the above server using the following type of call:

Vector params = new Vector();
String results ="";
params.addElement(results);
Object serverResult = client.execute("pingme",params);
result =(String) serverResult;

The problem appears to be that I can't figoure out how to fill out
params so that it's essentially null because the handler method
doesn't accept any parameters.  The execute call seems to always
require one.  Is there another call I can use?  Am I just doing
something silly here?

Thanks for the help,
Shawn

This is my first use of a mailing list so please be kind!

Re: How to use XmlRpcClient.execute with a method()

Posted by James Russo <jr...@halo3.net>.
Actually, he is not passing an empty vector. He's passing a vector with 
one element in it, a reference to a zero length string. I think this 
would look for a method with a single String argument in the method.

What does the class look like which contains the pingme method? Does it 
implement anything? On the server when you registered it, what did you 
register it as? Typically the RPC method
name would have the form 'something.somemethod'.

turning on debug might be helpful too:

XmlRpc.setDebug(true);

hope this helps,

-jr

Daniel wrote:

>Hi,
>
>Your xmlrpc call looks right.  If the method you're calling takes no
>arguments then you pass in an empty Vector, which is what you've done.
>
>I would check whether you are registering your handler/method on the
>server correctly.
>
>Regards,
>Daniel
>
>On Thu, 16 Dec 2004, Mailing List42 wrote:
>
>  
>
>>Hi folks,
>>
>>This is my first time sending to the list.  I've setup a server
>>application using a handler with the following:
>>
>>public String pingme()
>>{
>>   return "hello world!";
>>}
>>
>>I'm using the following client to call the server application:
>>org.apache.xmlrpc.XmlRpcClient
>>
>>I'm calling the above server using the following type of call:
>>
>>Vector params = new Vector();
>>String results ="";
>>params.addElement(results);
>>Object serverResult = client.execute("pingme",params);
>>result =(String) serverResult;
>>
>>The problem appears to be that I can't figoure out how to fill out
>>params so that it's essentially null because the handler method
>>doesn't accept any parameters.  The execute call seems to always
>>require one.  Is there another call I can use?  Am I just doing
>>something silly here?
>>
>>Thanks for the help,
>>Shawn
>>
>>This is my first use of a mailing list so please be kind!
>>
>>    
>>

Re: How to use XmlRpcClient.execute with a method()

Posted by Daniel <da...@yorku.ca>.
Hi,

Your xmlrpc call looks right.  If the method you're calling takes no
arguments then you pass in an empty Vector, which is what you've done.

I would check whether you are registering your handler/method on the
server correctly.

Regards,
Daniel

On Thu, 16 Dec 2004, Mailing List42 wrote:

> Hi folks,
>
> This is my first time sending to the list.  I've setup a server
> application using a handler with the following:
>
> public String pingme()
> {
>    return "hello world!";
> }
>
> I'm using the following client to call the server application:
> org.apache.xmlrpc.XmlRpcClient
>
> I'm calling the above server using the following type of call:
>
> Vector params = new Vector();
> String results ="";
> params.addElement(results);
> Object serverResult = client.execute("pingme",params);
> result =(String) serverResult;
>
> The problem appears to be that I can't figoure out how to fill out
> params so that it's essentially null because the handler method
> doesn't accept any parameters.  The execute call seems to always
> require one.  Is there another call I can use?  Am I just doing
> something silly here?
>
> Thanks for the help,
> Shawn
>
> This is my first use of a mailing list so please be kind!
>