View difference between Paste ID: Dq7te0a4 and GCWPRga1
SHOW: | | - or go back to the newest paste.
1
public String sendCommand(String message) {
2-
 
2+
3
    HttpClient httpclient = new DefaultHttpClient();
4
    HttpPost httppost = new HttpPost(URL);
5
    try {
6
        String response;
7
        StringEntity se = new StringEntity( message, HTTP.UTF_8);
8
        se.setContentType("text/xml");
9
        httppost.setEntity(se);
10-
 
10+
11
        HttpResponse httpresponse = httpclient.execute(httppost);
12
        HttpEntity resEntity = httpresponse.getEntity();
13
        response = EntityUtils.toString(resEntity, "UTF-8");
14
        return response;
15-
 
15+
16
    } catch (ClientProtocolException e) {
17
        e.printStackTrace();
18
    } catch (IOException e) {
19
        e.printStackTrace();
20
    }
21
    return "HttpPOST failed.";