Пример кода для отправки вашего json на сервер и получения ответа (если есть).
private Void sendJsonGetAsynch() {
Reader r;
HttpClient httpClient = ConnectionUtil.getNewHttpClient();
HttpConnectionParams.setConnectionTimeout(httpClient.getParams(), 10000);
HttpPost httpost = new HttpPost("your url");
InputStream data = null;
try
String json = URLEncoder.encode("here goes your json string ", "UTF-8");
StringEntity visitBeanStringEntity = new StringEntity(json);
httpost.setEntity(visitBeanStringEntity);
httpost.setHeader("json", "application/json");
httpost.setHeader(HTTP.CONTENT_TYPE, "application/json");
HttpResponse response = httpClient.execute(httpost);
if (response != null) {
data = response.getEntity().getContent();
r = new InputStreamReader(data);
StringBuffer buffer = new StringBuffer();
Reader in = new BufferedReader(r);
int ch;
while ((ch = in.read()) > -1) {
buffer.append((char) ch);
}
in.close();
logger.info("Return :" + buffer.toString());
return buffer.toString();
} else {
logger.error("Response was null");
throw new Exception("JSON response was null");
}
} catch (Exception e) {
logger.error(e.getMessage());
}
}