Hi Leif,

>From my understanding of SODA assosciative arrays are
treated as objects.

__
Raymond Irving

--- Leif W <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]>
> To: "Leif W" <[EMAIL PROTECTED]>
> 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:[EMAIL PROTECTED]
> > Sent: Thursday, January 22, 2004 7:03 PM
> > To: [EMAIL PROTECTED]
> > 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: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > 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 ===



-------------------------------------------------------
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
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to