@NotNull public HttpUriRequest createRequest( @NotNull Descriptors.MethodDescriptor method, @NotNull Message request) throws IOException, URISyntaxException { final HttpPost post = new HttpPost( baseUri.resolve( method.getService().getName().toLowerCase() + "/" + method.getName().toLowerCase() + format.getSuffix())); post.setHeader(HttpHeaders.CONTENT_TYPE, format.getMimeType()); post.setHeader(HttpHeaders.CONTENT_ENCODING, StandardCharsets.UTF_8.name()); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); format.write(request, stream, StandardCharsets.UTF_8); post.setEntity(new ByteArrayEntity(stream.toByteArray())); return post; }