我一直在尝试使用API中的数据,但是我一直无法从中读取XML响应。用C解析SOAP响应#
它卡梅斯形式:
<?xml version="1.0" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAPSDK4:GetStoreProductsResponse xmlns:SOAPSDK4="http://www.externalwebservice.com/message/">
<StoreProducts>
<StoreID></StoreID>
<Products></Products>
</StoreProducts>
</SOAPSDK4:GetStoreProductsResponse></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
而我需要的是里面是什么产品(现在)。
我试图使用Using C# to parse a SOAP Response(和其他人没有洪水这个)没有结果。
我的代码:
XDocument tst = XDocument.Load("Response.xml");
XNamespace xmlns = "http://schemas.xmlsoap.org/soap/envelope/";
var tstr = from result in tst.Descendants(xmlns + "StoreProducts") select result.Element("Products").Value;
我几乎可以肯定,我失去了一些东西基本。
任何线索将非常感激。
谢谢。
你检查这个链接发送的XML? http://stackoverflow.com/questions/2876012/using-c-to-parse-a-soap-response – Peyman