4 Replies Latest reply on May 22, 2008 2:24 PM by Snarfblat

    ANOTHER Stupid Newbie Question

      Now that I'm successfully retrieving data from my CFC (thanks to the response to my previous post), I have a new problem... no matter what I do, when I dump the output in the Introspector, the data coming back is in WDDX format. I have tried returning the query results directly, I've tried using SerializeJSON, I've tried creating a structure, and I've even looped through the results to put together a string for name/value pairs. I also set air.URLLoaderDataFormat.VARIABLES. No matter what, the end result is always the same... it shows up in AIR as WDDX.

      So... again, what am I doing wrong? :)


        • 1. Re: ANOTHER Stupid Newbie Question
          enorton@adobe Adobe Employee
          Hi Rob,

          Are you saying that when you get the data from the CFC outside of AIR it isn't in the WDDX format? Could you please post sample code how you are calling it where it behaves as you want, and where it doesn't behave as you want?

          • 2. Re: ANOTHER Stupid Newbie Question
            Snarfblat Level 1
            Hi Erica... here's what I'm getting back:

            0=<wddxPacket version='1.0'><header/><data><string>CENTER_NAME=Whatever&amp;

            Note that I added CR's for legibility. And here's the code getting it:

            function getEmp() {
            var request = new air.URLRequest(" http://whatever.com/my.cfc?method=getData&userid=12345");
            var loader = new air.URLLoader();
            loader.dataFormat = air.URLLoaderDataFormat.TEXT;
            loader.addEventListener(air.Event.COMPLETE, completeHandler);

            function completeHandler(event) {
            var loader = event.target.data;
            var result = loader;

            I don't understand why no matter what I do, it comes back as WDDX. Unless there's a WDDX translator for AIR, I'm stuck. What I've been doing in the interim is writing the query results to a text file, but that still doesn't give me an easy way to get the data loaded into variables or a structure that I can use.

            • 3. Re: ANOTHER Stupid Newbie Question
              enorton@adobe Adobe Employee
              Are you able to access
              through something besides AIR and get something other than WDDX?

              I think the .cfc is responsible for controlling the data sent back to you and how it is formatted. Setting the URLLoader.dataFormat property won't change that. It just informs the URLLoader how to interpret the data sent back.

              • 4. Re: ANOTHER Stupid Newbie Question
                Snarfblat Level 1
                If I access the cfc via the web browser using that url, I get WDDX back as well.

                I suppose my question is this... since all it ever returns is WDDX, how do you go about extracting data from that WDDX packet so you can use it in AIR?