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

soap

Package Overview
Dependencies
Maintainers
3
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.23.0 to 0.24.0

coverage/coverage.json

19

History.md

@@ -0,1 +1,20 @@

0.24.0 / 2018-04-05
===================
* [DOC] Error on custom deserializer example (#1000)
* [DOC] Fix broken link
* [DOC] adding bullets to separate each option
* [DOC] changed ClientSSLSecurity to ClientSSLSecurityPFX in the readme file
* [DOC] clarify section on client events in Readme.md (#989)
* [ENHANCEMENT] Added one-way response configuration options
* [ENHANCEMENT] Adding support for SOAP 1.2 Envelope Headers in the server side (#1003)
* [ENHANCEMENT] Enable multiArgs during promisification
* [ENHANCEMENT] add Client.wsdl for accessing client.wsdl during soap.createClient() (#990)
* [ENHANCEMENT] add option to remove element-by-element namespacing of json arrays (#994)
* [ENHANCEMENT] add rawRequest to callback arguments (#992)
* [FIX] Fixed checking for empty obj.Body before further actions (#986)
* [FIX] Lookup definitions in child element first (#958)
* [FIX] only detect xsi:nil if its value is `true` (#983)
* [MAINTENANCE] Updating the coverage to use the new version of Istanbul framework, the nyc.
* [MAINTENANCE] Upgrade Lodash to 4.17.5 (#1001)
0.23.0 / 2017-10-18

@@ -2,0 +21,0 @@ ===================

39

lib/client.js

@@ -29,4 +29,7 @@ /*

this.httpClient = options.httpClient || new HttpClient(options);
var suffixOption = options.overridePromiseSuffix ? { suffix: options.overridePromiseSuffix } : null;
BluebirdPromise.promisifyAll(this, suffixOption);
var promiseOptions = { multiArgs: true };
if (options.overridePromiseSuffix) {
promiseOptions.suffix = options.overridePromiseSuffix;
}
BluebirdPromise.promisifyAll(this, promiseOptions);
};

@@ -188,4 +191,4 @@ util.inherits(Client, events.EventEmitter);

}
self._invoke(method, args, location, function(error, result, raw, soapHeader) {
callback(error, result, raw, soapHeader);
self._invoke(method, args, location, function(error, result, rawResponse, soapHeader, rawRequest) {
callback(error, result, rawResponse, soapHeader, rawRequest);
}, options, extraHeaders);

@@ -284,3 +287,3 @@ };

}
self.lastMessage = message;

@@ -315,3 +318,3 @@ self.lastRequest = xml;

callback(err);
callback(err, undefined, undefined, undefined, xml);
};

@@ -347,3 +350,3 @@ req.on('error', onError);

self.emit('soapError', error, eid);
return callback(error, response);
return callback(error, response, undefined, undefined, xml);
}

@@ -364,3 +367,3 @@

if (err) {
callback(err);
callback(err, undefined, undefined, undefined, xml);
} else {

@@ -383,3 +386,3 @@ return parseSync(body, response);

if (json) {
return callback(null, response, json);
return callback(null, response, json, undefined, xml);
}

@@ -390,3 +393,3 @@ }

self.emit('soapError', error, eid);
return callback(error, response, body);
return callback(error, response, body, undefined, xml);
}

@@ -401,5 +404,10 @@ return finish(obj, body, response);

// one-way, no output expected
return callback(null, null, body, obj.Header);
return callback(null, null, body, obj.Header, xml);
}
// If it's not HTML and Soap Body is empty
if (!obj.html && !obj.Body) {
return callback(null, obj, body, obj.Header);
}
if( typeof obj.Body !== 'object' ) {

@@ -409,10 +417,5 @@ var error = new Error('Cannot parse response');

error.body = body;
return callback(error, obj, body);
return callback(error, obj, body, undefined, xml);
}
// if Soap Body is empty
if (!obj.Body) {
return callback(null, obj, body, obj.Header);
}
result = obj.Body[output.$name];

@@ -433,3 +436,3 @@ // RPC/literal response body may contain elements with added suffixes I.E.

callback(null, result, body, obj.Header);
callback(null, result, body, obj.Header, xml);
}

@@ -436,0 +439,0 @@

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

this.returnFault = options && options.returnFault;
this.onewayOptions = options && options.oneWay || {};

@@ -134,2 +135,4 @@ if (path[path.length - 1] !== '/')

this.wsdl.options.attributesKey = options.attributesKey || 'attributes';
this.onewayOptions.statusCode = this.onewayOptions.responseCode || 200;
this.onewayOptions.emptyBody = !!this.onewayOptions.emptyBody;
};

@@ -392,3 +395,7 @@

handled = true;
callback('');
body = '';
if (this.onewayOptions.emptyBody) {
body = self._envelope('', headers, includeTimestamp);
}
callback(body, this.onewayOptions.responseCode);
}

@@ -407,4 +414,9 @@

alias = findPrefix(defs.xmlns, ns);
var envelopeDefinition = this.wsdl.options.forceSoap12Headers
? "http://www.w3.org/2003/05/soap-envelope"
: "http://schemas.xmlsoap.org/soap/envelope/"
var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
"<soap:Envelope xmlns:soap=\"" + envelopeDefinition + "\" " +
encoding +

@@ -434,6 +446,5 @@ this.wsdl.xmlnsInEnvelope + '>';

xml += "<soap:Body>" +
body +
"</soap:Body>" +
"</soap:Envelope>";
xml += body ? "<soap:Body>" + body + "</soap:Body>" : "<soap:Body/>";
xml += "</soap:Envelope>";
return xml;

@@ -440,0 +451,0 @@ };

@@ -88,2 +88,7 @@ /// <reference types="node" />

export interface IOneWayOptions {
responseCode?: number;
emptyBody?: boolean;
}
export interface IServerOptions extends IWsdlBaseOptions {

@@ -95,2 +100,3 @@ path: string;

suppressStack?: boolean;
oneWay?: IOneWayOptions;
[key: string]: any;

@@ -138,3 +144,4 @@ }

setSecurity(security: ISecurity): void;
[method: string]: ISoapMethod | Function;
wsdl: WSDL;
[method: string]: ISoapMethod | WSDL | Function;
}

@@ -141,0 +148,0 @@

{
"name": "soap",
"version": "0.23.0",
"version": "0.24.0",
"description": "A minimal node SOAP client",

@@ -15,3 +15,3 @@ "engines": {

"finalhandler": "^1.0.3",
"lodash": "^3.10.1",
"lodash": "^4.17.5",
"request": ">=2.9.0",

@@ -37,3 +37,3 @@ "sax": ">=0.6",

"pretest": "jshint index.js lib test",
"cover": "istanbul cover _mocha -- --timeout 10000 test/*-test.js test/security/*.js",
"cover": "nyc --reporter=lcov --reporter=html --reporter=text mocha test/*-test.js test/security/*.js",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js -v",

@@ -55,5 +55,5 @@ "test": "mocha --timeout 10000 test/*-test.js test/security/*.js"

"glob": "~3.2.8",
"istanbul": "^0.4.1",
"jshint": "2.3.0",
"mocha": "~1.17.0",
"nyc": "^11.4.1",
"readable-stream": "~2.0.2",

@@ -60,0 +60,0 @@ "semver": "~5.0.3",

@@ -23,2 +23,3 @@ # 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]

- [Server Events](#server-events)
- [Server Response on one-way calls](#server-response-on-one-way-calls)
- [SOAP Fault](#soap-fault)

@@ -40,2 +41,6 @@ - [Server security example using PasswordDigest](#server-security-example-using-passworddigest)

- [Client Events](#client-events)
- [request](#request)
- [message](#message)
- [soapError](#soaperror)
- [response](#response)
- [Security](#security)

@@ -45,2 +50,3 @@ - [BasicAuthSecurity](#basicauthsecurity)

- [ClientSSLSecurity](#clientsslsecurity)
- [ClientSSLSecurityPFX](#clientsslsecuritypfx)
- [WSSecurity](#wssecurity)

@@ -140,2 +146,3 @@ - [WSSecurityCert](#wssecuritycert)

- 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']()`).
- 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`.

@@ -211,9 +218,9 @@ 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.

Server options include the below:
`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.)
`key`: A string or Buffer containing the private key of the server in PEM format. (Could be an array of keys). (Required)
`passphrase`: A string of passphrase for the private key or pfx.
`cert`: A string or Buffer containing the certificate key of the server in PEM format. (Could be an array of certs). (Required)
`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.
`crl` : Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
`ciphers`: A string describing the ciphers to use or exclude, separated by :. The default cipher suite is:
- `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.)
- `key`: A string or Buffer containing the private key of the server in PEM format. (Could be an array of keys). (Required)
- `passphrase`: A string of passphrase for the private key or pfx.
- `cert`: A string or Buffer containing the certificate key of the server in PEM format. (Could be an array of certs). (Required)
- `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.
- `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
- `ciphers`: A string describing the ciphers to use or exclude, separated by :. The default cipher suite is:

@@ -260,2 +267,12 @@ ``` javascript

### Server Response on one-way calls
The so called one-way (or asynchronous) calls occur when an operation is called with no output defined in WSDL.
The server sends a response (defaults to status code 200 with no body) to the client disregarding the result of the operation.
You can configure the response to match the appropriate client expectation to the SOAP standard implementation.
Pass in `oneWay` object in server options. Use the following keys:
`emptyBody`: if true, returns an empty body, otherwise no content at all (default is false)
`responseCode`: default statusCode is 200, override it with this options (for example 202 for SAP standard compliant response)
### SOAP Fault

@@ -439,6 +456,7 @@

``` javascript
client.MyFunction({name: 'value'}, function(err, result, raw, soapHeader) {
client.MyFunction({name: 'value'}, function(err, result, rawResponse, soapHeader, rawRequest) {
// result is a javascript object
// raw is the raw response
// rawResponse is the raw xml response string
// soapHeader is the response soap header as a javascript object
// rawRequest is the raw xml request string
})

@@ -458,3 +476,6 @@ ```

client.MyFunctionAsync({name: 'value'}).then((result) => {
// result is a javascript array containing result, raw and soapheader
// result is a javascript object
// raw is the raw response
// soapHeader is the response soap header as a javascript object
})

@@ -581,14 +602,26 @@ ```

* request - Emitted before a request is sent. The event handler receives the
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. 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).
### _request_
Emitted before a request is sent. The event handler has the signature `(xml, eid)`.
- _xml_ - The entire Soap request (Envelope) including headers.
- _eid_ - The exchange id.
### _message_
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)`.
- _message_ - Soap body contents.
- _eid_ - The exchange id.
### _soapError_
Emitted when an erroneous response is received. Useful if you want to globally log errors. The event handler has the signature `(error, eid)`.
- _error_ - An error object which also contains the resoponse.
- _eid_ - The exchange id.
### _response_
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)`
- _body_ - The SOAP response body.
- _response_ - The entire `IncomingMessage` response object.
- _eid_ - The exchange id.
An 'exchange' is a request/response couple.

@@ -656,2 +689,27 @@ Event handlers receive the exchange id in all events.

```
### ClientSSLSecurityPFX
_Note_: If you run into issues using this protocol, consider passing these options
as default request options to the constructor:
* `rejectUnauthorized: false`
* `strictSSL: false`
* `secureOptions: constants.SSL_OP_NO_TLSv1_2` (this is likely needed for node >= 10.0)
If you want to reuse tls sessions, you can use the option `forever: true`.
``` javascript
client.setSecurity(new soap.ClientSSLSecurityPFX(
'/path/to/pfx/cert', // or a buffer: [fs.readFileSync('/path/to/pfx/cert', 'utf8'),
'path/to/optional/passphrase',
{ /*default request options like */
// strictSSL: true,
// rejectUnauthorized: false,
// hostname: 'some-hostname'
// secureOptions: constants.SSL_OP_NO_TLSv1_2,
// forever: true,
},
));
```
### WSSecurity

@@ -845,3 +903,3 @@

var wsdlOptions = {
customDeserializer = {
customDeserializer: {

@@ -848,0 +906,0 @@ // this function will be used to any date found in soap responses

Sorry, the diff of this file is not supported yet

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

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