1Here is what you need to do:
2
3Get the Apache HttpClient, this would enable you to make the required request
4Create an HttpPost request with it and add the header application/x-www-form-urlencoded
5Create a StringEntity that you will pass JSON to it
6Execute the call
7The code roughly looks like (you will still need to debug it and make it work):
8
9// @Deprecated HttpClient httpClient = new DefaultHttpClient();
10HttpClient httpClient = HttpClientBuilder.create().build();
11try {
12 HttpPost request = new HttpPost("http://yoururl");
13 StringEntity params = new StringEntity("details={\"name\":\"xyz\",\"age\":\"20\"} ");
14 request.addHeader("content-type", "application/x-www-form-urlencoded");
15 request.setEntity(params);
16 HttpResponse response = httpClient.execute(request);
17} catch (Exception ex) {
18} finally {
19 // @Deprecated httpClient.getConnectionManager().shutdown();
20}