add soap moudle definition

This commit is contained in:
etuxxyl
2016-03-08 12:23:09 +08:00
parent 9f0f926a12
commit cbfaf727e1
2 changed files with 36 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
/// <reference path="soap.d.ts" />
import * as soap from 'soap';
const url = 'http://example.com/wsdl?wsdl';
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));
client.addSoapHeader({});
client['create']({name: 'value'}, function(err, result) {
// result is an object
});
client['create']({name: 'value'}, function(err, result) {
// result is an object
}, {});
});
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for soap
// Project: https://www.npmjs.com/package/soap
// Definitions by: Nicole Wang <https://github.com/nicoleWjie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'soap' {
class WSSecurity {
constructor(username: string, password: string, options: any);
}
interface Client {
setSecurity(s: WSSecurity): void;
[method: string]: (args: any, fn: (err: any, result: any) => void, options?: any) => void;
addSoapHeader(headJSON: any): void;
}
function createClient(wsdlPath: string, options: any, fn: (err: any, client: Client) => void): void;
}