Link to home
Start Free TrialLog in
Avatar of magicdlf
magicdlf

asked on

HTTP 400 Bad Request returned only when Java Applet connects to webserver

Experts,

I have a Java applet in my web application for rendering thumbnails. This is always working in most cases. However one of our customer reported that the Applet is not working. They deploy the web application on windows 2008 server. I check the logs and found that when the Java tries to connect to the IIS, I got the following HTTP 400 error:
Data: HTTP/1.1 400 Bad Request\r\nContent-Type: text/html\r\nDate: Thu, 03 Dec 2009 16:17:57 GMT\r\nConnection: close\r\nContent-Length: 20\r\n\r\n<h1>Bad Request</h1>
The url that the Java tried to access to is something like:
Data: GET /App/IrcXmlReq.aspx?Credentials=rxsizb2qnbf5ofddt0ki0zh&What=8&DataSource=CONTENT SERVER

I also tried to visit the url through IE, everything looks OK. I think there's something wrong in the IIS security configuration. Any help or suggestions will be appreciated. Thanks in advance!
private boolean tranSession()
  {
      boolean bRet = false;
      if(sCredentials == null || sTransessionURL == null)
        return false;
      try {
          String tranSessionURLReq = sTransessionURL + "?Credentials=" + sCredentials + "&What=8&DataSource=" + sDataSource;
          URL tranSessionURL = new URL(getCodeBase(), tranSessionURLReq);
          URLConnection con = tranSessionURL.openConnection();
          BufferedInputStream bis = new BufferedInputStream(con.getInputStream());
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          byte[] buf = new byte[BUF_SIZE];
          int bytesRead = 0;
          while ( (bytesRead = bis.read(buf)) != -1) {
            baos.write(buf, 0, bytesRead);
          }
          baos.flush();
          String sRet = baos.toString();
          baos.close();
          bis.close();
          if(sRet.contains("Success") )
            bRet = true;
      }
      catch(Exception e)
      {
      }
      return bRet;
  }

Open in new window

Avatar of Tray896
Tray896
Flag of United States of America image

I would check out the httperr log.  That might give you some additional details towards  a resolution.  That log file is located at %windir%\system32\logfiles\httperr
Avatar of magicdlf
magicdlf

ASKER

I have limited access to the client machine at the moment. I will check the log later. Anything else?
ASKER CERTIFIED SOLUTION
Avatar of arevuri
arevuri
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or there should be some issue with constructing url
arevuri, you are correct! The java code didn't encode the url. What a terrible mistake!
Thank you all for your efforts!