com.aliyuncs.exceptions.ClientException: InvalidDayuStatus.Malformed : The specified dayu status is wrongly formed. RequestId : 42D20EA8-3FF5-4139-8B94-E8809F6264B1
at com.aliyuncs.DefaultAcsClient.parseAcsResponse(DefaultAcsClient.java:142)
at com.aliyuncs.DefaultAcsClient.getAcsResponse(DefaultAcsClient.java:91)
at com.itmuch.cloud.common.utils.SmsUtils.sendSms(SmsUtils.java:41)
at com.itmuch.cloud.common.utils.SmsUtils.main(SmsUtils.java:25)
我估计是因为短信sdk升级了吧,我也是报这个错,然后用了最新的sdk包就可以了
https://help.aliyun.com/document_detail/55284.html?spm=5176.sms-account.109.1.66e36217m7CIi
IClientProfile profile = DefaultProfile.getProfile(regionid, accessKeyId, accessKeySecret);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Dysmsapi", "dysmsapi.aliyuncs.com");
client = new DefaultAcsClient(profile);
这样能解决。
InvalidDayuStatus.MalformedThe specified dayu status is wrongly formed. 大家怎么解决的
请问到底是什么问题?
public static String sendSms() throws ClientException {
String result = "";
try {
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "XXX",
"XXX");
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Sms", "sms.aliyuncs.com");
IAcsClient client = new DefaultAcsClient(profile);
SingleSendSmsRequest request = new SingleSendSmsRequest();
request.setSignName("XXX");// 控制台创建的签名名称
request.setTemplateCode("XXX");// 控制台创建的模板CODE
request.setParamString("{\"code\":\"123456\"}");// 短信模板中的变量;数字需要转换为字符串;个人用户每个变量长度必须小于15个字符。"
// request.setParamString("{}");
request.setAcceptFormat(FormatType.JSON); // 格式为json
request.setRecNum("XXXX");// 接收号码
SingleSendSmsResponse httpResponse = client.getAcsResponse(request);
System.out.println(httpResponse);
result = "true";
} catch (ClientException e) {
result = e.getErrCode();
e.printStackTrace();
}
return result;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。