throws BadRequestException, NotFoundException, IOException, UnAuthorizedAccessTokenException {
URL url = config.resolveURL(String.format("apps/%s/procedures/%s/methods/%s", appId, procedureId, methodId));
HttpRequest request = HttpRequest.post(url).withBody(GSON.toJson(parameters)).build();
HttpResponse response = restClient.execute(request, config.getAccessToken(),
HttpURLConnection.HTTP_BAD_REQUEST,
HttpURLConnection.HTTP_NOT_FOUND);
if (response.getResponseCode() == HttpURLConnection.HTTP_BAD_REQUEST) {
throw new BadRequestException("The Application, Procedure and method exist, " +
"but the arguments are not as expected: " + GSON.toJson(parameters));
} else if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
throw new NotFoundException("application or procedure or method", appId + "/" + procedureId + "/" + methodId);
}
return new String(response.getResponseBody(), Charsets.UTF_8);
}