I'm doing an android application and this has to be connected to a webservices that I did in netbeans that returns an arraylist of database objects and show it in a listview, I consume it with ksoap2 in android studio but I do not know how to do it, I've been guiding me for a couple of tips but I can not see how to pass this information to the listview.
Anyone who can help me. This is my webservices method I did it with dao so my web services method only returns the instance of this method
public ArrayList<Servicio> list() throws SQLException, ClassNotFoundException, Exception {
ResultSet rs = StaticConnect.connect().createStatement().executeQuery("SELECT * FROM ".concat(TABLA));
ArrayList<Servicio> listaQuery = new ArrayList<>();
while (rs.next()) {
listaQuery.add(new Servicio(rs.getInt(1), rs.getString(2), rs.getDouble(3), rs.getInt(4), rs.getInt(5), rs.getInt(6)));
}
rs.close();
if (!listaQuery.isEmpty()) {
return listaQuery;
}
throw new Exception("listado no existe");
}
This is the method of my webService
@WebMethod(operationName = "ListarServicios")
public ArrayList<Servicio> ListarServicios() throws ClassNotFoundException, Exception {
//TODO write your implementation code here:
DAOServicio dao = new DAOServicio();
return dao.list();
}
and when I execute it, I return the list that I want to show in my android application
<return>
<descripcion>Habitacion VIP</descripcion>
<idServicio>1</idServicio>
<idTipoServicio>1</idTipoServicio>
<idVigente>1</idVigente>
<precio>80000.0</precio>
<rut>20456852</rut>
</return>