Created
July 30, 2013 03:07
-
-
Save mapbutcher/6109889 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Calls the Arc GIS server. | |
/// </summary> | |
/// <param name="URI">The URI.</param> | |
/// <param name="response">The response.</param> | |
static public void CallArcGISServer(string URI, out JObject response) | |
{ | |
Stream data = null; | |
StreamReader reader = null; | |
try | |
{ | |
//log the request string | |
Logger.SystemInfo("Sending request to AGS: " + URI); | |
WebClientWrapper client = new WebClientWrapper(); | |
var credential = CredentialCache.DefaultNetworkCredentials; | |
client.Credentials = credential; | |
data = client.OpenRead(URI); | |
reader = new StreamReader(data); | |
string s = reader.ReadToEnd(); | |
response = JObject.Parse(s); | |
} | |
catch (Exception ex) | |
{ | |
Logger.SystemError("An error occured when calling ArcGIS Server" + ex.ToString()); | |
throw; | |
} | |
finally | |
{ | |
if (data != null) | |
data.Close(); | |
if (reader != null) | |
reader.Close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment