18 Replies Latest reply on Apr 25, 2008 8:19 AM by Developer504

    Receiving and displaying XML data via HTTPService

    Developer504 Level 1
      Hi folks. I am a pretty experienced database programmer, I work with a software called Magic eDev, but I'm a complete newby in Flex.

      I am trying to use Flex 3 to create a web / client interface for an application written in Magic eDev. I've made a very simple Flex App to read an XML file generated by another application written in the third party software (Magic eDev 9.4) via HTTPService. I think I have the HTTPService request part figured out, This little Application does not cause any errors in Flex. However, I am not seeing my data in the display. If I manually try the URL query to the Magic App, I do get the XML file with the data in it, but Flex doesn't seem to see anything.

      I just want to get two fields via the HTTPService data and display them, but I'm not getting any result. I can't even tell if Flex is actually querying Magic or not. Can anyone explain what I'm doing wrong?

      Also, is there some way to monitor what the Flex app is doing when you run it, as you can in some other systems?

      Here is my code:
      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"

      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;
      private function serv_result(evt:ResultEvent):void {
      var resultObj:Object = evt.result;
      userName.text = resultObj.catalog.username;
      emailAddress.text = resultObj.catalog.emailaddress;
      private function serv_fault(evt:FaultEvent):void {
      error.text += evt.fault.faultString;
      error.visible = true;
      form.visible = false;

      <mx:String id="XML_URL">album.xml</mx:String>
      <mx:HTTPService id="loginService"
      url=" http://localhost/magic94scripts/mgrqcgi94.exe"
      result="{ResultEvent(event)}" fault="{FaultEvent(event)}">


      <mx:ApplicationControlBar dock="true">
      <mx:Label text="{XML_URL}" />
      <mx:Label id="error"
      <mx:Form id="form"
      <mx:FormItem label="resultObj.catalog.username:">
      <mx:Label id="userName" />
      <mx:FormItem label="resultObj.catalog.emailaddress:">
      <mx:Label id="emailAddress" />

      This is what the XML file looks like:

      <?xml version="1.0" ?>
      - <catalog>