技术CTO-关注编程入门知识,提供编程入门教程

您的位置: 首页 > 移动开发 > android > 正文

求 大神帮忙ksoap调用WebService call方法报错。

来源: 技术CTO 阅读:

如题:代码如下
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.bodyOut = request;
envelope.dotNet = false;
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(url);
ht.debug = true;
String soapAction = AppUtil.NAMESPACE + methodName;
System.setProperty("http.keepAlive", "false");
ht.call(soapAction, envelope);
if (envelope.getResponse() != null) {
response = (String) envelope.getResponse();
                          }
ht.call();在4.1的手机上测试没问题,在4.3的手机上测就报错;

07-03 16:21:49.503: W/System.err(18758): java.io.EOFException
07-03 16:21:49.503: W/System.err(18758):  at libcore.io.Streams.readAsciiLine(Streams.java:203)
07-03 16:21:49.503: W/System.err(18758):  at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579)
07-03 16:21:49.503: W/System.err(18758):  at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827)
07-03 16:21:49.503: W/System.err(18758):  at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
07-03 16:21:49.503: W/System.err(18758):  at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
07-03 16:21:49.503: W/System.err(18758):  at org.ksoap2.transport.ServiceConnectionSE.getResponseCode(ServiceConnectionSE.java:103)
07-03 16:21:49.503: W/System.err(18758):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:197)
07-03 16:21:49.503: W/System.err(18758):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)
07-03 16:21:49.503: W/System.err(18758):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113)
07-03 16:21:49.503: W/System.err(18758):  at com.broadking.v3.service.ServerWebService.soapRequest(ServerWebService.java:44)
07-03 16:21:49.503: W/System.err(18758):  at com.broadking.v3.service.ServerWebService.invoke(ServerWebService.java:20)
07-03 16:21:49.503: W/System.err(18758):  at com.broadking.v3.jsonutil.SendRequest.getdata(SendRequest.java:42)
07-03 16:21:49.513: W/System.err(18758):  at com.broadking.v3.GroupActivity$BusinessAreaTask.doInBackground(GroupActivity.java:145)
07-03 16:21:49.513: W/System.err(18758):  at com.broadking.v3.GroupActivity$BusinessAreaTask.doInBackground(GroupActivity.java:1)
07-03 16:21:49.513: W/System.err(18758):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-03 16:21:49.513: W/System.err(18758):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-03 16:21:49.513: W/System.err(18758):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-03 16:21:49.513: W/System.err(18758):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-03 16:21:49.513: W/System.err(18758):  at java.lang.Thread.run(Thread.java:841)
07-03 16:21:49.513: I/System.out(18758): json===null
07-03 16:21:49.513: W/dalvikvm(18758): threadid=19: thread exiting with uncaught exception (group=0x42018898)
07-03 16:21:49.523: E/AndroidRuntime(18758): FATAL EXCEPTION: AsyncTask #4
07-03 16:21:49.523: E/AndroidRuntime(18758): java.lang.RuntimeException: An error occured while executing doInBackground()
07-03 16:21:49.523: E/AndroidRuntime(18758):  at android.os.AsyncTask$3.done(AsyncTask.java:299)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.util.concurrent.FutureTask.run(FutureTask.java:239)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.lang.Thread.run(Thread.java:841)
07-03 16:21:49.523: E/AndroidRuntime(18758): Caused by: java.lang.NullPointerException
07-03 16:21:49.523: E/AndroidRuntime(18758):  at com.broadking.v3.jsonutil.SendRequest.getdata(SendRequest.java:91)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at com.broadking.v3.GroupActivity$BusinessAreaTask.doInBackground(GroupActivity.java:145)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at com.broadking.v3.GroupActivity$BusinessAreaTask.doInBackground(GroupActivity.java:1)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-03 16:21:49.523: E/AndroidRuntime(18758):  ... 3 more

求各位大神给我指点指点。

不太明白你说的什么意思

http://blog.csdn.net/hqkls/article/details/20163601

希望可以对你有所帮助。
我的意思是程序执行到ht.call()这个地方就报错了。
能说清楚点么,最好把贴代码下。
把这个空指针异常解决了 , 这个能定位到 你自己写的代码中吗, 哪出现了空指针 ?  打 Log 跟 在4.1版本上运行对比
07-03 16:21:49.523: E/AndroidRuntime(18758): Caused by: java.lang.NullPointerException
07-03 16:21:49.523: E/AndroidRuntime(18758):  at com.broadking.v3.jsonutil.SendRequest.getdata(SendRequest.java:91)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at com.broadking.v3.GroupActivity$BusinessAreaTask.doInBackground(GroupActivity.java:145)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at com.broadking.v3.GroupActivity$BusinessAreaTask.doInBackground(GroupActivity.java:1)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
07-03 16:21:49.523: E/AndroidRuntime(18758):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
07-03 16:21:49.523: E/AndroidRuntime(18758):  ... 3 more
还有其它的错误信息吗 ?  上面好像说错了

^_^ 如果您热爱技术、热爱编程,想与更多的朋友一起交流学习,欢迎加入本站官方QQ群:345733473 ^_^