将Web服务作为XML对象读取 [英] Read web services as XML object
本文介绍了将Web服务作为XML对象读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我正在从网络服务中读取数据。
现在我想要将XML结果保存为XML对象。
使用XML对象我将上传到数据库。
请帮忙,
提前致谢
Hi,
In my application I am reading data from web services.
Now I want to save the XML result as an XML object.
With XML object I will upload in to database.
Please help,
Thanks in advance
推荐答案
试试如下。
Try like below.
public static XmlDocument MakeRequest(string requestUrl)
{
try
{
HttpWebRequest request = WebRequest.Create(requestUrl) as HttpWebRequest;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(response.GetResponseStream());
return (xmlDoc);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.Read();
return null;
}
}
欲了解更多信息:解析REST服务XML响应
我希望这会对你有所帮助。
For more info : Parsing REST Services XML Responses
I hope this will help to you.
这篇关于将Web服务作为XML对象读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文