1

I'm checking to see if anyone knows how to execute and read the response from a custom Geoprocessor published on an ArcGIS Server as a REST web service without the use of ArcObjects or an ArcGIS web API on the client side.

I've built a custom geoprocessor service and successfully published it to ArcGIS server as a web service. The service takes standard .Net objects as inputs and returns the same as outputs so there is no need for any ArcObjects on the client side. I simply want to execute the REST web service by using standard .Net tools like System.Net.HttpWebRequest and System.Net.HttpWebResponse classes similar to what is shown here.

I've used the ArcGIS Server services with ArcGIS Web API's in the past, but doing it this way is new to me.

1 Answer 1

1

You're going to want to refer to the ArcGIS REST API docs to see how to make your requests. This would also apply to your custom geoprocessing service.

I basically do just pass the request through WebRequest in .NET and do any tweaking as needed. A simple version may look something like this.

public object Get(string name)
{
    string query = "where=NAME LIKE '%" + name.ToUpper() + "%'&outFields=*&returnGeometry=false&returnDistinctValues=true&f=json";
    var request = WebRequest.Create(serviceURL + query);
    request.ContentType = "application/json";
    request.Method = "GET";
    var response = request.GetResponse();
    var stream = new System.IO.StreamReader(response.GetResponseStream());
    var o = Json.Decode(stream.ReadToEnd());
    response.Close();
    return o;
}

Once you have the request, you can parse the results into your own objects if you want and work with them from there.

4
  • Thanks for the link and the code sample. Let me see if it will get me where I need to be.
    – Tim Sexton
    Commented Oct 23, 2014 at 14:19
  • After several other issues, I finally got something working. Thanks for the pointers.
    – Tim Sexton
    Commented Oct 23, 2014 at 22:13
  • Any idea on how to handle the completeCallback and/or statusCallback on the geoprocessor from the client when using it this way?
    – Tim Sexton
    Commented Oct 24, 2014 at 12:49
  • OK - to check on the job status when using the REST services this way I found this link on the ArcGIS REST API: Spatial Analysis Service very helpful.
    – Tim Sexton
    Commented Oct 24, 2014 at 13:14

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.