Java httpClient Post调用小程序OCR身份证识别,地址:https:
返回错误信息:{"errcode":41005,"errmsg":"media data missing hint: [Mu3GOA0088w512] rid: 62e95228-4d4d74bf-24d67d7e"}。
Java 代码示例:
public static String sendHttpPostForm(String httpUrl, MultipartFile file) {
HttpPost httpPost = new HttpPost(httpUrl);
try {
File f = new File("/Users/heqi/Documents/tmp/" + file.getOriginalFilename());
file.transferTo(f);
FileBody d = new FileBody(f, ContentType.MULTIPART_FORM_DATA, file.getOriginalFilename());
HttpEntity httpEntity = MultipartEntityBuilder.create()
.setCharset(StandardCharsets.UTF_8)
.setContentType(ContentType.MULTIPART_FORM_DATA)
.setMode(HttpMultipartMode.BROWSER_COMPATIBLE)
.addPart("img", d)
.build();
httpPost.setEntity(httpEntity);
} catch (IOException e) {
e.printStackTrace();
}
return sendHttpPost(httpPost);
}
请问这是哪里传错参数了吗?