Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String sendCommand(String message) {
- HttpClient httpclient = new DefaultHttpClient();
- HttpPost httppost = new HttpPost(URL);
- try {
- String response;
- StringEntity se = new StringEntity( message, HTTP.UTF_8);
- se.setContentType("text/xml");
- httppost.setEntity(se);
- HttpResponse httpresponse = httpclient.execute(httppost);
- HttpEntity resEntity = httpresponse.getEntity();
- response = EntityUtils.toString(resEntity, "UTF-8");
- return response;
- } catch (ClientProtocolException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return "HttpPOST failed.";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement