1 Reply Latest reply on Jul 2, 2009 11:46 AM by paraglidersd

    Timeout in resultHandler for HTTPService request

    paraglidersd Level 1

      Hello All,

       

      I have a flex application where I am calling to get data in XML format.  The data file most likely will contain 10's of thousands of records (in most cases).  What I am experiencing is a timeout in my rHandle function (see code snippets below):

       

      Error #1502 A Script has executed for longer than the default timeout period of 15 seconds

       

      My question/problem has 2 parts.

      1) how do you disable the timeout?

      2) the reading/parsing of the XML data seems to take waaaay too long.  Is there a better way?

       

      I put an Alert message at the top of the result handler function and it didnt trigger before the timeout message triggered.  I am reading what could be 10's of thousands of records.  Is there a better (and FASTER) way to do this than to read in XML format?  Currently, no matter what I set the httpservice requests 'timeout' value to doesnt seem to have any effect.  I get a timeout after 15 seconds every time.  I have tried setting the timeout value to -1 (as documentation suggested) and/or to some very large value (say, 1200...20 minutes).  Any and all help is appreciated.   Here is the code and an example of the XML file

       

      ........
      private var contactService:HTTPService = new HTTPService();
      private var xData:XML;
      private var T_Data:ArrayCollection = new ArrayCollection();
      .......
      private function get_data():void
      {
         contactService.url="data/big_data.xml";
         contactService.format = "e4x";
         contactService.addEventListener(ResultEvent.RESULT, rHandle);
         contactService.requestTimeout = -1;
         contactService.send();
      }

       

      private function rHandle(event:ResultEvent):void
      {
         var i:int;

       

         xData = event.result as XML;

       

         for  (i=0; i < xData.el.length(); i++)
         {
            var t:Object = new Object();
            t.cid = xData.el[i].cid; 
            t.date = xData.el[i].date; 
            t.y_axis = xData.el[i].y_axis;
            T_Data.addItem(t);
         }
      }

       

      ........

       

      <mx:PlotChart.....DataProvider="{T_Data}"
         <mx:horizontalAxis>
            <mx:DateTimeAxis />
         </mx:horizontalAxis>
         <mx:verticalAxis>
            <mx:LinearAxis />
         </mx:verticalAxis>
         <mx:series>
            <mx:PlotSeries id=... yField="y_axis" xField="date" />
         </mx:series>
      </mx:PlotChart.....

       

       

       


      contents of big_data.xml

       

      <xml.....>
      <data>
      <el><cid>1</cid><date>1243814400982</date><y_axis>10</y_axis></el>
      <el><cid>2</cid><date>1243814401982</date><y_axis>12</y_axis></el>
      <el><cid>3</cid><date>1243814451982</date><y_axis>44</y_axis></el>
      <el><cid>4</cid><date>1243815451730</date><y_axis>21</y_axis></el>
      .........(10s of thousands of records like this)....
      </data>