我正在尝试将Android应用程序连接到java Web服务,但我收到此错误:
01-30 13:09:58.663 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ SoapFault - faultcode: 'soapenv:Server.userException' faultstring: 'java.lang.ArrayIndexOutOfBoundsException: 200' faultactor: 'null' detail: org.kxml2.kdom.Node@52f28a7c
01-30 13:09:58.663 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:137)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at org.ksoap2.transport.Transport.parseResponse(Transport.java:129)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at org.ksoap2.transport.HttpTransportSE.parseResponse(HttpTransportSE.java:301)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:274)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at lorenzodaneo.example.com.pmcity.ItemLocation$ConnectionWS.doInBackground(ItemLocation.java:99)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at lorenzodaneo.example.com.pmcity.ItemLocation$ConnectionWS.doInBackground(ItemLocation.java:78)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:287)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
01-30 13:09:58.667 8730-8758/lorenzodaneo.example.com.pmcity W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
我无法理解它是Web服务问题还是Android应用程序问题。 我可以从eclipse插件web服务浏览器运行web服务,从浏览器我可以看到web.xml页面。所以我觉得网络服务还可以吗? 我不知道从哪里开始解决问题!有什么建议吗?
答案 0 :(得分:0)
SoapPrimitive用于基本类型,因此数组应放在SoapObject中。对于数组,你必须迭代它的元素,它将是这样的:
SoapObject res=(SoapObject)envelope.bodyIn;
for(int i=0; i<t.getPropertyCount(); i++){
String ith_string = res.getProperty(i).toString()
}
如果没用,请尝试在此处发布xml reposnse dump。