Hi I'm getting the following stack trace

[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R Fatal transport error:
unknown certificate
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R
javax.net.ssl.SSLHandshakeException: unknown certificate
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R     at
com.ibm.jsse.bg.a(Unknown Source)
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R     at
com.ibm.jsse.b.a(Unknown
Source)
[06/10/07 23:04:28:609 BST] 6cfbe370 SystemErr     R     at
com.ibm.jsse.b.write(Unknown Source)

from this code ...  anyone know how to overcome the handshake exception?

HttpClient client = new HttpClient();
PostMethod post = new PostMethod("https://somehttpsurl.com";);

NameValuePair[] data = {
    new NameValuePair("name1", "value1"),
....
    new NameValuePair("nameX","valueX")
    };

post.setRequestBody(data);

try
{
    // Execute the method.
    int statusCode = client.executeMethod(post);

    if (statusCode != HttpStatus.SC_OK)
    {
        System.err.println("Method failed: " + post.getStatusLine());
    }

    // Read the response body.
    byte[] responseBody = post.getResponseBody();

    // Deal with the response.
    // Use caution: ensure correct character encoding and is not binary data
    out.println(new String(responseBody));
}
catch (HttpException e)
{
    System.err.println("Fatal protocol violation: " + e.getMessage());
    e.printStackTrace();

}
catch (IOException e)
{
    System.err.println("Fatal transport error: " + e.getMessage());
    e.printStackTrace();
}
finally
{
    // Release the connection.
    post.releaseConnection();
}

Reply via email to