From 25d569828b704a102f681a627c76c4129afa8be3 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Wed, 9 Jul 2025 13:44:47 +0000 Subject: (김준회) XML 기반 MDG 송신시 인증헤더 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/soap/mdg/send/vendor-master/action.ts | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/soap/mdg/send/vendor-master/action.ts b/lib/soap/mdg/send/vendor-master/action.ts index ae0c2c89..e0bd7009 100644 --- a/lib/soap/mdg/send/vendor-master/action.ts +++ b/lib/soap/mdg/send/vendor-master/action.ts @@ -624,7 +624,7 @@ export async function getVendorSendStatistics(): Promise<{ export async function sendTestVendorDataToMDG(formData: Record): Promise<{ success: boolean; message: string; - responseData?: any; + responseData?: unknown; }> { try { console.log('🧪 테스트용 VENDOR 데이터 SOAP 송신 시작'); @@ -728,12 +728,24 @@ export async function sendVendorEnvelopeToMDG(envelope: string): Promise<{ // 직접 XML 전송의 경우 기존 fetch 방식 유지 const MDG_ENDPOINT_URL = "http://shii8dvddb01.hec.serp.shi.samsung.net:50000/sap/xi/engine?type=entry&version=3.0&Sender.Service=P2038_D&Interface=http%3A%2F%2Fshi.samsung.co.kr%2FP2_MD%2FMDZ%5EP2MD3007_AO&QualityOfService=ExactlyOnce"; + // 인증 헤더 준비 + const headers: Record = { + 'Content-Type': 'text/xml; charset=utf-8', + 'SOAPAction': 'http://sap.com/xi/WebService/soap1.1', + }; + + // Basic Authentication 헤더 추가 + if (MDG_SOAP_USERNAME && MDG_SOAP_PASSWORD) { + const credentials = Buffer.from(`${MDG_SOAP_USERNAME}:${MDG_SOAP_PASSWORD}`).toString('base64'); + headers['Authorization'] = `Basic ${credentials}`; + console.log('🔐 Basic Authentication 헤더 추가 완료'); + } else { + console.warn('⚠️ MDG SOAP 인증 정보가 환경변수에 설정되지 않았습니다.'); + } + const res = await fetch(MDG_ENDPOINT_URL, { method: 'POST', - headers: { - 'Content-Type': 'text/xml; charset=utf-8', - 'SOAPAction': 'http://sap.com/xi/WebService/soap1.1', - }, + headers, body: envelope, }); -- cgit v1.2.3