3

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 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:// /ArcGIS/rest/service/GPTask/MapServer/jobs/

The page not found 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);
 }
2
  • You may need to add the 2 complete blocks of code so that we understand what you're doing. It may be a problem with the callback functions.
    – awesomo
    Commented Apr 10, 2013 at 15:56
  • I find out the issue. The above program is only work with ArcGIS 10.1 Server ,I think if I upgrade my 10.03 version server with 10.1 this feature will work
    – Shabeerali
    Commented Apr 11, 2013 at 9:54

1 Answer 1

4

I find out the issue. The above program is only work with ArcGIS 10.1 Server ,I think if I upgrade my 10.03 version server with 10.1 this feature will work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.