From 51b05b093fa15dd477981372f67ae7b3b2747733 Mon Sep 17 00:00:00 2001 From: wujian <14790700720@163.com> Date: 星期一, 23 九月 2024 08:49:29 +0800 Subject: [PATCH] change-3 --- jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java b/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java index ce9b0ed..abd05b1 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java +++ b/jcdm-main/src/main/java/com/jcdm/main/webservice/service/ReceivingServices.java @@ -31,9 +31,8 @@ import org.springframework.web.bind.annotation.RestController; import javax.swing.border.Border; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; +import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.List; public class ReceivingServices { @@ -176,7 +175,7 @@ } // 璁剧疆璇锋眰澶撮儴锛屽惁鍒欏彲鑳戒細鎶� 鈥渘o SOAPAction header鈥� 鐨勯敊璇� - postMethod.setRequestHeader("SOAPAction", ""); + postMethod.setRequestHeader("SOAPAction", "application/x-www-form-urlencoded; charset=UTF-8"); // 璁剧疆璇锋眰浣� postMethod.setRequestEntity(requestEntity); int status = 0; @@ -188,19 +187,14 @@ } if (status == 200) {// 鎴愬姛 InputStream is = null; - try { - is = postMethod.getResponseBodyAsStream(); - } catch (IOException e) { - logger.info("errorLocation2,"+e); - throw new RuntimeException(e); - } // 鑾峰彇璇锋眰缁撴灉瀛楃涓� String result = null; try { - result = IOUtils.toString(is); + result = postMethod.getResponseBodyAsString(); + logger.info("浜屾杈撳嚭娴�333333,{}",result); return result; } catch (IOException e) { - logger.info("errorLocation3,"+e); + logger.info("errorLocation2,"+e); throw new RuntimeException(e); } } -- Gitblit v1.9.3