Json RPC error 32600

纵然是瞬间 提交于 2019-12-13 01:12:57

问题


I am using jquery ajax to pass json rpc request to remote server. Here is my json string:

{"jsonrpc":"2.0","method":"merchant_check","params":{"hostID":150999,"orderID":107,"amount":"7777","currency":"051","mid":15001038,"tid":15531038,"mtpass":"12345","trxnDetails":""},"id":107}

I am getting this error:

{"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid JSON-RPC 2.0 request error (-32600)"}}

What am I doing wrong? Thanks for help.


回答1:


It may be the JSON liberary the service is using. Try the following:

  1. Put spaces between the end of a key string+colon amd tje value, "key": "value" vs "key":"value"
  2. Try putting the request id as a string, "id": "1" vs "id": 1
  3. I don't know how well ist was coded, the service, but if you have malformed parameters, it may give you the-32600 error, instead of -32602. So what kind of currency are you using that requires no decimal and gets sent as string? What is a "mid", an integer?

Your request object looks good, it think it's what the service is expecting and calling good or bad request object.




回答2:


I had the same problem using json-rpc net. The problem was caused by the content-type header. By default it was being set to application/x-www-form-urlencoded by my browser and it generated that error. Setting it to application/json fixed my issue.



来源:https://stackoverflow.com/questions/9988733/json-rpc-error-32600

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!