我一直在處理BlackBerry發佈請求,並且請求正在發送,但參數似乎不是。這裏是我的代碼:http發送請求不在黑莓5.0中發送參數
HttpConnection httpConnection = (HttpConnection) Connector.open(url);
httpConnection.setRequestMethod(HttpConnection.POST);
httpConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
URLEncodedPostData encPostData = new URLEncodedPostData("UTF-8", false);
encPostData.append("time", "1314144000");
System.out.println("url: " + httpConnection.getURL());
byte[] postData = encPostData.toString().getBytes("UTF-8");
System.out.println("post data: " + encPostData.toString());
httpConnection.setRequestProperty("Content-length", String.valueOf(postData.length));
System.out.println("url: " + httpConnection.getURL());
System.out.println("message:" + httpConnection.getResponseMessage());
OutputStream os = httpConnection.openOutputStream();
os.write(postData);
os.flush();
os.close();
我從服務器(我們設置)得到的響應是我們沒有發送時間戳。我的問題有沒有問題
encPostData.append("time", "1314144000");
code?
這並沒有幫助... – coder
曾經評論System.out.println(「message:」+ httpConnection.getResponseMessage());行和check.i檢查你的代碼它爲我工作 – koti
我剛剛評論了行System.out.println(「message:」+ httpConnection.getResponseMessage());出來,但它仍然沒有工作。正在建立連接,但服務器沒有獲取數據。 – coder