Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to obtain the shapefile output that I am receiving from the gpTool, which is hosted on the ArcServer, and placing it on the Map using,

gp.getResultImageLayer(jobInfo.jobId,"final_shp", imageParams, function(gpLayer) {
            map.addLayer(gpLayer);
          });

where gp is,

gp = new esri.tasks.Geoprocessor("http://domain/ArcGIS/rest/services/webGIS/Shock_Models/GPServer/Income_Log");

This is how it has been explained in the resource but not sure why it is not working.

The firebug gives me,

NetworkError: 500 Internal Server Error - http://webgis.arizona.edu/ArcGIS/rest/services/webGIS/Shock_Models/GPServer/Income_Log/jobs/j10905b1a50f141e0b62f1ab8ef230f51/results/final_shp?dpi=96&transparent=true&format=png8&imageSR=102100&f=image&bbox=%7B%22xmin%22%3A-14519891.438356264%2C%22ymin%22%3A637618.0139790997%2C%22xmax%22%3A-6692739.741956295%2C%22ymax%22%3A6507981.786279075%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%7D%7D&bboxSR=102100&size=800%2C600

And when I goto that particular link, I get this error,

Server Error - Object reference not set to an instance of an object.

Any idea how I can correct it?

UPDATE

I was told to use fiddler and see the error details that is occurring over the network and this is the output that I got,

SESSION STATE: Done. Response Entity Size: 849 bytes.

== FLAGS ================== BitFlags: [ClientPipeReused, ServerPipeReused] 0x18 X-CLIENTPORT: 2010 X-RESPONSEBODYTRANSFERLENGTH: 849 X-EGRESSPORT: 2023 X-HOSTIP: 128.196.53.161 X-PROCESSINFO: firefox:2248 X-CLIENTIP: 127.0.0.1 X-SERVERSOCKET: REUSE ServerPipe#2

== TIMING INFO ============ ClientConnected: 15:53:51.383 ClientBeginRequest: 15:53:51.494 GotRequestHeaders: 15:53:51.494 ClientDoneRequest: 15:53:51.494 Determine Gateway: 0ms DNS Lookup: 0ms TCP/IP Connect: 0ms HTTPS Handshake: 0ms ServerConnected: 15:52:45.077 FiddlerBeginRequest: 15:53:51.495 ServerGotRequest: 15:53:51.495 ServerBeginResponse: 15:53:51.679 GotResponseHeaders: 15:53:51.679 ServerDoneResponse: 15:53:51.679 ClientBeginResponse: 15:53:51.679 ClientDoneResponse: 15:53:51.679

Overall Elapsed: 00:00:00.1850106

The response was buffered before delivery to the client.

== WININET CACHE INFO ============ This URL is not present in the WinINET cache. [Code: 2] * Note: Data above shows WinINET's current cache state, not the state at the time of the request. * Note: Data above shows WinINET's Medium Integrity (non-Protected Mode) cache only.

But I am still confused as to what the error is? This is the application.

share|improve this question
    
Did you fix it? It looks like the application is working... –  Mintx Nov 16 '12 at 19:51
    
:) yes will post the answer soon, I am really swamped right now. –  Sam007 Nov 16 '12 at 20:24
add comment

1 Answer

up vote 2 down vote accepted

Ok guys. After a long fought battle I was able to find the solution. A special thanks to Domenico Ciavarella. This is his blog and it beautifully explains how it is done (though you will have to use google translate and convert it to english from italian).

Now, the code that I used was correct. The problem was in the manner Geoprocessing Tool needs to be created. Yes, this might sound strange but the truth is that if you want JavaScript API to display the resultLayer, the geoprocessing Tool hosted on ArcServer needs to be also provided a Map Server (This is true at least in ArcServer 10.03). The blog explains how to create the MapService and use it along with the geoprocessing Tool.

The another reason I know this to be true, is because the previous geoprocessing tool which was failing on my JavaScript Application was working fine on Flex API. Only when I added the MapService to it does it now work as it should.

Finally I was able to resolve this problem. Strangely, very few examples were out there using getResultImageLayer. Probably this is the reason.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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