This is because the SSL cert on the server is self-signed or signed by an unknown certificate authority. JSSE (the SSL library used by HttpClient) by default only trusts those SSL certs that are signed by a few authorities (i.e. Verisign, Thawte). Please take a look at Sun's JSSE docs for some more info about this, and how to work around it.
Mike
On Jan 13, 2004, at 8:50 PM, crescent wrote:
Hi, there
While trying to use HttpClient for a SSL application, I encountered an exception, the codes I used were as follows(the URL is made up here):
HttpClient client = new HttpClient(); HostConfiguration config = client.getHostConfiguration(); HttpsURL sslURL = new HttpsURL("https://sample.com/test.asp"); config.setHost(sslURL); PostMethod post = new PostMethod();
String sXML = "<to>https://sample.com/test.asp</to>"; post.setRequestBody(sXML); post.setRequestContentLength(sXML.getBytes(sEncoding).length); post.setRequestHeader("Content-type", "text/xml; charset=Big"); client.executeMethod(client.getHostConfiguration(), post);
and the exception occured was:
javax.net.ssl.SSLHandshakeException: unknown certificate
my development environment is:
OS : Windows 2000 AP Server : IBM WebSphere 5 JDK : WebSphere JDK
appreciate for any suggestions and solutions for the problem.
best regards
crescent
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]