Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to develop and debug Wechat official account

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail how to develop and debug the official account of Wechat. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

How to develop and debug Wechat official account

1. For local debugging, you need to map the port to the public network. What are the tools?

Recommend ngrok and QQ Browser

2. What can I use for ngrok?

As summarized by blog, let the Wechat public platform access the local computer through port 80. Ngrok is open source, of course, you can also use a server to build one.

3. Develop debugging tools

It is recommended to use real machine testing, Wechat public platform interface debugging tools, Wechat web developer tools

How to open developer mode

If the project clone is imported into IDE and started, and the port has been mapped to the public network to become the developer mode, it will be relatively simple.

Test number application address and development document address WIKI

Before becoming a developer, you need to make the following configurations:

Modify configuration parameter .png

Developer ID.png

Open development mode .png

The default address for weixin_guide to become developer url is: http:// domain name [/ project name] / msg

Token needs to be consistent with the modified configuration parameter .png.

Message encryption mode

1. Safe mode is recommended in the formal environment, and encryptMessage is set to true. EncodingAesKey must be consistent with the randomly generated EncodingAESKey in open development mode.

2. If it is a test, it is recommended to set it to plaintext to facilitate debugging.

Reminder: links that become developers should not be accessed by browsers (this is for the official account of Wechat; there must be errors in the access). After configuring the project, start the project directly and do port mapping, which is used in the test number or in the Subscription account and service number of the formal environment.

Problems that may be encountered

Message encryption and decryption interface JCE unlimited permission policy

Java.security.InvalidKeyException:illegal Key Size

Solution to exception java.security.InvalidKeyException:illegal Key Size:

Download the JCE unlimited access policy file on the official website. After downloading and decompressing it, you can see local_policy.jar and US_export_policy.jar as well as readme.txt. If JRE is installed, put two jar files in the% JRE_HOME%\ lib\ security directory to overwrite the original file, and if JDK is installed, put two jar files in the% JDK_HOME%\ jre\ lib\ security directory to overwrite the original file.

Download address of JDK7 version JCE

Download address of JDK8 version JCE

How weixin_guide becomes the Source Code interpretation of developer Mode

1. How to become the official reference document of developer model

2. Introduce in detail the articles written by the cnblogs blog before the implementation of the Java servlet version

3. Weixin_guide becomes a developer and all message interactions communicate with WeixinMsgController, while WeixinMsgController inherits from MsgControllerAdapter and clicks in to view the source code. You will find that MsgControllerAdapter is an abstract class that provides a lot of abstract methods (dealing with various events and messages). MsgControllerAdapter inherits from MsgController, one of which has an interceptor MsgInterceptor added to it. The interceptor encrypts and verifies the interactive data. Focus on the checkSignature method

Developer mode interceptor

Signature verification

This is the end of the article on "how to develop and debug Wechat official account". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report