24 lines
676 B
JavaScript
24 lines
676 B
JavaScript
|
// 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
|