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

    ANOTHER Stupid Newbie Question

    Snarfblat
      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? :)

      Thanks!

      Rob
        • 1. Re: ANOTHER Stupid Newbie Question
          enorton@adobe Level 1
          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?

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

            [app:/index.html][11:51:55]
            [
            0=<wddxPacket version='1.0'><header/><data><string>CENTER_NAME=Whatever&amp;
            HIRE_DATE=(date)&amp;EDIT_DATE=(date)&amp;EMPLOYEE_ID=12345
            &amp;POSITION_NAME=CSR&amp;STATUS=Active&amp;
            FIRST_NAME=John&amp;
            LAST_NAME=Doe</string></data></wddxPacket>
            ]

            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);
            loader.load(request);
            }

            function completeHandler(event) {
            var loader = event.target.data;
            var result = loader;
            air.Introspector.Console.dump(result);
            }


            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.

            Rob
            • 3. Re: ANOTHER Stupid Newbie Question
              enorton@adobe Level 1
              Hi,
              Are you able to access
              http://whatever.com/my.cfc?method=getData&userid=12345
              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.

              -Erica
              • 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?

                Rob