Ksoap on android raed list of objects from a c# web service

24 Views Asked by At

I have a c# web service (soap) which i want to use with an android client for that am using ksoap.

My web service gives an answer which look like this :

<ArrayOfPointage xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
<Pointage>
<Datepointage>2018-10-18T07:53:04</Datepointage>
<Status>Check In</Status>
<Modeverification>Empreint Degital</Modeverification>
<Machineid>1</Machineid>
<Userid>2</Userid>
</Pointage>
<Pointage>
<Datepointage>2018-10-18T08:34:43</Datepointage>
<Status>7</Status>
<Modeverification>Empreint Degital</Modeverification>
<Machineid>1</Machineid>
<Userid>2</Userid>
</Pointage>
<Pointage>
<Datepointage>2018-10-18T12:34:01</Datepointage>
<Status>Check In</Status>
<Modeverification>Empreint Degital</Modeverification>
<Machineid>1</Machineid>
<Userid>2</Userid>
</Pointage>
<Pointage>
<Datepointage>2018-10-18T13:40:59</Datepointage>
<Status>Check In</Status>
<Modeverification>Empreint Degital</Modeverification>
<Machineid>1</Machineid>
<Userid>2</Userid>
</Pointage>
<Pointage>
<Datepointage>2018-10-18T18:34:55</Datepointage>
<Status>Check Out</Status>
<Modeverification>Empreint Degital</Modeverification>
<Machineid>1</Machineid>
<Userid>2</Userid>
</Pointage>
</ArrayOfPointage>

how i can read this list of object in my android application with java. i try this java code but dosent work :

public static Void GetPointage(int userid,int year,int month,int day) throws IOException, XmlPullParserException {
        SoapObject request = new SoapObject("http://tempuri.org/", "GetPointages");
        request.addProperty("userid", userid);
        request.addProperty("year", year);
        request.addProperty("month", month);
        request.addProperty("day", day);
        SoapSerializationEnvelope envlope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envlope.dotNet = true;
        envlope.setOutputSoapObject(request);
        HttpTransportSE transport = new HttpTransportSE("http://192.168.1.83:82/WSPointage.asmx");
        transport.call("http://tempuri.org/GetPointages", envlope);
        SoapObject result = (SoapObject) envlope.getResponse();
        SoapObject result2 = (SoapObject) envlope.bodyIn;
        int count=result2.getPropertyCount();
        for(int i=0; i<count; i++)
        {
            SoapObject result3 =(SoapObject) result2.getProperty(i);
            String date= result3.getProperty("Datepointage").toString();
        }
        return  null;
    }
0

There are 0 best solutions below