soap 1.7.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -19,10 +19,12 @@ This module lets you connect to web services using SOAP. It also provides a serv
19
19
  - [Install](#install)
20
20
  - [Support](#support)
21
21
  - [Module](#module)
22
- - [soap.createClient(url[, options], callback) - create a new SOAP client from a WSDL url. Also supports a local filesystem path.](#soapcreateclienturl-options-callback---create-a-new-soap-client-from-a-wsdl-url-also-supports-a-local-filesystem-path)
23
- - [soap.createClientAsync(url[, options]) - create a new SOAP client from a WSDL url. Also supports a local filesystem path.](#soapcreateclientasyncurl-options---create-a-new-soap-client-from-a-wsdl-url-also-supports-a-local-filesystem-path)
24
- - [soap.listen(_server_, _path_, _services_, _wsdl_, _callback_) - create a new SOAP server that listens on _path_ and provides _services_.](#soaplistenserver-path-services-wsdl-callback---create-a-new-soap-server-that-listens-on-path-and-provides-services)
25
- - [soap.listen(_server_, _options_) - create a new SOAP server that listens on _path_ and provides _services_.](#soaplistenserver-options---create-a-new-soap-server-that-listens-on-path-and-provides-services)
22
+ - [soap](#soap)
23
+ - [createClient(url[, options], callback)](#createclienturl-options-callback)
24
+ - [createClientAsync(url[, options])](#createclientasyncurl-options)
25
+ - [listen(_server_, _path_, _services_, _wsdl_, _callback_)](#listen_server_-path-_services_-wsdl-_callback_)
26
+ - [listen(_server_, _options_)](#listen_server_-options)
27
+ - [createServerless(_options_)](#createserverless_options_)
26
28
  - [Server Logging](#server-logging)
27
29
  - [Server Events](#server-events)
28
30
  - [Server Response on one-way calls](#server-response-on-one-way-calls)
@@ -32,24 +34,36 @@ This module lets you connect to web services using SOAP. It also provides a serv
32
34
  - [SOAP Headers](#soap-headers)
33
35
  - [Received SOAP Headers](#received-soap-headers)
34
36
  - [Outgoing SOAP Headers](#outgoing-soap-headers)
37
+ - [_addSoapHeader_(soapHeader[, name, namespace, xmlns])](#_addsoapheader_soapheader-name-namespace-xmlns)
38
+ - [changeSoapHeader(index, soapHeader[, name, namespace, xmlns])](#changesoapheaderindex-soapheader-name-namespace-xmlns)
39
+ - [_getSoapHeaders_()](#getsoapheaders)
40
+ - [_clearSoapHeaders_()](#clearsoapheaders)
35
41
  - [Client](#client)
36
- - [Client.describe() - description of services, ports and methods as a JavaScript object](#clientdescribe---description-of-services-ports-and-methods-as-a-javascript-object)
37
- - [Client.setSecurity(security) - use the specified security protocol](#clientsetsecuritysecurity---use-the-specified-security-protocol)
38
- - [Client._method_(args, callback, options) - call _method_ on the SOAP service.](#clientmethodargs-callback-options---call-method-on-the-soap-service)
39
- - [Client.*method*Async(args, options) - call _method_ on the SOAP service.](#clientmethodasyncargs-options---call-method-on-the-soap-service)
40
- - [Client._service_._port_._method_(args, callback[, options[, extraHeaders]]) - call a _method_ using a specific _service_ and _port_](#clientserviceportmethodargs-callback-options-extraheaders---call-a-method-using-a-specific-service-and-port)
42
+ - [_describe_()](#describe)
43
+ - [_setSecurity_(security)](#_setsecurity_security)
44
+ - [_method_(args, callback, options)](#_method_args-callback-options)
45
+ - [*method*Async(args, options)](#methodasyncargs-options)
46
+ - [_service_._port_._method_(args, callback[, options[, extraHeaders]])](#_service__port__method_args-callback-options-extraheaders)
47
+ - [Options (optional)](#options-optional)
48
+ - [Extra Headers (optional)](#extra-headers-optional)
49
+ - [Alternative method call using callback-last pattern](#alternative-method-call-using-callback-last-pattern)
41
50
  - [Overriding the namespace prefix](#overriding-the-namespace-prefix)
42
- - [Client._lastRequest_ - the property that contains last full soap request for client logging](#clientlastrequest---the-property-that-contains-last-full-soap-request-for-client-logging)
43
- - [Client.setEndpoint(url) - overwrite the SOAP service endpoint address](#clientsetendpointurl---overwrite-the-soap-service-endpoint-address)
51
+ - [_lastRequest_](#lastrequest)
52
+ - [_setEndpoint_(url)](#_setendpoint_url)
44
53
  - [Client Events](#client-events)
45
- - [_request_](#request)
46
- - [_message_](#message)
47
- - [_soapError_](#soaperror)
48
- - [_response_](#response)
54
+ - [_request_](#request)
55
+ - [_message_](#message)
56
+ - [_soapError_](#soaperror)
57
+ - [_response_](#response)
49
58
  - [WSDL](#wsdl)
50
- - [WSDL.constructor(wsdl, baseURL, options):](#wsdlconstructorwsdl-baseurl-options)
51
- - [wsdl.xmlToObject(xml):](#wsdlxmltoobjectxml)
52
- - [wsdl.objectToXML(object, typeName, namespacePrefix, namespaceURI, ...):](#wsdlobjecttoxmlobject-typename-namespaceprefix-namespaceuri-)
59
+ - [Constructor(wsdl, baseURL, options)](#constructorwsdl-baseurl-options)
60
+ - [Parameters](#parameters)
61
+ - [xmlToObject(xml)](#xmltoobjectxml)
62
+ - [Parameters:](#parameters)
63
+ - [Returns:](#returns)
64
+ - [objectToXML(object, typeName, namespacePrefix, namespaceURI, ...)](#objecttoxmlobject-typename-namespaceprefix-namespaceuri-)
65
+ - [Parameters:](#parameters-1)
66
+ - [Returns:](#returns-1)
53
67
  - [Security](#security)
54
68
  - [BasicAuthSecurity](#basicauthsecurity)
55
69
  - [BearerSecurity](#bearersecurity)
@@ -58,6 +72,7 @@ This module lets you connect to web services using SOAP. It also provides a serv
58
72
  - [WSSecurity](#wssecurity)
59
73
  - [WSSecurityCert](#wssecuritycert)
60
74
  - [WSSecurityPlusCert](#wssecuritypluscert)
75
+ - [Option examples](#option-examples)
61
76
  - [WSSecurityCertWithToken](#wssecuritycertwithtoken)
62
77
  - [NTLMSecurity](#ntlmsecurity)
63
78
  - [Handling XML Attributes, Value and XML (wsdlOptions).](#handling-xml-attributes-value-and-xml-wsdloptions)
@@ -76,7 +91,7 @@ This module lets you connect to web services using SOAP. It also provides a serv
76
91
 
77
92
  <!-- END doctoc generated TOC please keep comment here to allow auto update -->
78
93
 
79
- ## Features
94
+ # Features
80
95
 
81
96
  - Very simple API
82
97
  - Handles both RPC and Document schema types
@@ -85,20 +100,24 @@ This module lets you connect to web services using SOAP. It also provides a serv
85
100
  - WS-Security UsernameToken Profile 1.0
86
101
  - Supports [Express](http://expressjs.com/) based web server (body parser middleware can be used)
87
102
 
88
- ## Install
103
+ # Install
89
104
 
90
105
  ```
91
106
  npm install soap
92
107
  ```
93
108
 
94
- ## Support
109
+ # Support
95
110
 
96
111
  Community support is available through GitHub issues tab.
97
112
  Paid support can be provided as well, please contact one of the active maintainers.
98
113
 
99
- ## Module
114
+ # Module
100
115
 
101
- ### soap.createClient(url[, options], callback) - create a new SOAP client from a WSDL url. Also supports a local filesystem path.
116
+ ## soap
117
+
118
+ ### createClient(url[, options], callback)
119
+
120
+ Creates a new SOAP client from a WSDL URL. Also supports a local filesystem path.
102
121
 
103
122
  - `url` (_string_): A HTTP/HTTPS URL, XML or a local filesystem path.
104
123
  - `options` (_Object_):
@@ -128,7 +147,7 @@ Paid support can be provided as well, please contact one of the active maintaine
128
147
  - `result` (_Any_)
129
148
  - Returns: `Client`
130
149
 
131
- #### Example
150
+ ##### Example
132
151
 
133
152
  HTTP/HTTPS:
134
153
 
@@ -188,12 +207,14 @@ soap.createClient(xml, {}, function (err, client) {
188
207
 
189
208
  Note: for versions of node >0.10.X, you may need to specify `{connection: 'keep-alive'}` in SOAP headers to avoid truncation of longer chunked responses.
190
209
 
191
- ### soap.createClientAsync(url[, options]) - create a new SOAP client from a WSDL url. Also supports a local filesystem path.
210
+ ### createClientAsync(url[, options])
211
+
212
+ Creates a new SOAP client from a WSDL URL. Also supports a local filesystem path.
192
213
 
193
214
  Construct a `Promise<Client>` with the given WSDL file.
194
215
 
195
216
  - `url` (_string_): A HTTP/HTTPS URL, XML or a local filesystem path.
196
- - `options` (_Object_): See [soap.createClient(url[, options], callback)](#soapcreateclienturl-options-callback---create-a-new-soap-client-from-a-wsdl-url-also-supports-a-local-filesystem-path) for a description.
217
+ - `options` (_Object_): See [createClient(url[, options], callback)](#createclienturl-options-callback) for a description.
197
218
  - Returns: `Promise<Client>`
198
219
 
199
220
  #### Example
@@ -221,9 +242,13 @@ console.log(result[0]);
221
242
 
222
243
  Note: for versions of node >0.10.X, you may need to specify `{connection: 'keep-alive'}` in SOAP headers to avoid truncation of longer chunked responses.
223
244
 
224
- ### soap.listen(_server_, _path_, _services_, _wsdl_, _callback_) - create a new SOAP server that listens on _path_ and provides _services_.
245
+ ### listen(_server_, _path_, _services_, _wsdl_, _callback_)
246
+
247
+ Creates a new SOAP server that listens on `path` and provides `services`.
225
248
 
226
- ### soap.listen(_server_, _options_) - create a new SOAP server that listens on _path_ and provides _services_.
249
+ ### listen(_server_, _options_)
250
+
251
+ Creates a new SOAP server that listens on `path` and provides `services`.
227
252
 
228
253
  - `server` (_Object_): A [http](https://nodejs.org/api/http.html) server or [Express](http://expressjs.com/) framework based server.
229
254
  - `path` (_string_)
@@ -341,7 +366,47 @@ soap.listen(server, {
341
366
  });
342
367
  ```
343
368
 
344
- ### Server Logging
369
+ ### createServerless(_options_)
370
+
371
+ Creates a new SOAP server without binding to an HTTP server.
372
+
373
+ Use this when you are running in serverless environments (for example AWS Lambda), where you receive the raw request body and must return the raw SOAP XML response yourself.
374
+
375
+ The returned server supports `processRequest(xml, requestOptions)`.
376
+
377
+ - `xml` (_string_): Raw SOAP XML request body.
378
+ - `requestOptions` (_Object_): Optional request metadata.
379
+ - `url` (_string_): Request path used for operation binding. (Example: `/stockquote`)
380
+ - `headers` (_Object_): Incoming HTTP headers. (Example: `{ 'content-type': 'text/xml' }`)
381
+
382
+ #### Example
383
+
384
+ ```javascript
385
+ function handler() {
386
+ var wsdl = fs.readFileSync('myservice.wsdl', 'utf8');
387
+
388
+ var server = await soap.createServerless({
389
+ path: '/myService',
390
+ services: services,
391
+ xml: wsdl,
392
+ });
393
+
394
+ var response = await server.processRequest(rawXmlRequest, {
395
+ url: '/myService',
396
+ headers: {
397
+ 'content-type': 'text/xml',
398
+ },
399
+ });
400
+
401
+ return {
402
+ statusCode: response.statusCode,
403
+ headers: response.headers,
404
+ body: response.body,
405
+ };
406
+ }
407
+ ```
408
+
409
+ ## Server Logging
345
410
 
346
411
  If the `log` method is defined, it will be called with:
347
412
 
@@ -356,7 +421,7 @@ If the `log` method is defined, it will be called with:
356
421
  };
357
422
  ```
358
423
 
359
- ### Server Events
424
+ ## Server Events
360
425
 
361
426
  Server instances emit the following events:
362
427
 
@@ -370,7 +435,7 @@ Server instances emit the following events:
370
435
  The sequence order of the calls is `request`, `headers` and then the dedicated
371
436
  service method.
372
437
 
373
- ### Server Response on one-way calls
438
+ ## Server Response on one-way calls
374
439
 
375
440
  The so called one-way (or asynchronous) calls occur when an operation is called with no output defined in WSDL.
376
441
  The server sends a response (defaults to status code 200 with no body) to the client disregarding the result of the operation.
@@ -380,7 +445,7 @@ Pass in `oneWay` object in server options. Use the following keys:
380
445
  `emptyBody`: if true, returns an empty body, otherwise no content at all (default is false)
381
446
  `responseCode`: default statusCode is 200, override it with this options (for example 202 for SAP standard compliant response)
382
447
 
383
- ### SOAP Fault
448
+ ## SOAP Fault
384
449
 
385
450
  A service method can reply with a SOAP Fault to a client by `throw`ing an
386
451
  object with a `Fault` property.
@@ -412,7 +477,7 @@ throw {
412
477
  };
413
478
  ```
414
479
 
415
- ### Server security example using PasswordDigest
480
+ ## Server security example using PasswordDigest
416
481
 
417
482
  If `server.authenticate` is not defined then no authentication will take place.
418
483
 
@@ -448,7 +513,7 @@ Synchronous authentication:
448
513
  };
449
514
  ```
450
515
 
451
- ### Server connection authorization
516
+ ## Server connection authorization
452
517
 
453
518
  The `server.authorizeConnection` method is called prior to the soap service method.
454
519
  If the method is defined and returns `false` then the incoming connection is
@@ -461,9 +526,9 @@ terminated.
461
526
  };
462
527
  ```
463
528
 
464
- ## SOAP Headers
529
+ # SOAP Headers
465
530
 
466
- ### Received SOAP Headers
531
+ ## Received SOAP Headers
467
532
 
468
533
  A service method can look at the SOAP headers by providing a 3rd arguments.
469
534
 
@@ -494,14 +559,16 @@ First parameter is the Headers object;
494
559
  second parameter is the name of the SOAP method that will called
495
560
  (in case you need to handle the headers differently based on the method).
496
561
 
497
- ### Outgoing SOAP Headers
562
+ ## Outgoing SOAP Headers
498
563
 
499
564
  Both client & server can define SOAP headers that will be added to what they send.
500
565
  They provide the following methods to manage the headers.
501
566
 
502
- #### _addSoapHeader_(soapHeader[, name, namespace, xmlns]) - add soapHeader to soap:Header node
567
+ ### _addSoapHeader_(soapHeader[, name, namespace, xmlns])
503
568
 
504
- ##### Parameters
569
+ Adds `soapHeader` to the `soap:Header` node.
570
+
571
+ #### Parameters
505
572
 
506
573
  - `soapHeader` Object({rootName: {name: 'value'}}), strict xml-string,
507
574
  or function (server only)
@@ -533,19 +600,21 @@ For example:
533
600
  });
534
601
  ```
535
602
 
536
- ##### Returns
603
+ #### Returns
537
604
 
538
605
  The index where the header is inserted.
539
606
 
540
- ##### Optional parameters when first arg is object :
607
+ #### Optional parameters when first arg is object :
541
608
 
542
609
  - `name` Unknown parameter (it could just a empty string)
543
610
  - `namespace` prefix of xml namespace
544
611
  - `xmlns` URI
545
612
 
546
- #### _changeSoapHeader_(index, soapHeader[, name, namespace, xmlns]) - change an already existing soapHeader
613
+ ### changeSoapHeader(index, soapHeader[, name, namespace, xmlns])
547
614
 
548
- ##### Parameters
615
+ Changes an existing `soapHeader`.
616
+
617
+ #### Parameters
549
618
 
550
619
  - `index` index of the header to replace with provided new value
551
620
  - `soapHeader` Object({rootName: {name: 'value'}}), strict xml-string
@@ -553,15 +622,21 @@ The index where the header is inserted.
553
622
 
554
623
  See `addSoapHeader` for how to pass a function into `soapHeader`.
555
624
 
556
- #### _getSoapHeaders_() - return all defined headers
625
+ ### _getSoapHeaders_()
626
+
627
+ Returns all defined headers.
557
628
 
558
- #### _clearSoapHeaders_() - remove all defined headers
629
+ ### _clearSoapHeaders_()
559
630
 
560
- ## Client
631
+ Removes all defined headers.
632
+
633
+ # Client
561
634
 
562
635
  An instance of `Client` is passed to the `soap.createClient` callback. It is used to execute methods on the soap service.
563
636
 
564
- ### Client.describe() - description of services, ports and methods as a JavaScript object
637
+ ## _describe_()
638
+
639
+ Returns a description of services, ports, and methods as a JavaScript object.
565
640
 
566
641
  ```javascript
567
642
  client.describe(); // returns
@@ -578,11 +653,15 @@ client.describe(); // returns
578
653
  }
579
654
  ```
580
655
 
581
- ### Client.setSecurity(security) - use the specified security protocol
656
+ ## _setSecurity_(security)
657
+
658
+ Uses the specified security protocol.
582
659
 
583
660
  See [Security](#security) for example usage.
584
661
 
585
- ### Client._method_(args, callback, options) - call _method_ on the SOAP service.
662
+ ## _method_(args, callback, options)
663
+
664
+ Calls a _method_ on the SOAP service.
586
665
 
587
666
  - `args` (_Object_): Arguments that generate an XML document inside of the SOAP Body section.
588
667
  - `callback` (_Function_)
@@ -615,10 +694,12 @@ client.MyFunction({ name: 'value' }, function (err, result, rawResponse, soapHea
615
694
  });
616
695
  ```
617
696
 
618
- ### Client.*method*Async(args, options) - call _method_ on the SOAP service.
697
+ ## *method*Async(args, options)
698
+
699
+ Calls a method on the SOAP service.
619
700
 
620
701
  - `args` (_Object_): Arguments that generate an XML document inside of the SOAP Body section.
621
- - `options` (_Object_): See [Client._method_(args, callback, options) - call _method_ on the SOAP service.](#clientmethodargs-callback-options---call-method-on-the-soap-service) for a description.
702
+ - `options` (_Object_): See [method(args, callback, options)](#methodargs-callback-options) for a description.
622
703
 
623
704
  #### Example
624
705
 
@@ -664,11 +745,13 @@ You may pass in a fully-formed XML string instead the individual elements in JSO
664
745
 
665
746
  You must specify all of the namespaces and namespace prefixes yourself. The element(s) from the WSDL are not utilized as they were in the "Example with JSON as the `args`" example above, which automatically populated the "Request" element.
666
747
 
667
- ### Client._service_._port_._method_(args, callback[, options[, extraHeaders]]) - call a _method_ using a specific _service_ and _port_
748
+ ## _service_._port_._method_(args, callback[, options[, extraHeaders]])
749
+
750
+ Calls a _method_ using a specific _service_ and _port_.
668
751
 
669
752
  - `args` (_Object_): Arguments that generate an XML document inside of the SOAP Body section.
670
753
  - `callback` (_Function_)
671
- - `options` (_Object_): See [Client._method_(args, callback, options) - call _method_ on the SOAP service.](#clientmethodargs-callback-options---call-method-on-the-soap-service) for a description.
754
+ - `options` (_Object_): See [_method_(args, callback, options)](#methodargs-callback-options) for a description.
672
755
  - `extraHeaders` (_Object_): Sets HTTP headers for the WSDL request.
673
756
 
674
757
  #### Example
@@ -679,7 +762,7 @@ client.MyService.MyPort.MyFunction({ name: 'value' }, function (err, result) {
679
762
  });
680
763
  ```
681
764
 
682
- #### Options (optional)
765
+ ### Options (optional)
683
766
 
684
767
  - Accepts any option that the request module accepts, see [here.](https://github.com/mikeal/request)
685
768
  - For example, you could set a timeout of 5 seconds on the request like this:
@@ -744,7 +827,7 @@ client.MyService.MyPort.MyFunction(
744
827
  );
745
828
  ```
746
829
 
747
- #### Extra Headers (optional)
830
+ ### Extra Headers (optional)
748
831
 
749
832
  Object properties define extra HTTP headers to be sent on the request.
750
833
 
@@ -754,7 +837,7 @@ Object properties define extra HTTP headers to be sent on the request.
754
837
  client.addHttpHeader('User-Agent', `CustomUserAgent`);
755
838
  ```
756
839
 
757
- #### Alternative method call using callback-last pattern
840
+ ### Alternative method call using callback-last pattern
758
841
 
759
842
  To align method call signature with node' standard callback-last patter and event allow promisification of method calls, the following method signatures are also supported:
760
843
 
@@ -768,7 +851,7 @@ client.MyService.MyPort.MyFunction({ name: 'value' }, options, extraHeaders, fun
768
851
  });
769
852
  ```
770
853
 
771
- ### Overriding the namespace prefix
854
+ ## Overriding the namespace prefix
772
855
 
773
856
  `node-soap` is still working out some kinks regarding namespaces. If you find that an element is given the wrong namespace prefix in the request body, you can add the prefix to it's name in the containing object. I.E.:
774
857
 
@@ -794,11 +877,15 @@ client.MyService.MyPort.MyFunction(
794
877
  );
795
878
  ```
796
879
 
797
- ### Client._lastRequest_ - the property that contains last full soap request for client logging
880
+ ## _lastRequest_
881
+
882
+ Contains the last full SOAP request for client logging.
798
883
 
799
- ### Client.setEndpoint(url) - overwrite the SOAP service endpoint address
884
+ ## _setEndpoint_(url)
800
885
 
801
- ### Client Events
886
+ Overwrites the SOAP service endpoint address.
887
+
888
+ ## Client Events
802
889
 
803
890
  Client instances emit the following events:
804
891
 
@@ -844,47 +931,47 @@ Example :
844
931
  client.MyService.MyPort.MyFunction(args, function (err, result) {}, { exchangeId: myExchangeId });
845
932
  ```
846
933
 
847
- ## WSDL
934
+ # WSDL
848
935
 
849
936
  A WSDL instance can also be instantiated directly when you want to (un)marshal
850
937
  messages without doing SOAP calls. This can be used when a WSDL does not contain
851
938
  bindings for services (e.g. some Windows Communication Foundation SOAP web
852
939
  services).
853
940
 
854
- ## WSDL.constructor(wsdl, baseURL, options):
941
+ ## Constructor(wsdl, baseURL, options)
855
942
 
856
943
  Construct a WSDL instance from either the WSDL content or the URL to the WSDL.
857
944
 
858
- #### Parameters
945
+ ### Parameters
859
946
 
860
947
  - wsdl: a WSDL string or an URL to the WSDL
861
948
  - baseURL: base URL for the SOAP API
862
949
  - options: options (see source for details), use `{}` as default.
863
950
 
864
- ### wsdl.xmlToObject(xml):
951
+ ## xmlToObject(xml)
865
952
 
866
953
  Unmarshal XML to object.
867
954
 
868
- #### Parameters:
955
+ ### Parameters:
869
956
 
870
957
  - xml: SOAP response (XML) to unmarshal
871
958
 
872
- #### Returns:
959
+ ### Returns:
873
960
 
874
961
  Object containing the object types from the xml as keys.
875
962
 
876
- ### wsdl.objectToXML(object, typeName, namespacePrefix, namespaceURI, ...):
963
+ ## objectToXML(object, typeName, namespacePrefix, namespaceURI, ...)
877
964
 
878
965
  Marshal an object to XML
879
966
 
880
- #### Parameters:
967
+ ### Parameters:
881
968
 
882
969
  - object: Object to marshal
883
970
  - typeName: type (as per the wsdl) of the object
884
971
  - namespacePrefix: namespace prefix
885
972
  - namespaceURI: URI of the namespace
886
973
 
887
- #### Returns:
974
+ ### Returns:
888
975
 
889
976
  XML representation of object.
890
977
 
@@ -929,7 +1016,7 @@ async function samplePostCall(prospect: IProspectType) {
929
1016
  }
930
1017
  ```
931
1018
 
932
- ## Security
1019
+ # Security
933
1020
 
934
1021
  `node-soap` has several default security protocols. You can easily add your own
935
1022
  as well. The interface is quite simple. Each protocol defines these optional methods:
@@ -939,19 +1026,19 @@ as well. The interface is quite simple. Each protocol defines these optional met
939
1026
  - `toXML()` - a method that returns a string of XML to be appended to the SOAP headers. Not executed if `postProcess` is also defined.
940
1027
  - `postProcess(xml, envelopeKey)` - a method that receives the the assembled request XML plus envelope key, and returns a processed string of XML. Executed before `options.postProcess`.
941
1028
 
942
- ### BasicAuthSecurity
1029
+ ## BasicAuthSecurity
943
1030
 
944
1031
  ```javascript
945
1032
  client.setSecurity(new soap.BasicAuthSecurity('username', 'password'));
946
1033
  ```
947
1034
 
948
- ### BearerSecurity
1035
+ ## BearerSecurity
949
1036
 
950
1037
  ```javascript
951
1038
  client.setSecurity(new soap.BearerSecurity('token'));
952
1039
  ```
953
1040
 
954
- ### ClientSSLSecurity
1041
+ ## ClientSSLSecurity
955
1042
 
956
1043
  _Note_: If you run into issues using this protocol, consider passing these options
957
1044
  as default request options to the constructor:
@@ -981,7 +1068,7 @@ client.setSecurity(
981
1068
  );
982
1069
  ```
983
1070
 
984
- ### ClientSSLSecurityPFX
1071
+ ## ClientSSLSecurityPFX
985
1072
 
986
1073
  _Note_: If you run into issues using this protocol, consider passing these options
987
1074
  as default request options to the constructor:
@@ -1009,7 +1096,7 @@ client.setSecurity(
1009
1096
  );
1010
1097
  ```
1011
1098
 
1012
- ### WSSecurity
1099
+ ## WSSecurity
1013
1100
 
1014
1101
  `WSSecurity` implements WS-Security. UsernameToken and PasswordText/PasswordDigest is supported.
1015
1102
 
@@ -1032,7 +1119,7 @@ the `options` object is optional and can contain the following properties:
1032
1119
  - `actor`: if set, adds Actor attribute with given value to security tag (default: `''`)
1033
1120
  - `appendElement`: A string containing XML element to append to the end of the WSSecurity element. This can be used to add custom elements like certificates or other security tokens (default: `''`)
1034
1121
 
1035
- ### WSSecurityCert
1122
+ ## WSSecurityCert
1036
1123
 
1037
1124
  WS-Security X509 Certificate support.
1038
1125
 
@@ -1070,7 +1157,7 @@ The `options` object is optional and can contain the following properties:
1070
1157
  - `idMode`: (optional) either 'wssecurity' to generate wsse-scoped reference Id on <Body> or undefined for an unscoped reference Id
1071
1158
  - `appendElement`: (optional) A string containing XML element to append to the end of the WSSecurity element. This can be used to add custom elements like certificates or other security tokens.
1072
1159
 
1073
- ### WSSecurityPlusCert
1160
+ ## WSSecurityPlusCert
1074
1161
 
1075
1162
  Use WSSecurity and WSSecurityCert together.
1076
1163
 
@@ -1081,7 +1168,7 @@ var wsSecurityPlusCert = new soap.WSSecurityPlusCert(wsSecurity, wsSecurityCert)
1081
1168
  client.setSecurity(wsSecurityPlusCert);
1082
1169
  ```
1083
1170
 
1084
- #### Option examples
1171
+ ### Option examples
1085
1172
 
1086
1173
  `hasTimeStamp:true`
1087
1174
 
@@ -1230,7 +1317,7 @@ client.setSecurity(wsSecurityPlusCert);
1230
1317
  </soap:Header>
1231
1318
  ```
1232
1319
 
1233
- ### WSSecurityCertWithToken
1320
+ ## WSSecurityCertWithToken
1234
1321
 
1235
1322
  WS-Security X509 Certificate support. Just like WSSecurityCert, except that it accepts the input properties as a single object, with two properties added `username` and `password`. Which if added, will add a UsernameToken Element to the xml security element.
1236
1323
 
@@ -1241,7 +1328,7 @@ WS-Security X509 Certificate support. Just like WSSecurityCert, except that it a
1241
1328
  </wsse:UsernameToken>
1242
1329
  ```
1243
1330
 
1244
- ### NTLMSecurity
1331
+ ## NTLMSecurity
1245
1332
 
1246
1333
  Parameter invocation:
1247
1334
 
@@ -1256,7 +1343,7 @@ var loginData = { username: 'username', password: 'password', domain: 'domain',
1256
1343
  client.setSecurity(new soap.NTLMSecurity(loginData));
1257
1344
  ```
1258
1345
 
1259
- ## Handling XML Attributes, Value and XML (wsdlOptions).
1346
+ # Handling XML Attributes, Value and XML (wsdlOptions).
1260
1347
 
1261
1348
  Sometimes it is necessary to override the default behaviour of `node-soap` in order to deal with the special requirements
1262
1349
  of your code base or a third library you use. Therefore you can use the `wsdlOptions` Object, which is passed in the
@@ -1272,7 +1359,7 @@ var wsdlOptions = {
1272
1359
 
1273
1360
  If nothing (or an empty Object `{}`) is passed to the `#createClient()` method, the `node-soap` defaults (`attributesKey: 'attributes'`, `valueKey: '$value'` and `xmlKey: '$xml'`) are used.
1274
1361
 
1275
- ### Overriding the `value` key
1362
+ ## Overriding the `value` key
1276
1363
 
1277
1364
  By default, `node-soap` uses `$value` as the key for any parsed XML value which may interfere with your other code as it
1278
1365
  could be some reserved word, or the `$` in general cannot be used for a key to start with.
@@ -1289,7 +1376,7 @@ soap.createClient(__dirname + '/wsdl/default_namespace.wsdl', wsdlOptions, funct
1289
1376
  });
1290
1377
  ```
1291
1378
 
1292
- ### Overriding the `xml` key
1379
+ ## Overriding the `xml` key
1293
1380
 
1294
1381
  By default, `node-soap` uses `$xml` as the key to pass through an XML string as is; without parsing or namespacing it. It overrides all the other content that the node might have otherwise had.
1295
1382
 
@@ -1343,7 +1430,7 @@ soap.createClient(__dirname + '/wsdl/default_namespace.wsdl', wsdlOptions, funct
1343
1430
  });
1344
1431
  ```
1345
1432
 
1346
- ### Overriding the `attributes` key
1433
+ ## Overriding the `attributes` key
1347
1434
 
1348
1435
  By default, `node-soap` uses `attributes` as the key to define a nodes attributes.
1349
1436
 
@@ -1396,7 +1483,7 @@ soap.createClient(__dirname + '/wsdl/default_namespace.wsdl', wsdlOptions, funct
1396
1483
  });
1397
1484
  ```
1398
1485
 
1399
- ### Overriding imports relative paths
1486
+ ## Overriding imports relative paths
1400
1487
 
1401
1488
  By default, WSDL and schema files import other schemas and types using relative paths.
1402
1489
 
@@ -1412,7 +1499,7 @@ soap.createClient(__dirname+'/wsdl/fixedPath/netsuite.wsdl', options, function(e
1412
1499
  });
1413
1500
  ```
1414
1501
 
1415
- ### Overriding import locations
1502
+ ## Overriding import locations
1416
1503
 
1417
1504
  You can override the URIs or paths of imports in the WSDL by specifying a `overrideImportLocation` function in the WSDL options.
1418
1505
 
@@ -1429,7 +1516,7 @@ soap.createClient('https://127.0.0.1/service.wsdl', options, function(err, clien
1429
1516
  });
1430
1517
  ```
1431
1518
 
1432
- ### Specifying the exact namespace definition of the root element
1519
+ ## Specifying the exact namespace definition of the root element
1433
1520
 
1434
1521
  In rare cases, you may want to precisely control the namespace definition that is included in the root element.
1435
1522
 
@@ -1455,7 +1542,7 @@ var wsdlOptions = {
1455
1542
 
1456
1543
  To see it in practice, have a look at the sample files in: [test/request-response-samples/addPets\_\_force_namespaces](https://github.com/vpulim/node-soap/tree/master/test/request-response-samples/addPets__force_namespaces)
1457
1544
 
1458
- ### Overriding element key specification in XML
1545
+ ## Overriding element key specification in XML
1459
1546
 
1460
1547
  In very rare cases ([external implementation isn't matching exactly the WSDL spec?](https://github.com/vpulim/node-soap/pull/1189)),
1461
1548
  you may want to override element XML keys in requests and/or responses.
@@ -1474,7 +1561,7 @@ var wsdlOptions = {
1474
1561
 
1475
1562
  Test sample files covering this are in [test/request-response-samples/Dummy\_\_ref_element_should_have_correct_namespace_with_overrideElementKey](https://github.com/vpulim/node-soap/tree/master/test/request-response-samples/Dummy__ref_element_should_have_correct_namespace_with_overrideElementKey)
1476
1563
 
1477
- ### Custom Deserializer
1564
+ ## Custom Deserializer
1478
1565
 
1479
1566
  Sometimes it's useful to handle deserialization in your code instead of letting node-soap do it.
1480
1567
  For example if the soap response contains dates that are not in a format recognized by javascript, you might want to use your own function to handle them.
@@ -1512,7 +1599,7 @@ Example :
1512
1599
 
1513
1600
  ```
1514
1601
 
1515
- ### Changing the tag formats to use self-closing (empty element) tags
1602
+ ## Changing the tag formats to use self-closing (empty element) tags
1516
1603
 
1517
1604
  The XML specification specifies that there is no semantic difference between `<Tag></Tag>` and `<Tag />`, and node-soap defaults to using the `<Tag></Tag>` format. But if your web service is particular, or if there is a stylistic preference, the `useEmptyTag` option causes tags with no contents to use the `<Tag />` format instead.
1518
1605
 
@@ -1527,7 +1614,7 @@ For example: `{ MyTag: { attributes: { MyAttr: 'value' } } }` is:
1527
1614
  - **Without useEmptyTag**: `<MyTag MyAttr="value"></MyTag>`
1528
1615
  - **With useEmptyTag set to true**: `<MyTag MyAttr="value" />`
1529
1616
 
1530
- ## Handling "ignored" namespaces
1617
+ # Handling "ignored" namespaces
1531
1618
 
1532
1619
  If an Element in a `schema` definition depends on an Element which is present in the same namespace, normally the `tns:`
1533
1620
  namespace prefix is used to identify this Element. This is not much of a problem as long as you have just one `schema` defined
@@ -1565,7 +1652,7 @@ var options = {
1565
1652
 
1566
1653
  This would override the default `ignoredNamespaces` of the `WSDL` processor to `['namespaceToIgnore', 'someOtherNamespace']`. (This shouldn't be necessary, anyways).
1567
1654
 
1568
- ## Handling "ignoreBaseNameSpaces" attribute
1655
+ # Handling "ignoreBaseNameSpaces" attribute
1569
1656
 
1570
1657
  If an Element in a `schema` definition depends has a basenamespace defined but the request does not need that value, for example you have a "sentJob" with basenamespace "v20"
1571
1658
  but the request need only: <sendJob> set in the tree structure, you need to set the ignoreBaseNameSpaces to true. This is set because in a lot of workaround the wsdl structure is not correctly
@@ -1582,7 +1669,7 @@ ignoredNamespaces: true
1582
1669
  }
1583
1670
  ```
1584
1671
 
1585
- ## Contributors
1672
+ # Contributors
1586
1673
 
1587
1674
  - Author: [Vinay Pulim](https://github.com/vpulim)
1588
1675
  - Active maintainers: