Android Question Webservices and datatable asp.net

Discussion in 'Android Questions' started by Luca Tonelli, May 3, 2018.

  1. Luca Tonelli

    Luca Tonelli Member Licensed User

    Hello
    I need to read the response of a webservices that provides data in a datatable The webservices is called correctly but
    I do not know how to read the data contained in the datatable.
     
  2. ronell

    ronell Well-Known Member Licensed User

    response is handled in
    Code:
    Sub JobDone (Job As String)
                     
    Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
        
    If Job.Success = True Then
                               
                          
    dim response as string
                          response = job.getstring 
    '<--- webservice response

    End Sub
     
    DonManfred likes this.
  3. Luca Tonelli

    Luca Tonelli Member Licensed User

    Job.getstring () returns an xml string.
    I would like to read the values of the individual rows by copying them into an array or a list.
    I return this:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <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>
          <LoginResponse xmlns=
    "https://site.it">
             <LoginResult>
                <xs:schema xmlns:xs=
    "http://www.w3.org/2001/XMLSchema" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="NewDataSet">
                   <xs:element name=
    "NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Table" msdata:UseCurrentLocale="true">
                      <xs:complexType>
                         <xs:choice minOccurs=
    "0" maxOccurs="unbounded">
                            <xs:element name=
    "Table">
                               <xs:complexType>
                                  <xs:sequence>
                                     <xs:element name=
    "Id" type="xs:decimal" minOccurs="0" />
                                     <xs:element name=
    "Abilitato" type="xs:boolean" minOccurs="0" />
                                     <xs:element name=
    "Admin" type="xs:boolean" minOccurs="0" />
                                  </xs:sequence>
                               </xs:complexType>
                            </xs:element>
                         </xs:choice>
                      </xs:complexType>
                   </xs:element>
                </xs:schema>
                <diffgr:diffgram xmlns:diffgr=
    "urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
                   <NewDataSet xmlns=
    "">
                      <Table diffgr:
    id="Table1" msdata:rowOrder="0">
                         <
    Id>1</Id>
                         <Abilitato>
    true</Abilitato>
                         <Admin>
    true</Admin>
                      </Table>
                   </NewDataSet>
                </diffgr:diffgram>
             </LoginResult>
          </LoginResponse>
       </soap:Body>
    </soap:Envelope>
     
  4. DonManfred

    DonManfred Expert Licensed User

    Search the Forum for XML2MAP
     
    Erel and ronell like this.
  5. ronell

    ronell Well-Known Member Licensed User

    sorry i only know how to do this in PHP, but as @DonManfred said you can search it in forum with the right key
     
  6. Luca Tonelli

    Luca Tonelli Member Licensed User

    Thanks for the reply
    I looked at the Xml2Map class. with the code shown below :
    Code:
    Dim xm As Xml2Map
            xm.Initialize
             
    Dim root As Map=xm.Parse(job.GetString())
            
    Dim Envelope As Map=root.Get("Envelope")
            
    Dim Body As Map=Envelope.Get("Body")
            
    Dim LoginResponse As Map=Body.Get("LoginResponse")
            
    Dim LoginResult As Map=LoginResponse.Get("LoginResult")
            
    Dim diffgram As Map =LoginResult.Get("diffgram")
            
    Dim NewDataSet As Map =diffgram.Get("NewDataSet")
            
    Dim Table As Map =NewDataSet.Get("Table")
    the map of the Table variable contains
    Code:
    (MyMap) {Attributes={id=Table1, rowOrder=0}, Id=1, Abilitato=true, Admin=true}
    I do not know how to extract the second part of the data
    Id=1, Abilitato=true, Admin=true
     
  7. DonManfred

    DonManfred Expert Licensed User

    Code:
    log($"${Table.Get("Admin")}"$)
     
  8. Luca Tonelli

    Luca Tonelli Member Licensed User

    It works
    Thanks
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice