Comparing version 0.14.0 to 0.15.0
@@ -0,1 +1,16 @@ | ||
0.15.0 / 2016-05-09 | ||
================= | ||
* [FIX] Make `ursa` an optional dependency since it's currently nearly impossible to install `soap` on a windows machine otherwise (#832) | ||
* [FIX] Fixed issue of referencing element in another namespace (#831) | ||
* [FIX] Fixed incorrect WSDL in `CDATA` tests (#830) | ||
* [FIX] Added mocks for node.js streams `cork`/`uncork` in tests (for `node >= 4.x`) (#829) | ||
* [ENHANCEMENT] Added basic `CDATA` support (#787) | ||
* [DOC] Added missing documentation about `Client.setEndpoint(url)` (#827) | ||
* [ENHANCEMENT] Added `toc` node-module in order to generate TOC in README.md via `npm run toc` command (#826) | ||
* [FIX] Fix `elementFormDefault` handling (#822) | ||
* [FIX] Added missing `compress` node-module to `package.json` dependencies (#823) | ||
* [ENHANCEMENT] The client `response` event is now triggered with the "raw" `IncomingMessage` object as second parameter (#816) | ||
* [DOC] Added note about the `keep-alive` workaround to prevent truncation of longer chunked reponses in `node > 0.10.x` (#818) | ||
* [ENHANCEMENT] Make it possible to overwrite the request module, e.g. for using `multipart-body` for file up- and downloads (#817) | ||
0.14.0 / 2016-04-12 | ||
@@ -2,0 +17,0 @@ ================= |
@@ -281,3 +281,3 @@ /* | ||
self.lastElapsedTime = response && response.elapsedTime; | ||
self.emit('response', body); | ||
self.emit('response', body, response); | ||
@@ -284,0 +284,0 @@ if (err) { |
@@ -70,5 +70,5 @@ /* | ||
if (headers.Connection === 'keep-alive') { | ||
options.body = data; | ||
} | ||
options.body = data; | ||
@@ -120,5 +120,3 @@ exoptions = exoptions || {}; | ||
}); | ||
if (headers.Connection !== 'keep-alive') { | ||
req.end(data); | ||
} | ||
return req; | ||
@@ -125,0 +123,0 @@ }; |
"use strict"; | ||
var ursa = require('ursa'); | ||
var optional = require("optional"); | ||
var ursa = optional('ursa'); | ||
var fs = require('fs'); | ||
@@ -39,3 +40,5 @@ var path = require('path'); | ||
function WSSecurityCert(privatePEM, publicP12PEM, password, encoding) { | ||
if (!ursa) { | ||
throw new Error('Module ursa must be installed to use WSSecurityCert'); | ||
} | ||
this.privateKey = ursa.createPrivateKey(privatePEM, password, encoding); | ||
@@ -42,0 +45,0 @@ this.publicP12PEM = publicP12PEM.toString().replace('-----BEGIN CERTIFICATE-----', '').replace('-----END CERTIFICATE-----', '').replace(/(\r\n|\n|\r)/gm, ''); |
{ | ||
"name": "soap", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"description": "A minimal node SOAP client", | ||
@@ -10,4 +10,8 @@ "engines": { | ||
"dependencies": { | ||
"compress": "^0.99.0", | ||
"debug": "~0.7.4", | ||
"ejs": "~2.3.4", | ||
"lodash": "3.x.x", | ||
"node-uuid": "~1.4.3", | ||
"optional": "^0.1.3", | ||
"request": ">=2.9.0", | ||
@@ -17,7 +21,7 @@ "sax": ">=0.6", | ||
"strip-bom": "~0.3.1", | ||
"ursa": "0.8.5 || >=0.9.3", | ||
"node-uuid": "~1.4.3", | ||
"ejs": "~2.3.4", | ||
"xml-crypto": "~0.8.0" | ||
}, | ||
"optionalDependencies": { | ||
"ursa": "0.8.5 || >=0.9.3" | ||
}, | ||
"repository": { | ||
@@ -32,2 +36,3 @@ "type": "git", | ||
"scripts": { | ||
"toc": "./node_modules/.bin/doctoc Readme.md --github --maxlevel 3", | ||
"pretest": "jshint index.js lib test", | ||
@@ -46,2 +51,3 @@ "cover": "istanbul cover _mocha -- --timeout 10000 test/*-test.js test/security/*.js", | ||
"diff": "^2.2.1", | ||
"doctoc": "^1.0.0", | ||
"duplexer": "~0.1.1", | ||
@@ -48,0 +54,0 @@ "glob": "~3.2.8", |
156
Readme.md
@@ -7,2 +7,46 @@ # 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] | ||
<!-- Run `npm run toc` to update below section --> | ||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
- [Features:](#features) | ||
- [Install](#install) | ||
- [Where can I file an issue?](#where-can-i-file-an-issue) | ||
- [Module](#module) | ||
- [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) | ||
- [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) | ||
- [Options](#options) | ||
- [Server Logging](#server-logging) | ||
- [Server Events](#server-events) | ||
- [SOAP Fault](#soap-fault) | ||
- [Server security example using PasswordDigest](#server-security-example-using-passworddigest) | ||
- [Server connection authorization](#server-connection-authorization) | ||
- [SOAP Headers](#soap-headers) | ||
- [Received SOAP Headers](#received-soap-headers) | ||
- [Outgoing SOAP Headers](#outgoing-soap-headers) | ||
- [Client](#client) | ||
- [Client.describe() - description of services, ports and methods as a JavaScript object](#clientdescribe---description-of-services-ports-and-methods-as-a-javascript-object) | ||
- [Client.setSecurity(security) - use the specified security protocol](#clientsetsecuritysecurity---use-the-specified-security-protocol) | ||
- [Client.*method*(args, callback) - call *method* on the SOAP service.](#clientmethodargs-callback---call-method-on-the-soap-service) | ||
- [Client.*service*.*port*.*method*(args, callback[, options[, extraHeaders]]) - call a *method* using a specific *service* and *port*](#clientserviceportmethodargs-callback-options-extraheaders---call-a-method-using-a-specific-service-and-port) | ||
- [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) | ||
- [Client.setEndpoint(url) - overwrite the SOAP service endpoint address](#clientsetendpointurl---overwrite-the-soap-service-endpoint-address) | ||
- [Client Events](#client-events) | ||
- [Security](#security) | ||
- [BasicAuthSecurity](#basicauthsecurity) | ||
- [BearerSecurity](#bearersecurity) | ||
- [ClientSSLSecurity](#clientsslsecurity) | ||
- [WSSecurity](#wssecurity) | ||
- [WSSecurityCert](#wssecuritycert) | ||
- [Handling XML Attributes, Value and XML (wsdlOptions).](#handling-xml-attributes-value-and-xml-wsdloptions) | ||
- [Specifying the exact namespace definition of the root element](#specifying-the-exact-namespace-definition-of-the-root-element) | ||
- [Handling "ignored" namespaces](#handling-ignored-namespaces) | ||
- [Handling "ignoreBaseNameSpaces" attribute](#handling-ignorebasenamespaces-attribute) | ||
- [soap-stub](#soap-stub) | ||
- [Example](#example) | ||
- [Contributors](#contributors) | ||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
## Features: | ||
@@ -59,2 +103,4 @@ | ||
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. | ||
### soap.listen(*server*, *path*, *services*, *wsdl*) - create a new SOAP server that listens on *path* and provides *services*. | ||
@@ -295,52 +341,3 @@ *wsdl* is an xml string that defines the service. | ||
### Client.setSecurity(security) - use the specified security protocol | ||
`node-soap` has several default security protocols. You can easily add your own | ||
as well. The interface is quite simple. Each protocol defines 2 methods: | ||
* `addOptions` - a method that accepts an options arg that is eventually passed directly to `request` | ||
* `toXML` - a method that returns a string of XML. | ||
By default there are 3 protocols: | ||
####BasicAuthSecurity | ||
``` javascript | ||
client.setSecurity(new soap.BasicAuthSecurity('username', 'password')); | ||
``` | ||
####ClientSSLSecurity | ||
_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) | ||
``` javascript | ||
client.setSecurity(new soap.ClientSSLSecurity( | ||
'/path/to/key' | ||
, '/path/to/cert' | ||
, {/*default request options*/} | ||
)); | ||
``` | ||
####WSSecurity | ||
``` javascript | ||
client.setSecurity(new soap.WSSecurity('username', 'password')) | ||
``` | ||
####WSSecurity with X509 Certificate | ||
``` javascript | ||
var privateKey = fs.readFileSync(privateKeyPath); | ||
var publicKey = fs.readFileSync(publicKeyPath); | ||
var password = ''; // optional password | ||
var wsSecurity = new soap.WSSecurityCert(privateKey, publicKey, password, 'utf8'); | ||
client.setSecurity(wsSecurity); | ||
``` | ||
####BearerSecurity | ||
``` javascript | ||
client.setSecurity(new soap.BearerSecurity('token')); | ||
``` | ||
### Client.*method*(args, callback) - call *method* on the SOAP service. | ||
@@ -416,2 +413,4 @@ | ||
### Client.setEndpoint(url) - overwrite the SOAP service endpoint address | ||
### Client Events | ||
@@ -427,17 +426,66 @@ Client instances emit the following events: | ||
* response - Emitted after a response is received. The event handler receives | ||
the entire response body. This is emitted for all responses (both success and | ||
errors). | ||
the SOAP response body as well as the entire `IncomingMessage` response object. | ||
This is emitted for all responses (both success and errors). | ||
## Security | ||
## WSSecurity | ||
`node-soap` has several default security protocols. You can easily add your own | ||
as well. The interface is quite simple. Each protocol defines 2 methods: | ||
* `addOptions` - a method that accepts an options arg that is eventually passed directly to `request` | ||
* `toXML` - a method that returns a string of XML. | ||
WSSecurity implements WS-Security. UsernameToken and PasswordText/PasswordDigest is supported. An instance of WSSecurity is passed to Client.setSecurity. | ||
### BasicAuthSecurity | ||
``` javascript | ||
new WSSecurity(username, password, options) | ||
client.setSecurity(new soap.BasicAuthSecurity('username', 'password')); | ||
``` | ||
### BearerSecurity | ||
``` javascript | ||
client.setSecurity(new soap.BearerSecurity('token')); | ||
``` | ||
### ClientSSLSecurity | ||
_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) | ||
``` javascript | ||
client.setSecurity(new soap.ClientSSLSecurity( | ||
'/path/to/key' | ||
, '/path/to/cert' | ||
, {/*default request options*/} | ||
)); | ||
``` | ||
### WSSecurity | ||
`WSSecurity` implements WS-Security. UsernameToken and PasswordText/PasswordDigest is supported. | ||
``` javascript | ||
var wsSecurity = new WSSecurity(username, password, options) | ||
//the 'options' object is optional and contains properties: | ||
//passwordType: 'PasswordDigest' or 'PasswordText' default is PasswordText | ||
//hasTimeStamp: true or false default is true | ||
client.setSecurity(wsSecurity); | ||
``` | ||
### WSSecurityCert | ||
WS-Security X509 Certificate support. | ||
``` javascript | ||
var privateKey = fs.readFileSync(privateKeyPath); | ||
var publicKey = fs.readFileSync(publicKeyPath); | ||
var password = ''; // optional password | ||
var wsSecurity = new soap.WSSecurityCert(privateKey, publicKey, password, 'utf8'); | ||
client.setSecurity(wsSecurity); | ||
``` | ||
_Note_: Optional dependency 'ursa' is required to be installed succefully when WSSecurityCert is used. | ||
## Handling XML Attributes, Value and XML (wsdlOptions). | ||
@@ -444,0 +492,0 @@ Sometimes it is necessary to override the default behaviour of `node-soap` in order to deal with the special requirements |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164972
3331
740
12
13
+ Addedcompress@^0.99.0
+ Addedoptional@^0.1.3
+ Addedcompress@0.99.0(transitive)
+ Addedoptional@0.1.4(transitive)
- Removedursa@0.8.5 || >=0.9.3