From: Leif W <war...@us...> - 2004-02-18 17:55:44
|
Here's a tip for debugging those IOElement and SODA server side scripts as we translate to other languages. I've just spent all day yesterday working on the PHP version and was writing to Josh Ferrell about this same issue. I guess all this talk should be on the DynAPI-DEV list. :-) Basically, what I was doing, was to just output the data whereever I wanted to look at it (in ws__Var2SODA). if ( $vtype == "array" ) { $data = "<a$lvl>"; // PHP code to output an array print_r( $v ); Then in ioelmsrv, in ws__docWrite: "var mySODAResponse = \"$h\";\n" . "$h;\n" . # DEBUG # "make.error\n" . "</script>\n" . Then in your browser, you can hopefully see that there's some JavaScript error (I use Mozilla Firebird, and from the JavaScript console, I can see an error and click on it, and it brings up the source of the server-side script-generated page). Should look something like this (I added the #### lines for clarification ####): #### begin outputted data #### Array ( [name] => PHP SODA Test [comment] => This Web Service was created using PHP [login] => ok [SYSCall] => 1 ) #### end outputted data #### Content-Type: text/html <html> <script language="javascript" type="text/javascript"> var ioObj,dynapi=parent.dynapi; if (dynapi) ioObj=parent.IOElement.notify(this); else alert('Error: Missing or invalid DynAPI library'); // DEBUG // var mySODAResponse = "var wsSODAResponse='<envelope><method>SYS:WebServiceConnect</method><body><a1><u 2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2></a1></body></envelope> '"; var wsSODAResponse='<envelope><method>SYS:WebServiceConnect</method><body><a1><u 2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2></a1></body></envelope> '; // DEBUG make.error </script> </html> Now I have all the information I need to debug my script. As you can see above, my envelope isn't being created properly. The data is clearly in the array, but there's unknown / 0 in the array in the envelope. It should probably be returned as an object for the client-side JavaScript, although there's only one array type in PHP for both numeric and assosciative indexed arrays. Hmm... And also, you can count top-level items in an array, but you can't use numeric indexing to reference the assosciative indexes ( for i = 0 ;; i++ ), and you can't use assosciative indexes to reference the numeric indexes ( foreach array as key => value ). So we have to handle the cases when an array might be sent with both numeric and assosciative indexes, and use both methods, and keep count separately, and check that they add up to the total, and put them in the proper place in the envelope. :-\ It's ambiguous, do I create an object for the assosciate indexed elements, and an array for the numeric? Does that then break the original structure? Do I create an object for the entire thing? How does JavaScript handle mixed arrays? I think it allows using numeric indexing even for the assosciative indexes, but I'm not sure. Leif ----- Original Message ----- From: "Joseph Sonnier" <jso...@ni...> To: "Leif W" <war...@us...> Sent: Wednesday, February 18, 2004 9:15 AM Subject: RE: Dynapi - PERL version > I have made quite a bit of progress so far. > I have the PERL calc working and the SODA tester working ~ dates and > booleans need some work. However, I have run into a problem. > > I did all my work so far on a windows box running IIS. > I just pushed the stuff over the UNIX ~ FreeBSD/Apache and the same code > fails. > > I put in some debugging stuff on the server side - it appears to be writing > out the HTML correctly. The client side fails with a "Request timeout". > > Can you give me clue how I could capture what is coming back from the > server? > Really any advice on debugging this > > > Thanks, > Joseph Sonnier > > > -----Original Message----- > From: Leif W [mailto:war...@us...] > Sent: Thursday, January 22, 2004 7:03 PM > To: jso...@ni... > Subject: Re: Dynapi - PERL version > > > Ahh yes. I started by copying the JScript version and converting on my > first pass. I guess I didn't make it too far. ;-) The SODA version needs > converting, the ioelmsrv.pl version needs testing, and I think needs a new > function added that was added to the JScript and VBScript version a while > ago. The PHP versions I was working on a while ago too but some are in > various states of conversions from JScript to PHP. I don't have the > examples as I don't have the libraries done yet. ;-) More hands needed, > definitely, as other things have drawn my attention. > > Leif > > ----- Original Message ----- > From: <jso...@ni...> > To: <war...@us...> > Sent: Thursday, January 22, 2004 6:42 PM > Subject: Re: Dynapi - PERL version > > > > I took a look in the CVS library and I found > > > > ioelmsrv.pl - PERL > > ioelmsrv.soda.pl - This seems to be in Javascript > > > > Did you only do the first function? > > Or is this a CVS issue? > > > > Do you having like dynapi.util.ioelement-soda-calc.php that can > > give me an example of how to use it from the server side? > > > > > > > > > > > > > Hello! > > > > > > Thanks for your interest! I think I sort of had a Perl version working, > > > but not sure, I can't remember. Haven't touched the code in a while. > > > The porting isn't too difficult, just need to take a look at each > > > function (from the JScript version) and rewrite in Perl. Think it just > > > needs some more hands. Everything I have done is in CVS, so you should > > > be able to get it from there. I've got Perl set up on both Linux and > > > Win2k for testing, and the script should run on both (with just the > > > change of the first line after the #! ), I can help with that part. > > > > > > Leif > > > > > > ----- Original Message ----- > > > From: "Joseph Sonnier" <jso...@us...> > > > To: <war...@us...> > > > Sent: Thursday, January 22, 2004 2:03 PM > > > Subject: Dynapi - PERL version > > > > > > > > >> I was checking to see if you have made any progress on the > > >> > > >> PERL version of the ioelement.srv and soda modules > > >> > > >> > > >> > > >> Is the port difficult or just needs more hands? > > >> > > >> > > >> > > >> I have started using the Dynapi SODA API on NT, but would > > >> > > >> like to move to a UNIX,LINUX platform. > > >> > > >> > > >> > > >> Any suggestions? > > > > > > > > > > > > > > |
From: Leif W <war...@us...> - 2004-02-19 11:59:15
Attachments:
myAry.php
|
----- Original Message ----- From: "Leif W" <war...@us...> To: "Joseph Sonnier" <jso...@ni...> Cc: "DynAPI-Dev" <dyn...@li...> Sent: Wednesday, February 18, 2004 12:52 PM Subject: [Dynapi-Dev] Re: Tips on debugging IOElement / SODA > It's ambiguous, do I create an object for the assosciate indexed elements, > and an array for the numeric? Does that then break the original structure? > Do I create an object for the entire thing? How does JavaScript handle > mixed arrays? I think it allows using numeric indexing even for the > assosciative indexes, but I'm not sure. Wow it's morning already?? Can't stop now, so close, just need some food and drink. I've come up with some functions to let me know for sure if an array is entirely one type or the other, empty, or mixed. If it's entirely numeric, then treat it as a normal array envelope. If it's entirely assosciative, treat it as an object (still need to finish that bit of code, almost done). If it's a mixture, it's ambiguous, and we need to let it error out. I was thinking of returning an unknown type, or raising an error, but I don't understand that mechanism yet. After searching through the docs and cross referencing with the ASP-JScript code, I finally understand what the object wrapping in the envelope should look like and what the PHP script should be doing and what it probably isn't doing right. Still many layers of understanding to sift through, but I feel as though I've made some great progress so far. Leif P.S. Attached is a little PHP test script to check the type of an array. |
From: Leif W <war...@us...> - 2004-02-19 14:27:46
|
Had a malformed envelope creation. The creation isn't extensively tested yet, but the connection for the test page works! A few things of note. One thing to notice, there's a missing <soda> ... </soda> tag. In the Var2SODA function, (in ASP JScript, VBScipt and in the PHP), nearly the first thing done is if the "lvl" is >= 0, increment it by 1. Skimming through the function, it never gets decremented anywhere, and then at the end, the <soda> ... </soda> tag is added only if "lvl" equals 0, which it never will, so the <soda> tag will never be added, and all connection response envelopes will be malformed. (!?) Something doesn't seem right about this, and unless I misunderstand something, I think it is necessary to back off the level at the end of the Var2SODA function, "lvl--", just before the <soda> tag check. I did this in the PHP script and the connect phase started working. Second, you notice all of my strings were <u#>, I had some funky regexp that wasn't matching the | in the <u3> and the space ( ) in the <u4> tags. I've made it more robust, so it should match just about any typeable character, but not high ansi, or non printables (anything you'd have to type ALT-### on your keypad), or use wget or curl to bypass your browser. ^_^ Third, I don't know if it's a problem, but it seems like a bug to me. The "lvl" for the <r#/> separators is off by one. To be more precise, it is always one less than the array elements. I don't know if that's the way it's supposed to be or not. But just looking at it, when everything is indented 4 blocks, it looks like a bug, to be switching between <u4> and <r3/>, for example. I could "fix" the way the script generates the envelope, but am not sure how it would affect the javascript. Might hiccup or burp on it. I'll have to try out of curiousity to see what happens. Now more bugs I see in my Apache log file from PHP, so I'll take it from there, then track down the other errors. Leif ==== Malformed envelope ==== <envelope> <method>SYS:WebServiceConnect</method> <body> <o1> <a2> <u3>name|comment|login|SYSCall</u3> <r2/> <a3> <u4>PHP SODA Test</u4> <r3/> <u4>This Web Service was created using PHP</u4> <r3/> <s4>ok</s4> <r3/> <b4>true</b4> </a3> </a2> </o1> </body> </envelope> ==== Well formed envelope ==== <envelope> <method>SYS:WebServiceConnect</method> <body> <soda> <o1> <a2> <s3>name|comment|login|SYSCall</s3> <r2/> <a3> <s4>PHP SODA Test</s4> <r3/> <s4>This Web Service was created using PHP</s4> <r3/> <s4>ok</s4> <r3/> <b4>true</b4> </a3> </a2> </o1> </soda> </body> </envelope> ----- Original Message ----- From: "Leif W" <war...@us...> To: "DynAPI-Dev" <dyn...@li...> Sent: Thursday, February 19, 2004 6:54 AM Subject: Re: [Dynapi-Dev] PHP SODA mixed array problem > ----- Original Message ----- > From: "Leif W" <war...@us...> > To: "Joseph Sonnier" <jso...@ni...> > Cc: "DynAPI-Dev" <dyn...@li...> > Sent: Wednesday, February 18, 2004 12:52 PM > Subject: [Dynapi-Dev] Re: Tips on debugging IOElement / SODA > > > > It's ambiguous, do I create an object for the assosciate indexed elements, > > and an array for the numeric? Does that then break the original > structure? > > Do I create an object for the entire thing? How does JavaScript handle > > mixed arrays? I think it allows using numeric indexing even for the > > assosciative indexes, but I'm not sure. > > Wow it's morning already?? Can't stop now, so close, just need some food > and drink. I've come up with some functions to let me know for sure if an > array is entirely one type or the other, empty, or mixed. If it's entirely > numeric, then treat it as a normal array envelope. If it's entirely > assosciative, treat it as an object (still need to finish that bit of code, > almost done). If it's a mixture, it's ambiguous, and we need to let it > error out. I was thinking of returning an unknown type, or raising an > error, but I don't understand that mechanism yet. After searching through > the docs and cross referencing with the ASP-JScript code, I finally > understand what the object wrapping in the envelope should look like and > what the PHP script should be doing and what it probably isn't doing right. > Still many layers of understanding to sift through, but I feel as though > I've made some great progress so far. > > Leif > > P.S. Attached is a little PHP test script to check the type of an array. > |
From: Kevin <ke...@ke...> - 2004-02-21 20:54:30
|
Hi Leif, Thanks for posting to the list. I'm well out of touch with dynapi at the moment but look forward to seeing soda php/perl versions so I can test with Apache. Kevin. ----- Original Message ----- From: "Leif W" <war...@us...> To: <dyn...@li...> Sent: Thursday, February 19, 2004 2:22 PM Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > Had a malformed envelope creation. -- clipped. |
From: Leif W <war...@us...> - 2004-02-21 22:29:20
|
I've put the most recent PHP SODA stuff into CVS, if you want to look. Right now, it only connects using the tester page. The main / modified files are the following four, and only been tested on the newer PHP4 under Apache2. dynapi3x/examples/ioelmsrv.php dynapi3x/examples/ioelmsrv.soda.php dynapi3x/examples/dynapi.util.ioelement-soda-tester.html dynapi3x/examples/dynapi.util.ioelement-soda-tester.php Just an idea for the docs or example page, something I'd like to do is elaborate upon what SODA is and does by dissecting an entire conversation, when a user clicks something non-trivial. I found all this very confusing, but have a good grasp of it now. I think I could better convey some of this complexity for an API user rather than let it sit hidden in the code for only the API hackers one by one. Leif ----- Original Message ----- From: "Kevin" <ke...@ke...> To: <dyn...@li...> Sent: Saturday, February 21, 2004 12:51 PM Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > Hi Leif, > > Thanks for posting to the list. I'm well out of touch with dynapi at the > moment but look forward to seeing soda php/perl versions so I can test > with Apache. > > Kevin. > > ----- Original Message ----- > From: "Leif W" <war...@us...> > To: <dyn...@li...> > Sent: Thursday, February 19, 2004 2:22 PM > Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > > > > Had a malformed envelope creation. > > -- clipped. > > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://www.mail-archive.com/dyn...@li.../ > > |
From: Andrew G. <an...@zo...> - 2004-02-23 04:52:19
|
Hi Leif, I'd be willing to help out with documenting the SODA RPC protocol. I've also followed the difficult path of reverse-engineering the jscript ASP code to get the Java servlet going. If I could contribute to, or review, any documentation about SODA then it will help me to better understand any deficiencies in my java code. regards, Andrew Leif W wrote: >I've put the most recent PHP SODA stuff into CVS, if you want to look. >Right now, it only connects using the tester page. The main / modified >files are the following four, and only been tested on the newer PHP4 under >Apache2. > >dynapi3x/examples/ioelmsrv.php >dynapi3x/examples/ioelmsrv.soda.php >dynapi3x/examples/dynapi.util.ioelement-soda-tester.html >dynapi3x/examples/dynapi.util.ioelement-soda-tester.php > >Just an idea for the docs or example page, something I'd like to do is >elaborate upon what SODA is and does by dissecting an entire conversation, >when a user clicks something non-trivial. I found all this very confusing, >but have a good grasp of it now. I think I could better convey some of this >complexity for an API user rather than let it sit hidden in the code for >only the API hackers one by one. > >Leif > >----- Original Message ----- >From: "Kevin" <ke...@ke...> >To: <dyn...@li...> >Sent: Saturday, February 21, 2004 12:51 PM >Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > > > > >>Hi Leif, >> >>Thanks for posting to the list. I'm well out of touch with dynapi at the >>moment but look forward to seeing soda php/perl versions so I can test >>with Apache. >> >>Kevin. >> >>----- Original Message ----- >>From: "Leif W" <war...@us...> >>To: <dyn...@li...> >>Sent: Thursday, February 19, 2004 2:22 PM >>Subject: Re: [Dynapi-Dev] PHP SODA - it connects! >> >> >> >> >>>Had a malformed envelope creation. >>> >>> >>-- clipped. >> >> >> >> >>------------------------------------------------------- >>SF.Net is sponsored by: Speed Start Your Linux Apps Now. >>Build and deploy apps & Web services for Linux with >>a free DVD software kit from IBM. Click Now! >>http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >>_______________________________________________ >>Dynapi-Dev mailing list >>Dyn...@li... >>http://www.mail-archive.com/dyn...@li.../ >> >> >> >> > > > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >_______________________________________________ >Dynapi-Dev mailing list >Dyn...@li... >http://www.mail-archive.com/dyn...@li.../ > > > > |
From: Leif W <war...@us...> - 2004-02-23 14:26:28
|
Andrew, Something trivial I was thinking of was the test functions on the tester page. Something non-trivial I was thinking of would be like the calculator (for a GUI) or sending something programmatically as a series of instructions to carry out. Now that I think of it, maybe one trivial, and one or two non-trivial examples (GUI and program) would be good. But the key would be to capture ALL HTTP session data (headers, GET/POST, cookies), and show the SODA envelope in an indented (4 space) format for illustration purposes. Maybe even with web access log files too, so someone can see the entire session, from client and server perspectives, from API perspective as well. When debugging, that's what it comes down to understanding, and it would have been easier if it was documented. And I know I'll probably forget in a few months or a year unless I leave some notes behind. ;-) What do you think? Leif ----- Original Message ----- From: "Andrew Gillett" <an...@zo...> To: <dyn...@li...> Sent: Sunday, February 22, 2004 11:44 PM Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > Hi Leif, > > I'd be willing to help out with documenting the SODA RPC protocol. I've > also followed the difficult path of reverse-engineering the jscript ASP > code to get the Java servlet going. If I could contribute to, or review, > any documentation about SODA then it will help me to better understand > any deficiencies in my java code. > > regards, > Andrew > > > Leif W wrote: > > >I've put the most recent PHP SODA stuff into CVS, if you want to look. > >Right now, it only connects using the tester page. The main / modified > >files are the following four, and only been tested on the newer PHP4 under > >Apache2. > > > >dynapi3x/examples/ioelmsrv.php > >dynapi3x/examples/ioelmsrv.soda.php > >dynapi3x/examples/dynapi.util.ioelement-soda-tester.html > >dynapi3x/examples/dynapi.util.ioelement-soda-tester.php > > > >Just an idea for the docs or example page, something I'd like to do is > >elaborate upon what SODA is and does by dissecting an entire conversation, > >when a user clicks something non-trivial. I found all this very confusing, > >but have a good grasp of it now. I think I could better convey some of this > >complexity for an API user rather than let it sit hidden in the code for > >only the API hackers one by one. > > > >Leif > > > >----- Original Message ----- > >From: "Kevin" <ke...@ke...> > >To: <dyn...@li...> > >Sent: Saturday, February 21, 2004 12:51 PM > >Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > > > > > > > > > >>Hi Leif, > >> > >>Thanks for posting to the list. I'm well out of touch with dynapi at the > >>moment but look forward to seeing soda php/perl versions so I can test > >>with Apache. > >> > >>Kevin. > >> > >>----- Original Message ----- > >>From: "Leif W" <war...@us...> > >>To: <dyn...@li...> > >>Sent: Thursday, February 19, 2004 2:22 PM > >>Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > >> > >> > >> > >> > >>>Had a malformed envelope creation. > >>> > >>> > >>-- clipped. > >> > >> > >> > >> > >>------------------------------------------------------- > >>SF.Net is sponsored by: Speed Start Your Linux Apps Now. > >>Build and deploy apps & Web services for Linux with > >>a free DVD software kit from IBM. Click Now! > >>http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > >>_______________________________________________ > >>Dynapi-Dev mailing list > >>Dyn...@li... > >>http://www.mail-archive.com/dyn...@li.../ > >> > >> > >> > >> > > > > > > > > > >------------------------------------------------------- > >SF.Net is sponsored by: Speed Start Your Linux Apps Now. > >Build and deploy apps & Web services for Linux with > >a free DVD software kit from IBM. Click Now! > >http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > >_______________________________________________ > >Dynapi-Dev mailing list > >Dyn...@li... > >http://www.mail-archive.com/dyn...@li.../ > > > > > > > > > > > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://www.mail-archive.com/dyn...@li.../ > > |
From: Andrew G. <an...@zo...> - 2004-02-24 06:46:03
|
Leif W wrote: >Andrew, > >Something trivial I was thinking of was the test functions on the tester >page. Something non-trivial I was thinking of would be like the calculator >(for a GUI) or sending something programmatically as a series of >instructions to carry out. Now that I think of it, maybe one trivial, and >one or two non-trivial examples (GUI and program) would be good. But the >key would be to capture ALL HTTP session data (headers, GET/POST, cookies), >and show the SODA envelope in an indented (4 space) format for illustration >purposes. Maybe even with web access log files too, so someone can see the >entire session, from client and server perspectives, from API perspective as >well. When debugging, that's what it comes down to understanding, and it >would have been easier if it was documented. And I know I'll probably >forget in a few months or a year unless I leave some notes behind. ;-) >What do you think? > >Leif > > It's certainly the case that when things go wrong, you end up looking at the low level XML in the requests (i.e. SODA). Capturing the HTTP session data for some trivial examples is an interesting idea, but it will be verbose. The requests/responses will differ depending upon whether the IOElement is set up to use GET or POST and whether it makes synchrounous or asyncrounous requests. The GET requests look quite ugly. This is part of a GET request to the Calculator service to perform "3 + 8": GET /dynapi/examples/dynapi.util.ioelement-soda-calc-js.asp?IORequestID=io9871945172862595&IOElementID=DynObject10&IOMethod=get&IOResponse=text/html&IOEnvelope=%3Cenvelope%3E%3Csid%3E740EE-30786407-BB56-065891136%3C/sid%3E%3Cmethod%3Eadd%3C/method%3E%3Cbody%3E%3Csoda%3E%3Ca0%3E%3Cs1%3E8%3C/s1%3E%3Cr0/%3E%3Cs1%3E3%3C/s1%3E%3C/a0%3E%3C/soda%3E%3C/body%3E%3C/envelope%3E Messy, huh? It becomes easier once the request is broken down to: GET /dynapi/examples/dynapi.util.ioelement-soda-calc-js.asp IORequestID=io9871945172862595 IOElementID=DynObject10 IOMethod=get IOResponse=text/html IOEnvelope=<envelope><sid>740EE-30786407-BB56-065891136</sid><method>add</method><body><soda><a0><s1>8</s1><r0/><s1>3</s1></a0></soda></body></envelope> And when the IOEnvelope is extracted, we get a recognizable SODA request: <envelope> <sid>740EE-30786407-BB56-065891136</sid> <method>add</method> <body> <soda> <a0> <s1>8</s1> <r0/> <s1>3</s1> </a0> </soda> </body> </envelope> I think it will make our lives much easier if concentrate on documenting the SODA XML. The cookies and stuff have never seemed of any great importance to me - but maybe that's because I use Tomcat which just handles all the session management for me. I'll have bit of a play with this stuff this evening and see what I come up with. Andrew. >----- Original Message ----- >From: "Andrew Gillett" <an...@zo...> >To: <dyn...@li...> >Sent: Sunday, February 22, 2004 11:44 PM >Subject: Re: [Dynapi-Dev] PHP SODA - it connects! > > > > >>Hi Leif, >> >>I'd be willing to help out with documenting the SODA RPC protocol. I've >>also followed the difficult path of reverse-engineering the jscript ASP >>code to get the Java servlet going. If I could contribute to, or review, >>any documentation about SODA then it will help me to better understand >>any deficiencies in my java code. >> >>regards, >>Andrew >> >> >>Leif W wrote: >> >> >> >>>I've put the most recent PHP SODA stuff into CVS, if you want to look. >>>Right now, it only connects using the tester page. The main / modified >>>files are the following four, and only been tested on the newer PHP4 >>> >>> >under > > >>>Apache2. >>> >>>dynapi3x/examples/ioelmsrv.php >>>dynapi3x/examples/ioelmsrv.soda.php >>>dynapi3x/examples/dynapi.util.ioelement-soda-tester.html >>>dynapi3x/examples/dynapi.util.ioelement-soda-tester.php >>> >>>Just an idea for the docs or example page, something I'd like to do is >>>elaborate upon what SODA is and does by dissecting an entire >>> >>> >conversation, > > >>>when a user clicks something non-trivial. I found all this very >>> >>> >confusing, > > >>>but have a good grasp of it now. I think I could better convey some of >>> >>> >this > > >>>complexity for an API user rather than let it sit hidden in the code for >>>only the API hackers one by one. >>> >>>Leif >>> >>>----- Original Message ----- >>>From: "Kevin" <ke...@ke...> >>>To: <dyn...@li...> >>>Sent: Saturday, February 21, 2004 12:51 PM >>>Subject: Re: [Dynapi-Dev] PHP SODA - it connects! >>> >>> >>> >>> >>> >>> >>>>Hi Leif, >>>> >>>>Thanks for posting to the list. I'm well out of touch with dynapi at the >>>>moment but look forward to seeing soda php/perl versions so I can test >>>>with Apache. >>>> >>>>Kevin. >>>> >>>>----- Original Message ----- >>>>From: "Leif W" <war...@us...> >>>>To: <dyn...@li...> >>>>Sent: Thursday, February 19, 2004 2:22 PM >>>>Subject: Re: [Dynapi-Dev] PHP SODA - it connects! >>>> >>>> >>>> >>>> >>>> >>>> >>>>>Had a malformed envelope creation. >>>>> >>>>> >>>>> >>>>> >>>>-- clipped. >>>> >>>> >>>> >>>> >>>>------------------------------------------------------- >>>>SF.Net is sponsored by: Speed Start Your Linux Apps Now. >>>>Build and deploy apps & Web services for Linux with >>>>a free DVD software kit from IBM. Click Now! >>>>http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >>>>_______________________________________________ >>>>Dynapi-Dev mailing list >>>>Dyn...@li... >>>>http://www.mail-archive.com/dyn...@li.../ >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >>>------------------------------------------------------- >>>SF.Net is sponsored by: Speed Start Your Linux Apps Now. >>>Build and deploy apps & Web services for Linux with >>>a free DVD software kit from IBM. Click Now! >>>http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >>>_______________________________________________ >>>Dynapi-Dev mailing list >>>Dyn...@li... >>>http://www.mail-archive.com/dyn...@li.../ >>> >>> >>> >>> >>> >>> >> >> >> >>------------------------------------------------------- >>SF.Net is sponsored by: Speed Start Your Linux Apps Now. >>Build and deploy apps & Web services for Linux with >>a free DVD software kit from IBM. Click Now! >>http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >>_______________________________________________ >>Dynapi-Dev mailing list >>Dyn...@li... >>http://www.mail-archive.com/dyn...@li.../ >> >> >> >> > > > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click >_______________________________________________ >Dynapi-Dev mailing list >Dyn...@li... >http://www.mail-archive.com/dyn...@li.../ > > > > |
From: Raymond I. <xw...@ya...> - 2004-02-19 14:24:10
|
Hi Leif, From my understanding of SODA assosciative arrays are treated as objects. __ Raymond Irving --- Leif W <war...@us...> wrote: > Here's a tip for debugging those IOElement and SODA > server side scripts as > we translate to other languages. > > I've just spent all day yesterday working on the PHP > version and was writing > to Josh Ferrell about this same issue. I guess all > this talk should be on > the DynAPI-DEV list. :-) > > Basically, what I was doing, was to just output the > data whereever I wanted > to look at it (in ws__Var2SODA). > > if ( $vtype == "array" ) > { > $data = "<a$lvl>"; > > // PHP code to output an array > print_r( $v ); > > Then in ioelmsrv, in ws__docWrite: > > "var mySODAResponse = \"$h\";\n" . > "$h;\n" . > # DEBUG > # "make.error\n" . > "</script>\n" . > > Then in your browser, you can hopefully see that > there's some JavaScript > error (I use Mozilla Firebird, and from the > JavaScript console, I can see an > error and click on it, and it brings up the source > of the server-side > script-generated page). Should look something like > this (I added the #### > lines for clarification ####): > > #### begin outputted data #### > Array > ( > [name] => PHP SODA Test > [comment] => This Web Service was created using > PHP > [login] => ok > [SYSCall] => 1 > ) > #### end outputted data #### > Content-Type: text/html > > <html> > <script language="javascript" > type="text/javascript"> > var ioObj,dynapi=parent.dynapi; > if (dynapi) ioObj=parent.IOElement.notify(this); > else alert('Error: Missing or invalid DynAPI > library'); > > // DEBUG > // var mySODAResponse = "var > wsSODAResponse='<envelope><method>SYS:WebServiceConnect</method><body><a1><u > 2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2></a1></body></envelope> > '"; > var > wsSODAResponse='<envelope><method>SYS:WebServiceConnect</method><body><a1><u > 2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2><r1/><u2>0</u2></a1></body></envelope> > '; > // DEBUG > make.error > </script> > </html> > > > Now I have all the information I need to debug my > script. As you can see > above, my envelope isn't being created properly. > The data is clearly in the > array, but there's unknown / 0 in the array in the > envelope. It should > probably be returned as an object for the > client-side JavaScript, although > there's only one array type in PHP for both numeric > and assosciative indexed > arrays. Hmm... And also, you can count top-level > items in an array, but > you can't use numeric indexing to reference the > assosciative indexes ( for i > = 0 ;; i++ ), and you can't use assosciative indexes > to reference the > numeric indexes ( foreach array as key => value ). > So we have to handle the > cases when an array might be sent with both numeric > and assosciative > indexes, and use both methods, and keep count > separately, and check that > they add up to the total, and put them in the proper > place in the envelope. > :-\ > > It's ambiguous, do I create an object for the > assosciate indexed elements, > and an array for the numeric? Does that then break > the original structure? > Do I create an object for the entire thing? How > does JavaScript handle > mixed arrays? I think it allows using numeric > indexing even for the > assosciative indexes, but I'm not sure. > > > Leif > > > ----- Original Message ----- > From: "Joseph Sonnier" <jso...@ni...> > To: "Leif W" <war...@us...> > Sent: Wednesday, February 18, 2004 9:15 AM > Subject: RE: Dynapi - PERL version > > > > I have made quite a bit of progress so far. > > I have the PERL calc working and the SODA tester > working ~ dates and > > booleans need some work. However, I have run into > a problem. > > > > I did all my work so far on a windows box running > IIS. > > I just pushed the stuff over the UNIX ~ > FreeBSD/Apache and the same code > > fails. > > > > I put in some debugging stuff on the server side - > it appears to be > writing > > out the HTML correctly. The client side fails > with a "Request timeout". > > > > Can you give me clue how I could capture what is > coming back from the > > server? > > Really any advice on debugging this > > > > > > Thanks, > > Joseph Sonnier > > > > > > -----Original Message----- > > From: Leif W [mailto:war...@us...] > > Sent: Thursday, January 22, 2004 7:03 PM > > To: jso...@ni... > > Subject: Re: Dynapi - PERL version > > > > > > Ahh yes. I started by copying the JScript version > and converting on my > > first pass. I guess I didn't make it too far. > ;-) The SODA version > needs > > converting, the ioelmsrv.pl version needs testing, > and I think needs a new > > function added that was added to the JScript and > VBScript version a while > > ago. The PHP versions I was working on a while > ago too but some are in > > various states of conversions from JScript to PHP. > I don't have the > > examples as I don't have the libraries done yet. > ;-) More hands needed, > > definitely, as other things have drawn my > attention. > > > > Leif > > > > ----- Original Message ----- > > From: <jso...@ni...> > > To: <war...@us...> > > Sent: Thursday, January 22, 2004 6:42 PM > > Subject: Re: Dynapi - PERL version > > > > > > > I took a look in the CVS library and I found > > > > > > ioelmsrv.pl - PERL > > > ioelmsrv.soda.pl - This seems to be in > Javascript > > > > > > Did you only do the first function? > > > Or is this a CVS issue? > > > > > > Do you having like > dynapi.util.ioelement-soda-calc.php that can > > > give me an example of how to use it from the > server side? > > > > > > > > > > > > > > > > === message truncated === |