Select to view content in your preferred language

Flex issue - OnResult/OnFault for a querytask

1009
2
08-22-2011 10:19 AM
ShravanBonagiri
Deactivated User
Hi All,

I have an application that is up and running as expected. However, some times it doesn't load properly in a browser. But, when I close and reopen the URL it loads properly. I'm copying my code here. Would you guys please help me with my situation. Thanks in advance.

OnResult - the application loads a drop down box from an oracle table and sorts it alphabetically in the init() function. OnFault - it shows query processing error.
Code:
private function init():void
   {
    var query:com.esri.ags.tasks.supportClasses.Query = new com.esri.ags.tasks.supportClasses.Query();
    query.outFields = ["GIS.Samples.NAME"];
    query.outSpatialReference = new SpatialReference(102100);
    query.returnGeometry = true;
    query.where = "1=1";   
    queryTask.execute(query, new AsyncResponder(onResult, onFault));
    function onResult(featureSet:FeatureSet, token:Object = null):void
    { 
    
     function queryTask_executeCompleteHandler(event:QueryEvent):void
     {
      var array:Array = new Array();
     
      for each(var graphic:Graphic in event.featureSet.features)
      {
       array.push(graphic.attributes["GIS.Samples.NAME"].toString());
      }
      array.sort();
     
      var arrayList2:ArrayList = new ArrayList();
      for each (var NAME:String in array)
      {
       for each (var graphic1:Graphic in event.featureSet.features)
       {
        if (graphic1.attributes["GIS.Samples.NAME"].toString() == name)
        {
         arrayList2.addItem(graphic1);
         break;
        }
       }
      }
     
      ddList.dataProvider = arrayList2;     
     }
    }
    function onFault(info:Object, token:Object = null):void
    {
     Alert.show("There was a problem processing your query.");
    }
   }
Tags (2)
0 Kudos
2 Replies
DrewDowling
Frequent Contributor
I had a problem in the past that sounds similar. The problem was with map services going to "sleep" after long periods of inactivity. The first query to a mapservice in the morning would fail, after that it would work fine. To get around this I implemented a monitoring service (downloaded from the samples section) that makes a call to each map service once an hour to keep at least one instance active. It also emails me if services are not working.

there were a couple of posts about this issue over the last 2 years or so. try searching for "sleeping services" or something like that.

Another possible solution is to try increasing the request timeout setting on the mapservice and see if  that makes a difference.

Hope this helps
0 Kudos
ShravanBonagiri
Deactivated User
Thanks Drew for your solution.

I followed this URL to solve the problem: IIS application pool settings needs to be changed.
http://forums.arcgis.com/threads/26850-Sleeping-Server-Services-slow-to-start
0 Kudos