[mapguide-commits] r7498 - trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun May 19 14:50:21 PDT 2013
Author: jng
Date: 2013-05-19 14:50:21 -0700 (Sun, 19 May 2013)
New Revision: 7498
Modified:
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs
Log:
#2269: This submission adds large file upload support for the SetResourceData operation in the HttpServerConnection. For files under 50MB, we use the old code path, otherwise we use a specialized code path that streams the file upload from a temp file source instead of funnelling into a temporary MemoryStream (obvious cause of OutOfMemoryException objects being thrown for SetResourceData calls with really large files)
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2013-05-17 13:48:43 UTC (rev 7497)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs 2013-05-19 21:50:21 UTC (rev 7498)
@@ -45,6 +45,7 @@
using System.Drawing;
using OSGeo.MapGuide.ObjectModels.FeatureSource;
using OSGeo.MapGuide.MaestroAPI.SchemaOverrides;
+using System.Diagnostics;
namespace OSGeo.MapGuide.MaestroAPI
{
@@ -455,51 +456,175 @@
public override void SetResourceData(string resourceid, string dataname, ResourceDataType datatype, System.IO.Stream stream, Utility.StreamCopyProgressDelegate callback)
{
+ //Protect against session expired
+ if (this.m_autoRestartSession && m_username != null && m_password != null)
+ this.DownloadData(m_reqBuilder.GetSiteVersion());
-#if DEBUG_LASTMESSAGE
- using (System.IO.Stream s = System.IO.File.Open("lastSaveData.bin", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
- Utility.CopyStream(stream, s);
-#endif
- if (stream.CanSeek)
- stream.Position = 0;
+ //Use the old code path if stream is under 50MB (implying seekable too)
+ if (stream.CanSeek && stream.Length < 50 * 1024 * 1024)
+ {
+ #if DEBUG_LASTMESSAGE
+ using (System.IO.Stream s = System.IO.File.Open("lastSaveData.bin", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.None))
+ Utility.CopyStream(stream, s);
+ #endif
+ if (stream.CanSeek)
+ stream.Position = 0;
- System.IO.MemoryStream outStream = new System.IO.MemoryStream();
-#if DEBUG_LASTMESSAGE
- try
- {
-#endif
- System.Net.WebRequest req = m_reqBuilder.SetResourceData(resourceid, dataname, datatype, outStream, stream, callback);
- req.Credentials = _cred;
- outStream.Position = 0;
-
- //Protect against session expired
- if (this.m_autoRestartSession && m_username != null && m_password != null)
- this.DownloadData(m_reqBuilder.GetSiteVersion());
+ System.IO.MemoryStream outStream = new System.IO.MemoryStream();
+ #if DEBUG_LASTMESSAGE
+ try
+ {
+ #endif
+ System.Net.WebRequest req = m_reqBuilder.SetResourceData(resourceid, dataname, datatype, outStream, stream, callback);
+ req.Credentials = _cred;
+ outStream.Position = 0;
- //TODO: We need a progress bar for the upload....
- req.Timeout = 1000 * 60 * 15;
- using(System.IO.Stream rs = req.GetRequestStream())
- {
- Utility.CopyStream(outStream, rs);
- rs.Flush();
- }
- using (System.IO.Stream resp = req.GetResponse().GetResponseStream())
- {
- //Do nothing... there is no return value
- }
-#if DEBUG_LASTMESSAGE
- }
- catch
- {
- using (System.IO.Stream s = System.IO.File.OpenWrite("lastPost.txt"))
- Utility.CopyStream(outStream, s);
+ //TODO: We need a progress bar for the upload....
+ req.Timeout = 1000 * 60 * 15;
+ using (System.IO.Stream rs = req.GetRequestStream())
+ {
+ Utility.CopyStream(outStream, rs);
+ rs.Flush();
+ }
+ using (System.IO.Stream resp = req.GetResponse().GetResponseStream())
+ {
+ //Do nothing... there is no return value
+ }
+ #if DEBUG_LASTMESSAGE
+ }
+ catch
+ {
+ using (System.IO.Stream s = System.IO.File.OpenWrite("lastPost.txt"))
+ Utility.CopyStream(outStream, s);
- throw;
- }
-#endif
-
+ throw;
+ }
+ #endif
+ }
+ else
+ {
+ //Dump to temp file
+ string tmp = Path.GetTempFileName();
+ try
+ {
+ using (var fw = File.OpenWrite(tmp))
+ {
+ Utility.CopyStream(stream, fw);
+ }
+ var fi = new FileInfo(tmp);
+ NameValueCollection nvc = m_reqBuilder.SetResourceDataParams(resourceid, dataname, datatype);
+ nvc.Add("DATALENGTH", fi.Length.ToString());
+ HttpUploadFile(m_reqBuilder.HostURI, tmp, "DATA", "application/octet-stream", nvc, callback);
+ }
+ finally
+ {
+ if (File.Exists(tmp))
+ {
+ try
+ {
+ File.Delete(tmp);
+ Debug.WriteLine("Deleted: " + tmp);
+ }
+ catch { }
+ }
+ }
+ }
}
+
+ //Source: http://stackoverflow.com/questions/566462/upload-files-with-httpwebrequest-multipart-form-data
+ private void HttpUploadFile(string url, string file, string paramName, string contentType, NameValueCollection nvc, Utility.StreamCopyProgressDelegate callback)
+ {
+ Debug.WriteLine(string.Format("Uploading {0} to {1}", file, url));
+ string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
+ string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}";
+ string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
+ byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");
+ byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
+
+ HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
+ wr.ContentType = "multipart/form-data; boundary=" + boundary;
+ wr.Method = "POST";
+ //DO NOT BUFFER. Otherwise this will still OOM on really large files
+ wr.AllowWriteStreamBuffering = false;
+ wr.KeepAlive = true;
+ wr.Credentials = _cred;
+
+ //Pre-compute request body size
+ {
+ long contentLength = 0L;
+ foreach (string key in nvc.Keys)
+ {
+ string formitem = string.Format(formdataTemplate, key, nvc[key]);
+ byte[] formitembytes = System.Text.Encoding.ASCII.GetBytes(formitem);
+ contentLength += formitembytes.Length;
+ contentLength += boundarybytes.Length;
+ }
+ contentLength += boundarybytes.Length;
+ string header = string.Format(headerTemplate, paramName, file, contentType);
+ byte[] headerbytes = System.Text.Encoding.ASCII.GetBytes(header);
+ contentLength += headerbytes.Length;
+ var fi = new FileInfo(file);
+ contentLength += fi.Length;
+ contentLength += trailer.Length;
+
+ wr.ContentLength = contentLength;
+ }
+
+ using (Stream rs = wr.GetRequestStream())
+ {
+ foreach (string key in nvc.Keys)
+ {
+ rs.Write(boundarybytes, 0, boundarybytes.Length);
+ string formitem = string.Format(formdataTemplate, key, nvc[key]);
+ byte[] formitembytes = System.Text.Encoding.ASCII.GetBytes(formitem);
+ rs.Write(formitembytes, 0, formitembytes.Length);
+ }
+ rs.Write(boundarybytes, 0, boundarybytes.Length);
+
+ string header = string.Format(headerTemplate, paramName, file, contentType);
+ byte[] headerbytes = System.Text.Encoding.ASCII.GetBytes(header);
+ rs.Write(headerbytes, 0, headerbytes.Length);
+
+ FileStream fileStream = new FileStream(file, FileMode.Open, FileAccess.Read);
+ /*
+ byte[] buffer = new byte[4096];
+ int bytesRead = 0;
+ while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
+ {
+ rs.Write(buffer, 0, bytesRead);
+ }
+ */
+ Utility.CopyStream(fileStream, rs, callback, 1024);
+ fileStream.Close();
+
+ rs.Write(trailer, 0, trailer.Length);
+ rs.Close();
+
+ WebResponse wresp = null;
+ try
+ {
+ wresp = wr.GetResponse();
+ Stream stream2 = wresp.GetResponseStream();
+ StreamReader reader2 = new StreamReader(stream2);
+ Debug.WriteLine(string.Format("File uploaded, server response is: {0}", reader2.ReadToEnd()));
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Error uploading file", ex);
+ if (wresp != null)
+ {
+ wresp.Close();
+ wresp = null;
+ }
+ }
+ finally
+ {
+ wr = null;
+ }
+ }
+ }
+
public override void SetResourceXmlData(string resourceid, System.IO.Stream content, System.IO.Stream header)
{
bool exists = ResourceExists(resourceid);
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs 2013-05-17 13:48:43 UTC (rev 7497)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI.Http/RequestBuilder.cs 2013-05-19 21:50:21 UTC (rev 7498)
@@ -26,29 +26,29 @@
namespace OSGeo.MapGuide.MaestroAPI
{
- /// <summary>
- /// Collection class for building web requests to the MapGuide Server
- /// </summary>
- internal class RequestBuilder
- {
+ /// <summary>
+ /// Collection class for building web requests to the MapGuide Server
+ /// </summary>
+ internal class RequestBuilder
+ {
private string m_userAgent = "MapGuide Maestro API";
- private string m_hosturi;
- private string m_sessionID = null;
- private string m_locale = null;
+ private string m_hosturi;
+ private string m_sessionID = null;
+ private string m_locale = null;
- internal RequestBuilder(Uri hosturi, string locale, string sessionid, bool bIncludeSessionIdInRequests)
- {
- m_hosturi = hosturi.AbsoluteUri;
- m_locale = locale;
- m_sessionID = sessionid;
+ internal RequestBuilder(Uri hosturi, string locale, string sessionid, bool bIncludeSessionIdInRequests)
+ {
+ m_hosturi = hosturi.AbsoluteUri;
+ m_locale = locale;
+ m_sessionID = sessionid;
m_userAgent += " v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
this.IncludeSessionIdInRequestParams = bIncludeSessionIdInRequests;
- }
+ }
- internal RequestBuilder(Uri hosturi, string locale)
- : this (hosturi, locale, null, false)
- {
- }
+ internal RequestBuilder(Uri hosturi, string locale)
+ : this (hosturi, locale, null, false)
+ {
+ }
/// <summary>
/// Indicates if the session id should be included as the SESSION request parameter. This needs to be set to true if
@@ -57,161 +57,161 @@
/// </summary>
internal bool IncludeSessionIdInRequestParams { get; private set; }
- internal string Locale { get { return m_locale; } }
+ internal string Locale { get { return m_locale; } }
- internal string CreateSession()
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CREATESESSION");
- param.Add("VERSION", "1.0.0");
- param.Add("FORMAT", "text/xml");
+ internal string CreateSession()
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CREATESESSION");
+ param.Add("VERSION", "1.0.0");
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- internal string GetSiteVersion()
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETSITEVERSION");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ internal string GetSiteVersion()
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETSITEVERSION");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ param.Add("LOCALE", m_locale);
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- internal string GetFeatureProviders()
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ internal string GetFeatureProviders()
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETFEATUREPROVIDERS");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETFEATUREPROVIDERS");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
- return m_hosturi + "?" + EncodeParameters(param);
+ param.Add("LOCALE", m_locale);
+ return m_hosturi + "?" + EncodeParameters(param);
- }
+ }
- internal string EnumerateResources(string startingpoint, int depth, string type, bool computeChildren)
- {
- if (type == null)
- type = "";
+ internal string EnumerateResources(string startingpoint, int depth, string type, bool computeChildren)
+ {
+ if (type == null)
+ type = "";
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "ENUMERATERESOURCES");
- param.Add("VERSION", "1.0.0");
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "ENUMERATERESOURCES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", startingpoint);
- param.Add("DEPTH", depth.ToString());
- param.Add("TYPE", type);
+ param.Add("LOCALE", m_locale);
+ param.Add("RESOURCEID", startingpoint);
+ param.Add("DEPTH", depth.ToString());
+ param.Add("TYPE", type);
param.Add("COMPUTECHILDREN", computeChildren ? "1" : "0");
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- internal string TestConnection(string featuresource)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ internal string TestConnection(string featuresource)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "TESTCONNECTION");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "TESTCONNECTION");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
param.Add("RESOURCEID", featuresource);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- internal System.Net.WebRequest TestConnectionPost(string providername, NameValueCollection parameters, System.IO.Stream outStream)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ internal System.Net.WebRequest TestConnectionPost(string providername, NameValueCollection parameters, System.IO.Stream outStream)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "TESTCONNECTION");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "TESTCONNECTION");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("PROVIDER", providername);
- System.Text.StringBuilder sb = new System.Text.StringBuilder();
- foreach(string k in parameters)
- {
- sb.Append(k);
- sb.Append("=");
- sb.Append(parameters[k]);
- sb.Append(";");
- }
- if (sb.Length != 0)
- sb.Length = sb.Length - 1;
+ param.Add("PROVIDER", providername);
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ foreach(string k in parameters)
+ {
+ sb.Append(k);
+ sb.Append("=");
+ sb.Append(parameters[k]);
+ sb.Append(";");
+ }
+ if (sb.Length != 0)
+ sb.Length = sb.Length - 1;
- //TODO: Figure out how to encode the '%' character...
- param.Add("CONNECTIONSTRING", sb.ToString());
+ //TODO: Figure out how to encode the '%' character...
+ param.Add("CONNECTIONSTRING", sb.ToString());
- string boundary;
- System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
- EncodeFormParameters(boundary, param, outStream);
- req.ContentLength = outStream.Length;
- return req;
- }
+ string boundary;
+ System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
+ EncodeFormParameters(boundary, param, outStream);
+ req.ContentLength = outStream.Length;
+ return req;
+ }
- internal string TestConnection(string providername, NameValueCollection parameters)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ internal string TestConnection(string providername, NameValueCollection parameters)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "TESTCONNECTION");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "TESTCONNECTION");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("PROVIDER", providername);
- System.Text.StringBuilder sb = new System.Text.StringBuilder();
- foreach(string k in parameters)
- {
- sb.Append(k);
- sb.Append("=");
- sb.Append(parameters[k]);
- sb.Append(";");
- }
- if (sb.Length != 0)
- sb.Length = sb.Length - 1;
+ param.Add("PROVIDER", providername);
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ foreach(string k in parameters)
+ {
+ sb.Append(k);
+ sb.Append("=");
+ sb.Append(parameters[k]);
+ sb.Append(";");
+ }
+ if (sb.Length != 0)
+ sb.Length = sb.Length - 1;
- //TODO: Figure out how to encode the '%' character...
- param.Add("CONNECTIONSTRING", sb.ToString());
+ //TODO: Figure out how to encode the '%' character...
+ param.Add("CONNECTIONSTRING", sb.ToString());
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- internal string SessionID
- {
- get { return m_sessionID; }
- set { m_sessionID = value; }
- }
+ internal string SessionID
+ {
+ get { return m_sessionID; }
+ set { m_sessionID = value; }
+ }
private string EncodeParameters(NameValueCollection param, bool bAddSessionId)
{
@@ -228,285 +228,301 @@
return sb.ToString(0, sb.Length - 1);
}
- private string EncodeParameters(NameValueCollection param)
- {
+ private string EncodeParameters(NameValueCollection param)
+ {
return EncodeParameters(param, true);
- }
+ }
- private string EncodeParameter(string name, string value)
- {
- return System.Web.HttpUtility.UrlEncode(name) + "=" + System.Web.HttpUtility.UrlEncode(value);
- }
+ private string EncodeParameter(string name, string value)
+ {
+ return System.Web.HttpUtility.UrlEncode(name) + "=" + System.Web.HttpUtility.UrlEncode(value);
+ }
- public string GetMapDWF(string id)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public string GetMapDWF(string id)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETMAP");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETMAP");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("DWFVERSION", "6.01");
- param.Add("EMAPVERSION", "1.0");
- param.Add("MAPDEFINITION", id);
+ param.Add("DWFVERSION", "6.01");
+ param.Add("EMAPVERSION", "1.0");
+ param.Add("MAPDEFINITION", id);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string GetResourceContent(string id)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public string GetResourceContent(string id)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETRESOURCECONTENT");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETRESOURCECONTENT");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
+ param.Add("RESOURCEID", id);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string GetResourceData(string id, string name)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public string GetResourceData(string id, string name)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETRESOURCEDATA");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETRESOURCEDATA");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
- param.Add("DATANAME", name);
+ param.Add("RESOURCEID", id);
+ param.Add("DATANAME", name);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string EnumerateResourceData(string id)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public string EnumerateResourceData(string id)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "ENUMERATERESOURCEDATA");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "ENUMERATERESOURCEDATA");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
+ param.Add("RESOURCEID", id);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string DeleteResourceData(string id, string name)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public string DeleteResourceData(string id, string name)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "DELETERESOURCEDATA");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "DELETERESOURCEDATA");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
- param.Add("DATANAME", name);
+ param.Add("RESOURCEID", id);
+ param.Add("DATANAME", name);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string GetResourceHeader(string id)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public string GetResourceHeader(string id)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETRESOURCEHEADER");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETRESOURCEHEADER");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
+ param.Add("RESOURCEID", id);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string SetResource(string id)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public string SetResource(string id)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "SETRESOURCE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "SETRESOURCE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
+ param.Add("RESOURCEID", id);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- private void EncodeFormParameters(string boundary, NameValueCollection param, System.IO.Stream responseStream)
- {
- foreach(string s in param.Keys)
- {
+ private void EncodeFormParameters(string boundary, NameValueCollection param, System.IO.Stream responseStream)
+ {
+ foreach(string s in param.Keys)
+ {
string val = param[s];
if (string.IsNullOrEmpty(val))
continue;
System.IO.MemoryStream content = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(val));
- AppendFormContent(s, null, boundary, responseStream, content, null);
- }
- }
+ AppendFormContent(s, null, boundary, responseStream, content, null);
+ }
+ }
- /// <summary>
- /// Writes a value/file to a form-multipart HttpRequest stream
- /// </summary>
- /// <param name="name">The name of the parameter</param>
- /// <param name="filename">The name of the file uploaded, set to null if this parameter is not a file</param>
- /// <param name="boundary">The request boundary string</param>
- /// <param name="responseStream">The stream to write to</param>
- /// <param name="dataStream">The stream to read from. When using non-file parameters, use UTF8 encoding</param>
- private void AppendFormContent(string name, string filename, string boundary, System.IO.Stream responseStream, System.IO.Stream dataStream, Utility.StreamCopyProgressDelegate callback)
- {
- string contenttype;
- if (filename == null)
- {
- filename = "";
- contenttype = "";
- }
- else
- {
- filename = " filename=\"" + filename + "\"";
- contenttype = "\r\nContent-Type: application/octet-stream";
- }
+ /// <summary>
+ /// Writes a value/file to a form-multipart HttpRequest stream
+ /// </summary>
+ /// <param name="name">The name of the parameter</param>
+ /// <param name="filename">The name of the file uploaded, set to null if this parameter is not a file</param>
+ /// <param name="boundary">The request boundary string</param>
+ /// <param name="responseStream">The stream to write to</param>
+ /// <param name="dataStream">The stream to read from. When using non-file parameters, use UTF8 encoding</param>
+ private void AppendFormContent(string name, string filename, string boundary, System.IO.Stream responseStream, System.IO.Stream dataStream, Utility.StreamCopyProgressDelegate callback)
+ {
+ string contenttype;
+ if (filename == null)
+ {
+ filename = "";
+ contenttype = "";
+ }
+ else
+ {
+ filename = " filename=\"" + filename + "\"";
+ contenttype = "\r\nContent-Type: application/octet-stream";
+ }
- byte[] headers = System.Text.Encoding.UTF8.GetBytes(string.Concat(new String[] { "Content-Disposition: form-data; name=\"" + name + "\";" + filename , "\"", contenttype, "\r\n\r\n"}));
- responseStream.Write(headers, 0, headers.Length);
+ byte[] headers = System.Text.Encoding.UTF8.GetBytes(string.Concat(new String[] { "Content-Disposition: form-data; name=\"" + name + "\";" + filename , "\"", contenttype, "\r\n\r\n"}));
+ responseStream.Write(headers, 0, headers.Length);
Utility.CopyStream(dataStream, responseStream, callback, 0);
- byte[] footer = System.Text.Encoding.UTF8.GetBytes("\r\n--" + boundary + "\r\n");
- responseStream.Write(footer, 0, footer.Length);
- }
+ byte[] footer = System.Text.Encoding.UTF8.GetBytes("\r\n--" + boundary + "\r\n");
+ responseStream.Write(footer, 0, footer.Length);
+ }
- public System.Net.WebRequest SetResource(string id, System.IO.Stream outStream, System.IO.Stream content, System.IO.Stream header)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ public System.Net.WebRequest SetResource(string id, System.IO.Stream outStream, System.IO.Stream content, System.IO.Stream header)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "SETRESOURCE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "SETRESOURCE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
+ param.Add("RESOURCEID", id);
- string boundary;
- System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
+ string boundary;
+ System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
- EncodeFormParameters(boundary, param, outStream);
- if (content != null)
- AppendFormContent("CONTENT", "content.xml", boundary, outStream, content, null);
- if (header != null)
- AppendFormContent("HEADER", "header.xml", boundary, outStream, header, null);
+ EncodeFormParameters(boundary, param, outStream);
+ if (content != null)
+ AppendFormContent("CONTENT", "content.xml", boundary, outStream, content, null);
+ if (header != null)
+ AppendFormContent("HEADER", "header.xml", boundary, outStream, header, null);
- req.ContentLength = outStream.Length;
- return req;
- }
+ req.ContentLength = outStream.Length;
+ return req;
+ }
+ internal NameValueCollection SetResourceDataParams(string resourceid, string dataname, ResourceDataType datatype)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "SETRESOURCEDATA");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("CLIENTAGENT", m_userAgent);
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
- public System.Net.WebRequest SetResourceData(string id, string dataname, ResourceDataType datatype, System.IO.Stream outStream, System.IO.Stream content, Utility.StreamCopyProgressDelegate callback)
- {
- if (m_sessionID == null)
- throw new Exception("Connection is not yet logged in");
+ param.Add("RESOURCEID", resourceid);
+ param.Add("DATANAME", dataname);
+ param.Add("DATATYPE", datatype.ToString());
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "SETRESOURCEDATA");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
+ return param;
+ }
+
+ public System.Net.WebRequest SetResourceData(string id, string dataname, ResourceDataType datatype, System.IO.Stream outStream, System.IO.Stream content, Utility.StreamCopyProgressDelegate callback)
+ {
+ if (m_sessionID == null)
+ throw new Exception("Connection is not yet logged in");
+
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "SETRESOURCEDATA");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", id);
- param.Add("DATANAME", dataname);
- param.Add("DATATYPE", datatype.ToString());
+ param.Add("RESOURCEID", id);
+ param.Add("DATANAME", dataname);
+ param.Add("DATATYPE", datatype.ToString());
//This does not appear to be used anywhere in the MG WebTier code
//anyway, set this if stream supports seeking
if (content.CanSeek)
- param.Add("DATALENGTH", content.Length.ToString());
+ param.Add("DATALENGTH", content.Length.ToString());
- string boundary;
- System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
+ string boundary;
+ System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
- EncodeFormParameters(boundary, param, outStream);
- AppendFormContent("DATA", "content.bin", boundary, outStream, content, callback);
+ EncodeFormParameters(boundary, param, outStream);
+ AppendFormContent("DATA", "content.bin", boundary, outStream, content, callback);
- req.ContentLength = outStream.Length;
- return req;
- }
+ req.ContentLength = outStream.Length;
+ return req;
+ }
- internal string reqAsUrl(string resourceId, string classname, string filter, string[] columns)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "SELECTFEATURES");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ internal string reqAsUrl(string resourceId, string classname, string filter, string[] columns)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "SELECTFEATURES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", resourceId);
- param.Add("CLASSNAME", classname);
-
- //Using the very standard TAB character for column seperation
- // ... nice if your data has "," or ";" in the column names :)
- if (columns != null)
- param.Add("PROPERTIES", string.Join("\t", columns));
+ param.Add("RESOURCEID", resourceId);
+ param.Add("CLASSNAME", classname);
+
+ //Using the very standard TAB character for column seperation
+ // ... nice if your data has "," or ";" in the column names :)
+ if (columns != null)
+ param.Add("PROPERTIES", string.Join("\t", columns));
- //param.Add("COMPUTED_ALIASES", computed_aliases);
- //param.Add("COMPUTED_PROPERTIES", computed_properties);
- if (filter != null)
- param.Add("FILTER", filter);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ //param.Add("COMPUTED_ALIASES", computed_aliases);
+ //param.Add("COMPUTED_PROPERTIES", computed_properties);
+ if (filter != null)
+ param.Add("FILTER", filter);
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
public string ExecuteSqlQuery(string featureSourceID, string sql)
{
@@ -525,27 +541,27 @@
return m_hosturi + "?" + EncodeParameters(param);
}
- public System.Net.WebRequest SelectFeatures(bool aggregate, string resourceId, string classname, string filter, string[] columns, NameValueCollection computedProperties, System.IO.Stream outStream)
- {
- NameValueCollection param = new NameValueCollection();
- if (aggregate)
+ public System.Net.WebRequest SelectFeatures(bool aggregate, string resourceId, string classname, string filter, string[] columns, NameValueCollection computedProperties, System.IO.Stream outStream)
+ {
+ NameValueCollection param = new NameValueCollection();
+ if (aggregate)
param.Add("OPERATION", "SELECTAGGREGATES");
else
param.Add("OPERATION", "SELECTFEATURES");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", resourceId);
- param.Add("CLASSNAME", classname);
-
- //Using the very standard TAB character for column seperation
- // ... nice if your data has "," or ";" in the column names :)
- if (columns != null)
- param.Add("PROPERTIES", string.Join("\t", columns));
+ param.Add("RESOURCEID", resourceId);
+ param.Add("CLASSNAME", classname);
+
+ //Using the very standard TAB character for column seperation
+ // ... nice if your data has "," or ";" in the column names :)
+ if (columns != null)
+ param.Add("PROPERTIES", string.Join("\t", columns));
if (computedProperties != null && computedProperties.Count > 0)
{
@@ -561,45 +577,45 @@
param.Add("COMPUTED_ALIASES", string.Join("\t", keys.ToArray()));
param.Add("COMPUTED_PROPERTIES", string.Join("\t", values.ToArray()));
}
- if (filter != null)
- param.Add("FILTER", filter);
+ if (filter != null)
+ param.Add("FILTER", filter);
- string boundary;
- System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
- EncodeFormParameters(boundary, param, outStream);
- req.ContentLength = outStream.Length;
+ string boundary;
+ System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
+ EncodeFormParameters(boundary, param, outStream);
+ req.ContentLength = outStream.Length;
- return req;
- }
+ return req;
+ }
- private System.Net.WebRequest PrepareFormContent(System.IO.Stream outStream, out string boundary)
- {
- System.Net.WebRequest req = System.Net.WebRequest.Create(m_hosturi);
- boundary = "---------------------" + DateTime.Now.Ticks.ToString("x");
- byte[] initialBound = System.Text.Encoding.UTF8.GetBytes(string.Concat("--", boundary, "\r\n"));
- req.ContentType = "multipart/form-data; boundary=" + boundary;
- req.Timeout = 20 * 1000;
- req.Method = "POST";
- outStream.Write(initialBound, 0, initialBound.Length);
- return req;
- }
+ private System.Net.WebRequest PrepareFormContent(System.IO.Stream outStream, out string boundary)
+ {
+ System.Net.WebRequest req = System.Net.WebRequest.Create(m_hosturi);
+ boundary = "---------------------" + DateTime.Now.Ticks.ToString("x");
+ byte[] initialBound = System.Text.Encoding.UTF8.GetBytes(string.Concat("--", boundary, "\r\n"));
+ req.ContentType = "multipart/form-data; boundary=" + boundary;
+ req.Timeout = 20 * 1000;
+ req.Method = "POST";
+ outStream.Write(initialBound, 0, initialBound.Length);
+ return req;
+ }
- public string DescribeSchema(string resourceId, string schema)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "DESCRIBEFEATURESCHEMA");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string DescribeSchema(string resourceId, string schema)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "DESCRIBEFEATURESCHEMA");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", resourceId);
- param.Add("SCHEMA", schema);
-
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ param.Add("RESOURCEID", resourceId);
+ param.Add("SCHEMA", schema);
+
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
public string DescribeSchema(string resourceID)
{
@@ -617,260 +633,260 @@
return m_hosturi + "?" + EncodeParameters(param);
}
- public string GetProviderCapabilities(string provider)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETPROVIDERCAPABILITIES");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string GetProviderCapabilities(string provider)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETPROVIDERCAPABILITIES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("PROVIDER", provider);
+ param.Add("PROVIDER", provider);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string EnumerateCategories()
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.ENUMERATECATEGORIES");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string EnumerateCategories()
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.ENUMERATECATEGORIES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string EnumerateCoordinateSystems(string category)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.ENUMERATECOORDINATESYSTEMS");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string EnumerateCoordinateSystems(string category)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.ENUMERATECOORDINATESYSTEMS");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("CSCATEGORY", category);
+ param.Add("CSCATEGORY", category);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string ConvertWktToCoordinateSystemCode(string wkt)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.CONVERTWKTTOCOORDINATESYSTEMCODE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string ConvertWktToCoordinateSystemCode(string wkt)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.CONVERTWKTTOCOORDINATESYSTEMCODE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("CSWKT", wkt);
+ param.Add("CSWKT", wkt);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string ConvertCoordinateSystemCodeToWkt(string code)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.CONVERTCOORDINATESYSTEMCODETOWKT");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string ConvertCoordinateSystemCodeToWkt(string code)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.CONVERTCOORDINATESYSTEMCODETOWKT");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("CSCODE", code);
+ param.Add("CSCODE", code);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string ConvertWktToEpsgCode(string wkt)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.CONVERTWKTTOEPSGCODE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string ConvertWktToEpsgCode(string wkt)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.CONVERTWKTTOEPSGCODE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("CSWKT", wkt);
+ param.Add("CSWKT", wkt);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string ConvertEpsgCodeToWkt(string code)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.CONVERTEPSGCODETOWKT");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string ConvertEpsgCodeToWkt(string code)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.CONVERTEPSGCODETOWKT");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("CSCODE", code);
+ param.Add("CSCODE", code);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string GetBaseLibrary()
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.GETBASELIBRARY");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string GetBaseLibrary()
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.GETBASELIBRARY");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string IsValidCoordSys(string wkt)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "CS.ISVALID");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string IsValidCoordSys(string wkt)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "CS.ISVALID");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("CSWKT", wkt);
+ param.Add("CSWKT", wkt);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string DeleteResource(string resourceid)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "DELETERESOURCE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string DeleteResource(string resourceid)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "DELETERESOURCE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", resourceid);
+ param.Add("RESOURCEID", resourceid);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string MoveResource(string source, string target, bool overwrite)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "MOVERESOURCE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string MoveResource(string source, string target, bool overwrite)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "MOVERESOURCE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("SOURCE", source);
- param.Add("DESTINATION", target);
- param.Add("OVERWRITE", overwrite ? "1" : "0");
+ param.Add("SOURCE", source);
+ param.Add("DESTINATION", target);
+ param.Add("OVERWRITE", overwrite ? "1" : "0");
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string CopyResource(string source, string target, bool overwrite)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "COPYRESOURCE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string CopyResource(string source, string target, bool overwrite)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "COPYRESOURCE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("SOURCE", source);
- param.Add("DESTINATION", target);
- param.Add("OVERWRITE", overwrite ? "1" : "0");
+ param.Add("SOURCE", source);
+ param.Add("DESTINATION", target);
+ param.Add("OVERWRITE", overwrite ? "1" : "0");
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string EnumerateResourceReferences(string resourceid)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "ENUMERATERESOURCEREFERENCES");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string EnumerateResourceReferences(string resourceid)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "ENUMERATERESOURCEREFERENCES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ param.Add("LOCALE", m_locale);
- param.Add("RESOURCEID", resourceid);
+ param.Add("RESOURCEID", resourceid);
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public System.Net.WebRequest GetMapImage(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups, System.IO.Stream outStream)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETMAPIMAGE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("MAPNAME", mapname);
+ public System.Net.WebRequest GetMapImage(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups, System.IO.Stream outStream)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETMAPIMAGE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("MAPNAME", mapname);
param.Add("CLIENTAGENT", m_userAgent);
- if (format != null && format.Length != 0)
- param.Add("FORMAT", format);
+ if (format != null && format.Length != 0)
+ param.Add("FORMAT", format);
- if (selectionXml != null && selectionXml.Length != 0)
- param.Add("SELECTION", selectionXml);
-
- param.Add("SETVIEWCENTERX", Utility.SerializeDigit(centerX));
- param.Add("SETVIEWCENTERY", Utility.SerializeDigit(centerY));
- param.Add("SETVIEWSCALE", Utility.SerializeDigit(scale));
- param.Add("SETDISPLAYDPI", dpi.ToString());
- param.Add("SETDISPLAYWIDTH", width.ToString());
- param.Add("SETDISPLAYHEIGHT", height.ToString());
+ if (selectionXml != null && selectionXml.Length != 0)
+ param.Add("SELECTION", selectionXml);
+
+ param.Add("SETVIEWCENTERX", Utility.SerializeDigit(centerX));
+ param.Add("SETVIEWCENTERY", Utility.SerializeDigit(centerY));
+ param.Add("SETVIEWSCALE", Utility.SerializeDigit(scale));
+ param.Add("SETDISPLAYDPI", dpi.ToString());
+ param.Add("SETDISPLAYWIDTH", width.ToString());
+ param.Add("SETDISPLAYHEIGHT", height.ToString());
- if (showlayers != null && showlayers.Length > 0)
- param.Add("SHOWLAYERS", string.Join(",", showlayers));
- if (hidelayers != null && hidelayers.Length > 0)
- param.Add("HIDELAYERS", string.Join(",", hidelayers));
- if (showgroups != null && showgroups.Length > 0)
- param.Add("SHOWGROUPS", string.Join(",", showgroups));
- if (hidegroups != null && hidegroups.Length > 0)
- param.Add("HIDEGROUPS", string.Join(",", hidegroups));
+ if (showlayers != null && showlayers.Length > 0)
+ param.Add("SHOWLAYERS", string.Join(",", showlayers));
+ if (hidelayers != null && hidelayers.Length > 0)
+ param.Add("HIDELAYERS", string.Join(",", hidelayers));
+ if (showgroups != null && showgroups.Length > 0)
+ param.Add("SHOWGROUPS", string.Join(",", showgroups));
+ if (hidegroups != null && hidegroups.Length > 0)
+ param.Add("HIDEGROUPS", string.Join(",", hidegroups));
param.Add("CLIP", clip ? "1" : "0");
- //TODO: Find out if this actually works...
- //param.Add("REFRESHLAYERS", ...)
+ //TODO: Find out if this actually works...
+ //param.Add("REFRESHLAYERS", ...)
- string boundary;
- System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
- EncodeFormParameters(boundary, param, outStream);
- req.ContentLength = outStream.Length;
+ string boundary;
+ System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
+ EncodeFormParameters(boundary, param, outStream);
+ req.ContentLength = outStream.Length;
- return req;
- }
+ return req;
+ }
public System.Net.WebRequest GetMapImage(string mapname, string format, string selectionXml, double x1, double y1, double x2, double y2, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups, System.IO.Stream outStream)
{
@@ -914,48 +930,48 @@
}
public string BuildRequest(NameValueCollection param)
- {
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ {
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string GetMapImageUrl(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETMAPIMAGE");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("MAPNAME", mapname);
-
- if (format != null && format.Length != 0)
- param.Add("FORMAT", format);
+ public string GetMapImageUrl(string mapname, string format, string selectionXml, double centerX, double centerY, double scale, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETMAPIMAGE");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("MAPNAME", mapname);
+
+ if (format != null && format.Length != 0)
+ param.Add("FORMAT", format);
- if (selectionXml != null && selectionXml.Length != 0)
- param.Add("SELECTION", selectionXml);
-
+ if (selectionXml != null && selectionXml.Length != 0)
+ param.Add("SELECTION", selectionXml);
+
- param.Add("SETVIEWCENTERX", Utility.SerializeDigit(centerX));
- param.Add("SETVIEWCENTERY", Utility.SerializeDigit(centerY));
- param.Add("SETVIEWSCALE", Utility.SerializeDigit(scale));
- param.Add("SETDISPLAYDPI", dpi.ToString());
- param.Add("SETDISPLAYWIDTH", width.ToString());
- param.Add("SETDISPLAYHEIGHT", height.ToString());
+ param.Add("SETVIEWCENTERX", Utility.SerializeDigit(centerX));
+ param.Add("SETVIEWCENTERY", Utility.SerializeDigit(centerY));
+ param.Add("SETVIEWSCALE", Utility.SerializeDigit(scale));
+ param.Add("SETDISPLAYDPI", dpi.ToString());
+ param.Add("SETDISPLAYWIDTH", width.ToString());
+ param.Add("SETDISPLAYHEIGHT", height.ToString());
- if (showlayers != null && showlayers.Length > 0)
- param.Add("SHOWLAYERS", string.Join(",", showlayers));
- if (hidelayers != null && hidelayers.Length > 0)
- param.Add("HIDELAYERS", string.Join(",", hidelayers));
- if (showgroups != null && showgroups.Length > 0)
- param.Add("SHOWGROUPS", string.Join(",", showgroups));
- if (hidegroups != null && hidegroups.Length > 0)
- param.Add("HIDEGROUPS", string.Join(",", hidegroups));
+ if (showlayers != null && showlayers.Length > 0)
+ param.Add("SHOWLAYERS", string.Join(",", showlayers));
+ if (hidelayers != null && hidelayers.Length > 0)
+ param.Add("HIDELAYERS", string.Join(",", hidelayers));
+ if (showgroups != null && showgroups.Length > 0)
+ param.Add("SHOWGROUPS", string.Join(",", showgroups));
+ if (hidegroups != null && hidegroups.Length > 0)
+ param.Add("HIDEGROUPS", string.Join(",", hidegroups));
- //TODO: Find out if this actually works...
- //param.Add("REFRESHLAYERS", ...)
+ //TODO: Find out if this actually works...
+ //param.Add("REFRESHLAYERS", ...)
param.Add("CLIP", clip ? "1" : "0");
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
public string GetMapImageUrl(string mapname, string format, string selectionXml, double x1, double y1, double x2, double y2, int dpi, int width, int height, bool clip, string[] showlayers, string[] hidelayers, string[] showgroups, string[] hidegroups)
{
@@ -994,31 +1010,31 @@
return m_hosturi + "?" + EncodeParameters(param);
}
- public System.Net.WebRequest QueryMapFeatures(string mapname, bool persist, string geometry, System.IO.Stream outStream, QueryMapFeaturesLayerAttributes attributes)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "QUERYMAPFEATURES");
- param.Add("VERSION", "1.0.0");
- param.Add("PERSIST", persist ? "1" : "0");
- param.Add("MAPNAME", mapname);
- param.Add("SESSION", m_sessionID);
- param.Add("GEOMETRY", geometry);
- param.Add("SELECTIONVARIANT", "INTERSECTS");
- param.Add("MAXFEATURES", "-1");
- param.Add("LAYERATTRIBUTEFILTER", ((int)attributes).ToString());
- param.Add("FORMAT", "text/xml");
+ public System.Net.WebRequest QueryMapFeatures(string mapname, bool persist, string geometry, System.IO.Stream outStream, QueryMapFeaturesLayerAttributes attributes)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "QUERYMAPFEATURES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("PERSIST", persist ? "1" : "0");
+ param.Add("MAPNAME", mapname);
+ param.Add("SESSION", m_sessionID);
+ param.Add("GEOMETRY", geometry);
+ param.Add("SELECTIONVARIANT", "INTERSECTS");
+ param.Add("MAXFEATURES", "-1");
+ param.Add("LAYERATTRIBUTEFILTER", ((int)attributes).ToString());
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
- string boundary;
- System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
- EncodeFormParameters(boundary, param, outStream);
- req.ContentLength = outStream.Length;
+ string boundary;
+ System.Net.WebRequest req = PrepareFormContent(outStream, out boundary);
+ EncodeFormParameters(boundary, param, outStream);
+ req.ContentLength = outStream.Length;
- return req;
- }
+ return req;
+ }
internal System.Net.WebRequest QueryMapFeatures(string runtimeMapName, int maxFeatures, string wkt, bool persist, string selectionVariant, Services.QueryMapOptions extraOptions, System.IO.Stream outStream)
{
@@ -1053,113 +1069,113 @@
return req;
}
- public string EnumerateApplicationTemplates()
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "ENUMERATEAPPLICATIONTEMPLATES");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string EnumerateApplicationTemplates()
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "ENUMERATEAPPLICATIONTEMPLATES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
-
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
+
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string EnumerateApplicationWidgets()
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "ENUMERATEAPPLICATIONWIDGETS");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string EnumerateApplicationWidgets()
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "ENUMERATEAPPLICATIONWIDGETS");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
-
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
+
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string EnumerateApplicationContainers()
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "ENUMERATEAPPLICATIONCONTAINERS");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string EnumerateApplicationContainers()
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "ENUMERATEAPPLICATIONCONTAINERS");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
-
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
+
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string GetSpatialContextInfo(string resourceID, bool activeOnly)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETSPATIALCONTEXTS");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
- param.Add("RESOURCEID", resourceID);
- param.Add("ACTIVEONLY", activeOnly ? "1" : "0");
+ public string GetSpatialContextInfo(string resourceID, bool activeOnly)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETSPATIALCONTEXTS");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
+ param.Add("RESOURCEID", resourceID);
+ param.Add("ACTIVEONLY", activeOnly ? "1" : "0");
param.Add("CLIENTAGENT", m_userAgent);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
-
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
+
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string HostURI { get { return m_hosturi; } }
+ public string HostURI { get { return m_hosturi; } }
- public string GetIdentityProperties(string resourceID, string schema, string classname)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "GETIDENTITYPROPERTIES");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
- param.Add("RESOURCEID", resourceID);
- param.Add("SCHEMA", schema);
- param.Add("CLASSNAME", classname);
+ public string GetIdentityProperties(string resourceID, string schema, string classname)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "GETIDENTITYPROPERTIES");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
+ param.Add("RESOURCEID", resourceID);
+ param.Add("SCHEMA", schema);
+ param.Add("CLASSNAME", classname);
param.Add("CLIENTAGENT", m_userAgent);
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
-
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
+
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
- public string EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type)
- {
- NameValueCollection param = new NameValueCollection();
- param.Add("OPERATION", "ENUMERATEUNMANAGEDDATA");
- param.Add("VERSION", "1.0.0");
- param.Add("SESSION", m_sessionID);
- param.Add("FORMAT", "text/xml");
+ public string EnumerateUnmanagedData(string startpath, string filter, bool recursive, UnmanagedDataTypes type)
+ {
+ NameValueCollection param = new NameValueCollection();
+ param.Add("OPERATION", "ENUMERATEUNMANAGEDDATA");
+ param.Add("VERSION", "1.0.0");
+ param.Add("SESSION", m_sessionID);
+ param.Add("FORMAT", "text/xml");
param.Add("CLIENTAGENT", m_userAgent);
if (startpath != null)
- param.Add("PATH", startpath);
- if (filter != null)
- param.Add("FILTER", filter);
- param.Add("RECURSIVE", recursive ? "1" : "0");
- if (type == UnmanagedDataTypes.Files)
- param.Add("Type", "Files");
- else if (type == UnmanagedDataTypes.Folders)
- param.Add("Type", "Folders");
- else
- param.Add("Type", "Both");
+ param.Add("PATH", startpath);
+ if (filter != null)
+ param.Add("FILTER", filter);
+ param.Add("RECURSIVE", recursive ? "1" : "0");
+ if (type == UnmanagedDataTypes.Files)
+ param.Add("Type", "Files");
+ else if (type == UnmanagedDataTypes.Folders)
+ param.Add("Type", "Folders");
+ else
+ param.Add("Type", "Both");
- if (m_locale != null)
- param.Add("LOCALE", m_locale);
-
- return m_hosturi + "?" + EncodeParameters(param);
- }
+ if (m_locale != null)
+ param.Add("LOCALE", m_locale);
+
+ return m_hosturi + "?" + EncodeParameters(param);
+ }
public string EnumerateUsers(string group)
{
More information about the mapguide-commits
mailing list