【发布时间】:2015-05-30 20:21:21
【问题描述】:
我在 SOAP 信封中收到来自 Web 服务的响应,如下所示:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<ProcessTranResponse xmlns="http://www.polaris.co.uk/XRTEService/2009/03/">
<ProcessTranResult xmlns:a="http://schemas.datacontract.org/2004/07/XRTEService" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:PrintFormFileNameContents i:nil="true"/>
<a:ResponseXML>response_message</a:ResponseXML>
</ProcessTranResult>
</ProcessTranResponse>
</s:Body>
我想将response_message 获取到一个字符串变量。我试过做
XDocument doc = XDocument.Parse(Response);
XNamespace xmlnsa = "http://schemas.datacontract.org/2004/07/XRTEService";
var ResponseXML = doc.Descendants(xmlnsa + "ResponseXML");
当我使用手表时,我在 ResponseXML -> Results View[0] -> Value 和 response_message 中看到,但我无法弄清楚从 C# 获取 Value 的下一步是什么。
【问题讨论】: