ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Wiedmann <jochen.wiedm...@freenet.de>
Subject Announce: Generator for XML-RPC Clients
Date Sun, 12 Sep 2004 20:25:37 GMT

Hi,

I'd like to announce the availability of the

     XmlRpcClientGenerator

a tool for generation of clients for Apache XML-RPC.

What it does: Given a set of server classes (either Java sources or 
compiled classes), it generates a corresponding set of client classes 
with the same signature and an XmlRpcHandler, that dispatches incoming 
XML-RPC calls to the server classes. For example, if you have the 
following server class:

     public class Calculator {
         public int add(int i1, int i2) {
	    return i1 + i2;
         }
         public double multiply(double d1, double d2) {
             return d1 * d2;
         }
     }

The generated client class will look similar to

     public class Calculator {
	private XmlRpcCaller caller;
	public Calculator(caller) {
	    this.caller = caller;
	}
         public int add(int i1, int i2) {
             Vector v = new Vector();
             v.add(new Integer(i1));
             v.add(new Integer(i2));
             XmlRpcClient c = new XmlRpcClient(url);
             Object o = caller.xmlRpcCall("Calculator.add", v);
             return ((Integer) o).intValue();
         }
         public double add(double d1, double d2) {
             Vector v = new Vector();
             v.add(new Double(d1));
             v.add(new Double(d2));
             Object o = caller.xmlRpcCall("Calculator.add", v);
             return ((Double) o).doubleValue();
         }
    }

In other words, by using the generator, your XML-RPC client becomes

   - type safe
   - better readable (no need for casting primitives, and the like)
   - marginally faster (no reflection on the server side)

See

 
http://cvs.apache.org/viewcvs.cgi/ws-jaxme/src/documentation/content/xdocs/js/apps/xmlrpc.xml

for the generators docs. The generator is currently only available as a 
part of the JaxMe Java sourge generator framework's CVS HEAD version. 
See http://ws.apache.org/jaxme/js for details on JaxMeJS. See
http://ws.apache.org/jaxme/downloads.cgi for instructions on how to 
checkout the CVS HEAD.


Jochen


-- 
http://lilypie.com/baby1/050423/1/5/1/+1

Mime
View raw message