I’m having trouble parsing the following soap response. This is my first time working with LINQ and must examples I’ve found use XML and not a SOAP envelope. How do I get the values of the different “items”. I know there are different options (using add service reference) but it is not an option in my current project.
<SOAP-ENV:Envelope
xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:ns1=\"http://random.com/api/1/service\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:ns2=\"http://xml.apache.org/xml-soap\"
xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"
SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">
<SOAP-ENV:Body>
<ns1:getBeatlesResponse>
<return xsi:type=\"ns2:Map\">
<item>
<key xsi:type=\"xsd:string\">error</key>
<value xsi:type=\"xsd:string\">OK</value>
</item>
<item>
<key xsi:type=\"xsd:string\">Beatles</key>
<value xsi:type=\"ns2:Map\">
<item>
<key xsi:type=\"xsd:int\">9</key>
<value xsi:type=\"xsd:string\">John Lennon</value>
</item>
<item>
<key xsi:type=\"xsd:int\">12</key>
<value xsi:type=\"xsd:string\">Paul McCartney</value>
</item>
<item>
<key xsi:type=\"xsd:int\">25</key>
<value xsi:type=\"xsd:string\">George Harrison</value>
</item>
<item>
<key xsi:type=\"xsd:int\">184</key>
<value xsi:type=\"xsd:string\">Ringo Starr</value>
</item>
</value>
</item>
</return>
</ns1:getBeatlesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Thanks in advance
this one is pretty tricky because you have items that have items which probably could have items too… so if you do something like this
you will get all the items separated and one which has all the values in one…
edit:
this works somewhat fine
you can now see all sub items with their correct key… only the ok/error is making some trouble… but you can get them from the final list and pick them if they are not any of the key-value pairs…
hope this helps