liujie
2026-04-03 84ddc2238887435626240d58e3c5938da6f9de2d
ruoyi-service/ruoyi-study/src/main/java/com/ruoyi/study/utils/HWSendSms.java
@@ -1,7 +1,7 @@
package com.ruoyi.study.utils;
import com.cloud.apigateway.sdk.utils.Client;
import com.cloud.apigateway.sdk.utils.Request;
//import com.cloud.apigateway.sdk.utils.Client;
//import com.cloud.apigateway.sdk.utils.Request;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -85,39 +85,39 @@
            return;
        }
        Request request = new Request();
        request.setKey(appKey);
        request.setSecret(appSecret);
        request.setMethod("POST");
        request.setUrl(url);
        request.addHeader("Content-Type", "application/x-www-form-urlencoded");
        request.setBody(body);
        LOGGER.info("Print the body: {}", body);
        try {
            HttpRequestBase signedRequest = Client.sign(request, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256);
            LOGGER.info("Print the authorization: {}", Arrays.toString(signedRequest.getHeaders("Authorization")));
            Header[] requestAllHeaders = signedRequest.getAllHeaders();
            for (Header h : requestAllHeaders) {
                LOGGER.info("req Header with name: {} and value: {}", h.getName(), h.getValue());
            }
            HttpResponse response = client.execute(signedRequest);
            LOGGER.info("Print the status line of the response: {}", response.getStatusLine().toString());
            Header[] resHeaders = response.getAllHeaders();
            for (Header h : resHeaders) {
                LOGGER.info("Processing Header with name: {} and value: {}", h.getName(), h.getValue());
            }
            HttpEntity resEntity = response.getEntity();
            if (resEntity != null) {
                LOGGER.info("Processing Body with name: {} and value: {}",
                        System.getProperty("line.separator"),
                    EntityUtils.toString(resEntity, "UTF-8"));
            }
        } catch (Exception e) {
            LOGGER.info(e.getMessage(), e);
            e.printStackTrace();
        }
//        Request request = new Request();
//        request.setKey(appKey);
//        request.setSecret(appSecret);
//        request.setMethod("POST");
//        request.setUrl(url);
//        request.addHeader("Content-Type", "application/x-www-form-urlencoded");
//        request.setBody(body);
//        LOGGER.info("Print the body: {}", body);
//        try {
//            HttpRequestBase signedRequest = Client.sign(request, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256);
//            LOGGER.info("Print the authorization: {}", Arrays.toString(signedRequest.getHeaders("Authorization")));
//            Header[] requestAllHeaders = signedRequest.getAllHeaders();
//            for (Header h : requestAllHeaders) {
//                LOGGER.info("req Header with name: {} and value: {}", h.getName(), h.getValue());
//            }
//
//            HttpResponse response = client.execute(signedRequest);
//
//            LOGGER.info("Print the status line of the response: {}", response.getStatusLine().toString());
//            Header[] resHeaders = response.getAllHeaders();
//            for (Header h : resHeaders) {
//                LOGGER.info("Processing Header with name: {} and value: {}", h.getName(), h.getValue());
//            }
//            HttpEntity resEntity = response.getEntity();
//            if (resEntity != null) {
//                LOGGER.info("Processing Body with name: {} and value: {}",
//                        System.getProperty("line.separator"),
//                    EntityUtils.toString(resEntity, "UTF-8"));
//            }
//        } catch (Exception e) {
//            LOGGER.info(e.getMessage(), e);
//            e.printStackTrace();
//        }
    }
    public CloseableHttpClient createIgnoreSSLHttpClient() throws Exception {