无法访问网络服务?问题是什么
问题描述:
public static string web Request(string AuthoUserName, string AuthoPassword, string sUserID, string sUserName, string sPlateNo, string sPlateCat, string sPlateCode, string sEmirate, string sCountry, string sCity, string sChessisNo, string sFetchURL)
{
string str = string.Empty;
try
{
Uri requestUri = new Uri(sFetchURL);
if (!(requestUri.Scheme == Uri.UriSchemeHttp))
{
return str;
}
HttpWebRequest request = null;
request = (HttpWebRequest) WebRequest.Create(requestUri);
request.Method = "GET";
request.ContentType = "text/xml;charset=\"utf-8\"";
string str2 = "<soapenv:envelope xmlns:soapenv="\"http://schemas.xmlsoap.org/soap/envelope/\"" xmlns:ae="\"http://ae.gov.trf.inq.ws.TrafficInquiryService\""><soapenv:header><ae:password>" + AuthoPassword + "</ae:password><ae:username>" + AuthoUserName + "</ae:username></soapenv:header><soapenv:body><ae:getvehicledetails><getvehicledetailsrequest><userid>" + sUserID + "</userid><username>" + sUserName + "</username><plate><plateno>" + sPlateNo + "</plateno><platecategory>" + sPlateCat + "</platecategory><platecode>" + sPlateCode + "</platecode><platesource><emirate>" + sEmirate + "</emirate><country>" + sCountry + "</country><city>" + sCity + "</city></platesource></plate><chassisno>" + sChessisNo + "</chassisno></getvehicledetailsrequest></ae:getvehicledetails></soapenv:body></soapenv:envelope>";
request.Method = "POST";
request.ContentType = "application/soap+xml; charset=utf-8";
request.Headers.Add("SOAPAction:\"\"");
request.ContentLength = str2.Length;
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(str2);
writer.Close();
StreamReader reader = new StreamReader(request.GetResponse().GetResponseStream());
while (!reader.EndOfStream)
{
str = str + reader.ReadLine();
}
}
catch (WebException exception)
{
HttpWebResponse response = null;
response = (HttpWebResponse) exception.Response;
StreamReader reader2 = new StreamReader(response.GetResponseStream());
while (!reader2.EndOfStream)
{
str = str + reader2.ReadLine();
}
}
return str;
}
返回远程服务器返回错误(500)内部服务器错误此错误
it's return "the remote server returned an error (500) internal server error" This error