Closed GoogleCodeExporter closed 9 years ago
I'll need to add an invoke method to the rpc clients.
Original comment by brian.di...@gmail.com
on 24 Feb 2012 at 6:01
When do you think this will be implemented? It's a blocker for me at the moment
and I might look for alternative libraries if the resolution time will be too
long..
Original comment by francesc...@gmail.com
on 4 May 2012 at 10:07
This is complete, please try the latest SNAPSHOT version and report back. I'll
cut a release after you've tested it.
Original comment by brian.di...@gmail.com
on 21 May 2012 at 9:18
Will test tomorrow first thing. Thank you.
Original comment by francesc...@gmail.com
on 21 May 2012 at 10:07
After testing I have discovered that this is not what I was looking for.
I have put in a quick and dirty hack to make it work the way I have intended.
Only one line is changed. Of course this breaks the library but it explains my
point.
I'll post as a comment:
public void writeRequest(
String methodName, Object[] arguments, OutputStream ops, String id)
throws IOException {
// create the request
ObjectNode request = mapper.createObjectNode();
request.put("id", id);
request.put("jsonrpc", JSON_RPC_VERSION);
request.put("method", methodName);
//Hacking in here
//request.put("params", mapper.valueToTree(arguments));
request.put("params", mapper.valueToTree(arguments[0]));
// show to listener
if (this.requestListener!=null) {
this.requestListener.onBeforeRequestSent(this, request);
}
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "JSON-PRC Request: "+request.toString());
}
// post the json data;
writeAndFlushValue(ops, request);
}
Original comment by francesc...@sumup.com
on 22 May 2012 at 1:11
What you've described is possible with what is in the latest snapshot.
you would do the following:
Object[] myArrayOfArguments = ...;
Map<String, Object> args = new HashMap<String, Object>();
args.put("params", myArrayOfArguments[0]);
client.writeRequest("method", args, ops, id);
Original comment by brian.di...@gmail.com
on 25 May 2012 at 2:50
Original comment by brian.di...@gmail.com
on 25 May 2012 at 2:51
Oh wait, i think i see what you're doing there. I'll make a change right now
for ya.
Original comment by brian.di...@gmail.com
on 25 May 2012 at 2:53
ok, take a look now. you'll notice that there is only one writeRequest now.
It accepts an Object for the argument.
Original comment by brian.di...@gmail.com
on 25 May 2012 at 3:45
Thanks for the fix! Problem is: it does not work with proxies. I guess (by
looking at proxy code) that it always uses the invoke with a Object[] param.
Can this enhancement be ported in the Proxy code as well?
Thanks!
Original comment by francesc...@sumup.com
on 4 Jun 2012 at 9:03
This is what I get from the logging while using the proxy:
Jun 4, 2012 10:57:00 AM com.googlecode.jsonrpc4j.JsonRpcClient
internalWriteRequest
FINE: JSON-PRC Request:
{"id":"-7242475462679936753","jsonrpc":"2.0","method":"login","params":[{"userna
me":.....}]}
Original comment by francesc...@sumup.com
on 4 Jun 2012 at 9:12
Yeah, I could make that happen. I'll ping this issue back after I've done it.
Original comment by br...@shopnation.com
on 4 Jun 2012 at 6:49
Original issue reported on code.google.com by
subp...@gmail.com
on 23 Feb 2012 at 8:41