I know this question is quite old, and the OP has probably solved it so far, but I just ran into the same problem and was able to fix it!
You need to add ;deviceside=true to your URL.
So, for example, your URL will change from "http://example.com/directory/submitpost.php" to "http://example.com/directory/submitpost.php;deviceside=true" .
I found this here: http://supportforums.blackberry.com/t5/Java-Development/Different-ways-to-make-an-HTTP-or-socket-connection/ta-p/445879
My POST request was disconnected after 3 minutes when I didn’t have this (see my comment ), but it works fine with this URL app.
I would also recommend using ConnectionFactory . Here are some of my code:
Network.httpPost("http://example.com/directory/submitpost.php;deviceside=true", paramNamesArray, paramValsArray)
public static void httpPost(String urlStr, String[] paramName, String[] paramVal) throws Exception { ConnectionFactory conFactory = new ConnectionFactory(); conFactory.setTimeLimit(1000); HttpConnection conn = (HttpConnection) conFactory.getConnection(urlStr).getConnection(); conn.setRequestMethod(HttpConnection.POST); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); StringBuffer sb = new StringBuffer(); for (int i = 0; i < paramName.length; i++) { sb.append(paramName[i]); sb.append("="); sb.append(paramVal[i]); sb.append("&"); } byte[] postData = sb.toString().getBytes("UTF-8"); conn.setRequestProperty("Content-Length",new Integer(postData.length).toString()); OutputStream out = conn.openOutputStream(); out.write(postData);
source share