From 975b34256443409f28589cf4c1c5d9f30e513e20 Mon Sep 17 00:00:00 2001 From: zhangqinbin <181961702@qq.com> Date: Wed, 3 Jan 2024 09:36:20 +0800 Subject: [PATCH] =?UTF-8?q?WPS=20=E6=9F=A5=E7=9C=8B=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B0=B4=E5=8D=B0=E5=8F=82=E6=95=B0=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ebtp/extend/wps/service/impl/WpsServiceImpl.java | 10 ++++++++-- .../mall/ebtp/extend/wps/util/HttpsUtils.java | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java index ad54a97..e3be2fa 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java @@ -607,9 +607,15 @@ public class WpsServiceImpl implements WpsService { dataJson = JSON.toJSONString(vo); } - String retJson = HttpUtils.httpPost(url, dataJson);//httpPost(kswpsurl,json); + //String retJson = HttpUtils.httpPost(url, dataJson);//httpPost(kswpsurl,json); + String retJson = ""; + if(url.indexOf("https://")>=0){ + retJson = HttpsUtils.UrlPost(url, "utf-8", dataJson); + }else{ + retJson = HttpUtils.httpPost(url, dataJson); + } + log.info("ret:"+retJson); - //String retJson = HttpUtils.httpPost(kswpsurl,json); KingSoftWpsRet ret = JSON.parseObject(retJson,KingSoftWpsRet.class); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/util/HttpsUtils.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/util/HttpsUtils.java index ac2bc6b..b0c7de0 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/util/HttpsUtils.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/util/HttpsUtils.java @@ -19,7 +19,7 @@ import java.util.Map; @Slf4j public class HttpsUtils { - + public static String UrlPost(String url,String charSet, String json){ return UrlPost(url,charSet,json,null); } @@ -104,6 +104,7 @@ public class HttpsUtils { return str; } + private static class TrustAnyTrustManager implements X509TrustManager { @Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {