0

After I getting my response in SOAP I have as a result Object like this:

Object result = envelope.getResponse();

result :[['1/10/2014 11:10:00 PM',1.5,2.2,55.9],['10/10/2014 12:30:00 AM',88.88,88.12,88.99],.....]

casting it to SoapObject throws :

"java.lang.ClassCastException: org.ksoap2.serialization.SoapPrimitive"

SoapObject response = (SoapObject) envelope.getResponse(); // throws error

So I tried:

SoapPrimitive resultsString = (SoapPrimitive)envelope.getResponse();

and I getting a result the same result Object.

ADDED: tried SoapObject response = (SoapObject)envelope.bodyIn; and got a result:

GetCodesResponse{GetCodesResult=[['1/10/2014 11:10:00 PM',1.5,2.2,55.9]....];}

It all return String , and I don't have an option to iterate through it. How can I run loop through result, create an Object type MyCustomClass with the contractor MyCustomClass(Data d,double a, double b, double c) from each Array element and insert them into ArrayList<MyCustom>

Dima
  • 443
  • 2
  • 9
  • 23
  • Could you post exception message? – Vartlok Jul 28 '14 at 11:52
  • Did you try to use `SoapObject response = (SoapObject)envelope.bodyIn;` instead of `(SoapObject) envelope.getResponse();` http://stackoverflow.com/questions/5799775/ksoap2-android-cast-class-exception-soapobject – Vartlok Jul 28 '14 at 12:04
  • It return something like that : GetCodesResponse{GetCodesResult=[['1/10/2014 11:10:00 PM',1.5,2.2,55.9]....];} – Dima Jul 28 '14 at 12:12
  • Possible that you should use `HttpPost` and `DefaultHttpClient`. Example: http://stackoverflow.com/questions/5167341/how-to-pass-json-array-as-parameter-to-a-webservice-using-ksoap2-in-android – Vartlok Jul 28 '14 at 12:29
  • Why? if I getting the result, the problem is just parsing it currect – Dima Jul 28 '14 at 12:31
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58164/discussion-between-vartlok-and-dima). – Vartlok Jul 28 '14 at 12:54

0 Answers0