1 Reply Latest reply: Jul 27, 2011 3:42 PM by DrClap RSS

    HttpURLConnection - Server returned HTTP response code: 400

    878522
      Hi friends,
      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.

      code :

      URL hostURL = new URL("http://www.domain.com/abc?paramters=values");
      HttpURLConnection urlcon = (HttpURLConnection) hostURL.openConnection();
      urlcon.setRequestMethod("GET");
      urlcon.setDoInput(true);
      //urlcon.connect(); --tried this one also...same exception
      InputStream is=urlcon.getInputStream(); -- exception occurs at this line.


      Please help me if you have any details for this error.