[GIS] How to setup proxy and use “POST” method when executing Geoprocessing Service in ArcGIS Server Javascript API

arcgis-javascript-apigeoprocessing-servicehttp-post

I am passing five featuresets to a ArcGIS Server Javascript API. When I do that I get 'Deferred Object not defined error'. Then I tried to use dojo.Deferred(). At that point the error goes away. But nothing happens. In Fidller, no request information is logged.
Then I removed some of the records from the featureset and I can see the request is logged in the fiddler and the request reaches the server. Processing fails, because all required data is not available.
Can some one help understand how to setup proxy server in ArcGIS Server 10.1 and use POST request it in JS API for Synchronous and Asynchronous Geoprocessing? Also I can someone show me how to use dojo.deferred() when using GP Service.

Thanks
Cyril

Best Answer

You need a proxy page in mainly two conditions:

  1. The application uses GET requests that exceed 2048 characters.

  2. The JavaScript makes a HTTP (besides Images & Scripts) request to a server on a different domain, which does not support JSONP.

You are facing the first problem:

I would request you to look at the following page: Using the proxy page

This page will give you basic information about a proxy page, as well as how to set it up.

You do not need to explicitly make the request a POST request if you are using ArcGIS API classes. They automatically become a POST request whenever needed.

And you don't actually need a dojo.deferred(). If you have set up the handlers properly, it should work fine.