soap 0.23.0 → 0.24.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/.travis.yml +1 -1
- package/History.md +19 -0
- package/Readme.md +79 -21
- package/coverage/coverage.json +1 -0
- package/coverage/lcov-report/base.css +212 -0
- package/coverage/lcov-report/index.html +119 -0
- package/coverage/lcov-report/node-soap/index.html +93 -0
- package/coverage/lcov-report/node-soap/index.js.html +74 -0
- package/coverage/lcov-report/node-soap/lib/client.js.html +1001 -0
- package/coverage/lcov-report/node-soap/lib/http.js.html +416 -0
- package/coverage/lcov-report/node-soap/lib/index.html +171 -0
- package/coverage/lcov-report/node-soap/lib/nscontext.js.html +734 -0
- package/coverage/lcov-report/node-soap/lib/security/BasicAuthSecurity.js.html +137 -0
- package/coverage/lcov-report/node-soap/lib/security/BearerSecurity.js.html +134 -0
- package/coverage/lcov-report/node-soap/lib/security/ClientSSLSecurity.js.html +296 -0
- package/coverage/lcov-report/node-soap/lib/security/ClientSSLSecurityPFX.js.html +218 -0
- package/coverage/lcov-report/node-soap/lib/security/WSSecurity.js.html +278 -0
- package/coverage/lcov-report/node-soap/lib/security/index.html +158 -0
- package/coverage/lcov-report/node-soap/lib/security/index.js.html +92 -0
- package/coverage/lcov-report/node-soap/lib/server.js.html +1139 -0
- package/coverage/lcov-report/node-soap/lib/soap.js.html +314 -0
- package/coverage/lcov-report/node-soap/lib/utils.js.html +161 -0
- package/coverage/lcov-report/node-soap/lib/wsdl.js.html +6275 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +1 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +158 -0
- package/coverage/lcov.info +3325 -0
- package/lib/client.js +21 -18
- package/lib/server.js +17 -6
- package/lib/soap.d.ts +8 -1
- package/lib/wsdl.js +18 -6
- package/package.json +4 -4
package/.travis.yml
CHANGED
package/History.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
0.24.0 / 2018-04-05
|
|
2
|
+
===================
|
|
3
|
+
* [DOC] Error on custom deserializer example (#1000)
|
|
4
|
+
* [DOC] Fix broken link
|
|
5
|
+
* [DOC] adding bullets to separate each option
|
|
6
|
+
* [DOC] changed ClientSSLSecurity to ClientSSLSecurityPFX in the readme file
|
|
7
|
+
* [DOC] clarify section on client events in Readme.md (#989)
|
|
8
|
+
* [ENHANCEMENT] Added one-way response configuration options
|
|
9
|
+
* [ENHANCEMENT] Adding support for SOAP 1.2 Envelope Headers in the server side (#1003)
|
|
10
|
+
* [ENHANCEMENT] Enable multiArgs during promisification
|
|
11
|
+
* [ENHANCEMENT] add Client.wsdl for accessing client.wsdl during soap.createClient() (#990)
|
|
12
|
+
* [ENHANCEMENT] add option to remove element-by-element namespacing of json arrays (#994)
|
|
13
|
+
* [ENHANCEMENT] add rawRequest to callback arguments (#992)
|
|
14
|
+
* [FIX] Fixed checking for empty obj.Body before further actions (#986)
|
|
15
|
+
* [FIX] Lookup definitions in child element first (#958)
|
|
16
|
+
* [FIX] only detect xsi:nil if its value is `true` (#983)
|
|
17
|
+
* [MAINTENANCE] Updating the coverage to use the new version of Istanbul framework, the nyc.
|
|
18
|
+
* [MAINTENANCE] Upgrade Lodash to 4.17.5 (#1001)
|
|
19
|
+
|
|
1
20
|
0.23.0 / 2017-10-18
|
|
2
21
|
===================
|
|
3
22
|
* [FIX] Fixing tests broken by #979
|
package/Readme.md
CHANGED
|
@@ -20,6 +20,7 @@ This module lets you connect to web services using SOAP. It also provides a ser
|
|
|
20
20
|
- [Options](#options)
|
|
21
21
|
- [Server Logging](#server-logging)
|
|
22
22
|
- [Server Events](#server-events)
|
|
23
|
+
- [Server Response on one-way calls](#server-response-on-one-way-calls)
|
|
23
24
|
- [SOAP Fault](#soap-fault)
|
|
24
25
|
- [Server security example using PasswordDigest](#server-security-example-using-passworddigest)
|
|
25
26
|
- [Server connection authorization](#server-connection-authorization)
|
|
@@ -36,10 +37,15 @@ This module lets you connect to web services using SOAP. It also provides a ser
|
|
|
36
37
|
- [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)
|
|
37
38
|
- [Client.setEndpoint(url) - overwrite the SOAP service endpoint address](#clientsetendpointurl---overwrite-the-soap-service-endpoint-address)
|
|
38
39
|
- [Client Events](#client-events)
|
|
40
|
+
- [request](#request)
|
|
41
|
+
- [message](#message)
|
|
42
|
+
- [soapError](#soaperror)
|
|
43
|
+
- [response](#response)
|
|
39
44
|
- [Security](#security)
|
|
40
45
|
- [BasicAuthSecurity](#basicauthsecurity)
|
|
41
46
|
- [BearerSecurity](#bearersecurity)
|
|
42
47
|
- [ClientSSLSecurity](#clientsslsecurity)
|
|
48
|
+
- [ClientSSLSecurityPFX](#clientsslsecuritypfx)
|
|
43
49
|
- [WSSecurity](#wssecurity)
|
|
44
50
|
- [WSSecurityCert](#wssecuritycert)
|
|
45
51
|
- [Handling XML Attributes, Value and XML (wsdlOptions).](#handling-xml-attributes-value-and-xml-wsdloptions)
|
|
@@ -134,6 +140,7 @@ The `options` argument allows you to customize the client with the following pro
|
|
|
134
140
|
- disableCache: don't cache WSDL files, request them every time.
|
|
135
141
|
- overridePromiseSuffix: if your wsdl operations contains names with Async suffix, you will need to override the default promise suffix to a custom one, default: `Async`.
|
|
136
142
|
- normalizeNames: if your wsdl operations contains names with non identifier characters (`[^a-z$_0-9]`), replace them with `_`. Note: if using this option, clients using wsdls with two operations like `soap:method` and `soap-method` will be overwritten. Then, use bracket notation instead (`client['soap:method']()`).
|
|
143
|
+
- namespaceArrayElements: provides support for nonstandard array semantics. If true, JSON arrays of the form `{list: [{elem: 1}, {elem: 2}]}` are marshalled into xml as `<list><elem>1</elem></list> <list><elem>2</elem></list>`. If false, marshalls into `<list> <elem>1</elem> <elem>2</elem> </list>`. Default: `true`.
|
|
137
144
|
|
|
138
145
|
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.
|
|
139
146
|
|
|
@@ -204,13 +211,13 @@ You can pass in server and [WSDL Options](#handling-xml-attributes-value-and-xml
|
|
|
204
211
|
using an options hash.
|
|
205
212
|
|
|
206
213
|
Server options include the below:
|
|
207
|
-
`pfx`: A string or Buffer containing the private key, certificate and CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with the key, cert and ca options.)
|
|
208
|
-
`key`: A string or Buffer containing the private key of the server in PEM format. (Could be an array of keys). (Required)
|
|
209
|
-
`passphrase`: A string of passphrase for the private key or pfx.
|
|
210
|
-
`cert`: A string or Buffer containing the certificate key of the server in PEM format. (Could be an array of certs). (Required)
|
|
211
|
-
`ca`: An array of strings or Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs will be used, like VeriSign. These are used to authorize connections.
|
|
212
|
-
`crl` : Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
|
|
213
|
-
`ciphers`: A string describing the ciphers to use or exclude, separated by :. The default cipher suite is:
|
|
214
|
+
- `pfx`: A string or Buffer containing the private key, certificate and CA certs of the server in PFX or PKCS12 format. (Mutually exclusive with the key, cert and ca options.)
|
|
215
|
+
- `key`: A string or Buffer containing the private key of the server in PEM format. (Could be an array of keys). (Required)
|
|
216
|
+
- `passphrase`: A string of passphrase for the private key or pfx.
|
|
217
|
+
- `cert`: A string or Buffer containing the certificate key of the server in PEM format. (Could be an array of certs). (Required)
|
|
218
|
+
- `ca`: An array of strings or Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs will be used, like VeriSign. These are used to authorize connections.
|
|
219
|
+
- `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
|
|
220
|
+
- `ciphers`: A string describing the ciphers to use or exclude, separated by :. The default cipher suite is:
|
|
214
221
|
|
|
215
222
|
``` javascript
|
|
216
223
|
var xml = require('fs').readFileSync('myservice.wsdl', 'utf8');
|
|
@@ -252,6 +259,16 @@ Server instances emit the following events:
|
|
|
252
259
|
The sequence order of the calls is `request`, `headers` and then the dedicated
|
|
253
260
|
service method.
|
|
254
261
|
|
|
262
|
+
### Server Response on one-way calls
|
|
263
|
+
|
|
264
|
+
The so called one-way (or asynchronous) calls occur when an operation is called with no output defined in WSDL.
|
|
265
|
+
The server sends a response (defaults to status code 200 with no body) to the client disregarding the result of the operation.
|
|
266
|
+
|
|
267
|
+
You can configure the response to match the appropriate client expectation to the SOAP standard implementation.
|
|
268
|
+
Pass in `oneWay` object in server options. Use the following keys:
|
|
269
|
+
`emptyBody`: if true, returns an empty body, otherwise no content at all (default is false)
|
|
270
|
+
`responseCode`: default statusCode is 200, override it with this options (for example 202 for SAP standard compliant response)
|
|
271
|
+
|
|
255
272
|
### SOAP Fault
|
|
256
273
|
|
|
257
274
|
A service method can reply with a SOAP Fault to a client by `throw`ing an
|
|
@@ -430,10 +447,11 @@ An instance of `Client` is passed to the `soap.createClient` callback. It is us
|
|
|
430
447
|
### Client.*method*(args, callback, options) - call *method* on the SOAP service.
|
|
431
448
|
|
|
432
449
|
``` javascript
|
|
433
|
-
client.MyFunction({name: 'value'}, function(err, result,
|
|
450
|
+
client.MyFunction({name: 'value'}, function(err, result, rawResponse, soapHeader, rawRequest) {
|
|
434
451
|
// result is a javascript object
|
|
435
|
-
//
|
|
452
|
+
// rawResponse is the raw xml response string
|
|
436
453
|
// soapHeader is the response soap header as a javascript object
|
|
454
|
+
// rawRequest is the raw xml request string
|
|
437
455
|
})
|
|
438
456
|
```
|
|
439
457
|
|
|
@@ -448,7 +466,10 @@ Interesting properties might be:
|
|
|
448
466
|
|
|
449
467
|
``` javascript
|
|
450
468
|
client.MyFunctionAsync({name: 'value'}).then((result) => {
|
|
469
|
+
// result is a javascript array containing result, raw and soapheader
|
|
451
470
|
// result is a javascript object
|
|
471
|
+
// raw is the raw response
|
|
472
|
+
// soapHeader is the response soap header as a javascript object
|
|
452
473
|
})
|
|
453
474
|
```
|
|
454
475
|
|
|
@@ -570,17 +591,29 @@ client.MyService.MyPort.MyFunction({name: 'value'}, options, extraHeaders, funct
|
|
|
570
591
|
### Client Events
|
|
571
592
|
Client instances emit the following events:
|
|
572
593
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
594
|
+
### _request_
|
|
595
|
+
Emitted before a request is sent. The event handler has the signature `(xml, eid)`.
|
|
596
|
+
|
|
597
|
+
- _xml_ - The entire Soap request (Envelope) including headers.
|
|
598
|
+
- _eid_ - The exchange id.
|
|
599
|
+
|
|
600
|
+
### _message_
|
|
601
|
+
Emitted before a request is sent, but only the body is passed to the event handler. Useful if you don't want to log /store Soap headers. The event handler has the signature `(message, eid)`.
|
|
602
|
+
|
|
603
|
+
- _message_ - Soap body contents.
|
|
604
|
+
- _eid_ - The exchange id.
|
|
605
|
+
|
|
606
|
+
### _soapError_
|
|
607
|
+
Emitted when an erroneous response is received. Useful if you want to globally log errors. The event handler has the signature `(error, eid)`.
|
|
608
|
+
|
|
609
|
+
- _error_ - An error object which also contains the resoponse.
|
|
610
|
+
- _eid_ - The exchange id.
|
|
611
|
+
### _response_
|
|
612
|
+
Emitted after a response is received. This is emitted for all responses (both success and errors). The event handler has the signature `(body, response, eid)`
|
|
613
|
+
|
|
614
|
+
- _body_ - The SOAP response body.
|
|
615
|
+
- _response_ - The entire `IncomingMessage` response object.
|
|
616
|
+
- _eid_ - The exchange id.
|
|
584
617
|
|
|
585
618
|
An 'exchange' is a request/response couple.
|
|
586
619
|
Event handlers receive the exchange id in all events.
|
|
@@ -644,6 +677,31 @@ client.setSecurity(new soap.ClientSSLSecurity(
|
|
|
644
677
|
},
|
|
645
678
|
));
|
|
646
679
|
```
|
|
680
|
+
|
|
681
|
+
### ClientSSLSecurityPFX
|
|
682
|
+
|
|
683
|
+
_Note_: If you run into issues using this protocol, consider passing these options
|
|
684
|
+
as default request options to the constructor:
|
|
685
|
+
* `rejectUnauthorized: false`
|
|
686
|
+
* `strictSSL: false`
|
|
687
|
+
* `secureOptions: constants.SSL_OP_NO_TLSv1_2` (this is likely needed for node >= 10.0)
|
|
688
|
+
|
|
689
|
+
If you want to reuse tls sessions, you can use the option `forever: true`.
|
|
690
|
+
|
|
691
|
+
``` javascript
|
|
692
|
+
client.setSecurity(new soap.ClientSSLSecurityPFX(
|
|
693
|
+
'/path/to/pfx/cert', // or a buffer: [fs.readFileSync('/path/to/pfx/cert', 'utf8'),
|
|
694
|
+
'path/to/optional/passphrase',
|
|
695
|
+
{ /*default request options like */
|
|
696
|
+
// strictSSL: true,
|
|
697
|
+
// rejectUnauthorized: false,
|
|
698
|
+
// hostname: 'some-hostname'
|
|
699
|
+
// secureOptions: constants.SSL_OP_NO_TLSv1_2,
|
|
700
|
+
// forever: true,
|
|
701
|
+
},
|
|
702
|
+
));
|
|
703
|
+
```
|
|
704
|
+
|
|
647
705
|
### WSSecurity
|
|
648
706
|
|
|
649
707
|
`WSSecurity` implements WS-Security. UsernameToken and PasswordText/PasswordDigest is supported.
|
|
@@ -832,7 +890,7 @@ Example :
|
|
|
832
890
|
```javascript
|
|
833
891
|
|
|
834
892
|
var wsdlOptions = {
|
|
835
|
-
customDeserializer
|
|
893
|
+
customDeserializer: {
|
|
836
894
|
|
|
837
895
|
// this function will be used to any date found in soap responses
|
|
838
896
|
date: function (text, context) {
|