I am trying to configure an http message in my Blackberry application. I have successfully implemented this in my respective Android app, so I know that it works on it. I tried several different things, and in fact I do not get errors, just the information on the server is not updated. I looked at this post:
Http POST on BlackBerry and several others. I found them useful, but they ultimately did not solve my problem. Again, I am not getting errors, but the server is not updating. Here is the code I'm currently using:
String url = "http://xxxx.com/ratings/add?;deviceside=true";
String postStr1 = "business_id=790";
String postStr2 = "&rating=4";
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("business_id", String.valueOf(790));
encPostData.append("rating", String.valueOf(4));
byte[] postData = encPostData.toString().getBytes("UTF-8");
httpConnection.setRequestProperty("Content-Length", String.valueOf(postData.length));
OutputStream os = httpConnection.openOutputStream();
os.write(postData);
os.flush();
Anyone have any ideas on what might be wrong?
coder source
share