Monday, November 08, 2010 at 12:02 AM.

system.verbs.builtins.betty.rpc.serverSupport.multiCall

on multiCall (callarray) {
	<<Changes
		<<4/9/01; 9:35:11 AM by DW
			<<Created. Conforms to the spec here:
			<<http://www.xmlrpc.com/discuss/msgReader$1208
			<<Called from user.betty.rpcHandlers.system.multiCall.
	bundle { //fault if this is a recursive call
		try { //if we're debugging, don't fail
			local (adrparamtable = parentof (client));
			if defined (adrparamtable^.flMulticall) {
				scriptError ("Can't process this call because we don't allow system.multicall to recurse.")};
			adrparamtable^.flMulticall = true}};
	bundle { //initialization
		if not defined (betty.rpc.errorCodes.multiCallError) {
			betty.rpc.errorCodes.multiCallError = 7}};
	local (i, responseArray = {});
	for i = 1 to sizeof (callarray) {
		try { //call the script
			local (onecall = callarray [i], flerror);
			local (result = betty.rpc.serverSupport.callHandler (onecall.methodName, @onecall.params, @flerror));
			if flerror {
				responseArray = responseArray + {result}}
			else {
				responseArray = responseArray + {{result}}}}
		else {
			local (errortable);
			new (tabletype, @errortable);
			errortable.faultString = tryError;
			errortable.faultCode = betty.rpc.errorCodes.multiCallError;
			responseArray = responseArray + {errortable}}};
	return (responseArray)};
bundle { //test code
	local (callarray = {}, i);
	for i = 1 to 10 {
		new (tabletype, @onecall);
		onecall.methodName = "examples.getStateNameWithError";
		onecall.params = {random (35, 65)};
		callarray = callarray + {onecall}};
	local (multicallresult = betty.rpc.serversupport.multicall (callarray));
	new (tabletype, @scratchpad.multicallresult);
	for i = 1 to sizeof (multicallresult) {
		scratchpad.multicallresult.[string.padwithzeros (sizeof (scratchpad.multicallresult), 3)] = multicallresult [i]};
	edit (@scratchpad.multicallresult)}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.