2 Replies Latest reply on Jul 26, 2006 6:37 PM by Vision Airlines

    Problem in getting data by using HTTPService

      Hi All,

      A http request: will get the following XML result set:


      By using HTTPService:

      <mx:HTTPService id="dataSrv" url="" useProxy="false" method="POST" showBusyCursor="true"
      fault="Alert.show('Connection Error!')">

      <mx:Button label="Get Record" click="dataSrv.send();"/>

      the result will then bind to a datagrid after the button is clicked

      The problem is that once i change the record to status=Inactive in the backend, and i click the button again, the record is still status=Active (it seems to me that the HTTPService get the cache data instead of posting the record again to the server). I have to reload the full page and click the button again so as to get the right status (i.e. Active status)

      How could i fix this problem?

        • 1. Re: Problem in getting data by using HTTPService
          ntsiii Level 3
          First try setting the caching headers on the server:
          <META HTTP-EQUIV="Cache-Control" CONTENT ="no-cache"> <META HTTP-EQUIV="expires" CONTENT="0">Or from a JSP page, try the following before writing anything to the output stream:

          response.setDateHeader ("Expires", 0);
          response.setHeader("Cache-Control", "max-age=0, must-revalidate");

          If that does not work, build you url in AS code and append a parameter that will always be unique. For example:
          var url : String = " http://www.server.com/file.php"; url += "?" + String ( Math.random() * 9999) ;

          Some people use Date instead of the random number.

          • 2. Re: Problem in getting data by using HTTPService
            Vision Airlines
            I thought I was the only one. I'm having the same problem ncelq. I haven't had the chance to try the above, but if you get any of these to work please post an example.