Passing an object as parameter from Andriod to web service using ksoap

Posted by user3718626 on Stack Overflow See other posts from Stack Overflow or by user3718626
Published on 2014-06-07T20:55:28Z Indexed on 2014/06/07 21:24 UTC
Read the original article Hit count: 331

I have an object called User which implements KvmSerializable. Would like to pass this object to the webservice.

PropertyInfo pi = new PropertyInfo();
        pi.setName("obj");
        pi.setValue(user);
        pi.setType(user.getClass());
        request.addProperty(pi);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 

       envelope.setOutputSoapObject(request);
       envelope.addMapping(NAMESPACE, "User",User.class);
       HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

I get the following error....

SoapFault - faultcode: 'soapenv:Server' faultstring: 'Unknow type {http://users.com}User' faultactor: 'null' detail: org.kxml2.kdom.Node@53263024
at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:141)
at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140)
at org.ksoap2.transport.Transport.parseResponse(Transport.java:118)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:272)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
at com.compete.WebServiceCallTask.getQuestion(WebServiceCallTask.java:114)
at com.compete.WebServiceCallTask.doInBackground(WebServiceCallTask.java:53)
at com.compete.WebServiceCallTask.doInBackground(WebServiceCallTask.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)

Appreciate if any one can point me to an sample code or can direct me what is the issue.

Thanks.

© Stack Overflow or respective owner

Related posts about android

Related posts about android-ksoap2