我試圖從返回字符串數組的Web服務中檢索數據。 我無法做到這一點,所以我給你的代碼片段
請幫助我我要瘋了!Ksoap簡單數組android
public void updateCategories(){
SOAP_ACTION = "http://app.market_helper.com/getCategories";
METHOD_NAME = "getCategories";
Log.i("MESSAGE FROM me", "It's running wtf");
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(
URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject)envelope.getResponse();
Log.i("message to me",""+response.getPropertyCount());
}catch (Exception e) {
e.printStackTrace();
}
}
我可以從原始類型檢索數據,但這有點複雜。 這是來自Web服務的響應提前
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getCategoriesResponse xmlns="http://DefaultNamespace">
<getCategoriesReturn>desktop computers</getCategoriesReturn>
<getCategoriesReturn>laptop computers</getCategoriesReturn>
<getCategoriesReturn>mobile phones</getCategoriesReturn>
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
<getCategoriesReturn xsi:nil="true" />
</getCategoriesResponse>
</soapenv:Body>
</soapenv:Envelope>
感謝
如果u得到解決後在這裏.....檢查此鏈接可能會對你有所幫助。http://ksoap.objectweb.org/project/faq/index.html ...根據他們發送和接收必須通過使用vector.but但即使我cou ld實現它..所以請分享你的解決方案,如果你有.. – 2012-01-13 05:24:14