Merge pull request #9722 from hongshanzhu/master

add two interface:ClientSSLSecurity and setEndpoint
This commit is contained in:
Mohamed Hegazy
2016-06-22 19:44:22 -07:00
committed by GitHub
2 changed files with 11 additions and 2 deletions
+3
View File
@@ -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
});
+8 -2
View File
@@ -8,13 +8,19 @@
declare module 'soap' {
import * as events from 'events';
class WSSecurity {
interface Security {
}
class WSSecurity implements Security {
constructor(username: string, password: string, options: any);
}
class ClientSSLSecurity implements 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;