当前位置:网站首页>Integration of Alibaba cloud SMS services and reasons for illegal message signing
Integration of Alibaba cloud SMS services and reasons for illegal message signing
2022-06-24 04:37:00 【Granger_ g】
Integrated Alibaba cloud SMS service , The following is the code for me to successfully receive SMS messages by integrating Alibaba cloud SMS service :
Some of the contents need to be changed to your own Alibaba cloud configuration
public class TestSms {
public static void main(String[] args) {
DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou",
"<accessKeyId>",
"<accessSecret>");// Write your correspondence in these two places Id and Secret
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain("dysmsapi.aliyuncs.com");
request.setSysVersion("2017-05-25");
request.setSysAction("SendSms");
request.putQueryParameter("RegionId", "cn-hangzhou");
// Determine the phone number and Verification Code
request.putQueryParameter("PhoneNumbers", "13100000000");
request.putQueryParameter("TemplateParam", "{\"code\":\"" + "123456" + "\"}");
// Confirm the template and signature of yes
request.putQueryParameter("SignName", " Fill in your SMS signature here ");
request.putQueryParameter("TemplateCode", " Write your template here code");
// RAM account number AccessKey Secret
try {
CommonResponse response = client.getCommonResponse(request);
System.out.println(response.getData());
} catch (ServerException e) {
e.printStackTrace();
} catch (ClientException e) {
e.printStackTrace();
}
}
}If everything is OK, the above code It's all done , You can receive SMS directly .
Problems encountered 1: The signature is illegal
terms of settlement :
1. Check your accessKeyId and accessSecret Are they all right
2. Check your SMS signature And templates code Be careful : Template code It's a bunch of SMS_1995992 Numbers like this , Don't fill in the name of the template
3. Coding problem , If your SMS signature is in Chinese , Try changing the coding method .( That's my problem , I changed it to GBK Coding method ok 了 )
边栏推荐
- 抢先报名丨新一代 HTAP 数据库如何在云上重塑?TiDB V6 线上发布会即将揭晓!
- Web technology sharing | [map] to realize customized track playback
- 英特尔 XTU 官方超频工具已支持 Win11 22H2 和 13 代酷睿 Raptor Lake 处理器
- Two most practical methods for cadence OrCAD capture to batch modify network names graphic tutorial and video demonstration
- How to monitor the operation of easygbs service in real time?
- Multi task video recommendation scheme, baidu engineers' actual combat experience sharing
- 阿里云混合云首席架构师张晓丹:政企混合云技术架构的演进和发展
- Brief introduction: how much do you know about supply chain attacks
- Naming of tables in MySQL
- [hot promotion] Tencent cloud enterprise cloud disk solution
猜你喜欢

阿里云新一代云计算体系架构 CIPU 到底是啥?

Opengauss version 3.0 source code compilation and installation guide

应用实践 | Apache Doris 整合 Iceberg + Flink CDC 构建实时湖仓一体的联邦查询分析架构

Multi task video recommendation scheme, baidu engineers' actual combat experience sharing

Apipost interface assertion details

What is the data center

SAP MTS/ATO/MTO/ETO专题之十:ETO模式 Q+空模式 未估价库存 策略自定义

2022年二级造价工程师备考攻略,你准备好了吗?

Abnova membrane protein lipoprotein solution

Openeuler kernel technology sharing issue 20 - execution entity creation and switching
随机推荐
由浅入深的混合精度训练教程
Go operation mongodb
Tsingsee Qingxi video easycvr integrated Dahua face recognition equipment
How to adjust the alarm information that remains unchanged after paging is selected on the easygbs alarm page?
脚本之美│VBS 入门交互实战
DP summary of ACM in recent two weeks
getAttribute 返回值为null
『应急响应实践』LogParser日志分析实践
"The first share of Chinese member e-commerce" gathered in the anti reptile attack and defense war | talk with industrial security experts
Making a Chatbot based on gpt2
2020年Android面试题汇总(初级)
What is the principle of Ping? How does the server disable Ping?
Mac CentOS installation phpredis
Huawei cloud gaussdb (for redis) unveiling issue 19: gaussdb (for redis) comprehensive comparison with CODIS
Abnova多肽设计和合成解决方案
大一下学期期末总结(补充知识漏洞)
开源之夏2022中选结果公示,449名高校生将投入开源项目贡献
Training course of mixed accuracy from simple to deep
15+ urban road element segmentation application, this segmentation model is enough
Specificity and correlation of Worthington deoxyribonuclease I