连接到webservice的问题

时间:2017-12-12 15:05:48

标签: java android web-services android-studio

已经过了1周我正在处理这个问题,我无法访问网络服务。

我在 onCreate

中的代码
WebServiceConnect wsc = new WebServiceConnect("myurl");
Integer nbre = wsc.doInBackground();

WebServiceConnect .class

public Integer doInBackground(Void... arg0){

        try{
            URL url = new URL(urltoconnect);

            HttpURLConnection connection = (HttpURLConnection) url.openConnection();

            connection.connect();

            int statusCode = connection.getResponseCode();

            return statusCode;

        }catch(Exception e){
            return 404;
        }
}

他总是给我404,所以它不起作用。

这就是我的logcat

12-12 08:48:05.542 2126-8606/com.google.android.googlequicksearchbox:search W/ErrorReporter: reportError [type: 211, code: 524300]: Error reading from input stream
12-12 08:48:05.542 2126-8606/com.google.android.googlequicksearchbox:search W/ErrorProcessor: onFatalError, processing error from engine(4)
                                                                                              com.google.android.apps.gsa.shared.speech.b.g: Error reading from input stream
                                                                                                  at com.google.android.apps.gsa.staticplugins.recognizer.j.a.a(SourceFile:28)
                                                                                                  at com.google.android.apps.gsa.staticplugins.recognizer.j.b.run(SourceFile:15)
                                                                                                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
                                                                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                                                                                                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
                                                                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.ag.run(Unknown Source:4)
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4)
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4)
                                                                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                                                                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                                                                                                  at java.lang.Thread.run(Thread.java:764)
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:6)
                                                                                               Caused by: com.google.android.apps.gsa.shared.exception.GsaIOException: Error code: 393238 | Buffer overflow, no available space.
                                                                                                  at com.google.android.apps.gsa.speech.audio.Tee.f(SourceFile:103)
                                                                                                  at com.google.android.apps.gsa.speech.audio.au.read(SourceFile:2)
                                                                                                  at java.io.InputStream.read(InputStream.java:101)
                                                                                                  at com.google.android.apps.gsa.speech.audio.ao.run(SourceFile:18)
                                                                                                  at com.google.android.apps.gsa.speech.audio.an.run(SourceFile:2)
                                                                                                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
                                                                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
                                                                                                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
                                                                                                  at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.ag.run(Unknown Source:4) 
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4) 
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.bo.run(SourceFile:4) 
                                                                                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
                                                                                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
                                                                                                  at java.lang.Thread.run(Thread.java:764) 
                                                                                                  at com.google.android.apps.gsa.shared.util.concurrent.a.ak.run(SourceFile:6) 
12-12 08:48:05.542 2126-8606/com.google.android.googlequicksearchbox:search I/AudioController: internalShutdown
12-12 08:48:05.544 2126-2480/com.google.android.googlequicksearchbox:search I/MicroRecognitionRunner: Stopping hotword detection.
12-12 08:48:05.572 2126-2126/com.google.android.googlequicksearchbox:search I/MicroDetectionWorker: onReady
12-12 08:48:05.573 2126-2126/com.google.android.googlequicksearchbox:search I/MicroDetector: Keeping mic open: false
12-12 08:48:05.573 2126-2126/com.google.android.googlequicksearchbox:search I/MicroDetectionWorker: #onError(false)
12-12 08:48:05.573 2126-8601/com.google.android.googlequicksearchbox:search I/DeviceStateChecker: DeviceStateChecker cancelled

我测试了一切我没有选择的东西。 THX

0 个答案:

没有答案