6
6
import { EventEmitter } from 'events' ;
7
7
import * as http from 'http' ;
8
8
import * as url from 'url' ;
9
- import { IOneWayOptions , ISecurity , IServerOptions , IServices , ISoapFault , ISoapServiceMethod } from './types' ;
9
+ import { IOneWayOptions , IServerOptions , IServicePort , IServices , ISoapFault , ISoapServiceMethod } from './types' ;
10
10
import { findPrefix } from './utils' ;
11
11
import { WSDL } from './wsdl' ;
12
12
import { BindingElement , IPort } from './wsdl/elements' ;
@@ -173,29 +173,29 @@ export class Server extends EventEmitter {
173
173
174
174
private _processSoapHeader ( soapHeader , name , namespace , xmlns ) {
175
175
switch ( typeof soapHeader ) {
176
- case 'object' :
177
- return this . wsdl . objectToXML ( soapHeader , name , namespace , xmlns , true ) ;
178
- case 'function' :
179
- const _this = this ;
180
- // arrow function does not support arguments variable
181
- // tslint:disable-next-line
182
- return function ( ) {
183
- const result = soapHeader . apply ( null , arguments ) ;
184
-
185
- if ( typeof result === 'object' ) {
186
- return _this . wsdl . objectToXML ( result , name , namespace , xmlns , true ) ;
187
- } else {
188
- return result ;
189
- }
190
- } ;
191
- default :
192
- return soapHeader ;
176
+ case 'object' :
177
+ return this . wsdl . objectToXML ( soapHeader , name , namespace , xmlns , true ) ;
178
+ case 'function' :
179
+ const _this = this ;
180
+ // arrow function does not support arguments variable
181
+ // tslint:disable-next-line
182
+ return function ( ) {
183
+ const result = soapHeader . apply ( null , arguments ) ;
184
+
185
+ if ( typeof result === 'object' ) {
186
+ return _this . wsdl . objectToXML ( result , name , namespace , xmlns , true ) ;
187
+ } else {
188
+ return result ;
189
+ }
190
+ } ;
191
+ default :
192
+ return soapHeader ;
193
193
}
194
194
}
195
195
196
196
private _initializeOptions ( options : IServerOptions ) {
197
197
this . wsdl . options . attributesKey = options . attributesKey || 'attributes' ;
198
- this . onewayOptions . statusCode = this . onewayOptions . responseCode || 200 ;
198
+ this . onewayOptions . statusCode = this . onewayOptions . responseCode || 200 ;
199
199
this . onewayOptions . emptyBody = ! ! this . onewayOptions . emptyBody ;
200
200
}
201
201
@@ -468,6 +468,7 @@ export class Server extends EventEmitter {
468
468
includeTimestamp ?,
469
469
) {
470
470
options = options || { } ;
471
+ let port : IServicePort ;
471
472
let method : ISoapServiceMethod ;
472
473
let body ;
473
474
let headers ;
@@ -490,6 +491,7 @@ export class Server extends EventEmitter {
490
491
491
492
try {
492
493
method = this . services [ serviceName ] [ portName ] [ methodName ] ;
494
+ port = this . services [ serviceName ] [ portName ] ;
493
495
} catch ( error ) {
494
496
return callback ( this . _envelope ( '' , headers , includeTimestamp ) ) ;
495
497
}
@@ -546,7 +548,7 @@ export class Server extends EventEmitter {
546
548
handleResult ( error , result ) ;
547
549
} ;
548
550
549
- const result = method ( args , methodCallback , options . headers , req ) ;
551
+ const result = method . apply ( this , [ args , methodCallback , options . headers , req ] ) ;
550
552
if ( typeof result !== 'undefined' ) {
551
553
if ( isPromiseLike < any > ( result ) ) {
552
554
result . then ( ( value ) => {
0 commit comments