我需要帮助。我正在从oracle数据库向Spring mvc发送一个http请求。作为回报,我得到了HTTP Status 400 – Bad Request
我该如何解决?添加
utl_http.set_body_charset (req, 'WINDOWS-1251');
也不起作用。
使用拉丁字母,一切正常。换成西里尔字母后,我会得到一个错误
请求(plsql)
declare
content varchar2(4000) := '{"to":"996707332572","from":"Текст","text":"Тест текст"}';
begin
req := utl_http.begin_request(url, 'POST',' HTTP/1.1');
utl_http.set_header(req, 'user-agent', 'mozilla/4.0');
utl_http.set_header(req, 'Content-Type', 'application/json');
utl_http.set_header(req, 'Content-Length', length(content));
utl_http.set_body_charset ('UTF-8');
utl_http.write_text(req, content);
res := utl_http.get_response(req);
控制器中的方法
@ResponseBody
@RequestMapping(value = "/send-msg",method = RequestMethod.POST,
produces = "application/xml; charset=utf-8")
public Object sendMsg(@RequestBody SmsBody smsBody) throws Exception