我需要将字符串数组传递给旨在接受字符串值数组的预定义Webserivce。但是,当我创建一个肥皂信封并将array.class或string.class属性设置为请求时,会引发序列化错误。
以上有什么建议吗?建议采用哪种数据类型或方法来解决该问题。
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
PropertyInfo p1 = new PropertyInfo();
p1.setName("items");
p1.setValue(results);
p1.setType(String.class); // else Array.class.
request.addProperty(p1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
httpTransport.debug = true;
httpTransport.call(SOAP_ACTION, envelope);
// throws an error in the above.
result = httpTransport.responseDump;
最佳答案
这是KSOAP2 for Android库的一个已知问题,该库目前根本不支持数组。问题描述为here。
可以找到here第三方补丁,解决方案和示例。
查看这些链接,您可以在上面找到答案。