html52.com
我爱小程序-开发者交流社区

调用https://api.weixin.qq.com/cv/ocr/返errcode:41005?

Java httpClient Post调用小程序OCR身份证识别,地址:https://api.weixin.qq.com/cv/ocr/idcard?,
返回错误信息:{"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);
}

请问这是哪里传错参数了吗?


网友回复

小茵儿:ggggggggghg

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付