J'ai essayé d'utiliser les données d'une API mais je n'ai pas pu lire la réponse XML.Analyse d'une réponse SOAP avec C#
Il CAMES sous la forme:
<?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>
Et ce que je dois est ce qui est à l'intérieur Produits (pour l'instant).
J'essayais d'utiliser Using C# to parse a SOAP Response (et d'autres pour ne pas inonder ceci) sans résultats.
Mon code:
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;
Je suis presque sûr que je manque quelque chose de fondamental.
Toute idée sera vraiment appréciée.
Merci.
Avez-vous vérifié ce lien? http://stackoverflow.com/questions/2876012/using-c-to-parse-a-soap-response – Peyman