Comparing version 0.9.2 to 0.9.3
@@ -0,1 +1,6 @@ | ||
0.9.3 / 2015-09-08 | ||
================= | ||
* [ENHANCEMENT] Allow namespace overriding for elements. (#709) | ||
* [MAINTENANCE] Disable travis emails. | ||
0.9.2 / 2015-09-08 | ||
@@ -2,0 +7,0 @@ ================= |
@@ -83,8 +83,8 @@ /* | ||
/** | ||
* What we want is to copy properties from one object to another one and avoid | ||
* properties overriding. This way we ensure the 'inheritance' of | ||
* What we want is to copy properties from one object to another one and avoid | ||
* properties overriding. This way we ensure the 'inheritance' of | ||
* <xsd:extension base=...> usage. | ||
* | ||
* NB: 'Element' (and subtypes) don't have any prototyped properties: there's | ||
* no need to process a 'hasOwnProperties' call, we should just iterate over the | ||
* NB: 'Element' (and subtypes) don't have any prototyped properties: there's | ||
* no need to process a 'hasOwnProperties' call, we should just iterate over the | ||
* keys. | ||
@@ -573,3 +573,3 @@ */ | ||
} | ||
if (typeof this.parts[part.$name] === 'object') { | ||
@@ -579,3 +579,3 @@ this.parts[part.$name].namespace = nsName.namespace; | ||
} | ||
this.children.splice(i--, 1); | ||
@@ -893,3 +893,3 @@ } | ||
} | ||
if (typeof elem === 'object') { | ||
@@ -1310,3 +1310,3 @@ elem.targetNSAlias = type.namespace; | ||
if (topSchema && topSchema[name + '[]']) { | ||
@@ -1331,3 +1331,3 @@ if (!topObject[name]) | ||
}; | ||
p.oncdata = function (text) { | ||
@@ -1337,3 +1337,3 @@ text = trim(text); | ||
return; | ||
if (/<\?xml[\s\S]+\?>/.test(text)) { | ||
@@ -1473,3 +1473,16 @@ var top = stack[stack.length - 1]; | ||
WSDL.prototype.objectToXML = function(obj, name, namespace, xmlns, first, xmlnsAttr, parameterTypeObject, ancestorXmlns) { | ||
/** | ||
* Convert an object to XML. This is a recursive method as it calls itself. | ||
* | ||
* @param {Object} obj the object to convert. | ||
* @param {String} name the name of the element (if the object being traversed is | ||
* an element). | ||
* @param {String} namespace the namespace prefix of the object I.E. xsd. | ||
* @param {String} xmlns the full namespace of the object I.E. http://w3.org/schema. | ||
* @param {Boolean} isFirst whether or not this is the first item being traversed. | ||
* @param {?} xmlnsAttr | ||
* @param {?} parameterTypeObject | ||
* @param {?} ancestorXmlns | ||
*/ | ||
WSDL.prototype.objectToXML = function(obj, name, namespace, xmlns, isFirst, xmlnsAttr, parameterTypeObject, ancestorXmlns) { | ||
var self = this; | ||
@@ -1490,3 +1503,3 @@ var schema = this.definitions.schemas[xmlns]; | ||
var xmlnsAttrib = ''; | ||
if (xmlns && first) { | ||
if (xmlns && isFirst) { | ||
@@ -1502,3 +1515,3 @@ if (prefixNamespace && this.options.ignoredNamespaces.indexOf(namespace) === -1) { | ||
var ancXmlns = ancestorXmlns ? ancestorXmlns : new Array(xmlns); | ||
// explicitly use xmlns attribute if available | ||
@@ -1510,3 +1523,3 @@ if (xmlnsAttr) { | ||
var ns = ''; | ||
if (prefixNamespace && ((qualified || first) || soapHeader) && this.options.ignoredNamespaces.indexOf(namespace) === -1) { | ||
if (prefixNamespace && ((qualified || isFirst) || soapHeader) && this.options.ignoredNamespaces.indexOf(namespace) === -1) { | ||
// prefix element | ||
@@ -1516,2 +1529,3 @@ ns = namespace.indexOf(":") === -1 ? namespace + ':' : namespace; | ||
// start building out XML string. | ||
if (Array.isArray(obj)) { | ||
@@ -1549,3 +1563,10 @@ for (var i = 0, item; item = obj[i]; i++) { | ||
var nonSubNameSpace = ''; | ||
if (first) { | ||
var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name); | ||
if (nameWithNsRegex) { | ||
nonSubNameSpace = nameWithNsRegex[1] + ':'; | ||
name = nameWithNsRegex[2]; | ||
} | ||
if (isFirst) { | ||
value = self.objectToXML(child, name, namespace, xmlns, false, null, parameterTypeObject, ancXmlns); | ||
@@ -1564,3 +1585,3 @@ } else { | ||
} | ||
var childParameterType = childParameterTypeObject.$type || childParameterTypeObject.$ref; | ||
@@ -1567,0 +1588,0 @@ |
{ | ||
"name": "soap", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "A minimal node SOAP client", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -262,2 +262,12 @@ # Soap [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] | ||
``` | ||
###Overriding the namespace prefix | ||
`node-soap` is still working out some kinks regarding namespaces. If you find that an element is given the wrong namespace prefix in the request body, you can add the prefix to it's name in the containing object. I.E.: | ||
```javascript | ||
client.MyService.MyPort.MyFunction({'ns1:name': 'value'}, function(err, result) { | ||
// request body sent with `<ns1:name`, regardless of what the namespace should have been. | ||
}, {timeout: 5000}) | ||
``` | ||
#### Options (optional) | ||
@@ -287,5 +297,5 @@ - Accepts any option that the request module accepts, see [here.](https://github.com/mikeal/request) | ||
* request - Emitted before a request is sent. The event handler receives the | ||
* request - Emitted before a request is sent. The event handler receives the | ||
entire Soap request (Envelope) including headers. | ||
* message - Emitted before a request is sent. The event handler receives the | ||
* 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. | ||
@@ -292,0 +302,0 @@ * soapError - Emitted when an erroneous response is received. |
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
121327
2568
464