开发者社区> 问答> 正文

哪位大哥有短信服务的代码贴一下,万分感谢

游客bwpva7tpetotk 2019-04-24 15:50:56 370

问题:templateParamJson can not be blank

public static void main(String[] args) {

      DefaultProfile profile = DefaultProfile.getProfile("default", "LT....", "9u\......");
      IAcsClient client = new DefaultAcsClient(profile);

      CommonRequest request = new CommonRequest();
      //request.setProtocol(ProtocolType.HTTPS);
      request.setMethod(MethodType.POST);
      request.setDomain("dysmsapi.aliyuncs.com");
      request.setVersion("2017-05-25");
      request.setAction("SendBatchSms");
      request.putQueryParameter("PhoneNumberJson", "136");
      request.putQueryParameter("TemplateCode", "SMS_163847932");
      request.putQueryParameter("SignNameJson", "");         
      request.putQueryParameter("TemplateParam", "{\"code\":\"1\"}");
      
      try {
          CommonResponse response = client.getCommonResponse(request);
          System.out.println(response.getData());
      } catch (ServerException e) {
          e.printStackTrace();
      } catch (ClientException e) {
          e.printStackTrace();
      }
  }.
分享到
取消 提交回答
全部回答(1)
+ 订阅

时时分享云计算技术内容,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。

推荐文章