Hy guysi develop a model ain ArcGis 10 and i publish it as a Map Service with a Tool Layer. The GP Service is Synchronus and he works very well. i need to change the GP Service in Asynchronous but i tried to change my script but don't works.i post here my script for my model synchronus
<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2010 ESRI
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions. See use restrictions in the file:
// <install location>/License.txt
//
////////////////////////////////////////////////////////////////////////////////
-->
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:viewer="com.esri.viewer.*"
height="192">
<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/ENEA/Cap_Term_Vol_MAX/GPServer/CapTermVolMAX";
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, 12, 0x1AA1D3, 0.3);
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>
<fx:Declarations>
<esri:GraphicsLayer id="graphicsLayer"/>
</fx:Declarations>
<viewer:WidgetTemplate id="helloWorld"
width="390" height="192">
<s:Label text="RICERCA CAPACITA' TERMICA MIN" y="10" horizontalCenter="0" color="#000000" fontWeight="bold"/>
<s:TextInput id="condizione"
width="66"
paddingLeft="0"
paddingRight="0"
text=">" y="48" horizontalCenter="0" textAlign="center"/>
<s:Label text="inserisci valore" y="76" horizontalCenter="0"/>
<s:Button
label="Ricerca"
click="startGeoProcess(event)"
bottom="5" left="10" cornerRadius="7"/>
<s:Button
label="Clear"
click="graphicsLayer.clear()"
bottom="5" right="9" cornerRadius="7"/>
<s:TextInput id="valore"
width="66"
paddingLeft="0"
paddingRight="0"
text="2" y="92" horizontalCenter="0" textAlign="center"/>
<s:Label text="inserisci operatore matematico ( > / < )" y="32" horizontalCenter="0"/>
</viewer:WidgetTemplate>
</viewer:BaseWidget>
can anybody tell me how to modify my script for set my GP Service as Asynchronous?help please Thanks