[soap] Apply @aleung's SoapMethod fix

This commit is contained in:
Josh Forisha
2017-02-13 08:07:47 -06:00
parent c5a820a738
commit ce405c074b
2 changed files with 7 additions and 4 deletions
+5 -1
View File
@@ -10,6 +10,10 @@ import * as events from 'events';
interface Security {
}
export interface SoapMethod {
(args: any, callback: (err: any, result: any) => void, options?: any, extraHeaders?: any): void;
}
export class WSSecurity implements Security {
constructor(username: string, password: string, options?: any);
}
@@ -34,7 +38,7 @@ export interface Client extends events.EventEmitter {
setEndpoint(endpoint: string): void;
setSOAPAction(action: string): void;
setSecurity(s: Security): void;
[method: string]: (args: any, callback: (err: any, result: any) => void, options?: any, extraHeaders?: any) => void;
[method: string]: SoapMethod | Function;
}
export interface Server extends events.EventEmitter {
+2 -3
View File
@@ -1,4 +1,3 @@
import * as soap from 'soap';
import * as events from 'events';
import * as fs from "fs";
@@ -27,10 +26,10 @@ soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) {
client.getHttpHeaders();
client.getSoapHeaders();
client.setSOAPAction('action');
client['create']({ name: 'value' }, function(err: any, result: any) {
(client['create'] as soap.SoapMethod)({ name: 'value' }, function(err: any, result: any) {
// result is an object
});
client['create']({ name: 'value' }, function(err: any, result: any) {
(client['create'] as soap.SoapMethod)({ name: 'value' }, function(err: any, result: any) {
// result is an object
}, {});
client.on('request', function(obj: any) {