@@ -398,4 +398,66 @@ describe('SOAP Server with Options', function() {
398
398
} ) ;
399
399
} ) ;
400
400
} ) ;
401
+ it ( 'should return configured statusCode on one-way operations' , function ( done ) {
402
+ test . server . listen ( 15099 , null , null , function ( ) {
403
+ test . soapServer = soap . listen ( test . server , {
404
+ path : '/stockquote' ,
405
+ services : test . service ,
406
+ xml : test . wsdl ,
407
+ oneWay : {
408
+ responseCode : 202
409
+ }
410
+ } , test . service , test . wsdl ) ;
411
+ test . baseUrl = 'http://' + test . server . address ( ) . address + ":" + test . server . address ( ) . port ;
412
+
413
+ //windows return 0.0.0.0 as address and that is not
414
+ //valid to use in a request
415
+ if ( test . server . address ( ) . address === '0.0.0.0' || test . server . address ( ) . address === '::' ) {
416
+ test . baseUrl = 'http://127.0.0.1:' + test . server . address ( ) . port ;
417
+ }
418
+
419
+ soap . createClient ( test . baseUrl + '/stockquote?wsdl' , function ( err , client ) {
420
+ assert . ifError ( err ) ;
421
+ client . on ( 'response' , function ( xml , response ) {
422
+ assert . equal ( response . statusCode , 202 ) ;
423
+ done ( ) ;
424
+ } ) ;
425
+
426
+ client . SetTradePrice ( { tickerSymbol : 'GOOG' } , function ( err , result , body ) {
427
+ assert . ifError ( err ) ;
428
+ assert . equal ( result , null ) ;
429
+ assert . equal ( body , '' ) ;
430
+ } ) ;
431
+ } ) ;
432
+ } ) ;
433
+ } ) ;
434
+ it ( 'should return empty body on one-way operations if configured' , function ( done ) {
435
+ var responseData = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"><soap:Body/></soap:Envelope>' ;
436
+ test . server . listen ( 15099 , null , null , function ( ) {
437
+ test . soapServer = soap . listen ( test . server , {
438
+ path : '/stockquote' ,
439
+ services : test . service ,
440
+ xml : test . wsdl ,
441
+ oneWay : {
442
+ emptyBody : true
443
+ }
444
+ } , test . service , test . wsdl ) ;
445
+ test . baseUrl = 'http://' + test . server . address ( ) . address + ":" + test . server . address ( ) . port ;
446
+
447
+ //windows return 0.0.0.0 as address and that is not
448
+ //valid to use in a request
449
+ if ( test . server . address ( ) . address === '0.0.0.0' || test . server . address ( ) . address === '::' ) {
450
+ test . baseUrl = 'http://127.0.0.1:' + test . server . address ( ) . port ;
451
+ }
452
+
453
+ soap . createClient ( test . baseUrl + '/stockquote?wsdl' , function ( err , client ) {
454
+ assert . ifError ( err ) ;
455
+ client . SetTradePrice ( { tickerSymbol : 'GOOG' } , function ( err , result , body ) {
456
+ assert . ifError ( err ) ;
457
+ assert . strictEqual ( body , responseData ) ;
458
+ done ( ) ;
459
+ } ) ;
460
+ } ) ;
461
+ } ) ;
462
+ } ) ;
401
463
} ) ;
0 commit comments