Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

soap

Package Overview
Dependencies
Maintainers
4
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soap - npm Package Compare versions

Comparing version 0.18.0 to 0.19.0

0

CONTRIBUTING.md

@@ -0,0 +0,0 @@ #Contribution Guidelines

17

History.md

@@ -0,1 +1,18 @@

0.19.0 / 2017-03-16
===================
* [FIX] Fixed missing namespace declaration on `Array` if the namespace is already declared with another prefix. (#923)
* [DOC] Fix spelling error (#917)
* [FIX] Add `sequence` to field if it's defined within the `complextType` (#914)
* [MAINTENANCE] Drop deprecated `node-uuid` package and use the `uuid` (successor) instead (#913)
* [FIX] Only add references for the soap:Body and wsse:Security/Timestamp elements in WSSecurityCert (#911)
* [MAINTENANCE] Updated `ejs` package version in `package.json` (#908)
* [ENHANCEMENT] Added possiblity to pass your own "custom deserializer" within the `wsdlOptions` in `createClient()` method (#901)
* [ENHANCEMENT] Added possibility to use your own "exchange ID" (#907)
* [ENHANCEMENT] Added "exchange ID" (`eid`) in emitted client events (#903)
* [ENHANCEMENT] Added option to suppress error stack in server response (#904)
* [FIX] Set namespace prefix for first element if `elementFormDefault=unqualified` (#905)
* [FIX] Fixed test (use `assert` instead of `should()` chain) in `test/server-test.js` (#906)
* [DOC] Fix documentation in `test/request-response-samples/README.md` (#900)
0.18.0 / 2016-11-25

@@ -2,0 +19,0 @@ =================

"use strict";
module.exports = require('./lib/soap');

@@ -16,3 +16,4 @@ /*

_ = require('lodash'),
concatStream = require('concat-stream');
concatStream = require('concat-stream'),
uuid = require('uuid');

@@ -185,2 +186,58 @@ var Client = function(wsdl, endpoint, options) {

Client.prototype._isSequenceRequired = function(methodName) {
var tns = this.wsdl.definitions.$targetNamespace;
var methodRequestName = _.result(this.wsdl.definitions, 'messages.' + methodName + '.$name');
var args = _.result(this.wsdl.definitions, 'messages.' + methodRequestName + '.parts');
if(typeof args === 'undefined' && typeof _.pick(args, 'params') !== 'undefined') {
return false;
}
if(Object.keys(args).length === 1) {
return false;
}
var complexTypeName = _.result(this.wsdl.definitions, 'messages.' + methodRequestName + '.element.$name');
var modeOfComplexType = _.result(
this.wsdl.definitions,
'schemas[\'' + tns + '\'].elements.' + complexTypeName + '.children[0].children[0].name');
if(modeOfComplexType === 'sequence') {
return true;
}
return false;
};
Client.prototype._setSequenceArgs = function(argsScheme, args) {
var result = {};
if(typeof argsScheme !== 'object') {
return args;
}
for (var partIndex in argsScheme) {
if(typeof args[partIndex] === 'undefined') {
continue;
}
if(typeof argsScheme[partIndex] !== 'object') {
result[partIndex] = args[partIndex];
} else {
result[partIndex] = this._setSequenceArgs(argsScheme[partIndex], args[partIndex]);
}
}
return result;
};
Client.prototype._getArgsScheme = function(methodName) {
var methodRequestName = _.result(this.wsdl.definitions, 'messages.'+methodName+'.$name');
var args = _.result(this.wsdl.definitions, 'messages.' + methodRequestName + '.parts');
if(typeof args === 'undefined' && typeof _.pick(args, 'params') !== 'undefined') {
return [];
}
if(Object.keys(args).length === 1) {
return [];
}
return args;
};
Client.prototype._invoke = function(method, args, location, callback, options, extraHeaders) {

@@ -206,2 +263,9 @@ var self = this,

if(this._isSequenceRequired(name)) {
var argsScheme = this._getArgsScheme(name);
if(argsScheme) {
args = this._setSequenceArgs(argsScheme, args);
}
}
if (this.wsdl.options.forceSoap12Headers) {

@@ -270,3 +334,3 @@ headers["Content-Type"] = "application/soap+xml; charset=utf-8";

if(self.security && self.security.postProcess){
xml = self.security.postProcess(xml);
xml = self.security.postProcess(xml, envelopeKey);
}

@@ -278,5 +342,7 @@

self.emit('message', message);
self.emit('request', xml);
var eid = options.exchangeId || uuid.v4();
self.emit('message', message, eid);
self.emit('request', xml, eid);
var tryJSONparse = function(body) {

@@ -300,3 +366,3 @@ try {

self.lastElapsedTime = null;
self.emit('response', null, null);
self.emit('response', null, null, eid);

@@ -316,3 +382,3 @@ callback(err);

self.lastElapsedTime = Date.now() - startTime;
self.emit('response', body, response);
self.emit('response', body, response, eid);

@@ -329,3 +395,3 @@ return parseSync(body, response);

self.lastElapsedTime = Date.now() - startTime;
self.emit('response', '<stream>', response);
self.emit('response', '<stream>', response, eid);

@@ -335,3 +401,3 @@ if (error) {

error.body = '<stream>';
self.emit('soapError', error);
self.emit('soapError', error, eid);
return callback(error, response);

@@ -350,3 +416,3 @@ }

self.lastElapsedTime = response && response.elapsedTime;
self.emit('response', body, response);
self.emit('response', body, response, eid);

@@ -377,3 +443,3 @@ if (err) {

error.body = body;
self.emit('soapError', error);
self.emit('soapError', error, eid);
return callback(error, response, body);

@@ -380,0 +446,0 @@ }

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ 'use strict';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

16

lib/security/WSSecurityCert.js

@@ -9,3 +9,3 @@ "use strict";

var SignedXml = require('xml-crypto').SignedXml;
var uuid = require('node-uuid');
var uuid = require('uuid');
var wsseSecurityHeaderTemplate = ejs.compile(fs.readFileSync(path.join(__dirname, 'templates', 'wsse-security-header.ejs')).toString());

@@ -51,8 +51,2 @@ var wsseSecurityTokenTemplate = ejs.compile(fs.readFileSync(path.join(__dirname, 'templates', 'wsse-security-token.ejs')).toString());

var references = ["http://www.w3.org/2000/09/xmldsig#enveloped-signature",
"http://www.w3.org/2001/10/xml-exc-c14n#"];
this.signer.addReference("//*[local-name(.)='Body']", references);
this.signer.addReference("//*[local-name(.)='Timestamp']", references);
var _this = this;

@@ -65,3 +59,3 @@ this.signer.keyInfoProvider = {};

WSSecurityCert.prototype.postProcess = function (xml) {
WSSecurityCert.prototype.postProcess = function (xml, envelopeKey) {
this.created = generateCreated();

@@ -79,2 +73,8 @@ this.expires = generateExpires();

var references = ["http://www.w3.org/2000/09/xmldsig#enveloped-signature",
"http://www.w3.org/2001/10/xml-exc-c14n#"];
this.signer.addReference("//*[name(.)='" + envelopeKey + ":Body']", references);
this.signer.addReference("//*[name(.)='wsse:Security']/*[local-name(.)='Timestamp']", references);
this.signer.computeSignature(xmlWithSec);

@@ -81,0 +81,0 @@

@@ -40,2 +40,3 @@ /*

this.wsdl = wsdl;
this.suppressStack = options && options.suppressStack;

@@ -146,3 +147,3 @@ if (path[path.length - 1] !== '/')

} else {
error = err.stack || err;
error = err.stack ? (self.suppressStack === true ? err.message : err.stack) : err;
res.statusCode = 500;

@@ -149,0 +150,0 @@ res.write(error);

@@ -76,3 +76,3 @@ /*

var wsdl = new WSDL(xml || services, uri, options);
return new Server(server, path, services, wsdl);
return new Server(server, path, services, wsdl, options);
}

@@ -79,0 +79,0 @@

@@ -0,0 +0,0 @@

{
"name": "soap",
"version": "0.18.0",
"version": "0.19.0",
"description": "A minimal node SOAP client",

@@ -13,6 +13,5 @@ "engines": {

"debug": "~0.7.4",
"ejs": "~2.3.4",
"ejs": "~2.5.5",
"finalhandler": "^0.5.0",
"lodash": "^3.10.1",
"node-uuid": "~1.4.3",
"optional": "^0.1.3",

@@ -24,2 +23,3 @@ "request": ">=2.9.0",

"strip-bom": "~0.3.1",
"uuid": "^3.0.1",
"xml-crypto": "~0.8.0"

@@ -42,3 +42,3 @@ },

"cover": "istanbul cover _mocha -- --timeout 10000 test/*-test.js test/security/*.js",
"coveralls": "cat ./coverage/lcov.info | coveralls -v",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js -v",
"test": "mocha --timeout 10000 test/*-test.js test/security/*.js"

@@ -45,0 +45,0 @@ },

@@ -0,0 +0,0 @@ Publishing

@@ -439,11 +439,29 @@ # Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]

* request - Emitted before a request is sent. The event handler receives the
entire Soap request (Envelope) including headers.
entire Soap request (Envelope) including headers. The second parameter is the exchange id.
* message - Emitted before a request is sent. The event handler receives the
Soap body contents. Useful if you don't want to log /store Soap headers.
Soap body contents. Useful if you don't want to log /store Soap headers. The second parameter is the exchange id.
* soapError - Emitted when an erroneous response is received.
Useful if you want to globally log errors.
The second parameter is the exchange id.
* response - Emitted after a response is received. The event handler receives
the SOAP response body as well as the entire `IncomingMessage` response object.
The third parameter is the exchange id.
This is emitted for all responses (both success and errors).
An 'exchange' is a request/response couple.
Event handlers receive the exchange id in all events.
The exchange id is the same for the requests events and the responses events, this way you can use it to retrieve the matching request
when an response event is received.
By default exchange ids are generated by using node-uuid but you can use options in client calls to pass your own exchange id.
Example :
```javascript
client.MyService.MyPort.MyFunction(args , function(err, result) {
}, {exchangeId: myExchangeId})
```
## Security

@@ -512,3 +530,3 @@

_Note_: Optional dependency 'ursa' is required to be installed succefully when WSSecurityCert is used.
_Note_: Optional dependency 'ursa' is required to be installed successfully when WSSecurityCert is used.

@@ -638,3 +656,39 @@ ## Handling XML Attributes, Value and XML (wsdlOptions).

### Custom Deserializer
Sometimes it's useful to handle deserialization in your code instead of letting node-soap do it.
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.
To do so, you can pass an customDeserializer object in options. The properties of this object are the types that your deserializer handles itself.
Example :
```javascript
var wsdlOptions = {
customDeserializer = {
// this function will be used to any date found in soap responses
date: function (text, context) {
/* text is the value of the xml element.
context contains the name of the xml element and other infos :
{
name: 'lastUpdatedDate',
object: {},
schema: 'xsd:date',
id: undefined,
nil: false
}
*/
return text;
}
}
};
soap.createClient(__dirname + '/wsdl/default_namespace.wsdl', wsdlOptions, function (err, client) {
...
});
```
## Handling "ignored" namespaces

@@ -641,0 +695,0 @@ If an Element in a `schema` definition depends on an Element which is present in the same namespace, normally the `tns:`

@@ -0,0 +0,0 @@ var _ = require('lodash');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc