AnsweredAssumed Answered

URL " http:// <server>/ArcGIS/rest/service/GPTask/MapServer/jobs/<jobid>" not found

Question asked by salicmd on Apr 10, 2013
Latest reply on Apr 11, 2013 by salicmd
Hi
I am Using ArcGIS Server 10.03 SP3. I created a geoprocessing service in the server which returns a result map service. I successfully created the gp service and map service with same name. I need to display the result in my application using ArcGIS Javascript API v3.3.
The logic works like the sample application  http://developers.arcgis.com/en/javascript/samples/gp_resultmapservice/


I tested the gp service in the REST Web interface and successfully executed.The result map is obtaining after completion of the task.

But when I use it in the JS API (ver. 3.3) front end , the fire bug tool shows success execution of the gp task , but when it executes

map.addLayer(gpLayer);

the response shows


    dojo.io.script.jsonp_dojoIoScript9._jsonpCallback({"currentVersion":10.03,"error":{"code":400,"message":"Unable to complete  operation.","details":["Invalid URL"]}});


When I tried the url  http:// <mygisServer>/ArcGIS/rest/service/GPTask/MapServer/jobs/<jobid> 


The page not found error shows.

When I changed the code with

    gp.getResultImageLayer(jobinfo.jobId, "output", imageParameters, function (gpLayer) {
     map.addLayer(gpLayer)
    });

I got  the result .

Can anybody help to find the exact reason? I need to include the service via ArcGISDynamicMapServiceLayer


Here is the My sample code that Did not work


    function applyGPTask() {
    var gpServiceUrl = "http://localhost/ArcGIS/rest/services/GPTasks/GPServer/GPTask";
    gp = new esri.tasks.Geoprocessor(gpServiceUrl);
    var params = {
        param1: "SUBDIVID=202",
        param2:"value2",
        param3: "value3"


     };   
      gp.setOutputSpatialReference({ wkid: 4326 });
      gp.submitJob(params, gpJobComplete, gpJobStatus, gpJobFailed);
     }


    function gpJobComplete(jobinfo) {   
    var mapurl = "http://localhost/ArcGIS/rest/services/GPTasks/MapServer/jobs/" + jobinfo.jobId;
    var gpLayer = new esri.layers.ArcGISDynamicMapServiceLayer(mapurl, {
        "id": "gpoutput",
        "opacity": 0.7
    });
        map.addLayer(gpLayer);
     }

Outcomes