我正在尝试从 url 读取 xml(它不是 url 它的安静服务),下面是我的代码。我不知道问题是什么,但我无法从 url 读取 xml。我得到错误,我没有得到任何数据..
string soap = "";
if (fPortalGuid != string.Empty)
{
HttpWebRequest request = WebRequest.Create("http://cramapp-dt-02s.cable.comcast.com:8158/restfulqueryservice/queryservice/getrequestdetails?api_key=......&request_id=33ebc6e9-9def-4f39-adf9-bba2edef3b54") as HttpWebRequest;
//request.Credentials = new NetworkCredential("rolland", "409cleaner");
//request.ContentType = "application / json; charset = utf - 8";
request.Method = "POST";
using (Stream stm = request.GetRequestStream())
{
using (StreamWriter stmw = new StreamWriter(stm))
{
stmw.Write(soap);
}
}
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader = new StreamReader(response.GetResponseStream());
// Console application output
Console.WriteLine(reader.ReadToEnd());
}
}
xml看起来像这样