0
现在不管我如何格式化我的请求属性,它获得:是否可以通过ksoap2发送一个基元数组?
Cannot Serialize: [int, int, int]
错误。我不知道还有什么可以尝试的。我试过了:
ArrayList<Integer>, int[], Vector<Integer>, List<Integer>
这些都没有奏效。我得到的最接近的一次是矢量。它似乎已经序列化的矢量对象很好,但是当我将它发送到Web服务方法,我得到了错误:
java.lang.RuntimeError Mismatched types
是的,我已经改变了向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;
}
我对你这么计数!提前致谢。