1android client has been weibservice play soapObject object, but I need to resolve how the data type?
xml files obtained through the web
-
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
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!
------ For reference only -------------------------------------- -
Top about datatable difficult to achieve the next check to know
------ For reference only -------------- -------------------------
I try to approach thank you
replace it with my own split it and spile
------ For reference only ---------------------------------- -----
Thank you for novice taught a layer by layer to extract a statement posted scattered points
------ For reference only ------------------------------------ ---
layer by layer parsing words, 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
---- - For reference only ---------------------------------------
there is a problem, take the data, if Webservice null values in a database query when, SoapObject returned result set attributes inside Without this field. When parsing error, how to judge whether it SoapObject properties.
------ For reference only -------------------------------------- -
that I really did not pay attention to me after parsing all tostring () yet what the problem
------ For reference only ---- -----------------------------------
code that parses your landlord can give me a look ? 378377577@qq.com
------ For reference only --------------------------------- ------
landlord could send me a copy, thank you!
没有评论:
发表评论