the XML-RPC endpoint can now invoke scripts as handlers, in addition to
objects of a specified class
This commit is contained in:
24
rpcscripts/test/test1.js
Normal file
24
rpcscripts/test/test1.js
Normal 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
|
||||
Reference in New Issue
Block a user