JSON-RPC client in Java [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this questionI'm trying to find a way to write a java application that can communicate with a json-rpc service (The service is a python twisted server).
However I haven't been able to find a decent library with some good examples (I've googled and fiddled around for like 6 hours now).
So are there any libraries for this in Java, or is there a more-cu开发者_如何学编程mbersome lower level way.
You can take a look at Spring and the RestTemplate class (here is a good introduction: http://blog.springsource.com/2009/03/27/rest-in-spring-3-resttemplate/).
Alternatively, you can use Commons HttpClient to post/get your Json payload to the service.
PostMethod post = new PostMethod("http://myservice.com");
// add the payload to the post object
HttpClient client = new HttpClient();
int status = client.executeMethod(post);
String response = post.getResponseBodyAsString();
Check this out: https://code.google.com/p/json-rpc-client/
The above is a JSON RPC client in Java that can talk to a JSON RPC Service.
精彩评论