现在无论我如何格式化我的请求属性,它都会得到:
Cannot Serialize: [int, int, int]
错误。我不知道还能尝试什么。我试过了:
ArrayList<Integer>, int[], Vector<Integer>, List<Integer>
这些都不起作用。我最接近的一个是 Vector。它似乎已经很好地序列化了 Vector 对象,但是当我将它发送到 Web 服务方法时,我得到了错误:
java.lang.RuntimeError Mismatched types
是的,我已将该方法的输入参数更改为 Vector,并确保导入了相同类型的 Vector。
这是我的 Web 服务和我的应用程序,因此,我确实拥有它的全部范围。我愿意更改应用程序和 WS 的任何部分。如果您有任何想法,请告诉我。这就是我创建 Web 服务请求的方式:
这是我尝试在其中使用 Vector 的完整方法。
public ArrayList<Contacts> getLocationslist(Vector<Integer> list){
ArrayList<Contacts> contacts = new ArrayList<Contacts>();
String SOAP_ACTION = "urn:getLocationsList";
String METHOD_NAME = "getLocationsList";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("arg0", list);
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
int i = 0;
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
while (i < resultsRequestSOAP.getPropertyCount()){
Contacts cont = new Contacts();
try {
Ksoap2ResultParser.parseBusinessObject(resultsRequestSOAP.getProperty(i).toString(), cont);
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
contacts.add(cont);
i = i + 1;
}
} catch (Exception e) {
e.printStackTrace();
}
return contacts;
}
我指望你!提前致谢。