Ksoap на андроид raed список объектов из веб-службы ac # - PullRequest
0 голосов
/ 19 октября 2018

У меня есть веб-служба ac # (soap), которую я хочу использовать с клиентом Android, для этого я использую ksoap.

Мой веб-сервис дает ответ, который выглядит следующим образом:

<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>

как я могу прочитать этот список объектов в моем приложении для Android с Java.я пытаюсь этот код Java, но не работает:

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;
    }
...