AnsweredAssumed Answered

Asynchronous Geoprocessing Service Works with ArcExplorer, ArcMap, But Not JavaScript

Question asked by chuckf74 on Jun 25, 2012
Latest reply on Nov 23, 2012 by ciava.at
Hi All,

I did the "GP Service Step By Step: Watershed Walkthrough" http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#/GP_service_step_by_step_Watershed/00930000003q000000/ and successfully published an asynchronous geoprocessing service to create a watershed from a pour point.  Using ArcMap and ArcExplorer I was able to successfully connect and run to the geoprocessing service. 

Then I tried implementing it with the AGS JavaScript API, but whenever the job is submitted, almost immediately, I get an error "GP Task Create Watershed Polygon does not exist or is inaccessible".  Using Fiddler to see what happens, I can copy the URL and when I paste it into the browser I get this error "dojo.io.script.jsonp_dojoIoScript4._jsonpCallback({"error":{"code":500,"message":"GPTask 'Create Watershed Polygon' does not exist or is inaccessible.","details":[]}});"

Other geoprocessing services have worked for me, but they have been synchronous.  In the same location as the walkthrough above, I did the buffer features tutorial and everything worked great, but it was synchronous.  When I change the watershed service to synchronous, it times out. 

I feel like the problem must be in the syntax of possibly it's permissions.  I set up a proxy for it and am not really sure if that would be something that would cause a problem (worked for others).  Has anybody else been able to get the watershed walkthrough to work with the AGS Javascript API?  Does anybody have an idea of what could be wrong or how to troubleshoot this?

Here is a section of my code for the geoprocessor:

function computeWatershed(evt) {              map.graphics.clear();             var pointSymbol = new esri.symbol.SimpleMarkerSymbol();             pointSymbol.setOutline = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1);             pointSymbol.setSize(5);             pointSymbol.setColor(new dojo.Color([0, 255, 0, 0.25]));              var graphic = new esri.Graphic(evt.mapPoint, pointSymbol);             map.graphics.add(graphic);              var features = [];             features.push(graphic);             var featureSet = new esri.tasks.FeatureSet();             featureSet.features = features;              var pourPoint = featureSet             var params = { "Pour_Point": featureSet };              gp = new esri.tasks.Geoprocessor("http://[server]/ArcGIS/rest/services/CreateWatershed/GPServer/Create%20Watershed%20Polygon");             gp.setOutputSpatialReference({ wkid: 102100 });             gp.updateDelay = 20000;             gp.submitJob(params, getCallback, getCallbackStatus, getError);  }   function getCallback() {             alert('getCallback');  }   function getCallbackStatus() {             alert('getCallbackStatus');  }  function getError(error) {             alert('GP Error: ' + error); } 

Outcomes