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>
을 그리고 내가 필요한 것은 (지금은) 제품 안에 무엇인가 :
그것은 형태로 cames.
나는 결과없이 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이처럼 보였다 경우
var tstr = from result in tst.Descendants("StoreProducts")
select result.Element("Products").Value;
당신이 준 예제 코드가 성공했을 :
<SOAP-ENV:StoreProducts>
<StoreID></StoreID>
<Products></Products>
</SOAP-ENV:StoreProducts>
에 전송 된 XML을 읽을 필요? http://stackoverflow.com/questions/2876012/using-c-to-parse-a-soap-response – Peyman