the XML-RPC endpoint can now invoke scripts as handlers, in addition to

objects of a specified class
This commit is contained in:
Eric J. Bowersox
2002-01-16 17:39:09 +00:00
parent 6ea41dc619
commit e3717ca62c
9 changed files with 277 additions and 45 deletions

24
rpcscripts/test/test1.js Normal file
View File

@@ -0,0 +1,24 @@
// test of RPC code
importPackage(java.util);
importPackage(Packages.com.silverwrist.venice.ui.rpc);
xreq = bsf.lookupBean("xmlrpc");
if ("venice:test.sumDifference"==xreq.method)
{ // implement the sumDifference API function call
if (xreq.paramCount!=2)
vlib.output(new XmlRpcFault(XmlRpcFault.INVALID_PARAMS,"parameter count mismatch"));
else
{ // get the parameters and convert them
v1 = xreq.getParamInt(0);
v2 = xreq.getParamInt(1);
// return the result
rc = vlib.createMap();
rc.put("sum",vlib.createInteger(v1 + v2));
rc.put("difference",vlib.createInteger(v1 - v2));
vlib.output(rc);
} // end else
vlib.done();
} // end if