我正在尝试通过 Ksoap 为我的Android应用调用WSDL Webservice
。当我使用SoapPrimitive
时,它可以工作,我得到以下字符串:
{"INGREDIENTS": [
{
"TEXT": "ohne Schweinefleisch",
"KEY": "*"
},
{
"TEXT": "mit Alkohol",
"KEY": "11"
},
...
等等..我想只有" Text"在ListView
,但我不知道如何使用SoapPrimitive实现这一点。
当我使用SoapObject时,我只得到以下的Exeption:
"java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive cannot be cast to org.ksoap2.serialization.SoapObject"
这是我的代码:
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject)envelope.getResponse();
}
出了什么问题?我在网上看了几个小时,但我没有找到答案。