我的网络服务有问题,它运行良好,但我需要在请求中发送一个数组并且不知道该怎么做......我读到,ksoap 不支持请求中的数组
我怎样才能欺骗服务并发送一个int数组?
这是我的代码,它适用于所有类型:)
SoapObject result = null;
SoapObject request = new SoapObject(NAMESPACE, methodname);
request.addProperty("int",new int[] {8,345,34,86,1,});
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE aHT = new HttpTransportSE(URL);
以下是失败后的 logcat 输出;)
09-20 10:25:53.156: E/AndroidRuntime(23865): FATAL EXCEPTION: main
09-20 10:25:53.156: E/AndroidRuntime(23865): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.wstest/com.example.wstest.MainActivity}: java.lang.NullPointerException
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.os.Handler.dispatchMessage(Handler.java:99)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.os.Looper.loop(Looper.java:123)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.app.ActivityThread.main(ActivityThread.java:3683)
09-20 10:25:53.156: E/AndroidRuntime(23865): at java.lang.reflect.Method.invokeNative(Native Method)
09-20 10:25:53.156: E/AndroidRuntime(23865): at java.lang.reflect.Method.invoke(Method.java:507)
09-20 10:25:53.156: E/AndroidRuntime(23865): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-20 10:25:53.156: E/AndroidRuntime(23865): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-20 10:25:53.156: E/AndroidRuntime(23865): at dalvik.system.NativeStart.main(Native Method)
09-20 10:25:53.156: E/AndroidRuntime(23865): Caused by: java.lang.NullPointerException
09-20 10:25:53.156: E/AndroidRuntime(23865): at com.example.wstest.MainActivity.onCreate(MainActivity.java:42)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
09-20 10:25:53.156: E/AndroidRuntime(23865): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
09-20 10:25:53.156: E/AndroidRuntime(23865): ... 11 more
希望你能帮我!谢谢