posted 17 years ago
I am getting this exception "java.io.IOException: Server returned HTTP response code: 400" while getting InputStream. Whereas, hitting the same URL in IExplorer gave the successful response. Please find below the code. Please help. Thanks.
Regards,
Hassam
URL hostURL = new URL("https://www.domain.com/abc?paramters=values");
HttpURLConnection urlcon = (HttpURLConnection) hostURL.openConnection();
urlcon.setRequestMethod("GET");
urlcon.setDoOutput(true);
urlcon.setDoInput(true);
urlcon.setUseCaches(false);
BufferedReader inputdata = new BufferedReader(new InputStreamReader(urlcon.getInputStream()));