java - Need help to display the return of SOAP request from webservice -
i try make first android app ! call webservice ksoap2 details of account. have function witch return array (resultrequestsoap). in resultrequestsoap there array of object. below function :
public array listall(string session){ final string soap_action = "http://www.nubio.net/soap/vps#listall"; final string method_name = "listall"; final string namespace = "http://www.nubio.net/soap/vps"; final string url = "http://www.nubio.net/soap/vps"; array myarray = null; soapobject request = new soapobject(namespace, method_name); //soapobject request.addproperty("session",session); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.setoutputsoapobject(request); httptransportse androidhttptransport = new httptransportse(url); try { androidhttptransport.call(soap_action, envelope); resultrequestsoap = envelope.getresponse(); //retour = resultrequestsoap.tostring(); if(resultrequestsoap != null){ myarray = (array)resultrequestsoap; } } catch (exception ae) { ae.printstacktrace ();; } return myarray; }
i test function return string , it's works fine, need show array on screen. how can display array in resultrequestsoap; ? original return of soap in resultrequestsoap; :
array( 0 => object{ vps_id : int ip : string hostname : string password : string (optional) os : string os_arch : integer os_distri : string expire : string (date time) }, ... )
so can return array soap , display it!? i'm sorry english, hope me :) best me display "hostname string" array button possible?
not sure asking, if method returns array of objects can print object out this:
for(int i=0; < myarray.length; i++){ object item = myarray[i]; // put textview here if wish, printing console system.out.println("item: "+i +" ip: "+item.ip); // or if private getter system.out.println("item: "+i +" ip: "+item.getip()); system.out.println("hostname: "+item.hostname); system.out.println("hostname: "+item.gethostname()); }
i think gives idea anyway?
Comments
Post a Comment