Beautiful. I was close, but you got me over the top.
thanks very much,
Randy
On Jan 15, 3:23pm, Michael Engelhart wrote:
> Subject: Re: [Webware-discuss] Java xmlrpc client
> Well - I took stab at this and I'm not sure what level of java
> experience you have but there are some things I had to do to get this
> working. Let me state that this is my first attempt at XML-RPC in any
> language!
>
> This is my java class file:
> import org.apache.xmlrpc.XmlRpcClient;
> import org.apache.xmlrpc.XmlRpcException;
> import java.util.Vector;
> import java.net.MalformedURLException;
> import java.io.IOException;
>
> public class RPCTest {
> public RPCTest() {
> System.out.println("Constructor called");
> }
>
> static void main(String args[]) {
> try {
> XmlRpcClient xmlrpc = new
> XmlRpcClient("http://localhost/WKMod/Examples/XMLRPCExample");
> Vector params = new Vector();
> params.addElement("10");
> params.addElement("20");
> Object result = xmlrpc.execute("multiply", params);
> System.out.println(result);
> } catch (XmlRpcException e) {
> System.out.println(e);
> } catch (MalformedURLException e) {
> System.out.println(e);
> } catch (IOException e) {
> System.out.println(e);
> }
> }
> }
>
> I also had to modify the XMLRPCExample.py example to convert the
> numbers to strings. Also the java method xmlrpc.execute() returned an
> Integer object (not an int) so the example on xml.apache.org gave me a
> ClassCastException.
> I don't know any of the intricacies or conventions surrounding XML-RPC
> so you may want to read up on that a bit but using the XMLRPC example
> with the minor changes here worked fine (remember to put your URL in
> there as I was using mod_webkit and it seemed you were using a CGI)
>
> added casts to int in XMLRPCExample.py because the java Vector class
> only excepts Objects (like String's) and not primitivess
>
> def multiply(self, x, y):
> return int(x) * int(y)
>
> def add(self, x, y):
> return int(x) + int(y)
>
> mike
>
-------------------------------------------------------
This SF.NET email is sponsored by: A Thawte Code Signing Certificate
is essential in establishing user confidence by providing assurance of
authenticity and code integrity. Download our Free Code Signing guide:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0028en
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss