以下是我的 SuperDuperService 的肥皂响应示例:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<MyResponse xmlns="http://mycrazyservice.com/SuperDuperService">
<Result>32347</Result>
</MyResponse>
</soap:Body>
</soap:Envelope>
由于某种原因,当我尝试获取“结果”的后代或元素时,我得到空值。它与命名空间有关系吗?有人可以提供一个解决方案来从中检索结果吗?
您可能想尝试这样的事情:
string myNamespace= "http://mycrazyservice.com/SuperDuperService";
var results = from result in yourXml.Descendants(XName.Get("MyResponse", myNamespace))
select result.Element("Result").value
这台笔记本电脑上没有 VS,因此我无法仔细检查我的代码,但它应该使用 LINQ to SQL 为您指明正确的方向。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)