Comparing version 0.19.0 to 0.19.1
@@ -1,2 +0,2 @@ | ||
#Contribution Guidelines | ||
# Contribution Guidelines | ||
@@ -7,3 +7,3 @@ Thank you for your support! node-soap wouldn't be where it is today without contributors like you who are willing to take the time to improve it for everyone else. | ||
##Filing issues | ||
## Filing issues | ||
* Please look through the issues that are currently open in the attempt to find one that matches yours. | ||
@@ -14,3 +14,3 @@ * If you find an issue that matches yours, please submit your documentation about it there as it will help everyone understand it more. | ||
##Submitting a Pull Request | ||
## Submitting a Pull Request | ||
* 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` | ||
@@ -28,3 +28,3 @@ * 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. | ||
##Making Changes | ||
## Making Changes | ||
* Any and all pull requests to change documentation or typos are welcome! | ||
@@ -57,6 +57,6 @@ * Any WSDL checked in should be as small and as generic as possible. This is to keep the size of the codebase from growing too large and to keep the reason for submitting the WSDL clear I.E. if the WSDL was submitted because attributes were not being parsed on response XML, then it would be appropriate to submit a WSDL that defines a response with attributes *and nothing else*. If you find an issue with the parser not being able to handle large WSDLs, then it would be appropriate to submit a large WSDL to recreate the issue with. | ||
##Issue Expiration | ||
## Issue Expiration | ||
Any pull request or issue filed is subject to an expiration date. We will close any open issue that has not received a response within a 2 week timeframe. The goal is not to sweep dirt under the rug, but to keep the focus on merging in pull requests. Please provide pull requests that meet the above criteria wherever possible. | ||
##Other ways you can contribute | ||
## Other ways you can contribute | ||
Please add response, request, and WSDL files to test/wsdl, and test/request-response-samples (see README therein). Doing so documents behavior and reduces the likelihood that bugs will be introduced by future pull requests. |
@@ -0,1 +1,11 @@ | ||
0.19.1 / 2017-05-30 | ||
=================== | ||
* [FIX] Reverting #914. It broke existing behavior and prevented array type arguments. (#937) | ||
* [FIX] Add test for accepting array as parameter based on wsdl (#933) | ||
* [DOC] readme.md clarifications, examples and typos (#930) | ||
* [MAINTENANCE] Fix build by satisfying jshint indentation (#931) | ||
* [MAINTENANCE] Drop `travis-ci` test support for `node.js` < `4.x` (LTS) (#932) | ||
* [DOC] Update CONTRIBUTING.md | ||
* [DOC] typo in server example (#925) | ||
0.19.0 / 2017-03-16 | ||
@@ -2,0 +12,0 @@ =================== |
"use strict"; | ||
module.exports = require('./lib/soap'); |
@@ -185,58 +185,2 @@ /* | ||
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) { | ||
@@ -262,9 +206,2 @@ var self = this, | ||
if(this._isSequenceRequired(name)) { | ||
var argsScheme = this._getArgsScheme(name); | ||
if(argsScheme) { | ||
args = this._setSequenceArgs(argsScheme, args); | ||
} | ||
} | ||
if (this.wsdl.options.forceSoap12Headers) { | ||
@@ -271,0 +208,0 @@ headers["Content-Type"] = "application/soap+xml; charset=utf-8"; |
@@ -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"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ |
{ | ||
"name": "soap", | ||
"version": "0.19.0", | ||
"version": "0.19.1", | ||
"description": "A minimal node SOAP client", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -0,0 +0,0 @@ Publishing |
140
Readme.md
@@ -152,3 +152,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] | ||
var server = http.createServer(function(request,response) { | ||
response.end("404: Not Found: " + request.url); | ||
response.end('404: Not Found: ' + request.url); | ||
}); | ||
@@ -166,3 +166,3 @@ | ||
//and all other routes & middleware will continue to work | ||
soap.listen(app, '/wsdl', service, xml); | ||
soap.listen(app, '/wsdl', myService, xml); | ||
}); | ||
@@ -225,6 +225,6 @@ | ||
Code: { | ||
Value: "soap:Sender", | ||
Subcode: { value: "rpc:BadArguments" } | ||
Value: 'soap:Sender', | ||
Subcode: { value: 'rpc:BadArguments' } | ||
}, | ||
Reason: { Text: "Processing Error" } | ||
Reason: { Text: 'Processing Error' } | ||
} | ||
@@ -240,6 +240,6 @@ }; | ||
Code: { | ||
Value: "soap:Sender", | ||
Subcode: { value: "rpc:BadArguments" } | ||
Value: 'soap:Sender', | ||
Subcode: { value: 'rpc:BadArguments' } | ||
}, | ||
Reason: { Text: "Processing Error" }, | ||
Reason: { Text: 'Processing Error' }, | ||
statusCode: 500 | ||
@@ -319,3 +319,3 @@ } | ||
##### Parameters | ||
- `soapHeader` Object({rootName: {name: "value"}}) or strict xml-string | ||
- `soapHeader` Object({rootName: {name: 'value'}}) or strict xml-string | ||
@@ -333,3 +333,3 @@ ##### Returns | ||
- `index` index of the header to replace with provided new value | ||
- `soapHeader` Object({rootName: {name: "value"}}) or strict xml-string | ||
- `soapHeader` Object({rootName: {name: 'value'}}) or strict xml-string | ||
@@ -397,2 +397,8 @@ #### *getSoapHeaders*() - return all defined headers | ||
- Also, you could pass your soap request through a debugging proxy such as [Fiddler](http://www.telerik.com/fiddler) or [Betwixt](https://github.com/kdzwinel/betwixt). | ||
``` javascript | ||
client.MyService.MyPort.MyFunction({name: 'value'}, function(err, result) { | ||
// client.lastElapsedTime - the elapsed time of the last request in milliseconds | ||
}, {proxy: 'http://localhost:8888'}) | ||
``` | ||
#### Extra Headers (optional) | ||
@@ -421,3 +427,3 @@ | ||
###Overriding the namespace prefix | ||
### 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.: | ||
@@ -514,12 +520,16 @@ | ||
``` 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 | ||
//hasTokenCreated: true or false, default is true | ||
//hasNonce: includes Nonce if set | ||
//mustUnderstand: adds `mustUnderstand=1` to header | ||
//actor: adds actor to security block | ||
var options = { | ||
hasNonce: true, | ||
actor: 'actor' | ||
}; | ||
var wsSecurity = new soap.WSSecurity('username', 'password', options) | ||
client.setSecurity(wsSecurity); | ||
``` | ||
the `options` object is optional and can contain the following properties: | ||
* `passwordType`: 'PasswordDigest' or 'PasswordText' (default: `'PasswordText'`) | ||
* `hasTimeStamp`: adds Timestamp element (default: `true`) | ||
* `hasTokenCreated`: adds Created element (default: `true`) | ||
* `hasNonce`: adds Nonce element (default: `false`) | ||
* `mustUnderstand`: adds mustUnderstand=1 attribute to security tag (default: `false`) | ||
* `actor`: if set, adds Actor attribute with given value to security tag (default: `''`) | ||
@@ -553,7 +563,7 @@ ### WSSecurityCert | ||
###Overriding the `value` key | ||
By default, `node-soap` uses `$value` as key for any parsed XML value which may interfere with your other code as it | ||
### Overriding the `value` key | ||
By default, `node-soap` uses `$value` as the key for any parsed XML value which may interfere with your other code as it | ||
could be some reserved word, or the `$` in general cannot be used for a key to start with. | ||
You can define your own `valueKey` by passing it in the `wsdl_options` to the createClient call like so: | ||
You can define your own `valueKey` by passing it in the `wsdl_options` to the createClient call: | ||
```javascript | ||
@@ -569,22 +579,41 @@ var wsdlOptions = { | ||
###Overriding the `xml` key | ||
As `valueKey`, `node-soap` uses `$xml` as key. The xml key is used to pass XML Object without adding namespace or parsing the string. | ||
### Overriding the `xml` key | ||
By default, `node-soap` uses `$xml` as the key to pass through an XML string as is; without parsing or namespacing it. It overrides all the other content that the node might have otherwise had. | ||
Example : | ||
For example : | ||
```javascript | ||
dom = { | ||
$xml: '<parentnode type="type"><childnode></childnode></parentnode>' | ||
{ | ||
dom: { | ||
nodeone: { | ||
$xml: '<parentnode type="type"><childnode></childnode></parentnode>', | ||
siblingnode: 'Cant see me.' | ||
}, | ||
nodetwo: { | ||
parentnode: { | ||
attributes: { | ||
type: 'type' | ||
}, | ||
childnode: '' | ||
} | ||
} | ||
} | ||
}; | ||
``` | ||
could become | ||
```xml | ||
<tns:dom> | ||
<tns:nodeone> | ||
<parentnode type="type"> | ||
<childnode></childnode> | ||
<childnode></childnode> | ||
</parentnode> | ||
</tns:nodeone> | ||
<tns:nodetwo> | ||
<tns:parentnode type="type"> | ||
<tns:childnode></tns:childnode> | ||
</tns:parent> | ||
</tns:nodetwo> | ||
</tns:dom> | ||
``` | ||
You can define your own `xmlKey` by passing it in the `wsdl_options` to the createClient call like so: | ||
You can define your own `xmlKey` by passing it in the `wsdl_options` object to the createClient call: | ||
```javascript | ||
@@ -601,10 +630,4 @@ var wsdlOptions = { | ||
###Overriding the `attributes` key | ||
You can achieve attributes like: | ||
``` xml | ||
<parentnode> | ||
<childnode name="childsname"> | ||
</childnode> | ||
</parentnode> | ||
``` | ||
By attaching an attributes object to a node. | ||
By default, `node-soap` uses `attributes` as the key to define a nodes attributes. | ||
``` javascript | ||
@@ -616,3 +639,4 @@ { | ||
name: 'childsname' | ||
} | ||
}, | ||
$value: 'Value' | ||
} | ||
@@ -622,3 +646,10 @@ } | ||
``` | ||
However, "attributes" may be a reserved key for some systems that actually want a node | ||
could become | ||
``` xml | ||
<parentnode> | ||
<childnode name="childsname">Value</childnode> | ||
</parentnode> | ||
``` | ||
However, `attributes` may be a reserved key for some systems that actually want a node called `attributes` | ||
```xml | ||
@@ -629,3 +660,3 @@ <attributes> | ||
In this case you can configure the attributes key in the `wsdlOptions` like so. | ||
You can define your own `attributesKey` by passing it in the `wsdl_options` object to the createClient call: | ||
```javascript | ||
@@ -637,3 +668,3 @@ var wsdlOptions = { | ||
soap.createClient(__dirname + '/wsdl/default_namespace.wsdl', wsdlOptions, function (err, client) { | ||
client.*method*({ | ||
client.method({ | ||
parentnode: { | ||
@@ -643,3 +674,4 @@ childnode: { | ||
name: 'childsname' | ||
} | ||
}, | ||
$value: 'Value' | ||
} | ||
@@ -653,13 +685,13 @@ } | ||
You can specify the namespace definitions by setting the overrideRootElement key in the `wsdlOptions` like so: | ||
You can specify the namespace definitions by setting the `overrideRootElement` key in the `wsdlOptions` like so: | ||
```javascript | ||
var wsdlOptions = { | ||
"overrideRootElement": { | ||
"namespace": "xmlns:tns", | ||
"xmlnsAttributes": [{ | ||
"name": "xmlns:ns2", | ||
"value": "http://tempuri.org/" | ||
overrideRootElement: { | ||
namespace: 'xmlns:tns', | ||
xmlnsAttributes: [{ | ||
name: 'xmlns:ns2', | ||
value: "http://tempuri.org/" | ||
}, { | ||
"name": "xmlns:ns3", | ||
"value": "http://sillypets.com/xsd" | ||
name: 'xmlns:ns3', | ||
value: "http://sillypets.com/xsd" | ||
}] | ||
@@ -670,3 +702,3 @@ } | ||
To see it in practice, consider the sample files in: [test/request-response-samples/addPets__force_namespaces](https://github.com/vpulim/node-soap/tree/master/test/request-response-samples/addPets__force_namespaces) | ||
To see it in practice, have a look at the sample files in: [test/request-response-samples/addPets__force_namespaces](https://github.com/vpulim/node-soap/tree/master/test/request-response-samples/addPets__force_namespaces) | ||
@@ -678,3 +710,3 @@ ### Custom Deserializer | ||
To do so, you can pass an customDeserializer object in options. The properties of this object are the types that your deserializer handles itself. | ||
To do so, you can pass a `customDeserializer` object in `options`. The properties of this object are the types that your deserializer handles itself. | ||
@@ -681,0 +713,0 @@ Example : |
@@ -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
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
0
853
180562
3533