hello
i am trying to get search data from bing...and it has a https url and even has user name and password to access it...when i am using it on normal pc browser it works fine.but when i am tring to redirect it to mobile browser it says secure connection not available.and when i am using it through code to get the data using the following code
i am getting 60 http errorCode:connection = (HttpConnection) Connector.open(baseURL); connection.setRequestMethod(HttpConnection.GET); connection.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0"); String accountKey = "d8I62wTYbZSFwVb+HI/CK="; String actkey=accountKey + ":" + accountKey; String accountKeyEnc = Base64.base64Encode((actkey).getBytes()); String accountKeyEnc = Base64.base64Encode((accountKey + ":" + accountKey).getBytes()); connection.setRequestProperty("Authorization", "Basic " + accountKeyEnc); connection.setRequestProperty("Content-Type", "text/plain"); connection.setRequestProperty("Content-Length", "0"); connection.setRequestProperty("Content-Language", "en-US"); connection.setRequestProperty("Connection", "close"); connection.setRequestProperty("Accept", "text/plain"); System.out.println("Status Line Code: " + connection.getResponseCode()); System.out.println("Status Line Message: " + connection.getResponseMessage()); if (connection.getResponseCode() == HttpConnection.HTTP_OK) { System.out.println(connection.getHeaderField(0) + " " + connection.getHeaderFieldKey(0)); System.out.println("Header Field Date: " + connection.getHeaderField("date")); inputstream = connection.openInputStream(); int length = (int) connection.getLength(); if (length != -1) { byte incomingData[] = new byte[length]; inputstream.read(incomingData); str = new String(incomingData); } else { ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); int ch; while ((ch = inputstream.read()) != -1) { bytestream.write(ch); } str = new String(bytestream.toByteArray()); bytestream.close(); } System.out.println(str);
please do help me i am struck

Reply With Quote


