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" <[EMAIL PROTECTED]>
To: "DynAPI-Dev" <[EMAIL PROTECTED]>
Sent: Thursday, February 19, 2004 6:54 AM
Subject: Re: [Dynapi-Dev] PHP SODA mixed array problem


> ----- Original Message ----- 
> From: "Leif W" <[EMAIL PROTECTED]>
> To: "Joseph Sonnier" <[EMAIL PROTECTED]>
> Cc: "DynAPI-Dev" <[EMAIL PROTECTED]>
> 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.
>




-------------------------------------------------------
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