diff options
| author | joonhoekim <26rote@gmail.com> | 2025-08-27 01:52:54 +0000 |
|---|---|---|
| committer | joonhoekim <26rote@gmail.com> | 2025-08-27 01:52:54 +0000 |
| commit | 818a500d9969d1c03098f612bb0b68502b6a5ae2 (patch) | |
| tree | d1b52f040972696993502dfa8a71f7bb1bc89cc2 /lib/soap/sender.ts | |
| parent | f61e9e9c6ea5b415d64ecb9f703a0633a5029da4 (diff) | |
(김준회) soap sender 함수 오류수정 및 벤더마스터 전송함수 리팩터링
Diffstat (limited to 'lib/soap/sender.ts')
| -rw-r--r-- | lib/soap/sender.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/soap/sender.ts b/lib/soap/sender.ts index 5a61462e..3728429b 100644 --- a/lib/soap/sender.ts +++ b/lib/soap/sender.ts @@ -18,6 +18,7 @@ export interface SoapSendConfig { retryCount?: number; retryDelay?: number; namespace?: string; // 네임스페이스를 동적으로 설정할 수 있도록 추가 + prefix: string; // 네임스페이스 접두사 (필수) } // 로깅 정보 타입 @@ -65,12 +66,13 @@ function createXmlBuilder() { // SOAP Envelope 생성 function createSoapEnvelope( namespace: string, - bodyContent: Record<string, unknown> + bodyContent: Record<string, unknown>, + prefix: string ): Record<string, unknown> { return { 'soap:Envelope': { '@_xmlns:soap': 'http://schemas.xmlsoap.org/soap/envelope/', - '@_xmlns:ns0': namespace, + [`@_xmlns:${prefix}`]: namespace, // 동적 접두사 생성 'soap:Body': bodyContent } }; @@ -96,11 +98,12 @@ export async function sendSoapXml( // 인증 정보 설정 (기본값 사용) const authConfig = auth || getDefaultAuth(); - // XML 생성 (네임스페이스를 동적으로 설정) + // XML 생성 (네임스페이스와 접두사를 동적으로 설정) const namespace = config.namespace || 'http://shi.samsung.co.kr/P2_MD/MDZ'; const soapEnvelope = createSoapEnvelope( namespace, - config.envelope + config.envelope, + config.prefix ); const xmlData = await generateSoapXml(soapEnvelope); @@ -255,6 +258,7 @@ export async function sendSimpleSoapXml( logInfo: SoapLogInfo, options?: { namespace?: string; + prefix?: string; soapAction?: string; auth?: SoapAuthConfig; timeout?: number; @@ -266,6 +270,7 @@ export async function sendSimpleSoapXml( soapAction: options?.soapAction, timeout: options?.timeout || 30000, // 기본 30초 namespace: options?.namespace, // 네임스페이스 옵션 추가 + prefix: options?.prefix || 'p1', // 기본 접두사 p1 }; const auth = options?.auth || getDefaultAuth(); @@ -285,6 +290,7 @@ export async function sendMdgSoapXml( soapAction: 'http://sap.com/xi/WebService/soap1.1', timeout: 60000, // MDG는 60초 타임아웃 namespace: 'http://shi.samsung.co.kr/P2_MD/MDZ', // MDG 전용 네임스페이스 명시 + prefix: 'p1', // MDG 전용 접두사 }; return await sendSoapXml(config, logInfo, auth); |
