C# 在C中解析Soap信封到数据集#
这是我的soap响应格式 我试图将soap响应存储到数据集中并检索结果C# 在C中解析Soap信封到数据集#,c#,soap,C#,Soap,这是我的soap响应格式 我试图将soap响应存储到数据集中并检索结果 Stream rd= new StreamReader(response.GetResponseStream()) soapresults rd.ReadToEnd(); XmlDocument doc= new XmlDocument(); XmlNodeReader xmlRead= new XmlNodeReader(doc); ds.ReadXml(xmlRead); if (ds.Tables.Coun
Stream rd= new StreamReader(response.GetResponseStream())
soapresults rd.ReadToEnd();
XmlDocument doc= new XmlDocument();
XmlNodeReader xmlRead= new XmlNodeReader(doc);
ds.ReadXml(xmlRead);
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
string data1 = dt.Rows[0]["DATA1"].ToString();
}
}
到目前为止我还没能做到
以下是XML:
<ns3:Envelope xmlns:ns3="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns2="http://www.fiorano.com/fesb/activity/DBQueryOnInput1/Out"
xmlns:ns4="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns3:Body>
<ns2:Result>
<ns2:rows>
<row resultcount="1" xmlns="http://www.fiorano.com/fesb/activity/DBQueryOnInput1/Out">
<DATA1>THANK YOU</DATA1>
<DATA2>FOR</DATA2>
<DATA3>YOUR</DATA3>
<DATA4>ASSISTANCE</DATA4>
</row>
</ns2:rows>
<ns2:updatecount>1</ns2:updatecount>
</ns2:Result>
</ns3:Body>
</ns3:Envelope>
非常感谢。
对于
你的
帮助
1.
那么当您尝试该代码时会发生什么?(首先,它看起来无法编译…)您的数据集是在第行填充的吗?ReadXml(xmlRead);你为什么不直接使用“添加服务参考”?与论坛网站不同,我们不使用“谢谢”或“感谢任何帮助”或签名。在这种情况下,您可以使用LINQ转换为XML。并且您可以根据需要读取XML。。