Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

WxCpXmlMessage.fromEncryptedXml 报错 AppID不正确 #1147

Copy link
Copy link
Closed
@silverlight

Description

@silverlight
Issue body actions

简要描述

服务端在接收用户发送的消息调用WxCpXmlMessage.fromEncryptedXml进行解密时报错,java.lang.RuntimeException: AppID不正确,但是用户发送的消息是能接收到。请问这个AppID指的是什么?目前项目里面只配置了corpId和suiteId。

模块版本情况

  • WxJava 模块名: weixin-java-cp
  • WxJava 版本号: 3.4.0

详细描述

如下是处理用户发送信息的逻辑

@PostMapping(produces = "application/xml; charset=UTF-8")
    public String post(@PathVariable("corpId") String corpId,
                       @RequestBody String requestBody,
                       @RequestParam("msg_signature") String signature,
                       @RequestParam("timestamp") String timestamp,
                       @RequestParam("nonce") String nonce) {
        log.info("\n数据回调:[signature=[{}], timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
                signature, timestamp, nonce, requestBody);
        try {

            final WxCpService wxCpService = WxCpConfiguration.getCpServices(corpId);
            WxCpXmlMessage inMessage = null;
            if (wxCpService == null) {
                final WxCpService cpService = configuration.getCpServices(corpId);
                inMessage = WxCpXmlMessage.fromEncryptedXml(requestBody, cpService.getWxCpConfigStorage(),
                        timestamp, nonce, signature);
            } else {
                inMessage = WxCpXmlMessage.fromEncryptedXml(requestBody, wxCpService.getWxCpConfigStorage(),
                        timestamp, nonce, signature);
            }
            this.route(corpId, inMessage);
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
        }

        return "";

日志

https://paste.ubuntu.com/p/cGJdSDjbcX/

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.