无法将SOAP请求的XML解析到数据集
问题描述:
我正忙于编写一个web服务,它将接受最多5个表值的SOAP REQUEST信息。无法将SOAP请求的XML解析到数据集
这就是我已经提出的一个有效的SOAP请求,但为简单起见,我已经删除了4个表格值得的XML。现在
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:EchoSoapRequest1>
<Route>
<Routecode>200906230000</RouteCode>
<Date>23/06/2009</Date>
<type>1</type>
<Depot_Code>'hh'</Depot_Code>
</Route>
</tem:EchoSoapRequest1>
</soapenv:Body>
</soapenv:Envelope>
,在我的web服务,这是我尝试在路由表中读取到dataset.Everything工作了这一点,我可以看到在变量xmlSoapRequest.I整个请求需要去掉每表并保存到他们自己的数据集中,以便我可以操作,然后将代码返回给客户端程序。
var xmlPayload = xmlSoapRequest.SelectSingleNode("//Route");
DataSet ds = new DataSet();
ds.ReadXml(xmlPayload.innerxml);
答
我想通了:)
var xmlPayload = xmlSoapRequest.SelectSingleNode("//Route");
DataSet ds = new DataSet();
XmlDocument xmldoc = new XmlDocument();
xmldoc.LoadXml(xmlPayload.OuterXml);
XmlNodeReader xmlread = new XmlNodeReader(xmldoc);
ds.ReadXml(xmlread);