Comparing version 0.5.1 to 0.6.0
@@ -15,2 +15,3 @@ #Contribution Guidelines | ||
* Pull Requests must be rebased to the latest version of master and squashed to a single commit i.e. `git checkout master;git pull upstream master;git checkout feature-branch;git rebase -i master` | ||
* Pull Requests must have accompanying tests (either Unit or Request/Response Sample tests are welcome). Your chances of getting the PR merged are very low if you don't provide any tests. | ||
* Pull Requests must have passing travis builds. | ||
@@ -17,0 +18,0 @@ * Pull Requests must be able to merge automatically from github. |
@@ -0,1 +1,13 @@ | ||
0.6.0 / 2014-10-29 | ||
================= | ||
* Enhancement: Adding bearer security type Exporting security type for usage. | ||
* Enhancement: The qualified elementFormQualified must be respected only when the current element is not a global element. The namespace attribute is only needed if it's not included in the xmlns. | ||
* Fix: Remove automatic port appending to "Host" header. | ||
* Fix: Avoid creating soap:Header container when there are no children. | ||
* Fix: Allowing a 'null' argument for WSDL methods that take no arguments. | ||
* Fix: Wrong initialization of xmlns array when handling rpc stype wsdl. | ||
* Fix: Fault handling. err should be used less frequently now. | ||
* Fix: Added checking if there is input and output for operations under bindings section. | ||
* Fix: XSD conflict with same namespace. | ||
0.5.1 / 2014-07-11 | ||
@@ -2,0 +14,0 @@ ================= |
@@ -143,2 +143,4 @@ /* | ||
message = args; | ||
} else if (args === null) { | ||
message = "<" + name + " />"; | ||
} else { | ||
@@ -154,6 +156,12 @@ assert.ok(!style || style === 'document', 'invalid message definition for rpc style binding'); | ||
this.wsdl.xmlnsInEnvelope + '>' + | ||
"<soap:Header>" + | ||
(self.soapHeaders ? self.soapHeaders.join("\n") : "") + | ||
(self.security ? self.security.toXML() : "") + | ||
"</soap:Header>" + | ||
((self.soapHeaders || self.security) ? | ||
( | ||
"<soap:Header>" + | ||
(self.soapHeaders ? self.soapHeaders.join("\n") : "") + | ||
(self.security ? self.security.toXML() : "") + | ||
"</soap:Header>" | ||
) | ||
: | ||
'' | ||
) + | ||
"<soap:Body>" + | ||
@@ -175,4 +183,2 @@ message + | ||
callback(err); | ||
} else if (response.statusCode !== 200) { | ||
callback(new Error('Invalid response: ' + response.statusCode + '\nBody: ' + body)); | ||
} else { | ||
@@ -179,0 +185,0 @@ try { |
@@ -17,3 +17,3 @@ /* | ||
var host = curl.hostname; | ||
var port = parseInt(curl.port || (secure ? 443 : false)); | ||
var port = parseInt(curl.port, 10); | ||
var path = [curl.pathname || '/', curl.search || '', curl.hash || ''].join(''); | ||
@@ -27,3 +27,3 @@ var method = data ? "POST" : "GET"; | ||
"Connection": "close", | ||
"Host" : host + (port ? ":"+port : "") | ||
"Host": host + (isNaN(port) ? "" : ":" + port) | ||
}; | ||
@@ -30,0 +30,0 @@ var attr; |
@@ -7,2 +7,3 @@ "use strict"; | ||
, WSSecurity: require('./WSSecurity') | ||
, BearerSecurity: require('./BearerSecurity') | ||
}; |
@@ -72,2 +72,3 @@ /* | ||
exports.ClientSSLSecurity = security.ClientSSLSecurity; | ||
exports.BearerSecurity = security.BearerSecurity; | ||
exports.createClient = createClient; | ||
@@ -74,0 +75,0 @@ exports.passwordDigest = passwordDigest; |
@@ -18,2 +18,3 @@ /* | ||
var stripBom = require('strip-bom'); | ||
var _ = require('lodash'); | ||
@@ -85,2 +86,8 @@ var Primitives = { | ||
function deepMerge(destination, source) { | ||
return _.merge(destination || {}, source, function(a, b) { | ||
return _.isArray(a) ? a.concat(b) : undefined; | ||
}); | ||
} | ||
function findKey(obj, val) { | ||
@@ -826,2 +833,6 @@ for (var n in obj) | ||
if(ns && definitions.schemas[ns]) { | ||
xmlns = definitions.schemas[ns].xmlns; | ||
} | ||
if (typeElement && !(typeName in Primitives)) { | ||
@@ -1003,7 +1014,9 @@ | ||
for (var methodName in methods) { | ||
var inputName = methods[methodName].input.$name; | ||
var outputName=""; | ||
if(methods[methodName].output ) | ||
outputName = methods[methodName].output.$name; | ||
topEls[inputName] = {"methodName": methodName, "outputName": outputName}; | ||
if (methods[methodName].input && methods[methodName].output) { | ||
var inputName = methods[methodName].input.$name; | ||
var outputName=""; | ||
if(methods[methodName].output ) | ||
outputName = methods[methodName].output.$name; | ||
topEls[inputName] = {"methodName": methodName, "outputName": outputName}; | ||
} | ||
} | ||
@@ -1068,3 +1081,3 @@ } | ||
self.definitions.schemas[include.namespace || wsdl.definitions.$targetNamespace] = wsdl.definitions; | ||
self.definitions.schemas[include.namespace || wsdl.definitions.$targetNamespace] = deepMerge(self.definitions.schemas[include.namespace || wsdl.definitions.$targetNamespace], wsdl.definitions); | ||
self._processNextInclude(includes, function(err) { | ||
@@ -1367,16 +1380,21 @@ callback(err); | ||
var schema = this.definitions.schemas[xmlns]; | ||
var soapHeader = !schema; | ||
var qualified = schema && schema.$elementFormDefault === 'qualified'; | ||
var parts = []; | ||
var prefixNamespace = (namespace || qualified) && namespace !== 'xmlns'; | ||
var xmlnsAttrib = ''; | ||
if (xmlns && first) { | ||
if (namespace && namespace !== 'xmlns') { | ||
if (prefixNamespace) { | ||
// resolve the prefix namespace | ||
xmlnsAttrib += ' xmlns:' + namespace + '="' + xmlns + '"'; | ||
} | ||
xmlnsAttrib += ' xmlns="' + xmlns + '"'; | ||
// only add default namespace if the schema elementFormDefault is qualified | ||
if (qualified || soapHeader) xmlnsAttrib += ' xmlns="' + xmlns + '"'; | ||
} | ||
var ancXmlns = first ? new Array(xmlns) : ancestorXmlns; | ||
var ancXmlns = ancestorXmlns ? ancestorXmlns : new Array(xmlns); | ||
// explicitly use xmlns attribute if available | ||
@@ -1388,3 +1406,4 @@ if (xmlnsAttr) { | ||
var ns = ''; | ||
if (namespace && namespace !== 'xmlns' && qualified) { | ||
if (prefixNamespace && ((qualified || first) || soapHeader)) { | ||
// prefix element | ||
ns = namespace.indexOf(":") === -1 ? namespace + ':' : namespace; | ||
@@ -1391,0 +1410,0 @@ } |
{ | ||
"name": "soap", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "A minimal node SOAP client", | ||
@@ -40,4 +40,5 @@ "engines": { | ||
"glob": "~3.2.8", | ||
"should": "~3.3.0" | ||
"should": "~3.3.0", | ||
"timekeeper": "~0.0.4" | ||
} | ||
} |
@@ -167,2 +167,8 @@ # Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] | ||
####BearerSecurity | ||
``` javascript | ||
client.setSecurity(new soap.BearerSecurity('token')); | ||
``` | ||
### Client.*method*(args, callback) - call *method* on the SOAP service. | ||
@@ -290,9 +296,9 @@ | ||
which was obviously wrong. | ||
`node-soap` now handles namespace prefixes which shouldn't be resolved (because it's not necessary) as so called `ignoredNamespaces` | ||
which default to an Array of 3 Strings (`['tns', 'targetNamespace', 'typedNamespace']`). | ||
If this is not sufficient for your purpose you can easily add more namespace prefixes to this Array, or override it in its entirety | ||
by passing an `ignoredNamespaces` object within the `options` you pass in `soap.createClient()` method. | ||
A simple `ignoredNamespaces` object, which only adds certain namespaces could look like this: | ||
@@ -307,3 +313,3 @@ ``` | ||
This would extend the `ignoredNamespaces` of the `WSDL` processor to `['tns', 'targetNamespace', 'typedNamespace', 'namespaceToIgnore', 'someOtherNamespace']`. | ||
If you want to override the default ignored namespaces you would simply pass the following `ignoredNamespaces` object within the `options`: | ||
@@ -310,0 +316,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
95589
22
2134
335
5