@Override
 public String templateSMS(
     String accountSid,
     String authToken,
     String appId,
     String templateId,
     String to,
     String param) {
   // TODO Auto-generated method stub
   String result = "";
   DefaultHttpClient httpclient = getDefaultHttpClient();
   try {
     // MD5加密
     EncryptUtil encryptUtil = new EncryptUtil();
     // 构造请求URL内容
     String timestamp = DateUtil.dateToStr(new Date(), DateUtil.DATE_TIME_NO_SLASH); // 时间戳
     String signature = getSignature(accountSid, authToken, timestamp, encryptUtil);
     String url =
         getStringBuffer()
             .append("/")
             .append(version)
             .append("/Accounts/")
             .append(accountSid)
             .append("/Messages/templateSMS")
             .append("?sig=")
             .append(signature)
             .toString();
     TemplateSMS templateSMS = new TemplateSMS();
     templateSMS.setAppId(appId);
     templateSMS.setTemplateId(templateId);
     templateSMS.setTo(to);
     templateSMS.setParam(param);
     Gson gson = new Gson();
     String body = gson.toJson(templateSMS);
     body = "{\"templateSMS\":" + body + "}";
     logger.info(body);
     HttpResponse response =
         post(
             "application/json",
             accountSid,
             authToken,
             timestamp,
             url,
             httpclient,
             encryptUtil,
             body);
     HttpEntity entity = response.getEntity();
     if (entity != null) {
       result = EntityUtils.toString(entity, "UTF-8");
     }
     EntityUtils.consume(entity);
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     // 关闭连接
     httpclient.getConnectionManager().shutdown();
   }
   return result;
 }
 @Override
 public String charegeClient(
     String accountSid,
     String authToken,
     String clientNumber,
     String chargeType,
     String charge,
     String appId) {
   // TODO Auto-generated method stub
   String result = "";
   DefaultHttpClient httpclient = getDefaultHttpClient();
   try {
     // MD5加密
     EncryptUtil encryptUtil = new EncryptUtil();
     // 构造请求URL内容
     String timestamp = DateUtil.dateToStr(new Date(), DateUtil.DATE_TIME_NO_SLASH); // 时间戳
     String signature = getSignature(accountSid, authToken, timestamp, encryptUtil);
     String url =
         getStringBuffer()
             .append("/2014-06-30/Accounts/")
             .append(accountSid)
             .append("/chargeClient")
             .append("?sig=")
             .append(signature)
             .toString();
     Client client = new Client();
     client.setClientNumber(clientNumber);
     client.setChargeType(chargeType);
     client.setCharge(charge);
     client.setAppId(appId);
     Gson gson = new Gson();
     String body = gson.toJson(client);
     body = "{\"client\":" + body + "}";
     logger.info(body);
     HttpResponse response =
         post(
             "application/json",
             accountSid,
             authToken,
             timestamp,
             url,
             httpclient,
             encryptUtil,
             body);
     // 获取响应实体信息
     HttpEntity entity = response.getEntity();
     if (entity != null) {
       result = EntityUtils.toString(entity, "UTF-8");
     }
     // 确保HTTP响应内容全部被读出或者内容流被关闭
     EntityUtils.consume(entity);
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     // 关闭连接
     httpclient.getConnectionManager().shutdown();
   }
   return result;
 }
 @Override
 public String dispalyNumber(
     String accountSid, String authToken, String appId, String clientNumber, String display) {
   // TODO Auto-generated method stub
   String result = "";
   DefaultHttpClient httpclient = getDefaultHttpClient();
   try {
     // MD5加密
     EncryptUtil encryptUtil = new EncryptUtil();
     // 构造请求URL内容
     String timestamp = DateUtil.dateToStr(new Date(), DateUtil.DATE_TIME_NO_SLASH);
     String signature = getSignature(accountSid, authToken, timestamp, encryptUtil);
     String url =
         getStringBuffer()
             .append("/")
             .append(version)
             .append("/Accounts/")
             .append(accountSid)
             .append("/dispalyNumber")
             .append("?sig=")
             .append(signature)
             .append("&appId=")
             .append(appId)
             .append("&clientNumber=")
             .append(clientNumber)
             .append("&display=")
             .append(display)
             .toString();
     HttpResponse response =
         get("application/json", accountSid, authToken, timestamp, url, httpclient, encryptUtil);
     // 获取响应实体信息
     HttpEntity entity = response.getEntity();
     if (entity != null) {
       result = EntityUtils.toString(entity, "UTF-8");
     }
     EntityUtils.consume(entity);
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     // 关闭连接
     httpclient.getConnectionManager().shutdown();
   }
   return result;
 }
 @Override
 public String findAccoutInfo(String accountSid, String authToken)
     throws NoSuchAlgorithmException, KeyManagementException {
   // TODO Auto-generated method stub
   String result = "";
   DefaultHttpClient httpclient = getDefaultHttpClient();
   try {
     // MD5加密
     EncryptUtil encryptUtil = new EncryptUtil();
     // 构造请求URL内容
     String timestamp = DateUtil.dateToStr(new Date(), DateUtil.DATE_TIME_NO_SLASH);
     String signature = getSignature(accountSid, authToken, timestamp, encryptUtil);
     String url =
         getStringBuffer()
             .append("/")
             .append(version)
             .append("/Accounts/")
             .append(accountSid)
             .append("")
             .append("?sig=")
             .append(signature)
             .toString();
     logger.info(url);
     HttpResponse response =
         get("application/json", accountSid, authToken, timestamp, url, httpclient, encryptUtil);
     // 获取响应实体信息
     HttpEntity entity = response.getEntity();
     if (entity != null) {
       result = EntityUtils.toString(entity, "UTF-8");
     }
     // 确保HTTP响应内容全部被读出或者内容流被关闭
     EntityUtils.consume(entity);
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     // 关闭连接
     httpclient.getConnectionManager().shutdown();
   }
   return result;
 }