summaryrefslogtreecommitdiff
path: root/lib/soap/types.ts
blob: dac8f83bf0a2e2f87b6b1b4fe680d2cdec795f91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SOAP 관련 타입 정의

// 기본 인증 정보 타입
export interface SoapAuthConfig {
  username?: string;
  password?: string;
}

// SOAP 전송 설정 타입
export interface SoapSendConfig {
  endpoint: string;
  envelope: Record<string, unknown>;
  soapAction?: string;
  timeout?: number;
  retryCount?: number;
  retryDelay?: number;
  namespace?: string; // 네임스페이스를 동적으로 설정할 수 있도록 추가
  prefix: string; // 네임스페이스 접두사 (필수)
}

// 로깅 정보 타입
export interface SoapLogInfo {
  direction: 'INBOUND' | 'OUTBOUND';
  system: string;
  interface: string;
}

// 전송 결과 타입
export interface SoapSendResult {
  success: boolean;
  message: string;
  responseText?: string;
  statusCode?: number;
  headers?: Record<string, string>;
  endpoint?: string;
  requestXml?: string;
  requestHeaders?: Record<string, string>;
}

// SOAP 에러 타입 (응답 정보 포함)
export class SoapResponseError extends Error {
  responseText?: string;
  statusCode?: number;
  headers?: Record<string, string>;
  endpoint?: string;
  requestXml?: string;
  requestHeaders?: Record<string, string>;
  
  constructor(message: string, details?: {
    responseText?: string;
    statusCode?: number;
    headers?: Record<string, string>;
    endpoint?: string;
    requestXml?: string;
    requestHeaders?: Record<string, string>;
  }) {
    super(message);
    this.name = 'SoapResponseError';
    if (details) {
      Object.assign(this, details);
    }
  }
}