发表于: 2021-03-27 23:07:09

2 1233


今天完成的事情:
申请腾讯云短信成功

写了一个阿里云短信test




明天计划的事情:
1. 完成短信 SDK

2. 完成邮箱SDK



遇到的问题:

申请阿里云短信失败



收获:



import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import org.junit.Test;
public class AlibabaInformationTest {
@Test
public void test1(){
//连接阿里云
DefaultProfile profile = DefaultProfile.getProfile("cn-shenzhen", "<accessSecret>", "<accessSecret>");
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("PhoneNumbers", "手机号");
request.putQueryParameter("SignName", "思青争");
request.putQueryParameter("TemplateCode", "SMS_xxxxxxxxxx");
request.putQueryParameter("TemplateParam", "验证码,需要转Json格式");
try {
CommonResponse response = client.getCommonResponse(request);
System.out.println(response.getData());
} catch (
ServerException e) {
e.printStackTrace();
} catch (
ClientException e) {
e.printStackTrace();
}
}
}



返回列表 返回列表
评论

    分享到