问题描述
我正在开发一个Android应用程序,以获得wevservice类的列表
i am developing an android application to get a list of class from wevservice
Web服务的方法是像列表<&mytable的GT; GetAllmytableData();
,但我不能投在我的mytable的类,它的数据。我创建了一个mytable的类的这个链接建议。
也适用 KVM系列化 MyClass中投的数据。但总是得到越来越 java.lang.ClassCastException:org.ksoap2.serialization.SoapObject
错误
the method of webservice is like List<mytable> GetAllmytableData();
But i cant cast that data in my mytable class. i create a mytable class as http://seesharpgears.blogspot.com/2010/10/ksoap-android-web-service-tutorial-with.html this link suggested.also applied kvm serialization in myclass to cast data. but always getting getting java.lang.ClassCastException: org.ksoap2.serialization.SoapObject
error.
我的数据中得到的SoapEnvelope就像
Data i getting in soapenvelope is like
anyType{DisplayName=a; [email protected]; FirstName=a; LastChangedDate=2/5/2012 11:24:38 PM; LastName=a; ObserverID=1; UserID=1; }
anyType{DisplayName=b; [email protected]; FirstName=b; LastChangedDate=2/5/2012 11:25:52 PM; LastName=b; ObserverID=1; UserID=2; }
anyType{DisplayName=c; [email protected]; FirstName=c; LastChangedDate=2/6/2012 9:10:44 AM; LastName=c; ObserverID=3; UserID=3; }
我怎么可以解析并把我的mytable的类的对象数组,
how i can parse and put in my "mytable" class's object array,
提供的链接PLZ任何建议
any suggestion on link plz provided
推荐答案
基肖尔,这是一个多维数组占据第一位:
Kishor, this is a multi dimensional array take the first one:
anyType//property 0
{
DisplayName=a; // property 0 [0]
[email protected]; // property 0 [1]
FirstName=a; // property 0 [2]
LastChangedDate=2/5/2012 11:24:38 PM; //etc...
LastName=a;
ObserverID=1;
UserID=1;
}
您可以手动获取每个属性这样的:
you can get each property manually like that:
SoapObject yourResponseObject = (SoapObject) soapEnvelope.bodyIn;
SoapObject array = (SoapObject) yourResponseObject .getProperty(0);// this is -->anyType //property 0
SoapObject DisplayName= (SoapObject)array .getProperty(0);// this is--> // property 0 [0] ;
SoapObject Email= (SoapObject)array .getProperty(1);// this is--> // property 0 [1] ;
等...
此外,如果你想检查我的答案here
这篇关于Android的KSOAP得到web服务类的数组列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!