1 Reply Latest reply on Nov 27, 2006 10:39 AM by Bill Sahlas

    HTTP to xml and back

    matt@frodis
      I've been playing with a project that was all html/php based. I was able to set up a nice Flex 2 IU and hook it up to my back end database without much trouble. I get xml records from an http dataprovider and have some text fields and some datagrids. What I want to do, though, is be able to update the xml record and push it back over http. The event.result I get back from the dataprovider is type Object. I was thinking that I ought to be able to coerce it into an XML object and bind my UI to it so I could add and remove datagrid items from the XML.

      I can't seem to figure out how to do anything with the event.result other than bind my UI to it. So how can I take xml received over http and make it into an XML object I can bind to and change ?

      Here's what my provider and callback look like:
      <mx:HTTPService
      id="listingService"
      url=" http://xxx.xxx.com/testdata.php"
      result="listingResult(event)"
      method="POST">
      <mx:request xmlns="">
      <op>listsettings</op>
      <account>{loginService.lastResult.userinfo.account}</account>
      </mx:request>
      </mx:HTTPService>

      <mx:Script>
      <![CDATA[
      import mx.utils.XMLUtil
      [Bindable]
      var xmlData:XML;
      import mx.rpc.events.ResultEvent;
      import mx.utils.StringUtil;
      public function getListing() : void {
      listingService.send();
      }
      public function listingResult(event:ResultEvent) : void {
      if(StringUtil.trim(String(event.result)) == String("FAILED"))
      return;
      xmlData = new XML(event.result);
      }
      ]]>
      </mx:Script>