📄 arcxml_service.asmx.cs
字号:
using System;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Net;
using System.Text;
using System.Web.Services;
using System.Xml;
using System.Globalization;
namespace ArcXMLService
{
[WebService(Namespace="http://microsoft.com/webservices/")]
public class ArcXML_Web_Service : System.Web.Services.WebService
{
public ArcXML_Web_Service()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
#region sendMyArcXML(arcxmlString,currentServer,currentService,currentCustomService) function
/**/
[WebMethod
(
Description="Include the ArcXML request, the ArcIMS server you want to send this to, and the ArcIMS service name. If you are using the Query, Geocode, or Extract Servers, you also need to include the custom string. Query Server requires &Query, Geocode Server requires &Geocode, and Extract Server requires &Extract.",EnableSession=true
)
]
public String sendMyArcXML (string arcxmlString, string currentServer, string currentService, string currentCustomService )
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(arcxmlString);
string s = SendRequest(sb, currentServer, currentService, currentCustomService);
return s;
}
#endregion
#region SendRequest(sb, ServerName, ServiceName, CustomService) function
private string SendRequest(StringBuilder sb, string ServerName, string ServiceName, string CustomService)
{
string theURL = "http://" + ServerName + "/servlet/com.esri.esrimap.Esrimap?ServiceName=" + ServiceName + "&ClientVersion=4.0";
if (CustomService != "")theURL += "&CustomService=" + CustomService;
HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create(theURL);
HttpWReq.Method = "POST";
HttpWReq.ContentLength = sb.Length;
//HttpWReq.ContentType = "application/x-www-form-urlencoded";
try
{
StreamWriter pWriter = new StreamWriter(HttpWReq.GetRequestStream());
pWriter.Write(sb.ToString());
pWriter.Close();
}
catch (Exception e)
{
return null;
}
HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
using (StreamReader sr =
new StreamReader(HttpWResp.GetResponseStream()) )
{
string s;
System.IO.StringReader stgr = new System.IO.StringReader(sr.ReadToEnd());
s = stgr.ReadToEnd();
return s;
}
}
}
#endregion
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -