333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
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
65
66
67
68
69
70
71
72
73
74
75
76
/// <reference types="node" />
import { EventEmitter } from 'events';
import { IncomingHttpHeaders } from 'http';
import * as request from 'request';
import { IHeaders, IOptions, ISecurity } from './types';
import { WSDL } from './wsdl';
export interface ISoapError extends Error {
    response?: any;
    body?: any;
}
export interface Client {
    emit(event: 'request', xml: string, eid: string): boolean;
    emit(event: 'message', message: string, eid: string): boolean;
    emit(event: 'soapError', error: any, eid: string): boolean;
    emit(event: 'response', body: any, response: any, eid: string): boolean;
    /** Emitted before a request is sent. */
    on(event: 'request', listener: (xml: string, eid: string) => void): this;
    /** Emitted before a request is sent, but only the body is passed to the event handler. Useful if you don't want to log /store Soap headers. */
    on(event: 'message', listener: (message: string, eid: string) => void): this;
    /** Emitted when an erroneous response is received. */
    on(event: 'soapError', listener: (error: any, eid: string) => void): this;
    /** Emitted after a response is received. This is emitted for all responses (both success and errors). */
    on(event: 'response', listener: (body: any, response: any, eid: string) => void): this;
}
export declare class Client extends EventEmitter {
    [method: string]: any;
    /** contains last full soap request for client logging */
    lastRequest?: string;
    lastMessage?: string;
    lastEndpoint?: string;
    lastRequestHeaders?: request.Headers;
    lastResponse?: any;
    lastResponseHeaders?: IncomingHttpHeaders;
    lastElapsedTime?: number;
    private wsdl;
    private httpClient;
    private soapHeaders;
    private httpHeaders;
    private bodyAttributes;
    private endpoint;
    private security;
    private SOAPAction;
    private streamAllowed;
    private returnSaxStream;
    private normalizeNames;
    private overridePromiseSuffix;
    constructor(wsdl: WSDL, endpoint?: string, options?: IOptions);
    /** add soapHeader to soap:Header node */
    addSoapHeader(soapHeader: any, name?: string, namespace?: any, xmlns?: string): number;
    changeSoapHeader(index: any, soapHeader: any, name?: any, namespace?: any, xmlns?: any): void;
    /** return all defined headers */
    getSoapHeaders(): string[];
    /** remove all defined headers */
    clearSoapHeaders(): void;
    addHttpHeader(name: string, value: any): void;
    getHttpHeaders(): IHeaders;
    clearHttpHeaders(): void;
    addBodyAttribute(bodyAttribute: any, name?: string, namespace?: string, xmlns?: string): void;
    getBodyAttributes(): any[];
    clearBodyAttributes(): void;
    /** overwrite the SOAP service endpoint address */
    setEndpoint(endpoint: string): void;
    /** description of services, ports and methods as a JavaScript object */
    describe(): any;
    /** use the specified security protocol */
    setSecurity(security: ISecurity): void;
    setSOAPAction(SOAPAction: string): void;
    private _initializeServices;
    private _initializeOptions;
    private _defineService;
    private _definePort;
    private _promisifyMethod;
    private _defineMethod;
    private _processSoapHeader;
    private _invoke;
}