2013年9月15日星期日

android in webservce get soapObject data analysis problems

Try to be a recent development, uses network communication piece . There are several problems :
1android client has been weibservice play soapObject object , but I need to resolve how the data type ?
xml files obtained through the web

-
adminbb
admin
e10adc3949ba59abbe56e057f20f883e
732



admin
2005/5/8 0:00:00
adminbb
2012/2/17 10:01:50
108.9418
34.2640
2012/1/9 14:12:04
1
2020/12/31 23:59:59
36.40.67.173
1
707

android above call the webservice get soapObject tostring () looks like this after
GetNameInfoResponse {GetNameInfoResult = anyType {user_info = anyType {USER_NO = adminbb; USER_NAME = admin; PASSWORD = e10adc3949ba59abbe56e057f20f883e; ROLE_ID = 732; TELEPHONE = anyType {}; EMAIL = anyType { }; REMARK = anyType {}; CREATER = admin; CREATED_TIME = 2005-5-8 0:00:00; MODIFIER = adminbb; LAST_MODIFIED = 2012-2-17 10: 01:50; INI_LON = 108.9418; INI_LAT = 34.2640; LAST_LOGIN_TIME = 2012-1-9 14:12:04; STATUS = 1; DEAD_LINE_TIME = 2020-12-31 23: 59:59; LAST_LOGIN_IP = 36.40.67.173; IS_MANAGER = 1; GROUP_ID = 707;};};}
can be obtained directly from c # , like similar datatable type data .
how to use Ksoap class can get the standard android xml file and then call your own parsing library parsing ? Do only use post get method call webservice to get xml?
------ Solution ---------------------------------------- ----
get SoapObject object inside the loop to take each field
for (int i = 0; i SoapObject soapChilds = (SoapObject) soapObject.getProperty (i);
System.out.println (soapChilds.getProperty ("USER_NO"). toString ());
System.out.println (soapChilds.getProperty ("USER_NAME"). toString ());
.
.
.
}
------ Solution ----------------------------------- ---------
is on the top floor

you can while debugging while watching the corresponding data obtained is not up
------ Solution ---------------------- ----------------------
if you are to develop their own ends , it is recommended to use json, speed, small size, easy to parse gray often !
service side : result = JsonConvert.SerializeObject (Objcet) ;/ / Start serialization
Client:

GsonBuilder gsonb = new GsonBuilder();
// Json中的日期表达方式没有办法直接转换成我们的Date类型, 因此需要单独注册一个Date的反序列化类.
DateDeserializer ds = new DateDeserializer();
// 给GsonBuilder方法单独指定Date类型的反序列化方法
gsonb.registerTypeAdapter(Date.class, ds);
Type t = new TypeToken<LinkedList<你的数据类型,和web端保持一致的>>() {}.getType();
Gson gson = gsonb.create();
// 将json数据解析成对象
if (!result.equals("-1")) {
//result是你获得的字符串,t是要转换的类型
resultList = gson.fromJson(result, t);
}

------ Solution ------------------------------------- -------


since we use SoapObject, then use its standard solution , a layer take until taking on so far !
------ eference --------------------------------------- < br> top about datatable difficult to achieve the next check to know
------ eference ------------------ ---------------------
I try to approach thank you
replace it with my own split it and spile

------ eference ------------------------------------ ---
Thank you for novice taught a layer by layer to extract a statement posted scattered points
------ eference --------------------------------------- < br> parse it layer by layer , you must know what type it is that way , because it is not necessarily a string , they might be a list of objects , um, how to judge it
------ eference - --------------------------------------
there is a problem , take the data, If Webservice null values ​​in a database query when , SoapObject returned result set properties which do not have this field . When parsing error, how to judge whether it SoapObject properties .
------ eference --------------------------------------- < br>

that I really did not pay attention to me after parsing all tostring () yet what the problem
------ eference ------ ---------------------------------
code that parses your landlord can give me a look ? 378377577@qq.com
------ eference ----------------------------------- ----
landlord could send me a copy , thank you !
------ eference --------------------------------------- < br> landlord , the same problem is resolved not out ! Can you give some code to see ? 1027296673@qq.com or http://bbs.csdn.net/topics/390591966 guide me ,

没有评论:

发表评论