Hi, Is your server responding with the very important HTTP status line? It looks like this:
HTTP/1.1 200 OK Try telnetting in and performing the same HTTP request. If you're connecting to an SSL server you'll probably need to use openssl's "s_client" command. openssl s_client -connect www.cucbc.com:443 After all the certificate and SSL information flies by on the screen, type in something like this: HEAD / HTTP/1.0[enter] [enter] Replace "www.cucbc.com" with whatever server you are connecting to. Replace "/" with the path of the resource you are requesting. You should hopefully see a response like this: HTTP/1.1 200 OK Date: Mon, 02 Oct 2006 14:22:02 GMT Server: Apache/2.0.46 (Red Hat) Accept-Ranges: bytes Connection: close Content-Type: text/html; charset=UTF-8 If you are on Windows you can download OpenSSL starting from this link: http://www.openssl.org/related/binaries.html Instead of the openssl "s_client" command, you could try this pure-java "commons-ssl" Ping utility I'm working on instead, but it only does "HEAD /" - it doesn't try any other URL's. You'd need to hack it up a bit to get different URLs. http://juliusdavies.ca/commons-ssl/ Download "commons-ssl.jar" or "commons-ssl.zip", and once you have a jar file, try this: java -jar commons-ssl.jar Hopefully that will show whether your server is correctly responding with a status line! yours, Julius On Mon, 2006-02-10 at 09:07 -0500, Glenn Holmer wrote: > I'm writing code to connect to an SSL server. Although I can see the > responses I'm expecting in the wire trace, the program still fails on a > ProtocolException (when I call client.executeMethod() with a > PostMethod). I've tried several adjustments: > > client = new HttpClient(); > client.getParams().setParameter( > "http.protocol.version", > HttpVersion.HTTP_1_0); > client.getParams().setParameter( > "http.protocol.content-charset", > "UTF-8"); > client.getParams().setParameter( > "http.protocol.unambiguous-statusline", > false); > client.getParams().setParameter( > "http.protocol.strict-transfer-encoding", > false); > client.getParams().setParameter( > "http.protocol.status-line-garbage-limit", > Integer.MAX_VALUE); > > Is there anything obvious I might have missed? This is the stack trace: > > org.apache.commons.httpclient.ProtocolException: The server > xxxxxxxx.xxxxxxxx.com failed to respond with a valid HTTP response > at > org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1846) > at > org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590) > at > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324) > -- Julius Davies Senior Application Developer, Technology Services Credit Union Central of British Columbia http://www.cucbc.com/ Tel: 416-652-0183 Cel: 647-232-7571 1441 Creekside Drive Vancouver, BC Canada V6J 4S7 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
