我正在测试具有多个返回值的Web服务。如何将它们放入数组并返回?
这是网络服务的响应:
<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">
<S:Body>
<ns2>
<return>
<ename>name</ename>
<enum>accountNumber</enum>
<ld>date</ld>
<num>accountNumber</num>
<cd>replyCode</cd>
<dt>replydate</dt>
<ld>date</ld>
<amt>replyAmount</amt>
</return>
<return>
<ename>name</ename>
<enum>accountNumber</enum>
<ld>date</ld>
<num>accountNumber</num>
<cd>replyCode</cd>
<dt>replydate</dt>
<ld>date</ld>
<amt>replyAmount</amt>
</return>
</ns2>
</S:Body>
</S:Envelope>
这是我获得响应的示例代码。
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
soapResult += reader.ReadToEnd();
}
if (soapResult.Contains("xml") == true)
{
//to array
}
我希望返回一个数组响应。