jsonrpc使用问题,如何输入正确参数和格式
本人小白刚进公司 给了我个demo然后让我熟悉 用rpc调用Hshare的一些方法 了解功能 只会照着在invoke方法里输入不带参数的方法,例如"getinfo"不需要参数 就可以运行并且返回数据 想那些带参数的不是报格式错误 就是 报异常 ,希望有大神指点一下
这个是demo
public static void main(String[] args) throws Throwable {
final String rpcuser = "test";
final String rpcpassword = "test1";
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(rpcuser, rpcpassword.toCharArray());
}
});
JsonRpcHttpClient client = new JsonRpcHttpClient(new URL("http://192.168.0.35:10086"));
System.out.println(client.invoke("getinfo", new Object[] {}, Object.class));
}
下面是Hshare的 json-rpc-api 链接
https://github.com/HcashOrg/hcashd/blob/dev/docs/json_rpc_api.md#ExampleCode