I need to send message data to https-url using apache HttpClient package,
after sending the message data i need to get the html data.
the mail data I send is an XML string, and the mail data I receive is an XML string.
Any information regarding this issue would be greatly appreciated.
I googled and I found examples on the Internet that uses DefaultHttpClient, which is now deprecated in version 4. so I would like to know how to properly use the new version of the client.
thank.
Update
public String sendPost(final String request, final String postData) throws ClientProtocolException, IOException {
String result = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(request);
CloseableHttpResponse response = httpclient.execute(httpPost);
try {
HttpEntity entity = response.getEntity();
result = EntityUtils.toString(entity);
EntityUtils.consume(entity);
} finally {
response.close();
}
return result;
}
, . , . , , , postData. ?