Android Question Webservices and datatable asp.net

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.
 

ronell

Well-Known Member
Licensed User
Longtime User
response is handled in
B4X:
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
 
Upvote 0

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:
B4X:
<?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>
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Search the Forum for XML2MAP
 
Upvote 0

Luca Tonelli

Member
Licensed User
Thanks for the reply
I looked at the Xml2Map class. with the code shown below :
B4X:
        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
B4X:
(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
 
Upvote 0
Top