gpt4 book ai didi

android - ksoap2 in android in Multiple Array Data Retrieving

转载 作者:太空狗 更新时间:2023-10-29 16:09:37 25 4
gpt4 key购买 nike

实际上我有一个搜索员工的服务.. 该服务以多种数组形式为我提供结果,例如:

<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>

现在我添加了以下代码:

androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject result=(SoapObject) envelope.getResponse();

但是 getResponse 给我以下错误:

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)

请各位 friend 帮帮忙。我已经在帖子上问了我的问题
get data from ksoap2 in android

最佳答案

envelope.getResponse() 可以返回一个 SoapObject 或一个 SoapPrimitive/Vector,我想你是在 SoapObject 上转换一个 Vector

关于android - ksoap2 in android in Multiple Array Data Retrieving,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5976335/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com