One of the developer suggested BIS-B setting and that seems to addressed the timed out issue. However I get 411 which is HTTP_LENGTH_REQUIRED error. I set the length with
conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
the new code looks like,
StreamConnection s = (StreamConnection) Connector.open(url + ";deviceside=false;ConnectionType=mds-public");
conn = (HttpConnection) s;
if (conn == null) {
return ("Could not create Connection.");
}
conn.setRequestMethod(HttpConnection.GET);
conn.setRequestProperty("Content-Length", Integer.toString(data.length()));
out = conn.openOutputStream();
out.write(data.getBytes());
out.flush();
responseCode = conn.getResponseCode();
if (responseCode != HttpConnection.HTTP_OK) {
sendResult = false;
responseContent = null;
} else {
sendResult = true;
// System.out.println("http: connection ok.");
getResponseContent( conn );
}
any clue?
thanks,
Guna
Quote:
Originally Posted by ggovind I've gone through almost all the httpConnection related issues discussed in this forum. I'm having this problem of "Timed Out" at the Connector.open() call. I tried several URLs and none works.
conn = (HttpConnection) Connector.open(url);
conn.setRequestMethod(requestMode);
out = conn.openOutputStream();
out.write(data.getBytes());
out.flush();
responseCode = conn.getResponseCode();
just to clarify, I have lessthan 50 buyes in my data payload. The timeout happens approximately after 20 seconds, not after 2 minutes. I tried with several URLs just for testing, it always times out. I'm using GET mode. I'm trying this on my BOLD. The code works fine in my simulator. not time outs in the simulator with the same URL. Anyhelp?
thanks, |