public Object invokeMethod(String method, Object[] params) {
PostMethod post = new PostMethod(this.url + appendToUrl);
ByteBuffer resultBuffer = null;
ByteBuffer data = encodeInvoke(method, params);
post.setRequestEntity(new InputStreamRequestEntity(
data.asInputStream(), data.limit(), CONTENT_TYPE));
try {
int resultCode = client.executeMethod(post);
if (resultCode / 100 != 2) {
throw new RuntimeException(
"Didn't receive success from remoting server.");