Detailed explanation of Java+WeChat public account development process steps
In the past two days, I wanted to learn WeChat public account development, so I searched online and started practicing. During the process, due to various problems, (the description was incomplete, some articles popped up a new constant without knowing how, It didn’t say where it was defined, and the problem with the jar package version cost me a day), so I will record it here.
1. First, you must register a WeChat public account. Go to Du Niang to search the WeChat public platform and enter this page to register (skip this step if you already have an account):
2. Then use Eclipse to create a new project. Here I am building a web project, jdk is 1.8, and tomcat is 8.5.
3 .In order to establish a connection with WeChat, after building the project, first create a new class and name it: CheckUtil. Its function is to serve as a verification tool for connecting to WeChat. The code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
4. Then create a new servlet , rewrite the doGet method to receive the GET request from WeChat. Part of the code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
5. After the code is written, we need a tool to map our intranet link to the public network so that WeChat can access it. Go to our backend. Here I use ngrok, a free mapping tool. Just go to Du Niang to search and download it. After downloading, unzip it and put it in a designated location. Press the Win key and R key at the same time, enter cmd, and press Enter to enter. Dos environment, switch to the drive letter where ngrock is located, enter ngrock http 8080 and press Enter (start tomcat before doing this):
6. Press Enter and wait for a while, that is You can get the public network link. The link given in the shaded area shown in the figure below can directly access the link content under the local machine 127.0.0.1:8080, which are the addresses corresponding to the http protocol and https protocol:
7. Log in to the WeChat public account platform, slide to the bottom, and click Development in the lower left corner - Basic configuration:
Click the submit button , the prompt submission is successful, which means that WeChat can access our own backend.
Related recommendations:
Java implements graphic and text code examples for WeChat public platform development
WeChat public account payment development (java) examples Detailed explanation
The above is the detailed content of Detailed explanation of Java+WeChat public account development process steps. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Troubleshooting and solutions to the company's security software that causes some applications to not function properly. Many companies will deploy security software in order to ensure internal network security. ...

Solutions to convert names to numbers to implement sorting In many application scenarios, users may need to sort in groups, especially in one...

Field mapping processing in system docking often encounters a difficult problem when performing system docking: how to effectively map the interface fields of system A...

When using MyBatis-Plus or other ORM frameworks for database operations, it is often necessary to construct query conditions based on the attribute name of the entity class. If you manually every time...

Start Spring using IntelliJIDEAUltimate version...

Conversion of Java Objects and Arrays: In-depth discussion of the risks and correct methods of cast type conversion Many Java beginners will encounter the conversion of an object into an array...

Detailed explanation of the design of SKU and SPU tables on e-commerce platforms This article will discuss the database design issues of SKU and SPU in e-commerce platforms, especially how to deal with user-defined sales...

How does the Redis caching solution realize the requirements of product ranking list? During the development process, we often need to deal with the requirements of rankings, such as displaying a...
