android中的ksoap2在多数组数据检索中 [英] ksoap2 in android in Multiple Array Data Retrieving
本文介绍了android中的ksoap2在多数组数据检索中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
实际上,我有一个用于搜索员工的服务.该服务使我得到的结果具有多种数组形式,例如:
actually I have a service for search an employee.. that service gives me result in multiple array form like:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:searchResponse xmlns:ns1="urn:abcdwsdl">
<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType=":[6]">
<item xsi:type="xsd:string">success</item>
<item xsi:type="xsd:string">Search results retrieved for *</item>
<item xsi:type="xsd:">
<item>
<ad_id xsi:type="xsd:string">2</ad_id>
<fname xsi:type="xsd:string">abcr</ad_text>
<lname xsi:type="xsd:string">def</location>
<phone xsi:type="xsd:float">123456</lati>
<address xsi:type="xsd:float">America</longi>
</item>
<item>
<ad_id xsi:type="xsd:string">12</ad_id>
<fnamet xsi:type="xsd:string">test user</ad_text>
<lname xsi:type="xsd:string">hello</location>
<phone xsi:type="xsd:float">987654543</lati>
<address xsi:type="xsd:float">England</longi>
</item>
</item>
<item xsi:type="xsd:int">2</item>
<item xsi:type="xsd:int">0</item>
<item xsi:type="xsd:int">0</item>
</return>
</ns1:searchResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
现在,我添加了以下代码:
Now i added the following code:
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject result=(SoapObject) envelope.getResponse();
但是getResponse给我以下错误:
But getResponse Gives me the following Error:
in catch
java.lang.ClassCastException: java.util.Vector
at org.test.search.FirstActivity.loginMethod(FirstActivity.java:74)
at org.test.search.FirstActivity.onCreate(FirstActivity.java:26)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
请朋友帮忙.我已经在帖子中问过我的问题了
从android中的ksoap2获取数据
Please friends Help in this. i already have asked my question on the post
get data from ksoap2 in android
推荐答案
envelope.getResponse()可以返回一个SoapObject或一个SoapPrimitive/Vector,我认为您是在一个SoapObject上投射一个Vector
envelope.getResponse() can return a SoapObject, or a SoapPrimitive/Vector, I think you're casting a Vector on a SoapObject
这篇关于android中的ksoap2在多数组数据检索中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文