From ff880ddac3afb6a23a053fb43fb99a1ee9cb1545 Mon Sep 17 00:00:00 2001 From: eorsaaq Date: Mon, 20 Jun 2016 17:41:08 +0800 Subject: [PATCH 1/2] add two interface:ClientSSLSecurity and setEndpoint --- soap/soap-tests.ts | 3 +++ soap/soap.d.ts | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/soap/soap-tests.ts b/soap/soap-tests.ts index 8010d7285e..100bacf2f5 100644 --- a/soap/soap-tests.ts +++ b/soap/soap-tests.ts @@ -11,7 +11,10 @@ const wsdlOptions = { name: 'value' }; soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) { let securityOptions = { 'hasTimeStamp': false }; client.setSecurity(new soap.WSSecurity('user', 'password', securityOptions)); + let defaults = {'rejectUnauthorized': false}; + client.setSecurity(new soap.ClientSSLSecurity('/path/to/key', '/path/to/cert', '/path/to/ca',defaults)); client.addSoapHeader({}); + client.setEndpoint('http://localhost'); client['create']({ name: 'value' }, function(err, result) { // result is an object }); diff --git a/soap/soap.d.ts b/soap/soap.d.ts index fa26cbf04c..ce501e9e7a 100644 --- a/soap/soap.d.ts +++ b/soap/soap.d.ts @@ -8,13 +8,19 @@ declare module 'soap' { import * as events from 'events'; - class WSSecurity { + class Security { + } + class WSSecurity extends Security { constructor(username: string, password: string, options: any); } + class ClientSSLSecurity extends Security { + constructor(key: string, cert: string, ca: string, defaults: any); + } interface Client extends events.EventEmitter { - setSecurity(s: WSSecurity): void; + setSecurity(s: Security): void; [method: string]: (args: any, fn: (err: any, result: any) => void, options?: any, extraHeaders?: any) => void; addSoapHeader(headJSON: any): void; + setEndpoint(endpoint: string): void; } function createClient(wsdlPath: string, options: any, fn: (err: any, client: Client) => void): void; From 350b4790f442aaf916c2fcbacc75cc50aa628339 Mon Sep 17 00:00:00 2001 From: sam <362625119@qq.com> Date: Thu, 23 Jun 2016 10:18:31 +0800 Subject: [PATCH 2/2] Update soap.d.ts update soap.d.ts. use interfaces to replace class for Security. --- soap/soap.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soap/soap.d.ts b/soap/soap.d.ts index ce501e9e7a..6fcd1b703f 100644 --- a/soap/soap.d.ts +++ b/soap/soap.d.ts @@ -8,12 +8,12 @@ declare module 'soap' { import * as events from 'events'; - class Security { + interface Security { } - class WSSecurity extends Security { + class WSSecurity implements Security { constructor(username: string, password: string, options: any); } - class ClientSSLSecurity extends Security { + class ClientSSLSecurity implements Security { constructor(key: string, cert: string, ca: string, defaults: any); } interface Client extends events.EventEmitter {