[2020-12-02 11:32:10.972] [acc6f142-37f1-4d31-82ce-e8bf624b702f] [http-nio-9018-exec-5 ] [ERROR] [c.y.ecp.mapp.alice.speech.impl.context.BaiduSpeechContext :113 ] - 127.0.0.1|316d369b-dbf3-4592-bc35-f8cead9fecc2|语音识别失败: I/O error on POST request for "http://vop.baidu.com/server_api": Software caused connection abort: recv failed; nested exception is java.net.SocketException: Software caused connection abort: recv failed
代码是这样的:
json.put("speech", base64Content);
json.put("format", format);
// 采样率
json.put("rate", 16000);
json.put("channel", 1);
// 创建唯一的cuid值
json.put("cuid", appId);
json.put("token", token);
json.put("len", length);
HttpHeaders header = new HttpHeaders();
header.setContentType(MediaType.APPLICATION_JSON);
HttpEntity httpEntity = new HttpEntity(json.toJSONString(), header);
long recognizeStart = System.currentTimeMillis();
ResponseEntity response = restTemplate.postForEntity(RECOGNIZE_PATH, httpEntity,
JSONObject.class);
JSONObject result = response.getBody();
你好,信息中没有看到百度侧返回的相关错误信息,建议优先测试官方demo https://github.com/Baidu-AIP/speech-demo