Hi all,
i created a midlet on nokia s40, use HttpsConnection to connect the server, but i got error Certificate failed verification.
i just write the code like the document of nokia help, but it failed.
void getViaHttpsConnection(String url)
throws CertificateException, IOException {
HttpsConnection c = null;
InputStream is = null;
try {
c = (HttpsConnection)Connector.open(url);

// Getting the InputStream ensures that the connection
// is opened (if it was not already handled by
// Connector.open()) and the SSL handshake is exchanged,
// and the HTTP response headers are read.
// These are stored until requested.
is = c.openDataInputStream();

if c.getResponseCode() == HttpConnection.HTTP_OK) {///////////exception happened at this line getResponseCode() function
// Get the length and process the data
int len = (int)c.getLength();
if (len > 0) {
byte[] data = new byte[len];
int actual = is.readFully(data);
} else {
int ch;
while ((ch = is.read()) != -1) {
} else {
} finally {
if (is != null)
if (c != null)
i try to add con.setRequestProperty("Content-Length",
con.setRequestProperty("Content-Type", "text/html");
but, i still got this error.

i download an example for https, MIDP_2_0_Introduction_to_Secure_MIDlet_Communication_v1_0, but it failed too.

who can tell me how to use httpsconnection? what property do i lost?
who can give me a https example that can work?

thank you all.