Niska Delavega

Niska Delavega

  • NA
  • 101
  • 3k

Parse and bind Soap web service result to gridview ASP.NET C

Dec 3 2019 8:12 AM
I have the following  webservice which i downloaded and saved as xml file , i bind it with my gridview . how do i display all  Data  as column in my gridview?  Following is my databinding code:
  1. XmlReader myxmlFile = XmlReader.Create("C:/test.xml"new XmlReaderSettings());  
  2.           
  3.      DataSet dss = new DataSet();  
  4.      DataTable dt = new DataTable();  
  5.   
  6.      dss.ReadXml(myxmlFile);  
  7.   
  8.      GridView1.DataSource = dss.Tables["Attribute"];  
  9.     
  10.      GridView1.DataBind();  
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">  
  3.   <soap:Body>  
  4.     <SingletonCD xmlns="mywebservice">  
  5.       <SingletonCR>  
  6.         <TS>OK</TS>  
  7.         <ErrorCode>0</ErrorCode>  
  8.         <ErrorDescription />  
  9.         <WebserviceContent>  
  10.           <data xmlns="">  
  11.             <AS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
  12.               <Singleton>  
  13.                 <N1>000000000000</N1>  
  14.                 <MI>40000000000000</MI>  
  15.                 <TS>OK</TS>  
  16.                 <Gr>Neull</Gr>  
  17.                 <Ad>  
  18.                   <Attribute Name="N" Group="AB">NATIVE</Attribute>  
  19.                   <Attribute Name="C" Group="AB">JUIIN</Attribute>  
  20.                   <Attribute Name="T " Group="AB">9.00</Attribute>  
  21.                   <Attribute Name="P 1" Group="AB">GHD67</Attribute>  
  22.                   <Attribute Name="P 2" Group="AB">GH678</Attribute>  
  23.                   <Attribute Name="C" Group="AB">EXXA</Attribute>  
  24.                   <Attribute Name="T" Group="AB">MaH</Attribute>  
  25.                   <Attribute Name="P" Group="AB">0.00</Attribute>  
  26.                   <Attribute Name="D" Group="AB">Dest name</Attribute>  
  27.                   <Attribute Name="A" Group="AB">Agent name</Attribute>  
  28.                 </Ad>  
  29.               </Singleton>  
  30.            <Singleton>  
  31.                 <N1>000000000300</N1>  
  32.                 <MI>40000055000000</MI>  
  33.                 <TS>OK</TS>  
  34.                 <Gr>NULL</Gr>  
  35.                 <Ad>  
  36.                   <Attribute Name="N" Group="AB">BAN</Attribute>  
  37.                   <Attribute Name="C" Group="AB">SZEYDOU</Attribute>  
  38.                   <Attribute Name="T " Group="AB">9U00</Attribute>  
  39.                   <Attribute Name="P1" Group="AB">GD67</Attribute>  
  40.                   <Attribute Name="P2" Group="AB">G678</Attribute>  
  41.                   <Attribute Name="C" Group="AB">EXUA</Attribute>  
  42.                   <Attribute Name="T" Group="AB">MaH</Attribute>  
  43.                   <Attribute Name="P" Group="AB">0.00</Attribute>  
  44.                   <Attribute Name="D" Group="AB">Dest CO</Attribute>  
  45.                   <Attribute Name="A" Group="AB">Agent CO</Attribute>  
  46.                 </Ad>  
  47.               </Singleton>  
  48. </AS>  
  49.           </data>  
  50.         </WebserviceContent>  
  51.       </SingletonCR>  
  52.     </SingletonCD>  
  53.   </soap:Body>  
  54. </soap:Envelope>  

Answers (2)