5 Replies Latest reply on Apr 9, 2007 2:23 PM by coredump

    HTTPService's send() method gets response only once

    GurjarNiraj
      Hi,

      I have used HTTPService object to get the xml file from remote place. Following is the mxml file code

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="d:/testfolder/index.html">

      <mx:Script>
      <![CDATA[

      import mx.rpc.events.FaultEvent;
      import mx.rpc.events.ResultEvent;


      // Result handler - gets called after RSS is loaded.
      private function dataResultHandler(event:ResultEvent):void
      {
      }

      // Fault handler - displays the error
      private function dataFaultHandler(event:FaultEvent):void
      {
      }

      ]]>
      </mx:Script>


      <mx:HTTPService
      id="feedRequest"
      url=" http://www.testing.com:8080/my.xml"
      result="dataResultHandler(event);"
      fault="dataFaultHandler(event);"
      useProxy="false"/>

      <mx:Panel layout="absolute"
      title="External Reference Tag Generation" left="-2" right="0" bottom="10" top="10">
      <mx:TextArea height="292" borderStyle="solid" left="63" right="62" y="10" toolTip="Generates @ejb.ejb-external-ref tags using 'LocalHome' import statements of text" text="{feedRequest.lastResult.niraj.description}" />
      <mx:Button label="Submit" id="btnSubmit" left="63" y="312" click="feedRequest.send();"/>
      </mx:Panel>
      </mx:Application>


      Here, on click of submit button request is send to the given url " http://www.testing.com:8080/my.xml" which returns the xml file of the following format.

      my.xml
      <?xml version="1.0" encoding="utf-8" ?>
      <niraj>
      <description>good</description>
      </niraj>

      So, text area prints 'good'.

      After this I change the content of my.xml file to following
      <?xml version="1.0" encoding="utf-8" ?>
      <niraj>
      <description>bad</description>
      </niraj>

      Still when I press submit button, no matter how many times, text area shows 'good'. I expect it to change to 'bad' on each click.
      Even I tried to handle the 'result' event of HTTPService using 'datadataResultHandler()', but here still I see old data is retrieved.

      PS: I have hosted url using Tomcat http://www.testing.com:8080/my.xml

      -Niraj