From 45e0b2d0d1288d1dc42edf5f09bcafa5852967e4 Mon Sep 17 00:00:00 2001 From: seokjun jeon Date: Mon, 13 Jan 2025 13:25:30 +0900 Subject: [PATCH] 20250113_4 --- .../java/com/icomsys/MessagingConnector.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/icomsys/MessagingConnector.java b/src/main/java/com/icomsys/MessagingConnector.java index 924c12e..b0e5310 100644 --- a/src/main/java/com/icomsys/MessagingConnector.java +++ b/src/main/java/com/icomsys/MessagingConnector.java @@ -1,5 +1,6 @@ package com.icomsys; + import com.icomsys.dsl.MessageSendServiceDsl; import com.icomsys.util.CommonBeanUtils; import com.icomsys.vo.*; @@ -22,6 +23,7 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; +@Service public class MessagingConnector { public RestTemplate restTemplate; @@ -118,12 +120,10 @@ public class MessagingConnector { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.MULTIPART_FORM_DATA); headers.add("sejongApiKey", apiKey); - System.out.println("headers : " + headers); // Body MULTIPART_FORM_DATA로 변환 MultiValueMap body = new LinkedMultiValueMap<>(); ObjectMapper objectMapper = new ObjectMapper(); Map map = null; - System.out.println("messageSendRequest : " + messageSendRequest); // SMS if (messageSendRequest.getSendType().equals("SMS")) { @@ -148,6 +148,10 @@ public class MessagingConnector { body.setAll(map); + System.out.println("Request URL: " + url); + System.out.println("Request Headers: " + headers); + System.out.println("Request Body: " + body); + // 연동 API (메세지 전송) try{ HttpEntity request = new HttpEntity<>(body, headers); @@ -158,11 +162,22 @@ public class MessagingConnector { return super.getType(); } }); - - sejongMessageSendResponse = response.getBody(); System.out.println("response.getBody() : " + response.getBody()); + if (response != null) { + System.out.println("Status Code: " + response.getStatusCode()); + if (response.hasBody()) { + System.out.println("Response Body: " + response.getBody()); + } else { + System.out.println("Response Body is null"); + } + } else { + System.out.println("Response is null"); + } + sejongMessageSendResponse = response.getBody(); + } catch (Exception e) { + e.printStackTrace(); messageSendResponse.setCode("500"); messageSendResponse.setMessage("서버 통신 오류"); }