diff --git a/soap/soap-tests.ts b/soap/soap-tests.ts index e922575959..5229cfcf8e 100644 --- a/soap/soap-tests.ts +++ b/soap/soap-tests.ts @@ -1,6 +1,7 @@ /// import * as soap from 'soap'; +import * as events from 'events'; const url = 'http://example.com/wsdl?wsdl'; const wsdlOptions = { name: 'value' }; @@ -15,5 +16,8 @@ soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) { client['create']({ name: 'value' }, function(err, result) { // result is an object }, {}); + client.on('request', function(obj: any) { + //obj is an object + }); }); diff --git a/soap/soap.d.ts b/soap/soap.d.ts index 2685953ccf..36f50309b7 100644 --- a/soap/soap.d.ts +++ b/soap/soap.d.ts @@ -3,11 +3,15 @@ // Definitions by: Nicole Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare module 'soap' { + import * as events from 'events'; + class WSSecurity { constructor(username: string, password: string, options: any); } - interface Client { + interface Client extends events.EventEmitter { setSecurity(s: WSSecurity): void; [method: string]: (args: any, fn: (err: any, result: any) => void, options?: any) => void; addSoapHeader(headJSON: any): void;