C#: How to iterate through XML SOAP Response and create an object with properties containing List of error responses and success messages? -


i'm relatively new this, decided ask question.

i'm calling web service , xml soap response back, containing nodes errors, object properties , success message.

this xml i'm getting:

<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">     <soap:body>         <add xmlns="books">             <out xmlns="books">                 <actiontype xmlns="http://booksserverurl.com">insert</actiontype>                 <readernumber xmlns="http://booksserverurl.com">98765432</readernumber>                 <messageswitherror xmlns="http://booksserverurl.com">                     <ns1:error xmlns:ns1="http://error.booksserverurl.com">                         <errorcode xmlns="http://error.booksserverurl.com">er:1000</errorcode>                         <errormessage xmlns="http://error.booksserverurl.com">book record not exist.</errormessage>                     </ns1:error>                     <ns1:error xmlns:ns1="http://error.booksserverurl.com">                         <errorcode xmlns="http://error.booksserverurl.com">er:1001</errorcode>                         <errormessage xmlns="http://error.booksserverurl.com">book record not exist.</errormessage>                     </ns1:error>                 </errormsg>                 <bookid xmlns="http://booksserverurl.com">1000009</merchantid>                 <bookloc xmlns="http://booksserverurl.com">us</bookloc>                 <messagewithsuccess xmlns="http://booksserverurl.com" xsi:nil="true" />             </out>         </add>     </soap:body> </soap:envelope> 

then, created classes called soapresponse , soapresponseerror accordingly:

public class soapresponse {     public string messagewithsuccess { get; set; }     public string bookloc{ get; set; }     public string bookid{ get; set; }     public list<soapresponseerror> responseerror { get; set; } }  public class soapresponseerror {     private string errorcode;     private string errormessage;      public string code     {         { return this.code; }         set { this.code = value; }     }      public string message     {         { return this.message; }         set { this.message = value; }     } } 

i not want deserialization in particular case. how can traverse xml response, so, responseerror list have codes , messages , rest of nodes assigned accordingly?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -