feat: KT API 반영

dev
Jonguk. Lim 1 year ago
parent 2947ac5d57
commit 9c7e34143e

@ -163,6 +163,7 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(paramDTO.getSignguCode(), paramDTO.getFfnlgCode()); final CmmEnsRlaybsnmDTO ktMnsInfo = CmmKtMmsUtils.getRlaybsnmInfo(paramDTO.getSignguCode(), paramDTO.getFfnlgCode());
final KtTokenRequest reqDTO = KtTokenRequest.builder() final KtTokenRequest reqDTO = KtTokenRequest.builder()
.clientId(ktMnsInfo.getKtClientId()) .clientId(ktMnsInfo.getKtClientId())
//.clientId(ktMnsInfo.getKtSvcClientId())
.clientSecret(ktMnsInfo.getKtSvcClientSecret()) .clientSecret(ktMnsInfo.getKtSvcClientSecret())
.scope(ktMnsInfo.getKtScope()) .scope(ktMnsInfo.getKtScope())
.build(); .build();
@ -173,9 +174,8 @@ public class KtMmsService extends EgovAbstractServiceImpl implements IKtMmsServi
// headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); // headerMap.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE);
// headerMap.put("client-id", "client-id"); // headerMap.put("client-id", "client-id");
// headerMap.put("client-tp", "10"); // headerMap.put("client-tp", "10");
headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, "access-token")); // headerMap.put(HttpHeaders.AUTHORIZATION, String.format("%s %s", AUTH_TYPE_BEARER, "access-token"));
//try {
return webClient.exchange( return webClient.exchange(
HOST + API_GENERATE_TOKEN, HOST + API_GENERATE_TOKEN,
HttpMethod.POST, HttpMethod.POST,

@ -3,7 +3,6 @@ package kr.xit.ens.kt.web;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import kr.xit.biz.cmm.service.ICmmEnsCacheService; import kr.xit.biz.cmm.service.ICmmEnsCacheService;
import kr.xit.biz.ens.model.kt.KtAcmdDTO;
import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfRequest; import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfRequest;
import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfResponse; import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdCerfResponse;
import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdInfoRequest; import kr.xit.biz.ens.model.kt.KtAcmdDTO.KtAcmdInfoRequest;

@ -425,6 +425,14 @@
</dependency> </dependency>
<!-- cache: caffeine --> <!-- cache: caffeine -->
<!-- MacOS DNS resolver error -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-aarch_64</classifier>
</dependency>
<!-- MacOS DNS resolver error -->
</dependencies> </dependencies>
<build> <build>

@ -75,10 +75,10 @@ public class WebClientConfig {
.clientConnector(new ReactorClientHttpConnector(defaultHttpClient())) .clientConnector(new ReactorClientHttpConnector(defaultHttpClient()))
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 * 1024)) .codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(2 * 1024 * 1024))
.exchangeStrategies(defaultExchangeStrategies()) .exchangeStrategies(defaultExchangeStrategies())
// .filters(exchangeFilterFunctions -> { .filters(exchangeFilterFunctions -> {
// exchangeFilterFunctions.add(requestFilter()); exchangeFilterFunctions.add(requestFilter());
// exchangeFilterFunctions.add(responseFilter()); exchangeFilterFunctions.add(responseFilter());
// }) })
.build(); .build();
} }
@ -136,9 +136,10 @@ public class WebClientConfig {
private ExchangeFilterFunction requestFilter() { private ExchangeFilterFunction requestFilter() {
return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> { return ExchangeFilterFunction.ofRequestProcessor(clientRequest -> {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder("\n>>>>>>>>>> Http Rest Request <<<<<<<<<<<<<\n"); StringBuilder sb = new StringBuilder("\n>>>>>>>>>> WebClient Http Request <<<<<<<<<<<<<\n");
sb.append(logMethodAndUrl(clientRequest)); sb.append(logMethodAndUrl(clientRequest));
sb.append(logHeaders(clientRequest)); sb.append(logHeaders(clientRequest));
sb.append("-------------------------------------------------------");
log.debug(sb.toString()); log.debug(sb.toString());
} }
return Mono.just(clientRequest); return Mono.just(clientRequest);
@ -165,9 +166,10 @@ public class WebClientConfig {
if(log.isDebugEnabled()) { if(log.isDebugEnabled()) {
StringBuilder sb = new StringBuilder( StringBuilder sb = new StringBuilder(
"\n>>>>>>>>>> Http Rest Response <<<<<<<<<<<<<\n"); "\n>>>>>>>>>> WebClient Http Response <<<<<<<<<<<<<\n");
sb.append(logStatus(clientResponse)); sb.append(logStatus(clientResponse));
sb.append(logHeaders(clientResponse)); sb.append(logHeaders(clientResponse));
sb.append("-------------------------------------------------------");
log.debug(sb.toString()); log.debug(sb.toString());
return logBody(clientResponse); return logBody(clientResponse);
} }
@ -193,21 +195,20 @@ public class WebClientConfig {
} }
} }
private static String logHeaders(ClientRequest request) {
private static String logHeaders(ClientResponse response) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
response.headers()
.asHttpHeaders() request.headers()
.forEach((name, values) -> .forEach((name, values) ->
values.forEach(value -> sb.append(name).append(": ").append(value).append("\n")) values.forEach(value -> sb.append(name).append(": ").append(value).append("\n"))
); );
return sb.toString(); return sb.toString();
} }
private static String logHeaders(ClientRequest request) { private static String logHeaders(ClientResponse response) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
response.headers()
request.headers() .asHttpHeaders()
.forEach((name, values) -> .forEach((name, values) ->
values.forEach(value -> sb.append(name).append(": ").append(value).append("\n")) values.forEach(value -> sb.append(name).append(": ").append(value).append("\n"))
); );

Loading…
Cancel
Save