Now matter how I format my request property, it get a:
Cannot Serialize: [int, int, int]
error. I have no clue what else to try. I've tried:
ArrayList<Integer>, int[], Vector<Integer>, List<Integer>
None of these worked. The one that I got the closest on was Vector.. It seemed to have serialized the Vector Objects fine, but when I sent it to the Web Service method I got the error:
java.lang.RuntimeError Mismatched types
Yes, I have changed the input parameter for the method to Vector and made sure that I've imported the same types of Vectors.
This is my Web Service and my app, so, I do have full range of it. I am willing to change any portion of both the app and the WS. If you have any ideas please let me know. This is how I am creating my request for the Web Service:
This is a full method that I am trying to use the Vector in.
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;
}
I am counting on you SO!! Thanks in advance.
After a few more attempts, I just went with using a String Tokenizer.
ArrayList<Integer> clist = new ArrayList<Integer>();
StringTokenizer st = new StringTokenizer(list);
while(st.hasMoreTokens()){
String id = st.nextToken(",");
clist.add(Integer.parseInt(id));
}
Just Create a String that contains all of the Values that you wish to send in an Array. I created the Array, then used
for(Int i : intsList){
String list = list + i + ",";
}
Then let the tokenizer split the values by each ",".
Which worked well. I'm just going to assume at this point that Ksoap2 cannot Serialize any array type. Thanks Guys! -Ninn