diff --git a/soap/index.d.ts b/soap/index.d.ts index 0ec9549058..4262bdb64c 100644 --- a/soap/index.d.ts +++ b/soap/index.d.ts @@ -23,6 +23,7 @@ interface Client extends events.EventEmitter { [method: string]: (args: any, fn: (err: any, result: any) => void, options?: any, extraHeaders?: any) => void; addSoapHeader(headJSON: any): void; setEndpoint(endpoint: string): void; + describe(): any; } export interface Server extends events.EventEmitter { diff --git a/soap/soap-tests.ts b/soap/soap-tests.ts index fe84c6a959..c0d902a642 100644 --- a/soap/soap-tests.ts +++ b/soap/soap-tests.ts @@ -8,9 +8,9 @@ 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 }; + let securityOptions = { hasTimeStamp: false }; client.setSecurity(new soap.WSSecurity('user', 'password', securityOptions)); - let defaults = {'rejectUnauthorized': false}; + 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'); @@ -23,6 +23,7 @@ soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) { client.on('request', function(obj: any) { //obj is an object }); + client.describe(); }); var myService = { @@ -33,23 +34,23 @@ var myService = { name: args.name }; }, - - // This is how to define an asynchronous function. + + // This is how to define an asynchronous function. MyAsyncFunction: function(args: any, callback: any) { - // do some work + // do some work callback({ name: args.name }); }, - - // This is how to receive incoming headers + + // This is how to receive incoming headers HeadersAwareFunction: function(args: any, cb: any, headers: any) { return { name: headers.Token }; }, - - // You can also inspect the original `req` + + // You can also inspect the original `req` reallyDeatailedFunction: function(args: any, cb: any, headers: any, req: any) { console.log('SOAP `reallyDeatailedFunction` request from ' + req.connection.remoteAddress); return { @@ -59,11 +60,11 @@ var myService = { } } }; - + var xml = fs.readFileSync('myservice.wsdl', 'utf8'), server = http.createServer(function(request,response) { response.end("404: Not Found: " + request.url); }); - + server.listen(8000); soap.listen(server, '/wsdl', myService, xml);