soap 0.20.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/.editorconfig +23 -23
- package/.jshintrc +29 -29
- package/.travis.yml +22 -22
- package/CONTRIBUTING.md +52 -58
- package/History.md +52 -2
- package/LICENSE +7 -7
- package/PUBLISHING.md +28 -28
- package/Readme.md +1062 -931
- 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/index.js +3 -3
- package/lib/client.js +434 -425
- package/lib/http.js +129 -129
- package/lib/nscontext.js +223 -223
- package/lib/security/BasicAuthSecurity.js +24 -24
- package/lib/security/BearerSecurity.js +23 -23
- package/lib/security/ClientSSLSecurity.js +82 -65
- package/lib/security/ClientSSLSecurityPFX.js +51 -51
- package/lib/security/WSSecurity.js +90 -90
- package/lib/security/WSSecurityCert.js +78 -78
- package/lib/security/index.js +10 -10
- package/lib/security/templates/wsse-security-header.ejs +12 -12
- package/lib/security/templates/wsse-security-token.ejs +3 -3
- package/lib/server.js +474 -444
- package/lib/soap.d.ts +220 -0
- package/lib/soap.js +110 -110
- package/lib/utils.js +30 -30
- package/lib/wsdl.js +2272 -2234
- package/package.json +8 -8
- package/soap-stub.js +148 -148
- package/.npmignore +0 -2
package/package.json
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "A minimal node SOAP client",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=0.
|
|
6
|
+
"node": ">=4.0.0"
|
|
7
7
|
},
|
|
8
8
|
"author": "Vinay Pulim <v@pulim.com>",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"bluebird": "^3.5.0",
|
|
11
|
-
"compress": "^0.99.0",
|
|
12
11
|
"concat-stream": "^1.5.1",
|
|
13
|
-
"debug": "
|
|
12
|
+
"debug": "^2.6.9",
|
|
14
13
|
"ejs": "~2.5.5",
|
|
15
14
|
"finalhandler": "^1.0.3",
|
|
16
|
-
"lodash": "^
|
|
15
|
+
"lodash": "^4.17.5",
|
|
17
16
|
"request": ">=2.9.0",
|
|
18
17
|
"sax": ">=0.6",
|
|
19
18
|
"selectn": "^0.9.6",
|
|
20
19
|
"serve-static": "^1.11.1",
|
|
21
20
|
"strip-bom": "~0.3.1",
|
|
22
|
-
"uuid": "^3.0
|
|
21
|
+
"uuid": "^3.1.0",
|
|
23
22
|
"xml-crypto": "~0.8.0"
|
|
24
23
|
},
|
|
25
24
|
"repository": {
|
|
@@ -27,13 +26,14 @@
|
|
|
27
26
|
"url": "https://github.com/milewise/node-soap.git"
|
|
28
27
|
},
|
|
29
28
|
"main": "./index.js",
|
|
29
|
+
"types": "./lib/soap.d.ts",
|
|
30
30
|
"directories": {
|
|
31
31
|
"lib": "./lib"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"toc": "./node_modules/.bin/doctoc Readme.md --github --maxlevel 3",
|
|
35
35
|
"pretest": "jshint index.js lib test",
|
|
36
|
-
"cover": "
|
|
36
|
+
"cover": "nyc --reporter=lcov --reporter=html --reporter=text mocha test/*-test.js test/security/*.js",
|
|
37
37
|
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js -v",
|
|
38
38
|
"test": "mocha --timeout 10000 test/*-test.js test/security/*.js"
|
|
39
39
|
},
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"duplexer": "~0.1.1",
|
|
51
51
|
"express": "^4.14.0",
|
|
52
52
|
"glob": "~3.2.8",
|
|
53
|
-
"istanbul": "^0.4.1",
|
|
54
53
|
"jshint": "2.3.0",
|
|
55
54
|
"mocha": "~1.17.0",
|
|
55
|
+
"nyc": "^11.4.1",
|
|
56
56
|
"readable-stream": "~2.0.2",
|
|
57
57
|
"semver": "~5.0.3",
|
|
58
58
|
"should": "~3.3.0",
|
package/soap-stub.js
CHANGED
|
@@ -1,148 +1,148 @@
|
|
|
1
|
-
var _ = require('lodash');
|
|
2
|
-
|
|
3
|
-
var aliasedClientStubs = {};
|
|
4
|
-
var clientStubs = {};
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This module stubs the soap module to allow for offline
|
|
8
|
-
* testing and stubbed clients. All clients' methods are stubbed with sinon and have
|
|
9
|
-
* additional functionality:
|
|
10
|
-
*
|
|
11
|
-
* <ul>
|
|
12
|
-
* <li>.respondWithError() - Responds with the mocked client's sample error response.</li>
|
|
13
|
-
* <li>.respondWithSuccess() - Responds with the mocked client's sample success response.</li>
|
|
14
|
-
* </ul>
|
|
15
|
-
*
|
|
16
|
-
* Register a client by calling `.registerClient(urlToWsdl, clientStub)`. For an
|
|
17
|
-
* example client stub, see ./soap-stub-client-example.js.
|
|
18
|
-
*
|
|
19
|
-
* @property {Boolean} errOnCreateClient returns an error to the createClient method when set to true.
|
|
20
|
-
*/
|
|
21
|
-
module.exports = {
|
|
22
|
-
createClient: createClient,
|
|
23
|
-
createErroringStub: createErroringStub,
|
|
24
|
-
createRespondingStub: createRespondingStub,
|
|
25
|
-
errOnCreateClient: false,
|
|
26
|
-
getStub: getStub,
|
|
27
|
-
registerClient: registerClient,
|
|
28
|
-
reset: reset,
|
|
29
|
-
security: require('./lib/security')
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Return a stubbed client based on the value of wsdlUrl.
|
|
34
|
-
*
|
|
35
|
-
* @throws if wsdlUrl is unknown.
|
|
36
|
-
*
|
|
37
|
-
* @param {String} wsdlUrl
|
|
38
|
-
* @param {Object} options
|
|
39
|
-
* @param {Function} cb
|
|
40
|
-
* @return {Object}
|
|
41
|
-
*/
|
|
42
|
-
function createClient(wsdlUrl, options, cb) {
|
|
43
|
-
if (!cb) {
|
|
44
|
-
cb = options;
|
|
45
|
-
options = {};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (this.errOnCreateClient) {
|
|
49
|
-
return setTimeout(cb.bind(null, new Error('forced error on createClient')));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var client = getStub(wsdlUrl);
|
|
53
|
-
|
|
54
|
-
if (client) {
|
|
55
|
-
resetStubbedMethods(client);
|
|
56
|
-
setTimeout(cb.bind(null, null, client));
|
|
57
|
-
} else {
|
|
58
|
-
setTimeout(cb.bind(null, new Error('no client stubbed for ' + wsdlUrl)));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Returns a method that calls all callbacks given to the method it is attached
|
|
64
|
-
* to with the given error.
|
|
65
|
-
*
|
|
66
|
-
* <pre>
|
|
67
|
-
* myClientStub.someMethod.errorOnCall = createErroringStub(error);
|
|
68
|
-
*
|
|
69
|
-
* // elsewhere
|
|
70
|
-
*
|
|
71
|
-
* myClientStub.someMethod.errorOnCall();
|
|
72
|
-
* </pre>
|
|
73
|
-
*
|
|
74
|
-
* @param {?} object anything
|
|
75
|
-
* @return {Function}
|
|
76
|
-
*/
|
|
77
|
-
function createErroringStub(err) {
|
|
78
|
-
return function() {
|
|
79
|
-
this.args.forEach(function(argSet) {
|
|
80
|
-
setTimeout(argSet[1].bind(null, err));
|
|
81
|
-
});
|
|
82
|
-
this.yields(err);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Returns a method that calls all callbacks given to the method it is attached
|
|
88
|
-
* to with the given response.
|
|
89
|
-
*
|
|
90
|
-
* <pre>
|
|
91
|
-
* myClientStub.someMethod.respondWithError = createRespondingStub(errorResponse);
|
|
92
|
-
*
|
|
93
|
-
* // elsewhere
|
|
94
|
-
*
|
|
95
|
-
* myClientStub.someMethod.respondWithError();
|
|
96
|
-
* </pre>
|
|
97
|
-
*
|
|
98
|
-
* @param {?} object anything
|
|
99
|
-
* @return {Function}
|
|
100
|
-
*/
|
|
101
|
-
function createRespondingStub(object, body) {
|
|
102
|
-
return function() {
|
|
103
|
-
this.args.forEach(function(argSet) {
|
|
104
|
-
setTimeout(argSet[1].bind(null, null, object));
|
|
105
|
-
});
|
|
106
|
-
this.yields(null, object, body);
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Registers a stubbed client with soap-stub. urlToWsdl is the path you will use
|
|
112
|
-
* in your app.
|
|
113
|
-
*
|
|
114
|
-
* @param {String} alias A simple name to refer to the clientStub as.
|
|
115
|
-
* @param {String} urlToWsdl May be file system URL or http URL.
|
|
116
|
-
* @param {Object} clientStub A client with stubbed methods.
|
|
117
|
-
*/
|
|
118
|
-
function registerClient(alias, urlToWsdl, clientStub) {
|
|
119
|
-
aliasedClientStubs[alias] = clientStub;
|
|
120
|
-
clientStubs[urlToWsdl] = clientStub;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Resets state associated with clientStubs.
|
|
125
|
-
*/
|
|
126
|
-
function reset() {
|
|
127
|
-
_.forEach(clientStubs, resetStubbedMethods);
|
|
128
|
-
this.errOnCreateClient = false;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Returns a previously registered client stub.
|
|
133
|
-
*
|
|
134
|
-
* @param {String} aliasOrWsdlUrl
|
|
135
|
-
* @return {Object} clientStub
|
|
136
|
-
*/
|
|
137
|
-
function getStub(aliasOrWsdlUrl) {
|
|
138
|
-
return aliasedClientStubs[aliasOrWsdlUrl] || clientStubs[aliasOrWsdlUrl];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function resetStubbedMethods(client) {
|
|
142
|
-
Object.keys(client).forEach(function(method) {
|
|
143
|
-
method = client[method];
|
|
144
|
-
if (typeof method === 'function' && typeof method.reset === 'function') {
|
|
145
|
-
method.reset();
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
1
|
+
var _ = require('lodash');
|
|
2
|
+
|
|
3
|
+
var aliasedClientStubs = {};
|
|
4
|
+
var clientStubs = {};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This module stubs the soap module to allow for offline
|
|
8
|
+
* testing and stubbed clients. All clients' methods are stubbed with sinon and have
|
|
9
|
+
* additional functionality:
|
|
10
|
+
*
|
|
11
|
+
* <ul>
|
|
12
|
+
* <li>.respondWithError() - Responds with the mocked client's sample error response.</li>
|
|
13
|
+
* <li>.respondWithSuccess() - Responds with the mocked client's sample success response.</li>
|
|
14
|
+
* </ul>
|
|
15
|
+
*
|
|
16
|
+
* Register a client by calling `.registerClient(urlToWsdl, clientStub)`. For an
|
|
17
|
+
* example client stub, see ./soap-stub-client-example.js.
|
|
18
|
+
*
|
|
19
|
+
* @property {Boolean} errOnCreateClient returns an error to the createClient method when set to true.
|
|
20
|
+
*/
|
|
21
|
+
module.exports = {
|
|
22
|
+
createClient: createClient,
|
|
23
|
+
createErroringStub: createErroringStub,
|
|
24
|
+
createRespondingStub: createRespondingStub,
|
|
25
|
+
errOnCreateClient: false,
|
|
26
|
+
getStub: getStub,
|
|
27
|
+
registerClient: registerClient,
|
|
28
|
+
reset: reset,
|
|
29
|
+
security: require('./lib/security')
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Return a stubbed client based on the value of wsdlUrl.
|
|
34
|
+
*
|
|
35
|
+
* @throws if wsdlUrl is unknown.
|
|
36
|
+
*
|
|
37
|
+
* @param {String} wsdlUrl
|
|
38
|
+
* @param {Object} options
|
|
39
|
+
* @param {Function} cb
|
|
40
|
+
* @return {Object}
|
|
41
|
+
*/
|
|
42
|
+
function createClient(wsdlUrl, options, cb) {
|
|
43
|
+
if (!cb) {
|
|
44
|
+
cb = options;
|
|
45
|
+
options = {};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (this.errOnCreateClient) {
|
|
49
|
+
return setTimeout(cb.bind(null, new Error('forced error on createClient')));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var client = getStub(wsdlUrl);
|
|
53
|
+
|
|
54
|
+
if (client) {
|
|
55
|
+
resetStubbedMethods(client);
|
|
56
|
+
setTimeout(cb.bind(null, null, client));
|
|
57
|
+
} else {
|
|
58
|
+
setTimeout(cb.bind(null, new Error('no client stubbed for ' + wsdlUrl)));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Returns a method that calls all callbacks given to the method it is attached
|
|
64
|
+
* to with the given error.
|
|
65
|
+
*
|
|
66
|
+
* <pre>
|
|
67
|
+
* myClientStub.someMethod.errorOnCall = createErroringStub(error);
|
|
68
|
+
*
|
|
69
|
+
* // elsewhere
|
|
70
|
+
*
|
|
71
|
+
* myClientStub.someMethod.errorOnCall();
|
|
72
|
+
* </pre>
|
|
73
|
+
*
|
|
74
|
+
* @param {?} object anything
|
|
75
|
+
* @return {Function}
|
|
76
|
+
*/
|
|
77
|
+
function createErroringStub(err) {
|
|
78
|
+
return function() {
|
|
79
|
+
this.args.forEach(function(argSet) {
|
|
80
|
+
setTimeout(argSet[1].bind(null, err));
|
|
81
|
+
});
|
|
82
|
+
this.yields(err);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Returns a method that calls all callbacks given to the method it is attached
|
|
88
|
+
* to with the given response.
|
|
89
|
+
*
|
|
90
|
+
* <pre>
|
|
91
|
+
* myClientStub.someMethod.respondWithError = createRespondingStub(errorResponse);
|
|
92
|
+
*
|
|
93
|
+
* // elsewhere
|
|
94
|
+
*
|
|
95
|
+
* myClientStub.someMethod.respondWithError();
|
|
96
|
+
* </pre>
|
|
97
|
+
*
|
|
98
|
+
* @param {?} object anything
|
|
99
|
+
* @return {Function}
|
|
100
|
+
*/
|
|
101
|
+
function createRespondingStub(object, body) {
|
|
102
|
+
return function() {
|
|
103
|
+
this.args.forEach(function(argSet) {
|
|
104
|
+
setTimeout(argSet[1].bind(null, null, object));
|
|
105
|
+
});
|
|
106
|
+
this.yields(null, object, body);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Registers a stubbed client with soap-stub. urlToWsdl is the path you will use
|
|
112
|
+
* in your app.
|
|
113
|
+
*
|
|
114
|
+
* @param {String} alias A simple name to refer to the clientStub as.
|
|
115
|
+
* @param {String} urlToWsdl May be file system URL or http URL.
|
|
116
|
+
* @param {Object} clientStub A client with stubbed methods.
|
|
117
|
+
*/
|
|
118
|
+
function registerClient(alias, urlToWsdl, clientStub) {
|
|
119
|
+
aliasedClientStubs[alias] = clientStub;
|
|
120
|
+
clientStubs[urlToWsdl] = clientStub;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Resets state associated with clientStubs.
|
|
125
|
+
*/
|
|
126
|
+
function reset() {
|
|
127
|
+
_.forEach(clientStubs, resetStubbedMethods);
|
|
128
|
+
this.errOnCreateClient = false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Returns a previously registered client stub.
|
|
133
|
+
*
|
|
134
|
+
* @param {String} aliasOrWsdlUrl
|
|
135
|
+
* @return {Object} clientStub
|
|
136
|
+
*/
|
|
137
|
+
function getStub(aliasOrWsdlUrl) {
|
|
138
|
+
return aliasedClientStubs[aliasOrWsdlUrl] || clientStubs[aliasOrWsdlUrl];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function resetStubbedMethods(client) {
|
|
142
|
+
Object.keys(client).forEach(function(method) {
|
|
143
|
+
method = client[method];
|
|
144
|
+
if (typeof method === 'function' && typeof method.reset === 'function') {
|
|
145
|
+
method.reset();
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
package/.npmignore
DELETED