ksoap2 webservice help
i am working on application for events listing , the applica开发者_Go百科tion get the events from the database , the events arrive to the application throw webservice correctly , but my problem is to bind the soap object in adapter of the listview , i do this
try {
aht.call(SOAP_ACTION, envelope);
resultsRequestSOAP = (SoapObject) envelope.getResponse();
// rs = (SoapPrimitive) envelope.getResponse();
// resultString = (List<UBAEvent>)envelope.getResponse();
} catch (Exception e) {
e.printStackTrace();
}
int x = resultsRequestSOAP.getPropertyCount();
adapter = new MyArrayAdapter(this);
UBAEvent ubaEvent = new UBAEvent();
for (int i = 0; i < x; i++) {
ubaEvent = (UBAEvent) resultsRequestSOAP.getProperty(i);
adapter.add(ubaEvent);
}
but it is not work can any one help me how to bind the soap object into adapter ?
You first need to parse the answer ok that is in soapobjects in your case is resultsRequestSOAP. If you enable debug, in variable aht you have the XML response. And that xml is already parsed in resultsRequestSOAP object. To retreview you do these :
SoapObject s5 = (SoapObject)resultsRequestSOAP.getProperty(0);
String same=s5.getProperty("name").toString();
after these you build the object ubaEvent you trying complex types so best way i know is these one or you can try the hard way with serialization
精彩评论