Android的KSOAP得到web服务类的数组列表 [英] Android Ksoap get a list array of class from webservice

查看:199
本文介绍了Android的KSOAP得到web服务类的数组列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Android应用程序,以获得wevservice类的列表

i am developing an android application to get a list of class from wevservice

Web服务的方法是像列表<&mytable的GT; GetAllmytableData(); ,但我不能投在我的mytable的类,它的数据。我创建了一个mytable的类的http://seesharpgears.blogspot.com/2010/10/ksoap-android-web-service-tutorial-with.html这个链接建议。
也适用 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=hi@y.com; FirstName=a; LastChangedDate=2/5/2012 11:24:38 PM; LastName=a; ObserverID=1; UserID=1; }
anyType{DisplayName=b; Email=hi@y.com; FirstName=b; LastChangedDate=2/5/2012 11:25:52 PM; LastName=b; ObserverID=1; UserID=2; }
 anyType{DisplayName=c; Email=hi@y.com; 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=hi@y.com; // 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]  ;

等...
此外,如果你想检查我的答案<一个href=\"http://stackoverflow.com/questions/9068161/android-calling-net-webservice-ksoap2/9074239#9074239\">here

这篇关于Android的KSOAP得到web服务类的数组列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆