Monday, November 08, 2010 at 12:02 AM.
system.verbs.builtins.betty.rpc.clientMulticall
on clientMultiCall (rpcServer="localhost", rpcPort=user.inetd.config.http.port, adrCallTable=nil, fldebug=false, ticksToTimeOut=nil, flShowMessages=true, rpcPath=nil, flAsynch=false, adrCallback=nil, extraInfo=nil, adrErrorCallback=nil, username="", password="") { <<Changes <<4/9/01; 8:09:48 PM by DW <<Created. Interfaces to the multicall capability. <<http://frontier.userland.com/stories/storyReader$7394 local (multicallparamlist = {}, adrsub, call); for adrsub in adrCallTable { new (tabletype, @call); call.methodName = adrsub^.methodName; call.params = adrsub^.params; multicallparamlist = multicallparamlist + {call}}; local (params = {multicallparamlist}); local (returnedlist = betty.rpc.client (rpcServer, rpcPort, "system.multicall", @params, fldebug, ticksToTimeOut, flShowMessages, rpcPath, username:username, password:password)); local (returnedtable, ixlist = 1); new (tabletype, @returnedtable); for adrsub in adrCallTable { adrreturnsub = @returnedtable.[nameof (adrsub^)]; new (tabletype, adrreturnsub); case typeof (returnedlist [ixlist]) { listtype { adrreturnsub^.flError = false; adrreturnsub^.value = returnedlist [ixlist] [1]}; tabletype { local (t = returnedlist [ixlist]); adrreturnsub^.flError = true; adrreturnsub^.faultCode = t.faultCode; adrreturnsub^.faultString = t.faultString}}; ixlist++}; return (returnedtable)}; bundle { //test code <<Note <<For this test we use a special version of examples.getStateName that errors if the statenum is out of range. <<The handler follows, copy this into a new script at user.betty.rpcHandlers.examples.getStateNameWithError. <<on getStateNameWithError (statenum) <<if (statenum < 1) or (statenum > 50) <<scripterror ("Can't get the state name because the state num is less than 1 or greater than 50.") <<return (states.nthState (statenum)) local (calltable, i); new (tabletype, @calltable); for i = 1 to 10 { new (tabletype, @onecall); onecall.methodName = "examples.getStateNameWithError"; onecall.params = {random (35, 65)}; calltable.[string.padwithzeros (i, 3)] = onecall}; scratchpad.multicallresult = clientMultiCall (adrCallTable:@calltable); 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.