How to parse a complex object with ksoap?

纵饮孤独 提交于 2019-12-08 11:21:27

问题


I use ksoap to connect to a soap web service. And get a Soapobject in return. How would I parse this complex soapobject.

My problem is that a SoapObject returns an object for getProperty, this can be a leaf or a node in the tree. I have a complex resultobject that consists of some ints and strings and a list of complex objects. I now somehow have to decide if the property is a leaf or another complex object that can be parsed as an SoapObject.

Is there an example on how to parse this?


回答1:


You could find this tutorial useful on handling complex objects in KSOAP with Android:

Complex objects tutorial with sample code

Hope this helps




回答2:


I think, you can use this android web service client open source tool. Where you needn't parse the complex response object. Its just like call a method of a service.

say, for a service say ComplexRespService with param ComplexResponse you have to just write :

 ComplexRespService service = new ComplexRespService ();
 CoplextRespPort port = service.getPort();
 ComplexResponse resp = port.getResponse ( "someRequest");

In this way, It support the complex request/response. This tool can generate "ws client stub" from just the wsdl file.




回答3:


I have added a bit about parsing a complex pojo array on the wiki now. Check it out at http://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks



来源:https://stackoverflow.com/questions/4455644/how-to-parse-a-complex-object-with-ksoap

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!