ksoap2 发送复杂对象时出错
需要帮助!我试图解决这个问题,
03-01 20:56:17.342: WARN/System.err(610): java.lang.NullPointerException
03-01 20:56:17.463: WARN/System.err(610): at java.io.Writer.write(Writer.java:152)
03-01 20:56:17.482: WARN/System.err(610): at org.kxml2.io.KXmlSerializer.startTag(KXmlSerializer.java:422)
03-01 20:56:17.482: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:613)
03-01 20:56:17.522: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:657)
03-01 20:56:17.532: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeProperty(SoapSerializationEnvelope.java:645)
03-01 20:56:17.542: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:614)
03-01 20:56:17.562: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:598)
03-01 20:56:17.572: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:655)
03-01 20:56:17.592: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeBody(SoapSerializationEnvelope.java:579)
03-01 20:56:17.592: WARN/System.err(610): at org.ksoap2.SoapEnvelope.write(SoapEnvelope.java:192)
03-01 20:56:17.612: WARN/System.err(610): at org.ksoap2.transport.Transport.createRequestData(Transport.java:74)
03-01 20:56:17.622: WARN/System.err(610): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:58)
03-01 20:56:17.642: WARN/System.err(610): at com.siteStory.webService.UtilityWS.sendRequest(UtilityWS.java:48)
03-01 20:56:17.642: WARN/System.err(610): at com.siteStory.webService.UserWS.insertUser(UserWS.java:90)
03-01 20:56:17.662: WARN/System.err(610): at com.siteStory.login.Registration$1.onClick(Registration.java:37)
03-01 20:56:17.662: WARN/System.err(610): at android.view.View.performClick(View.java:2408)
03-01 20:56:17.692: WARN/System.err(610): at android.view.View$PerformClick.run(View.java:8816)
03-01 20:56:17.702: WARN/System.err(610): at android.os.Handler.handleCallback(Handler.java:587)
03-01 20:56:17.712: WARN/System.err(610): at android.os.Handler.dispatchMessage(Handler.java:92)
03-01 20:56:17.722: WARN/System.err(610): at android.os.Looper.loop(Looper.java:123)
03-01 20:56:17.732: WARN/System.err(610): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-01 20:56:17.782: WARN/System.err(610): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 20:56:17.782: WARN/System.err(610): at java.lang.reflect.Method.invoke(Method.java:521)
03-01 20:56:17.812: WARN/System.err(610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-01 20:56:17.822: WARN/System.err(610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-01 20:56:17.832: WARN/System.err(610): at dalvik.system.NativeStart.main(Native Method)
我依赖于本教程: http://seesharpgears.blogspot.com/2010/10/ksoap-android-web-service-tutorial-with.html
我想我没有添加一些属性,但我添加的是:
PropertyInfo p1 = new PropertyInfo();
p1.setName("user");
p1.setValue(user);
p1.setType(User.class);
utilityWS.setProperty(p1);
Need help! I'm trying to figure this problem
03-01 20:56:17.342: WARN/System.err(610): java.lang.NullPointerException
03-01 20:56:17.463: WARN/System.err(610): at java.io.Writer.write(Writer.java:152)
03-01 20:56:17.482: WARN/System.err(610): at org.kxml2.io.KXmlSerializer.startTag(KXmlSerializer.java:422)
03-01 20:56:17.482: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:613)
03-01 20:56:17.522: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:657)
03-01 20:56:17.532: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeProperty(SoapSerializationEnvelope.java:645)
03-01 20:56:17.542: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:614)
03-01 20:56:17.562: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:598)
03-01 20:56:17.572: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:655)
03-01 20:56:17.592: WARN/System.err(610): at org.ksoap2.serialization.SoapSerializationEnvelope.writeBody(SoapSerializationEnvelope.java:579)
03-01 20:56:17.592: WARN/System.err(610): at org.ksoap2.SoapEnvelope.write(SoapEnvelope.java:192)
03-01 20:56:17.612: WARN/System.err(610): at org.ksoap2.transport.Transport.createRequestData(Transport.java:74)
03-01 20:56:17.622: WARN/System.err(610): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:58)
03-01 20:56:17.642: WARN/System.err(610): at com.siteStory.webService.UtilityWS.sendRequest(UtilityWS.java:48)
03-01 20:56:17.642: WARN/System.err(610): at com.siteStory.webService.UserWS.insertUser(UserWS.java:90)
03-01 20:56:17.662: WARN/System.err(610): at com.siteStory.login.Registration$1.onClick(Registration.java:37)
03-01 20:56:17.662: WARN/System.err(610): at android.view.View.performClick(View.java:2408)
03-01 20:56:17.692: WARN/System.err(610): at android.view.View$PerformClick.run(View.java:8816)
03-01 20:56:17.702: WARN/System.err(610): at android.os.Handler.handleCallback(Handler.java:587)
03-01 20:56:17.712: WARN/System.err(610): at android.os.Handler.dispatchMessage(Handler.java:92)
03-01 20:56:17.722: WARN/System.err(610): at android.os.Looper.loop(Looper.java:123)
03-01 20:56:17.732: WARN/System.err(610): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-01 20:56:17.782: WARN/System.err(610): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 20:56:17.782: WARN/System.err(610): at java.lang.reflect.Method.invoke(Method.java:521)
03-01 20:56:17.812: WARN/System.err(610): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-01 20:56:17.822: WARN/System.err(610): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-01 20:56:17.832: WARN/System.err(610): at dalvik.system.NativeStart.main(Native Method)
I relied on this tutorial: http://seesharpgears.blogspot.com/2010/10/ksoap-android-web-service-tutorial-with.html
I think I don't add some property but what I added is:
PropertyInfo p1 = new PropertyInfo();
p1.setName("user");
p1.setValue(user);
p1.setType(User.class);
utilityWS.setProperty(p1);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需放置一个断点,看看为什么它会抛出 NPE。
Just put a break point and see why it throws an NPE..