Select to view content in your preferred language

Set timelimit and time out in Flex Compiler

889
3
07-06-2011 12:58 PM
francescodi_vito
Deactivated User
Hy guys
i have a GP Service that takes more time to run. And so i must set i time limit or timeout in flex compiler
i wrote this in flex compiler
Additional Compiler Argument:
-locale en_US -source-path=locale/{locale} -keep-all-type-selectors=true -default-script-limits 5000 6000

but when i run my gp i Flex Viewer App. i have always the error that ShackWave Flash not respond
what i do to set the time out of Flex Viewer App.? or i have to set a time out for the widget that call the GP Service?
Help please
Tags (2)
0 Kudos
3 Replies
BjornSvensson
Esri Regular Contributor
Is your GP task running as "Synchronous" or "Asynchronous"?

Asynchronous execution is better for slower running GP tasks.

From the documentation:
In synchronous execution, the client executes the task and waits for a response before proceeding. The Supported Operations section of the Services Directory displays "Execute Task" for synchronous tasks.
In asynchronous execution, the client submits a job, then verifies that it was successful using a unique job ID. When the task completes, the client can retrieve the results. The Supported Operations section of the Services Directory displays "Submit Job" for asynchronous tasks.
http://help.arcgis.com/en/webapi/flex/help/index.html#/Geoprocessing_tasks/017p00000003000000/
0 Kudos
francescodi_vito
Deactivated User
hi bjorn
my GP Service is Synchronous and this is the script that i wrote for call him in FlexViewer
<fx:Script>
  <![CDATA[
   import com.esri.ags.FeatureSet;
   import com.esri.ags.Graphic;
   import com.esri.ags.SpatialReference;
   import com.esri.ags.events.GeoprocessorEvent;
   import com.esri.ags.events.GraphicsLayerEvent;
   import com.esri.ags.events.MapMouseEvent;
   import com.esri.ags.geometry.Geometry;
   import com.esri.ags.symbols.SimpleFillSymbol;
   import com.esri.ags.symbols.SimpleLineSymbol;
   import com.esri.ags.symbols.SimpleMarkerSymbol;
   import com.esri.ags.tasks.Geoprocessor;
   
   import mx.controls.Alert;
   import mx.rpc.events.FaultEvent;
   
   private function startGeoProcess(event:MouseEvent):void
   {
    
    
    var parms:Object = new Object();
    parms.Condizione = String(condizione.text);
    parms.Valore = Number(valore.text);
    
    
    var geoprocessTask:Geoprocessor = new Geoprocessor();
    geoprocessTask.outSpatialReference = map.spatialReference;
    geoprocessTask.showBusyCursor = true;
    geoprocessTask.url = "http://193.204.163.134/ArcGIS/rest/services/Peso_di_Volume_Medio/GPServer/PesodiVolumeMedio";
    geoprocessTask.useAMF = false;
    geoprocessTask.execute(parms);
    geoprocessTask.addEventListener(GeoprocessorEvent.EXECUTE_COMPLETE, executeCompleteHandler);
    geoprocessTask.addEventListener(FaultEvent.FAULT, faultHandler);
   }
   
   private function executeCompleteHandler(event:GeoprocessorEvent):void
   {
    
    
    var myPointSymbol:SimpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, 0x1AA1D3, 0.2);
        
    
    for each (var graphic:Graphic in event.executeResult.results[0].value.features)
    {
     graphic.symbol = myPointSymbol;
     graphicsLayer.add(graphic);
     map.addLayer(graphicsLayer);
     
    }
   }
   
   private function faultHandler(event:FaultEvent):void
   {
    if (event.type == "fault"
     && event.fault.name == 'Error'
     && event.fault.faultCode == '500'
     && event.fault.faultString == 'Error Executing Task')
    {
     Alert.show("Oops - no results.  Try clicking in an ocean...");
    }
    else
    {
     Alert.show("Unexpected fault:\n" + event.toString());
    }
   }
  ]]>
 </fx:Script>

And it's ok if the model responds immediately.

I tried to write this code for Asynchronus property. And i changed the script with

geoprocessTask.submitJob(parms);
and
geoprocessTask.addEventListener(GeoprocessorEvent.JOB_COMPLETE, executeCompleteHandler);

But in this way the widget don't give me a graphic response.
Why Bjorn? Where is the error?
Please Help me
0 Kudos
francescodi_vito
Deactivated User
What do you think Bjorn?
0 Kudos