Monday, March 3, 2014

android in webservce get data parsing problem soapObject


Recent attempts to be developed, used network communication piece. There are several problems:
1android client has been weibservice play soapObject object but how to resolve a data type that I need?
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

After calling the webservice get android above soapObject tostring () looks like this
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;};};}
The same can not be obtained directly from c # datatable similar type of data.
How to use Ksoap class can get a standard xml file and then call your own parsing library android resolve? Could only get xml webservice calls with post get method?<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Top datatable difficult to achieve under investigation to know
Reply:
Take each field inside the loop obtained after SoapObject object
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 ().);
.
.
.
}
Reply:

Is on the top floor
You can debug while watching the corresponding data obtained is not up
Reply:
If you are to develop their own ends, it is recommended to use json, fast, small, gray often easily resolved!
Server: result = JsonConvert.SerializeObject (Objcet) ;/ / start sequence of
Client:
 
GsonBuilder gsonb = new GsonBuilder ();
/ / Json date expression in no way directly into our Date type, and therefore requires a separate register a Date deserialization class.
DateDeserializer ds = new DateDeserializer ();
/ / Method to GsonBuilder specified Date type deserialization method
alonegsonb.registerTypeAdapter (Date.class, ds);
Type t = new TypeToken > () {} getType ();.
Gson gson = gsonb.create ();
/ / Json data will be parsed into objects
if (! result.equals ("-1")) {
/ / Result is a string that you get, t is the type you want to convert
resultList = gson.fromJson (result, t);
}

Reply:
I try to approach you and thank
And replace it with my own split it
spile
Reply:
After taking each field
cycle
get SoapObject object inside:
references 2nd Floor weicheng_android replyfor (int i = 0; i SoapObject soapChilds = (SoapObject) soapObject.getProperty (i);
System.out.println (soapChilds.getPro ......


As with SoapObject, then use its standard solution, layers take until taking on so far!
Reply:
Thank you for rookie taught a layer by layer to extract the statement posted on the scattered points
Reply:
Layer by layer parsing words, you must know what type it is Yeah, because it's not necessarily a string, they might be a list of objects, um, how to judge it
Reply:
There is a problem when fetching data, if Webservice null values ​​in a database query, the property SoapObject returned result set which do not have this field. When parsing error, how to judge SoapObject property exists yet.
Reply:
referenced 8th Floor reply:
one level to resolve the case, you must know what type it is that way, because it is not necessarily a string, may is also a list of objects, um, how to judge it


This I really did not pay attention to me after all tostring parse () the problem is not what
Reply:
Code analysis of your landlord can give me a look? 378377577@qq.com
Reply:
Can the landlord sent me a copy, thank you!
Reply:
The landlord, the same problem is resolved not to come out! Can you give some code to see? 1027296673@qq.com or http://bbs.csdn.net/topics/390591966 guide me,
Reply:
To return to what to use XML format, I was BYTE [] to return the client to read, like a lot of gibberish,,
QQ: 395156809, help to tell you, thank you

No comments:

Post a Comment