briandilley/jsonrpc4j

Error code 32700 in post method (JsonParseException Invalid UTF-8 middle byte 0xebat)

olegkrutskih opened this issue · 0 comments

My english is not very well. So I describe it with code.
After started the server, I test interfaces by post from SoapUI.
But there are some problems:
When post body contains only latin characters, the result is correct.
When post body contains russian characters,it returns error code: 32700.

Code:
Interface:

@JsonRpcMethod("set_task_state")
    fun setTaskState(
            @JsonRpcParam(value = "id_task") idTask: Long,
            @JsonRpcParam(value = "id_user") idUser: Long,
            @JsonRpcParam(value = "state") state: String
    )

Implementation:

override fun setTaskState(idTask: Long, idUser: Long, state: String) {
        log.info("Device call method: setTaskState")
    }

JSON in POST body:

{
	"jsonrpc": "2.0",
	"method": "set_task_state",
	"params": {
		"id_task": 1,
		"id_user": 1,
		"state": "Фыв"
	},
	"id": 1
}

Answer:

{
   "jsonrpc": "2.0",
   "id": "null",
   "error":    {
      "code": -32700,
      "message": "JSON parse error"
   }
}

In debug-mode, I see error:

com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0xfb
 at [Source: (com.googlecode.jsonrpc4j.NoCloseInputStream); line: 7, column: 15]

An exception occurs in the class JsonRpcBasicServer in func handleRequest (235-245 lines).

Anybody can help me with this error?