Http Get Request returns html?
Once you check the server side code as well..after the is coming means change the code like this...
url = new URL(urlString); httpURLConnection = (HttpsURLConnection) url.openConnection(); //httpURLConnection = (HttpURLConnection) url.openConnection(); // HttpsURLConnection.setDefaultHostnameVerifier(new NullHostNameVerifier()); httpURLConnection.setRequestMethod("GET"); httpURLConnection.setRequestProperty("Connection", "keep-alive"); httpURLConnection.setRequestProperty("Content-Type", "application/json"); httpURLConnection.setRequestProperty("UseCookieContainer", "True"); httpURLConnection.setChunkedStreamingMode(0); httpURLConnection.connect(); if (httpURLConnection != null) { respCode = httpURLConnection.getResponseCode(); messageStatus.setResponseCode(respCode); } if (respCode == 200) { InputStream responseStream = httpURLConnection.getInputStream(); messageStatus.setResponseStream(responseStream); }
Are you in control of the target web service?
Have you tried "text/x-json" as the content type. Recently found out myself that some systems don't support application/json even though it's the standard.
The server must return JSON, not just printing. If you use PHP for example, use:
print(json_encode($response));
not simple print method.