FileNotFoundException when calling webservice

后端 未结 5 819
天涯浪人
天涯浪人 2021-02-04 01:47

Hello I got past my initial problem. I\'m a total android noob, this is my first app. I\'m testing this on the Android emulator. I try to connect to a .NET webservice at h

5条回答
  •  [愿得一人]
    2021-02-04 02:39

    The HttpURLConnection class is misleading in that it will throw a FileNotFoundException for any HTTP error code of 400 or above.

    So it's not necessarily an incorrect URL (404) it could be 400 (bad request), 403 (forbidden), 500 (internal server error) or something else.

    Use the getResponseCode method to get a more precise indication of the problem.

提交回复
热议问题