我正在使用 Android 2.1 API。我通过 ksoap 协议从网上下载数据。结果就是这个异常org.ksoap2.serialization.SoapPrimitive
,不明白为什么。
用debugging,for
第一轮运行正常,第二轮就挂了education re = (SoapObject) ((SoapObject) envelope.getResponse ()). getProperty (s)
,报错org.ksoap2.serialization.SoapPrimitive
。
这是代码:
request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("dev", false);
request.addProperty("Cap", input_cap.getText().toString());
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
envelope.addMapping(NAMESPACE,Offerta.Offerta_CLASS.getSimpleName(),Offerta.Offerta_CLASS);
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
int nOff = ((SoapObject) envelope.getResponse()).getPropertyCount();
SoapObject re;
for (int i = 0; i < nOff; i++) {
re = (SoapObject) ((SoapObject) envelope.getResponse()).getProperty(i);
img.setImageBitmap(getBitmap(Integer.parseInt(re.getProperty(0).toString())));
titolo.setText(re.getProperty(1).toString());
descrizioneTitolo.setText(re.getProperty(3).toString());
provincia.setText(getProvincia(Integer.parseInt(re.getProperty(13).toString())));
sintesi.setText(re.getProperty(2).toString());
contenitore_paese.addView(view);
}