You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rpc-dev@xml.apache.org by Martin Redington <m....@ucl.ac.uk> on 2002/12/05 04:36:04 UTC

Enhancement request

Enhancement request.

I guess you guys are still deep in the code, but here's an enhancement 
request.

A method on XmlRpcClient (and I guess SecureXmlRpcClient), with a 
method signature as follows:

public Object execute(String method, byte[] request)

and/or

public Object execute(String method, String request)

That takes the raw xml required for the xmlrpc request from the second 
argument.


Rationale:

Why would one want to do this?

I've been doing a lot of testing of my xmlrpc service recently using 
JUnit.

My xmlrpc arguments are typically passed as structs (Hashtables), so I 
have a java method in my testclient class that takes a method name and 
the name of a properties files as arguments, builds a struct from the 
properties file, executes the xmlrpc method with those arguments, and 
returns the result.

I can call this function from my own commandline client, or from JUnit, 
as part of a test, which ends up being one line long (as a another 
method wraps all of this up, and sanity checks the return values).

This has all worked fantastically for me so far.

However, I have a few methods where the arguments are more complicated 
than structs (e.g. a list with a struct and a list of structs). Writing 
test cases for these is cumbersome, as I have to define all these 
Hashtables and Vectors, populate them, join them together, and pass 
them in. Changing the input values is even more cumbersome and 
error-prone.

It would be very nice if I could store these arguments as text files, 
like my property files. The most obvious format to use for these files 
would be the same xml format that is used by xmlrpc. I could read in 
the contents, and use the execute method above to test the method.

All my test cases go back to being one-liners, and to change the 
arguments, I simply edit my .xml file.

Although you probably wouldn't want to use this method in normal 
operations, for building unit tests of xmlrpc interfaces, it could be 
very useful. Looking at the 1.1 code that I have it should also be 
pretty easy to do ...