我嘗試製作我的第一個android應用程序! 我使用ksoap2調用web服務來獲取我的帳戶的詳細信息。 我有一個函數返回一個數組(resultRequestSOAP)。 在resultRequestSOAP中有一個ARRAY對象。 下面我的功能:需要幫助來顯示從webservice返回的SOAP請求
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;
}
我測試函數返回字符串,它工作正常,但我需要在屏幕上顯示的陣列。 如何顯示resultRequestSOAP中的數組; ? 但是resultRequestSOAP中soap的原始返回值;是:
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)
},
...
)
所以我可以從肥皂中返回數組並顯示它!? 對不起我的英語,我希望你能幫助我:) 最適合我的只會顯示數組中的「主機名字符串」,因爲按鈕有可能嗎?
什麼語言和平臺? – 2011-02-11 14:33:28
@John:這是Java和Android平臺 – 2011-02-11 17:33:08
是的,它和Android平臺,你能幫我嗎?對不起,我的英文..你明白我想說明什麼嗎?感謝您的幫助 – naturlight 2011-02-11 18:00:15