开发者

JSON-RPC client in Java [closed]

开发者 https://www.devze.com 2023-02-10 15:18 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

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 question

I'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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号