我正在使用 Ksoap2 从 Android 调用 Web 服务。我构建了请求,但是 .call() 方法抛出了以下异常:
07-22 11:12:57.718: W/System.err(9582): java.lang.NumberFormatException: Invalid int: "][2"
07-22 11:12:57.728: W/System.err(9582): at java.lang.Integer.invalidInt(Integer.java:138)
07-22 11:12:57.728: W/System.err(9582): at java.lang.Integer.parse(Integer.java:375)
07-22 11:12:57.738: W/System.err(9582): at java.lang.Integer.parseInt(Integer.java:366)
07-22 11:12:57.738: W/System.err(9582): at java.lang.Integer.parseInt(Integer.java:332)
07-22 11:12:57.738: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.getIndex(SoapSerializationEnvelope.java:287)
07-22 11:12:57.748: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.readVector(SoapSerializationEnvelope.java:304)
07-22 11:12:57.758: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.readInstance(SoapSerializationEnvelope.java:446)
07-22 11:12:57.758: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:387)
07-22 11:12:57.768: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerializationEnvelope.java:273)
07-22 11:12:57.768: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:389)
07-22 11:12:57.788: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.readUnknown(SoapSerializationEnvelope.java:273)
07-22 11:12:57.788: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.read(SoapSerializationEnvelope.java:389)
07-22 11:12:57.798: W/System.err(9582): at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:151)
07-22 11:12:57.798: W/System.err(9582): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140)
07-22 11:12:57.798: W/System.err(9582): at org.ksoap2.transport.Transport.parseResponse(Transport.java:118)
07-22 11:12:57.808: W/System.err(9582): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:253)
07-22 11:12:57.808: W/System.err(9582): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:116)
07-22 11:12:57.808: W/System.err(9582): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:111)
如果我将完全相同的请求放入 SoapUI,则调用有效。
即使使用 KSoap2,我也会收到响应,但错误似乎是在 Ksoap2 解析响应中。
我相信这是导致错误的响应的这一部分:
<data soapenc:arrayType="xsd:anyType[][2]" xsi:type="soapenc:Array" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
Ksoap2 认为 anyType[][2] 的 ][2 应该是一个 int。
这是 ksoap2 中的错误吗?有解决方法吗?