soap 0.27.1 → 0.31.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/History.md +48 -0
- package/Readme.md +295 -7
- package/lib/client.d.ts +3 -2
- package/lib/client.js +73 -45
- package/lib/client.js.map +1 -1
- package/lib/http.d.ts +2 -1
- package/lib/http.js +14 -2
- package/lib/http.js.map +1 -1
- package/lib/security/WSSecurityCert.d.ts +13 -0
- package/lib/security/WSSecurityCert.js +32 -3
- package/lib/security/WSSecurityCert.js.map +1 -1
- package/lib/server.d.ts +5 -2
- package/lib/server.js +38 -7
- package/lib/server.js.map +1 -1
- package/lib/soap.d.ts +2 -1
- package/lib/soap.js +2 -0
- package/lib/soap.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/wsdl/elements.d.ts +2 -2
- package/lib/wsdl/elements.js +19 -4
- package/lib/wsdl/elements.js.map +1 -1
- package/lib/wsdl/index.d.ts +1 -0
- package/lib/wsdl/index.js +60 -39
- package/lib/wsdl/index.js.map +1 -1
- package/package.json +9 -9
package/History.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
+
0.31.0 / 2020-02-21
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
* [DOC] Update Readme.md (#1105)
|
|
5
|
+
* [ENHANCEMENT] Client.*method*Async can have options as the second argument (#1104)
|
|
6
|
+
* [FIX] Add WSDL xmlns header attribute (#1093)
|
|
7
|
+
* [FIX] Catch errors when parsing WSDL (#1102)
|
|
8
|
+
* [FIX] Fix min/maxOccurs parsing and handling (#1100)
|
|
9
|
+
* [FIX] Fixes bug when envelopeKey is changed and WSSecurityCert is set (#1106)
|
|
10
|
+
* [FIX] fix for circular descriptions (#1101)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
0.30.0 / 2019-10-16
|
|
14
|
+
===================
|
|
15
|
+
|
|
16
|
+
* [ENHANCEMENT] Allow a fixed file path for local includes (#1089)
|
|
17
|
+
* [ENHANCEMENT] New XML Signing Options, extra tags to sign and small bug fix (#1091)
|
|
18
|
+
* [ENHANCEMENT] added forceMTOM option and updated the Readme (#1086)
|
|
19
|
+
* [FIX] Added undefined check in WSDL.processAttributes (#1090)
|
|
20
|
+
* [FIX] Fixes bug where methodName would not be included in the response event (#1087)
|
|
21
|
+
* [FIX] fixed MTOM removing soap12header (#1084)
|
|
22
|
+
|
|
23
|
+
0.29.0 / 2019-07-26
|
|
24
|
+
===================
|
|
25
|
+
|
|
26
|
+
* [ENHANCEMENT] Added Options object for signer.computeSignature (#1066)
|
|
27
|
+
* [FIX] Prototype pollution in lodash versions <=4.17.11. Hence, updating lodash version to ^4.17.15 in package.json and package-lock.json (#1085)
|
|
28
|
+
* [FIX] Fix known vulnerabilities found by `npm audit` (#1083)
|
|
29
|
+
* [FIX] Adjusts URL detection to be case insensitive (#1082)
|
|
30
|
+
* [FIX] Fixed issue causing error message, "TypeError: Cannot read property 'output' of undefined" (#1081)
|
|
31
|
+
|
|
32
|
+
0.28.0 / 2019-06-20
|
|
33
|
+
===================
|
|
34
|
+
|
|
35
|
+
* [ENHANCEMENT] Added support for parsing of doubles and floats. (#1065)
|
|
36
|
+
* [ENHANCEMENT] Adds promise server authentication (#1069)
|
|
37
|
+
* [ENHANCEMENT] Expose the WSDL class (#1071)
|
|
38
|
+
* [ENHANCEMENT] Now supporting XSI namespace overrides (#1079)
|
|
39
|
+
* [ENHANCEMENT] added possibility to add action to content-type header (#1073)
|
|
40
|
+
* [ENHANCEMENT] client.addSoapHeader() dynamic SOAP header (#1062)
|
|
41
|
+
* [ENHANCEMENT] emit response events allowing user override on response XML (#1070)
|
|
42
|
+
* [FIX] Fix description for recursive wsdl with extended element (#1078)
|
|
43
|
+
* [FIX] Fixes issue with unknown ReadableStream type (#1076)
|
|
44
|
+
* [FIX] Update types to make `options` optional for createClientAsync (#1068)
|
|
45
|
+
* [FIX] fix for soap 1.2 content-type header, missing action key (#1075)
|
|
46
|
+
* [FIX] types: move forceSoap12Headers to IWsdlBaseOptions (#1063)
|
|
47
|
+
* [MAINTENANCE] Updated read me to reflect changes in soap.listen (#1060)
|
|
48
|
+
|
|
1
49
|
0.27.1 / 2019-04-19
|
|
2
50
|
===================
|
|
3
51
|
|
package/Readme.md
CHANGED
|
@@ -16,7 +16,7 @@ This module lets you connect to web services using SOAP. It also provides a ser
|
|
|
16
16
|
- [Module](#module)
|
|
17
17
|
- [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)
|
|
18
18
|
- [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)
|
|
19
|
-
- [soap.listen(*server*, *path*, *services*, *wsdl*) - create a new SOAP server that listens on *path* and provides *services*.](#soaplistenserver-path-services-wsdl---create-a-new-soap-server-that-listens-on-path-and-provides-services)
|
|
19
|
+
- [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)
|
|
20
20
|
- [Options](#options)
|
|
21
21
|
- [Server Logging](#server-logging)
|
|
22
22
|
- [Server Events](#server-events)
|
|
@@ -145,9 +145,10 @@ The `options` argument allows you to customize the client with the following pro
|
|
|
145
145
|
|
|
146
146
|
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.
|
|
147
147
|
|
|
148
|
-
### soap.listen(*server*, *path*, *services*, *wsdl*) - create a new SOAP server that listens on *path* and provides *services*.
|
|
148
|
+
### soap.listen(*server*, *path*, *services*, *wsdl*, *callback*) - create a new SOAP server that listens on *path* and provides *services*.
|
|
149
149
|
*server* can be a [http](https://nodejs.org/api/http.html) Server or [express](http://expressjs.com/) framework based server
|
|
150
150
|
*wsdl* is an xml string that defines the service.
|
|
151
|
+
*callback* a function to run after the server has been initialized.
|
|
151
152
|
|
|
152
153
|
``` javascript
|
|
153
154
|
var myService = {
|
|
@@ -203,7 +204,9 @@ Note: for versions of node >0.10.X, you may need to specify `{connection: 'keep-
|
|
|
203
204
|
});
|
|
204
205
|
|
|
205
206
|
server.listen(8000);
|
|
206
|
-
soap.listen(server, '/wsdl', myService, xml)
|
|
207
|
+
soap.listen(server, '/wsdl', myService, xml, function(){
|
|
208
|
+
console.log('server initialized');
|
|
209
|
+
});
|
|
207
210
|
|
|
208
211
|
//express server example
|
|
209
212
|
var app = express();
|
|
@@ -212,7 +215,9 @@ Note: for versions of node >0.10.X, you may need to specify `{connection: 'keep-
|
|
|
212
215
|
app.listen(8001, function(){
|
|
213
216
|
//Note: /wsdl route will be handled by soap module
|
|
214
217
|
//and all other routes & middleware will continue to work
|
|
215
|
-
soap.listen(app, '/wsdl', myService, xml)
|
|
218
|
+
soap.listen(app, '/wsdl', myService, xml, function(){
|
|
219
|
+
console.log('server initialized');
|
|
220
|
+
});
|
|
216
221
|
});
|
|
217
222
|
|
|
218
223
|
```
|
|
@@ -265,6 +270,8 @@ Server instances emit the following events:
|
|
|
265
270
|
|
|
266
271
|
* request - Emitted for every received messages.
|
|
267
272
|
The signature of the callback is `function(request, methodName)`.
|
|
273
|
+
* response - Emitted before sending SOAP response.
|
|
274
|
+
The signature of the callback is `function(response, methodName)`.
|
|
268
275
|
* headers - Emitted when the SOAP Headers are not empty.
|
|
269
276
|
The signature of the callback is `function(headers, methodName)`.
|
|
270
277
|
|
|
@@ -493,8 +500,21 @@ The `options` object is optional and is passed to the `request`-module.
|
|
|
493
500
|
Interesting properties might be:
|
|
494
501
|
* `timeout`: Timeout in milliseconds
|
|
495
502
|
* `forever`: Enables keep-alive connections and pools them
|
|
496
|
-
|
|
497
|
-
|
|
503
|
+
* `attachments`: array of attachment objects. This converts the request into MTOM: _headers['Content-Type']='multipart/related; type="application/xop+xml"; start= ... '_
|
|
504
|
+
```
|
|
505
|
+
[{
|
|
506
|
+
mimetype: content mimetype,
|
|
507
|
+
contentId: part id,
|
|
508
|
+
name: file name,
|
|
509
|
+
body: binary data
|
|
510
|
+
},
|
|
511
|
+
...
|
|
512
|
+
]
|
|
513
|
+
```
|
|
514
|
+
* `forceMTOM`: set to True if you want to send the request as MTOM even if you don't have attachments
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
### Client.*method*Async(args, options) - call *method* on the SOAP service.
|
|
498
518
|
|
|
499
519
|
``` javascript
|
|
500
520
|
client.MyFunctionAsync({name: 'value'}).then((result) => {
|
|
@@ -508,6 +528,23 @@ Interesting properties might be:
|
|
|
508
528
|
|
|
509
529
|
The `args` argument allows you to supply arguments that generate an XML document inside of the SOAP Body section.
|
|
510
530
|
|
|
531
|
+
The `options` object is optional and is passed to the `request`-module.
|
|
532
|
+
Interesting properties might be:
|
|
533
|
+
* `timeout`: Timeout in milliseconds
|
|
534
|
+
* `forever`: Enables keep-alive connections and pools them
|
|
535
|
+
* `attachments`: array of attachment objects. This converts the request into MTOM: _headers['Content-Type']='multipart/related; type="application/xop+xml"; start= ... '_
|
|
536
|
+
```
|
|
537
|
+
[{
|
|
538
|
+
mimetype: content mimetype,
|
|
539
|
+
contentId: part id,
|
|
540
|
+
name: file name,
|
|
541
|
+
body: binary data
|
|
542
|
+
},
|
|
543
|
+
...
|
|
544
|
+
]
|
|
545
|
+
```
|
|
546
|
+
* `forceMTOM`: set to True if you want to send the request as MTOM even if you don't have attachments
|
|
547
|
+
|
|
511
548
|
##### Example with JSON for the `args`
|
|
512
549
|
The example above uses `{name: 'value'}` as the args. This may generate a SOAP messages such as:
|
|
513
550
|
|
|
@@ -663,6 +700,87 @@ Example :
|
|
|
663
700
|
}, {exchangeId: myExchangeId})
|
|
664
701
|
```
|
|
665
702
|
|
|
703
|
+
## WSDL
|
|
704
|
+
|
|
705
|
+
A WSDL instance can also be instantiated directly when you want to (un)marshal
|
|
706
|
+
messages without doing SOAP calls. This can be used when a WSDL does not contain
|
|
707
|
+
bindings for services (e.g. some Windows Communication Foundation SOAP web
|
|
708
|
+
services).
|
|
709
|
+
|
|
710
|
+
## WSDL.constructor(wsdl, baseURL, options):
|
|
711
|
+
|
|
712
|
+
Construct a WSDL instance from either the WSDL content or the URL to the WSDL.
|
|
713
|
+
#### Parameters
|
|
714
|
+
|
|
715
|
+
- wsdl: A string wSDL or an URL to the WSDL
|
|
716
|
+
- baseURL: base URL for the SOAP API
|
|
717
|
+
- options: options (see source for details), use `{}` as default.
|
|
718
|
+
|
|
719
|
+
### wsdl.xmlToObject(xml):
|
|
720
|
+
|
|
721
|
+
Unmarshal XML to object.
|
|
722
|
+
|
|
723
|
+
#### Parameters:
|
|
724
|
+
- xml: SOAP response (XML) to unmarshal
|
|
725
|
+
|
|
726
|
+
#### Returns:
|
|
727
|
+
|
|
728
|
+
Object containing the object types from the xml as keys.
|
|
729
|
+
|
|
730
|
+
### wsdl.objectToXML(object, typeName, namespacePrefix, namespaceURI, ...):
|
|
731
|
+
|
|
732
|
+
Marshal an object to XML
|
|
733
|
+
|
|
734
|
+
#### Parameters:
|
|
735
|
+
- object: Object to marshal
|
|
736
|
+
- typeName: type (as per the wsdl) of the object
|
|
737
|
+
- namespacePrefix: namespace prefix
|
|
738
|
+
- namespaceURI: URI of the namespace
|
|
739
|
+
|
|
740
|
+
#### Returns:
|
|
741
|
+
|
|
742
|
+
XML representation of object.
|
|
743
|
+
|
|
744
|
+
#### Example:
|
|
745
|
+
```typescript
|
|
746
|
+
// Abstracted from a real use case
|
|
747
|
+
import { AxiosInstance } from 'axios';
|
|
748
|
+
import { WSDL } from 'soap';
|
|
749
|
+
import { IProspectType } from './types';
|
|
750
|
+
|
|
751
|
+
// A WSDL in a string.
|
|
752
|
+
const WSDL_CONTENT = "...";
|
|
753
|
+
|
|
754
|
+
const httpClient: AxiosInstance = /* ... instantiate ... */;
|
|
755
|
+
const url = 'http://example.org/SoapService.svc';
|
|
756
|
+
|
|
757
|
+
const wsdl = new WSDL(WSDL_CONTENT, baseURL, {});
|
|
758
|
+
|
|
759
|
+
async function sampleGetCall(): IProspectType | undefined {
|
|
760
|
+
const res = await httpClient.get(`${baseURL}/GetProspect`);
|
|
761
|
+
|
|
762
|
+
const object = wsdl.xmlToObject(res.data);
|
|
763
|
+
|
|
764
|
+
if (!object.ProspectType) {
|
|
765
|
+
// Response did not contain the expected type
|
|
766
|
+
return undefined;
|
|
767
|
+
}
|
|
768
|
+
// Optionally, unwrap and set defaults for some fields
|
|
769
|
+
// Ensure that the object meets the expected prototype
|
|
770
|
+
// Finally cast and return the result.
|
|
771
|
+
return object.ProspectType as IProspectType;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
async function samplePostCall(prospect: IProspectType) {
|
|
775
|
+
// objectToXML(object, typeName, namespacePrefix, namespaceURI, ...)
|
|
776
|
+
const objectBody = wsdl.objectToXML(obj, 'ProspectType', '', '');
|
|
777
|
+
const data = `<?xml version="1.0" ?>${body}`;
|
|
778
|
+
|
|
779
|
+
const res = await httpClient.post(`${baseURL}/ProcessProspect`, data);
|
|
780
|
+
// Optionally, deserialize request and return response status.
|
|
781
|
+
}
|
|
782
|
+
```
|
|
783
|
+
|
|
666
784
|
|
|
667
785
|
## Security
|
|
668
786
|
|
|
@@ -763,10 +881,163 @@ WS-Security X509 Certificate support.
|
|
|
763
881
|
var privateKey = fs.readFileSync(privateKeyPath);
|
|
764
882
|
var publicKey = fs.readFileSync(publicKeyPath);
|
|
765
883
|
var password = ''; // optional password
|
|
766
|
-
var
|
|
884
|
+
var options = {
|
|
885
|
+
hasTimeStamp: true,
|
|
886
|
+
additionalReferences: [
|
|
887
|
+
'wsa:Action',
|
|
888
|
+
'wsa:ReplyTo',
|
|
889
|
+
'wsa:To',
|
|
890
|
+
],
|
|
891
|
+
signerOptions: {
|
|
892
|
+
prefix: 'ds',
|
|
893
|
+
attrs: { Id: 'Signature' },
|
|
894
|
+
existingPrefixes: {
|
|
895
|
+
wsse: 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd',
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
var wsSecurity = new soap.WSSecurityCert(privateKey, publicKey, password, options);
|
|
767
899
|
client.setSecurity(wsSecurity);
|
|
768
900
|
```
|
|
769
901
|
|
|
902
|
+
The `options` object is optional and can contain the following properties:
|
|
903
|
+
* `hasTimeStamp`: Includes Timestamp tags (default: `true`)
|
|
904
|
+
* `signatureTransformations`: sets the Reference Transforms Algorithm (default ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', 'http://www.w3.org/2001/10/xml-exc-c14n#']). Type is a string array
|
|
905
|
+
* `signatureAlgorithm`: set to `http://www.w3.org/2001/04/xmldsig-more#rsa-sha256` to use sha256
|
|
906
|
+
* `additionalReferences` : (optional) Array of Soap headers that need to be signed. This need to be added using `client.addSoapHeader('header')`
|
|
907
|
+
* `signerOptions`: (optional) passes options to the XML Signer package - from (https://github.com/yaronn/xml-crypto)
|
|
908
|
+
* `existingPrefixes`: (optional) A hash of prefixes and namespaces prefix: namespace that shouldn't be in the signature because they already exist in the xml (default: `{ 'wsse': 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' }`)
|
|
909
|
+
* `prefix`: (optional) Adds this value as a prefix for the generated signature tags.
|
|
910
|
+
* `attrs`: (optional) A hash of attributes and values attrName: value to add to the signature root node
|
|
911
|
+
|
|
912
|
+
#### Option examples
|
|
913
|
+
|
|
914
|
+
`hasTimeStamp:true`
|
|
915
|
+
|
|
916
|
+
``` xml
|
|
917
|
+
<soap:Header>
|
|
918
|
+
<wsse:Security soap:mustUnderstand="1">
|
|
919
|
+
<wsse:BinarySecurityToken>XXX</wsse:BinarySecurityToken>
|
|
920
|
+
<!-- The Timestamp group of tags are added and signed -->
|
|
921
|
+
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" Id="Timestamp">
|
|
922
|
+
<Created>2019-10-01T08:17:50Z</Created>
|
|
923
|
+
<Expires>2019-10-01T08:27:50Z</Expires>
|
|
924
|
+
</Timestamp>
|
|
925
|
+
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
|
926
|
+
<SignedInfo>
|
|
927
|
+
...
|
|
928
|
+
<Reference URI="#Timestamp">
|
|
929
|
+
<Transforms>
|
|
930
|
+
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
|
|
931
|
+
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
|
932
|
+
</Transforms>
|
|
933
|
+
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
|
|
934
|
+
<DigestValue>XyZ=</DigestValue>
|
|
935
|
+
</Reference>
|
|
936
|
+
</SignedInfo>
|
|
937
|
+
</Signature>
|
|
938
|
+
</wsse:Security>
|
|
939
|
+
</soap:Header>
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
`additionalReferences: ['To']`
|
|
943
|
+
``` XML
|
|
944
|
+
<soap:Header>
|
|
945
|
+
<To Id="To">localhost.com</To>
|
|
946
|
+
<wsse:Security soap:mustUnderstand="1">
|
|
947
|
+
<wsse:BinarySecurityToken>XXX</wsse:BinarySecurityToken>
|
|
948
|
+
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
|
949
|
+
<SignedInfo>
|
|
950
|
+
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
|
951
|
+
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
|
|
952
|
+
<!-- The "To" tag is signed and added as a reference -->
|
|
953
|
+
<Reference URI="#To">
|
|
954
|
+
<Transforms>
|
|
955
|
+
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
|
|
956
|
+
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
|
957
|
+
</Transforms>
|
|
958
|
+
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
|
|
959
|
+
<DigestValue>XYZ</DigestValue>
|
|
960
|
+
</Reference>
|
|
961
|
+
</SignedInfo>
|
|
962
|
+
<SignatureValue>
|
|
963
|
+
Rf6M4F4puQuQHJIPtJz1CZIVvF3qOdpEEcuAiooWkX5ecnAHSf3RW3sOIzFUWW7VOOncJcts/3xr8DuN4+8Wm9hx1MoOcWJ6kyRIdVNbQWLseIcAhxYCntRY57T2TBXzpb0UPA56pry1+TEcnIQXhdIzG5YT+tTVTp+SZHHcnlP5Y+yqnIOH9wzgRvAovbydTYPCODF7Ana9K/7CSGDe7vpVT85CUYUcJE4DfTxaRa9gKkKrBdPN9vFVi0WfxtMF4kv23cZRCZzS5+CoLfPlx3mq65gVXsqH01RLbktNJq9VaQKcZUgapmUCMzrYhqyzUQJ8HrSHqe+ya2GsjlB0VQ==
|
|
964
|
+
</SignatureValue>
|
|
965
|
+
<KeyInfo>
|
|
966
|
+
<wsse:SecurityTokenReference
|
|
967
|
+
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
|
|
968
|
+
<wsse:Reference URI="#x509-c5c0d213676f4a6ba5e6fa58074eb57a"
|
|
969
|
+
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
|
|
970
|
+
</wsse:SecurityTokenReference>
|
|
971
|
+
</KeyInfo>
|
|
972
|
+
</Signature>
|
|
973
|
+
</wsse:Security>
|
|
974
|
+
</soap:Header>
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
`signerOptions.prefix:'ds'`
|
|
978
|
+
|
|
979
|
+
``` XML
|
|
980
|
+
<soap:Header>
|
|
981
|
+
<To Id="To">localhost.com</To>
|
|
982
|
+
<wsse:Security soap:mustUnderstand="1">
|
|
983
|
+
<wsse:BinarySecurityToken>XXX</wsse:BinarySecurityToken>
|
|
984
|
+
<!-- Signature and children tags are given the prefix defined. -->
|
|
985
|
+
<ds:Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
|
|
986
|
+
<ds:SignedInfo>
|
|
987
|
+
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
|
988
|
+
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
|
|
989
|
+
<ds:Reference URI="#To">
|
|
990
|
+
<ds:Transforms>
|
|
991
|
+
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
|
|
992
|
+
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
|
993
|
+
</ds:Transforms>
|
|
994
|
+
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
|
|
995
|
+
<ds:DigestValue>XYZ</DigestValue>
|
|
996
|
+
</ds:Reference>
|
|
997
|
+
</ds:SignedInfo>
|
|
998
|
+
<ds:SignatureValue>
|
|
999
|
+
Rf6M4F4puQuQHJIPtJz1CZIVvF3qOdpEEcuAiooWkX5ecnAHSf3RW3sOIzFUWW7VOOncJcts/3xr8DuN4+8Wm9hx1MoOcWJ6kyRIdVNbQWLseIcAhxYCntRY57T2TBXzpb0UPA56pry1+TEcnIQXhdIzG5YT+tTVTp+SZHHcnlP5Y+yqnIOH9wzgRvAovbydTYPCODF7Ana9K/7CSGDe7vpVT85CUYUcJE4DfTxaRa9gKkKrBdPN9vFVi0WfxtMF4kv23cZRCZzS5+CoLfPlx3mq65gVXsqH01RLbktNJq9VaQKcZUgapmUCMzrYhqyzUQJ8HrSHqe+ya2GsjlB0VQ==
|
|
1000
|
+
</ds:SignatureValue>
|
|
1001
|
+
<ds:KeyInfo>
|
|
1002
|
+
<wsse:SecurityTokenReference
|
|
1003
|
+
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
|
|
1004
|
+
<wsse:Reference URI="#x509-c5c0d213676f4a6ba5e6fa58074eb57a"
|
|
1005
|
+
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
|
|
1006
|
+
</wsse:SecurityTokenReference>
|
|
1007
|
+
</ds:KeyInfo>
|
|
1008
|
+
</ds:Signature>
|
|
1009
|
+
</wsse:Security>
|
|
1010
|
+
</soap:Header>
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
`signerOptions.attrs:{ Id: 'signature-100', foo:'bar'}`
|
|
1014
|
+
|
|
1015
|
+
``` xml
|
|
1016
|
+
<soap:Header>
|
|
1017
|
+
<wsse:Security soap:mustUnderstand="1">
|
|
1018
|
+
<wsse:BinarySecurityToken>XXX</wsse:BinarySecurityToken>
|
|
1019
|
+
<!-- The Timestamp group of tags are added and signed -->
|
|
1020
|
+
<Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" Id="Timestamp">
|
|
1021
|
+
<Created>2019-10-01T08:17:50Z</Created>
|
|
1022
|
+
<Expires>2019-10-01T08:27:50Z</Expires>
|
|
1023
|
+
</Timestamp>
|
|
1024
|
+
<Signature Id="signature-100" foo="bar" xmlns="http://www.w3.org/2000/09/xmldsig#">
|
|
1025
|
+
<SignedInfo>
|
|
1026
|
+
...
|
|
1027
|
+
<Reference URI="#Timestamp">
|
|
1028
|
+
<Transforms>
|
|
1029
|
+
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
|
|
1030
|
+
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
|
|
1031
|
+
</Transforms>
|
|
1032
|
+
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
|
|
1033
|
+
<DigestValue>XyZ=</DigestValue>
|
|
1034
|
+
</Reference>
|
|
1035
|
+
</SignedInfo>
|
|
1036
|
+
</Signature>
|
|
1037
|
+
</wsse:Security>
|
|
1038
|
+
</soap:Header>
|
|
1039
|
+
```
|
|
1040
|
+
|
|
770
1041
|
### NTLMSecurity
|
|
771
1042
|
|
|
772
1043
|
Parameter invocation:
|
|
@@ -903,6 +1174,23 @@ soap.createClient(__dirname + '/wsdl/default_namespace.wsdl', wsdlOptions, funct
|
|
|
903
1174
|
});
|
|
904
1175
|
});
|
|
905
1176
|
```
|
|
1177
|
+
|
|
1178
|
+
### Overriding imports relative paths
|
|
1179
|
+
|
|
1180
|
+
By default, WSDL and schema files import other schemas and types using relative paths.
|
|
1181
|
+
|
|
1182
|
+
However in some systems (i.e. NetSuite) when the wsdl is downloaded for offline caching, all files are flattened under a single directory and all the imports fail.
|
|
1183
|
+
Passing this option allows `node-soap` to correctly load all files.
|
|
1184
|
+
|
|
1185
|
+
```javascript
|
|
1186
|
+
var options ={
|
|
1187
|
+
wsdl_options = { fixedPath: true }
|
|
1188
|
+
};
|
|
1189
|
+
soap.createClient(__dirname+'/wsdl/fixedPath/netsuite.wsdl', options, function(err, client) {
|
|
1190
|
+
// your code
|
|
1191
|
+
});
|
|
1192
|
+
```
|
|
1193
|
+
|
|
906
1194
|
### Specifying the exact namespace definition of the root element
|
|
907
1195
|
In rare cases, you may want to precisely control the namespace definition that is included in the root element.
|
|
908
1196
|
|
package/lib/client.d.ts
CHANGED
|
@@ -44,8 +44,8 @@ export declare class Client extends EventEmitter {
|
|
|
44
44
|
private normalizeNames;
|
|
45
45
|
constructor(wsdl: WSDL, endpoint?: string, options?: IOptions);
|
|
46
46
|
/** add soapHeader to soap:Header node */
|
|
47
|
-
addSoapHeader(soapHeader: any, name?: string, namespace?:
|
|
48
|
-
changeSoapHeader(index:
|
|
47
|
+
addSoapHeader(soapHeader: any, name?: string, namespace?: any, xmlns?: string): number;
|
|
48
|
+
changeSoapHeader(index: any, soapHeader: any, name?: any, namespace?: any, xmlns?: any): void;
|
|
49
49
|
/** return all defined headers */
|
|
50
50
|
getSoapHeaders(): string[];
|
|
51
51
|
/** remove all defined headers */
|
|
@@ -68,5 +68,6 @@ export declare class Client extends EventEmitter {
|
|
|
68
68
|
private _defineService;
|
|
69
69
|
private _definePort;
|
|
70
70
|
private _defineMethod;
|
|
71
|
+
private _processSoapHeader;
|
|
71
72
|
private _invoke;
|
|
72
73
|
}
|