Sorry if some of these questions seem redundant, but I'm picking the code apart line by line as I convert it, and am hitting some stumbling blocks in my comprehension during this process.
See below. ----- Original Message ----- From: "Raymond Irving" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 18, 2003 5:56 PM Subject: Re: [Dynapi-Dev] ioelmsrv.soda.jscript.asp -> ioelmsrv.soda.php conversion > > See below: > > --- Leif W <[EMAIL PROTECTED]> wrote: > > On line 168 of the JScript version: > > > > if (typeof(value)=="string" && > > value.indexOf("@RESULT#")==0) > > value=ar[value.substr(8)]; > > > > In the statement: > > > > value = ar[value.substr(8)]; > > > > "ar" has a null value, as it has not yet been set to > > anything inside the > > function. So how do we get a value from it? What > > should it be set to, and > > at what point should it be set? > > Looking at ioelmsvr.soda.jscript.asp: > > The "ar" is an array (line 122) that's used to store > results from a previously executed function (line > 186). I see the assignment of an empty array to local (not global) variable ar on line 122, and between that and line 168 where the ar array is being accessed, there was no assignment, so ar["anything"] will never exist. I don't understand how something on a later line in the same function can be considered a previously executed function. It doesn't make sense to me. Line 186 is after line 122, so assignment to array ar will only occur after line 186 is hit. Is it because this is inside a loop? Does the assignment on line 186 always occur on an iteration before the access of line 168? Is there any guarantee of this? I don't see any error checks for an empty array, and no comment about this non-intuitive assumption-based behaviour. Also, there's no try..catch construct in PHP or Perl as used in the JScript, but I think I remember seeing a way to write such functions in Perl, and I'm searching for an equivalent in PHP. I could just as easily embed a return statement in the eval and check the eval result and go from there. I may go so far as to implement something like try .. catch functions in PHP if I can. Also, I found talk of try..catch construct being added to PHP back in a mail archive from 2000. There's no mention of try..catch in the current PHP manual, but PHP5 has recently been released and I am curious if they've added the construct to this major revision. In any case, to make the PHP code more versatile, I'd probably want a PHP3 or PHP4 fallback solution anyways. > This makes it possible to execute multi functions on > the server in one call: > > Let's say we want to perform the following calculation > via our web service: > > 23+(((5*7)-6)/2) which is equal to 37.5 > > With conventional tools you would have to make several > calls to the server or create a function on the server > that can perform the above calculation. But what it > you're not able to create the function on the server? > Then you'd just have to stick with with what you have. > SODA-RPC solves the above problem by allowing you to > not only make multiple calls but to also pass > arguments from one method to the next in a single call > to the server! > > Here's how it's done using a simple object: > > var fn={ > multiply:[5,7], > subtract:['@RESULT#0',6], > divide:['@RESULT#1',2], > add:[23,'@RESULT#2'] > } > var response = io.calc.call(fn,null,false); > if (response.error) alert(response.error.text); > else alert(response.value[3]); // displays 37.5 > > The "@RESULT#0" variable would store the result from > the "multiply" function while "@RESULT#1" would store > the results from the "subtract" function, etc. So these results are being stored in the array named ar, with corresponding indexes? It's starting to make sense now. There will never be a result on first iteration (first method name). There will be results on successive iterations (from the previous method). Is this a correct interpretation? > See also: > > docs/docs/quickref.soda.html > examples/dynapi.util.ioelement-soda-nsync.html > > > -- > Raymond Irving > > > > Leif > > > > ----- Original Message ----- > > From: "Leif W" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, July 18, 2003 11:30 AM > > Subject: Re: [Dynapi-Dev] ioelmsrv.soda.jscript.asp > > -> ioelmsrv.soda.php > > conversion > > > > > > > Ok. I saw that further on in the file and that's > > what I suspected, but I > > > wasn't sure. I'll make the change to the ASP > > versions too, to use > > > soda.Methodname (JScript), soda.item("methodName") > > (VBScript), and $soda[ > > > "methodName" ] (PHP), respectively. > > > > > > Leif > > > > > > ----- Original Message ----- > > > From: "Raymond Irving" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Friday, July 18, 2003 10:35 AM > > > Subject: Re: [Dynapi-Dev] > > ioelmsrv.soda.jscript.asp -> ioelmsrv.soda.php > > > conversion > > > > > > > > > > Hi Leif, > > > > > > > > The variable mn is used to hold the method name > > but > > > > it's used further down in function. > > > > > > > > It should be safe to replace mn in line 110 and > > 114 of > > > > ioelmsvr.soda.jscript.asp with soda.methodName > > > > > > > > -- > > > > Raymond Irving > > > > > > > > --- Leif W <[EMAIL PROTECTED]> wrote: > > > > > In the ASP versions of the file, in function > > > > > wsDispatch, an undefined > > > > > variable named "mn" is passed to > > > > > ws__createSODAEnvelope. Is this correct? > > > > > It doesn't seem correct... Should a NULL > > value be > > > > > passed instead, or should > > > > > mn be set to something beforehand? > > > > > > > > > > Leif > > > > > > > > > > JScript version > > > > > --------------- > > > > > // check if internal system function returned > > any > > > > > data > > > > > if(!isoda) { > > > > > // Not System Function - continue with > > dispatch & > > > > > invoke dispatch events > > > > > if created > > > > > continueDispatch=true; > > > > > // trigger dispatch event > > > > > if (wso_hasDispatchEvent) { > > > > > value=ws__invokeEvent("dispatch"); > > > > > if (value==false) { > > > > > // send error (E4) message to client - > > > > > connection rejected > > > > > isoda = > > > > > > > > > > > > ws__createSODAEnvelope(mn,null,"E4",wso_sodaErrorText["E4"]); > > > > > > > > > > ----^^---- > > > > > continueDispatch=false; > > > > > }else if(typeof(value)=="string") { > > > > > // send error (E1) message to client - > > system > > > > > error > > > > > isoda = > > > > > > > > > > > > ws__createSODAEnvelope(mn,null,"E1",wso_sodaErrorText["E1"]+ > > > > > " : > > > > > "+value+" while executing dispatch event") > > > > > > > > > > ----^^---- > > > > > continueDispatch=false; > > > > > } > > > > > } > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > > This SF.net email is sponsored by: VM Ware > > > > > With VMware you can run multiple operating > > systems > > > > > on a single machine. > > > > > WITHOUT REBOOTING! Mix Linux / Windows / > > Novell > > > > > virtual machines at the > > > > > same time. Free trial click here: > > > > > http://www.vmware.com/wl/offer/345/0 > > > > > > > _______________________________________________ > > > > > Dynapi-Dev mailing list > > > > > [EMAIL PROTECTED] > > > > > > > > > > > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > > > > > > > > > > __________________________________ > > > > Do you Yahoo!? > > > > SBC Yahoo! DSL - Now only $29.95 per month! > > > > http://sbc.yahoo.com > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This SF.net email is sponsored by: VM Ware > > > > With VMware you can run multiple operating > > systems on a single machine. > > > > WITHOUT REBOOTING! Mix Linux / Windows / Novell > > virtual machines at the > > > > same time. Free trial click here: > > http://www.vmware.com/wl/offer/345/0 > > > > _______________________________________________ > > > > Dynapi-Dev mailing list > > > > [EMAIL PROTECTED] > > > > > > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: VM Ware > > > With VMware you can run multiple operating systems > > on a single machine. > > > WITHOUT REBOOTING! Mix Linux / Windows / Novell > > virtual machines at the > > > same time. Free trial click here: > > http://www.vmware.com/wl/offer/345/0 > > > _______________________________________________ > > > Dynapi-Dev mailing list > > > [EMAIL PROTECTED] > > > > > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: VM Ware > > With VMware you can run multiple operating systems > > on a single machine. > > WITHOUT REBOOTING! Mix Linux / Windows / Novell > > virtual machines at the > > same time. Free trial click here: > > http://www.vmware.com/wl/offer/345/0 > > _______________________________________________ > > Dynapi-Dev mailing list > > [EMAIL PROTECTED] > > > http://www.mail-archive.com/[EMAIL PROTECTED]/ > > > __________________________________ > Do you Yahoo!? > SBC Yahoo! DSL - Now only $29.95 per month! > http://sbc.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by: VM Ware > With VMware you can run multiple operating systems on a single machine. > WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the > same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 > _______________________________________________ > Dynapi-Dev mailing list > [EMAIL PROTECTED] > http://www.mail-archive.com/[EMAIL PROTECTED]/ > ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ Dynapi-Dev mailing list [EMAIL PROTECTED] http://www.mail-archive.com/[EMAIL PROTECTED]/