java - Serialize an array of ints to send using KSOAP2 -
i'm having problem trying send array of ints .net web service expects array in 1 of arguments. that's @ least understand api description on web service says this:
<dataindexids> <int>int</int> <int>int</int> </dataindexids>
so when send single int below not errors , think works fine.
request.addproperty("dataindexids", 63);
but when try send array of ints:
request.addproperty("dataindexids", new int[] {63, 62}); // array of ints
or arraylist of integers:
arraylist<integer> indexes = new arraylist<integer>(); indexes.add(63); indexes.add(62); request.addproperty("dataindexids", indexes); // arraylist of integers
i thrown "java.lang.runtimeexception: cannot serialize" exception. please? doing wrong? thanks!
i'm sending android client .net server, worked me
soapobject myarrayparameter = new soapobject(namespace, my_array_param_name); for( int : myarray ) { propertyinfo p = new propertyinfo(); p.setnamespace("http://schemas.microsoft.com/2003/10/serialization/arrays"); // use whatever type server expecting here (eg. "int") p.setname("short"); p.setvalue(i); myarrayparameter.addproperty(p); } request.addsoapobject(myarrayparameter);
produces
<classificationids> <n4:short i:type="d:long" xmlns:n4="http://schemas.microsoft.com/2003/10/serialization/arrays">18</n4:short> </classificationids>
which looks terrible, server eats anyway
Comments
Post a Comment