0

I was meet a problem when I tried used net/jsonrpc package to build a server and a Java client with jsonrpc4j

The problem is jsonrpc4j is when error happen, golang`s method will return error and encoding to json.

I got this json object in client

{"id": -6028374044949000, "result": null, "error": "some error return message"}

This object cast failed in java's json4j.

http://www.jsonrpc.org/specification#error_object

After I checked the jsonrpc page, it is said the error field MUST a json object with fields [code, message, date], the golang jsonrpc package not meet the require.

So I`m confused how to solve this. Change the jsonrpc lib, Just replace the rpc way to thrift/gRpc, Avoid to return error but send error in reply and let Java check the response, Or just edited the json4j or golang's source code ( I'm very horrible about this option)

Thanks for watch.

Venser Lin
  • 13
  • 4

1 Answers1

0

If you need JSON-RPC 2.0 support for Go you can try https://github.com/powerman/rpc-codec

Powerman
  • 790
  • 6
  • 12