Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StreamConnection s = (StreamConnection) Connector
- .open(connectionString);
- httpConn = (HttpConnection) s;
- httpConn.setRequestMethod("POST");
- httpConn.setRequestProperty("Content-Length", Integer.toString(postData.length()));
- OutputStream output = httpConn.openOutputStream();
- output.write(postData.getBytes());
- output.flush();
- output.close();
- String response = httpConn.getResponseMessage();
- int statusCode = httpConn.getResponseCode();
- if (statusCode != HttpConnection.HTTP_OK) {
- }
- InputStream is = httpConn.openInputStream();
- int ret = 0;
- while ((ret = is.read(buf)) > 0) {
- os.write(buf, 0, ret);
- }
- result = new String(os.toByteArray());
- ConnectionFactory cf = new ConnectionFactory();
- ConnectionDescriptor cd = cf.getConnection("YourUrl");
- httpConnector = (HttpConnection) cd.getConnection();
- httpConnector.setRequestMethod(HttpConnection.POST);
Add Comment
Please, Sign In to add comment