Hi,

in my program, I use consecutive https-Requests. On the 6230 Emulator, everything works fine, but only the first request gets
through with the real phone, after this, it hangs.

Could you please give me a hint, what has to be observed?

Kind regards and thanks a lot,

Bernhard


My code is as follows:


...
/* 1st Request ------------------------------------------------*/
kontostand.authentification.append("logon gestartet");

conn_https = (HttpConnection) Connector.open("https://...",Connector.READ_WRITE);

conn_https.setRequestMethod(HttpConnection.GET);

conn_https.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707");
conn_https.setRequestProperty("Accept","text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1");
conn_https.setRequestProperty("Accept-Language","en-us,en;q=0.5");
conn_https.setRequestProperty("Accept-Encoding","gzip,deflate");
conn_https.setRequestProperty("Accept-Charset","ISO-8859-1,utf-8;q=0.7,*;q=0.7");
conn_https.setRequestProperty("Keep-Alive","300");
conn_https.setRequestProperty("Connection","Keep-Alive");

conn_https.setRequestProperty("Referer","http://...");
is = new DataInputStream(conn_https.openInputStream());

int count = 0;
int run = 0;
String act_header_field_key = null;
while ( ((act_header_field_key = conn_https.getHeaderFieldKey(count)) != null ) && ( count < 10 ) ) {
if (( act_header_field_key.equals("set-cookie") ) && ( run < 20)) {
cookies[run] = new String(conn_https.getHeaderField(count));
run ++;
}
count ++;
}



int ch=0;
while ((ch = is.read()) != -1) {
buffer.append((char)ch);
}
reply = buffer.toString();
// System.err.println(reply);
int Start, Ende;
Start = reply.indexOf("jsessionid=");
Ende = reply.indexOf("?",Start);

String SessionID = reply.substring(Start, Ende);

//System.err.println("SessionID " + SessionID);

is.close();

conn_https.close();


/* 2nd Request */
conn_https = (HttpConnection) Connector.open("https://...;" + SessionID + "?Action=...",Connector.READ_WRITE);

conn_https.setRequestMethod(HttpConnection.GET);
conn_https.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707");

conn_https.setRequestProperty("Accept-Language","en-us,en;q=0.5");
conn_https.setRequestProperty("Accept-Encoding","gzip,deflate");
conn_https.setRequestProperty("Accept-Charset","ISO-8859-1,utf-8;q=0.7,*;q=0.7");
conn_https.setRequestProperty("Keep-Alive","300");
conn_https.setRequestProperty("Connection","Keep-Alive");

conn_https.setRequestProperty("Referer","https://...");

is = new DataInputStream(conn_https.openInputStream());
count = 0;

act_header_field_key = null;
contentlength = 0;

while ( ((act_header_field_key = conn_https.getHeaderFieldKey(count)) != null ) && ( count < 10 ) ) {
//System.err.println(conn_https.getHeaderFieldKey(count) + " --- " + conn_https.getHeaderField(count));
if (( act_header_field_key.equals("set-cookie") ) && ( run < 20)) {
cookies[run] = new String(conn_https.getHeaderField(count));
run ++;
}
if (act_header_field_key.equals("content-length")) {
contentlength = Integer.parseInt(conn_https.getHeaderField(count));
}
count ++;
}

ch=0;
index= 0;

buffer = new StringBuffer();

while (( ch = is.read()) != -1) {
buffer.append((char)ch);
}

reply = new String(buffer.toString());
conn_https.getResponseCode() + conn_https.getResponseMessage() );
// System.err.println(reply);

is.close();


conn_https.close();


...