2 Replies Latest reply on Jun 1, 2010 7:11 PM by odyssey27

    Explain VideoPhone sample cgi script

    odyssey27 Level 1

      I'm confused by the cgi script for the sqlLite service and the HttpService result method.


      If there are multiple <friend> records being returned, how come there isn't a for loop to process? I mean, what is the basic logic for processing the result?


      Also, because the return string is hand-hewed, it doesn't convert very well to a structured dataset return format. Can anyone give me a quick pseudo-cdoe description of how the result is 1.) built on server side, and 2.)  consumed in the client.


      Thanks for any feedback,


        • 1. Re: Explain VideoPhone sample cgi script
          Michael Thornburgh Adobe Employee

          the cgi script can process more than one lookup in a single HTTP request.  that function isn't used by VideoPhoneLabs.


          the result is also structured so that there could be multiple identities/peerIDs for each friend, but that case isn't supported by the database schema (m_username is a primary key, meaning entries are unique), nor by VideoPhoneLabs.


          finally, lookups are done case-insensitive, but friend names are stored case-preserving.  for each friend, for each identity, if the case of the lookup request doesn't match what was stored in the database (during the register phase), then there's an extra "<registered>" tag that returns the exact username registered (including capitalization).


          a Flex HTTPService by default interprets the results of a query as XML and parses it into an Object.  so, for s:HTTPService:


             var httpResult:Object = s.result;

             var result:Object = httpResult.result;

             var updated:Boolean = result.update; // only present if you attempted a registration

             var friend:Object = result.friend as Object; // only if you attempted a lookup

             var user:String = friend.user;

             var identity:String = friend.identity; // the peerID

             var registeredUser:String = friend.hasOwnProperty("registered") ? friend.registered : user;

          1 person found this helpful
          • 2. Re: Explain VideoPhone sample cgi script
            odyssey27 Level 1

            Michael, thank you for that. I'm in the process of retrofitting it to a .net service (hence my statement about structured dataset return format). The non-used stuff was throwing me, well so did the multi uses of same result elements, but I'm now getting there and your input will definitely help me.