成功的php会话需要什么?

I'm writing a client j2me app that connects to a php based api using a post method. For security purposes the app and the api should interact within a session with a 30 minutes timeout. My problem is that, the application user has to keep on logging in even when the session time out is not yet done. My php code is fine because I've tested it on a browser and it works fine; however but the application fails and I have to keep on logging in. Might I be missing something? These are the headers am sending to the server using my Java app.

String phonenumber = this.phonenumberTextbox.getString();
String password = this.passwordTextBox.getString();
HttpConnection httpConn = null;
String url = "http://192.168.56.1/?action=login-user";
InputStream is;
OutputStream os;
is = null;
os = null;
String sReply = "";
boolean loggedIn = false;
try {
    // Open an HTTP Connection object
    httpConn = (HttpConnection) Connector.open(url);
    // Setup HTTP Request to POST
    httpConn.setRequestMethod(HttpConnection.POST);
    httpConn.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Confirguration/CLDC-1.0");
    httpConn.setRequestProperty("Accept_Language", "en-US");
    //Content-Type is must to pass parameters in POST Request
    httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
           os = httpConn.openOutputStream();
    String params;
    params = "phonenumber=" + phonenumber + "&password=" + password;
    os.write(params.getBytes());

    // Read Response from the Server
    StringBuffer sb = new StringBuffer();
    is = httpConn.openDataInputStream();
    int chr;
    while ((chr = is.read()) != -1) {
        sb.append((char) chr);
    }
    // Web Server just returns stuff         
    sReply = sb.toString();
} catch (IOException ex) {
    System.out.println("Cannot find server");
} finally {
    if (is != null) {
        try {
            is.close();
        } catch (IOException ex) {
        }
    }
    if (os != null) {
        try {
            os.close();
        } catch (IOException ex) {
        }
    }
    if (httpConn != null) {
        try {
            httpConn.close();
        } catch (IOException ex) {
        }
    }
}
// do something with sReply

Default practice in PHP these days** when dealing for sessions if for PHP to generate a cookie for the client to store. Your java client must store this cookie (called phpsessid by default, but any PHP programmer worth their salt will change the cookie name), and present it in the HTTP headers on subsequent requests.

I'm not very familiar with the HTTP support in Java, but if it's anything like curl it will include options for setting and retrieving cookies.

** It used to be possible to pass session tokens by a query string (a GET parameter) when making the request, but as this was horribly insecure and leaked potentially sensitive information, it's never used any more and may even no longer be available as an option.