error: org.ksoap2.serialization.SoapObject cannot be cast to org.ksoap2.serialization.PropertyInfo

2,234 views
Skip to first unread message

KenLian

unread,
Apr 18, 2012, 5:21:58 AM4/18/12
to ksoap2-...@googlegroups.com
Hi all,
     Did any one know about this exception.
My code is as following:

        try {

            //SoapObject request = translateXMLDocumentNodeToSoapObject(params,mnamespace);
        SoapObject users = new SoapObject(mnamespace, "users");
        SoapObject john = new SoapObject(mnamespace, "user");
        john.addProperty("name", "john");
        john.addProperty("age", 12);
        SoapObject marie = new SoapObject(mnamespace, "user");
        john.addProperty("name", "marie");
        john.addProperty("age", 27);
        users.addSoapObject(john);
        users.addSoapObject(marie);
            /*
             * Set the web service envelope
             * 
             * */
            SoapSerializationEnvelope envelope =

                new SoapSerializationEnvelope(SoapEnvelope.VER11);

            envelope.dotNet = true;

            envelope.setOutputSoapObject(users);
            envelope.addMapping(mnamespace, "SoapObject", users.getClass());

            HttpTransportSE androidHttpTransport = new HttpTransportSE(mWSUrl,mpintTimeOut);
            
            // enable debug
            androidHttpTransport.debug = true;

            /*
             * Call the web service and retrieve result ... how luvly <3
             * 
             * */
            androidHttpTransport.call(mnamespace + METHOD, envelope);
              

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

            return result.toString();

        } catch (Exception e) {

        System.out.println("Calling the web services error: "+e.getMessage());
            return null;

        }

CJGarber

unread,
Apr 18, 2012, 11:30:06 AM4/18/12
to ksoap2-android
This line may be the problem:

envelope.addMapping(mnamespace, "SoapObject", users.getClass());

should be:

envelope.addMapping(mnamespace, "users", users.getClass());

KenLian

unread,
Apr 18, 2012, 9:54:15 PM4/18/12
to ksoap2-...@googlegroups.com
I just try and it don't work either....

在 2012年4月18日星期三UTC+8下午11时30分06秒,CJGarber写道:

CJGarber

unread,
Apr 18, 2012, 10:03:49 PM4/18/12
to ksoap2-android
Did you also add mapping for user class?
eg envelope.addMapping(mnamespace, "user", user.getClass());

ken.lian

unread,
Apr 18, 2012, 10:58:17 PM4/18/12
to ksoap2-...@googlegroups.com
Yeah , i added mapping for both of the two classes...  

2012/4/19 CJGarber <carolyn....@gmail.com>

Sergej Koščejev

unread,
Apr 28, 2012, 6:03:55 PM4/28/12
to ksoap2-...@googlegroups.com
On Wednesday, April 18, 2012 11:21:58 AM UTC+2, KenLian wrote:
Hi all,
     Did any one know about this exception.



Sergej
Reply all
Reply to author
Forward
0 new messages