Comparing version 0.12.0 to 0.13.0
@@ -18,13 +18,13 @@ #Contribution Guidelines | ||
* Pull Requests must be able to merge automatically from github. | ||
* Please **do not close a pull request due to a request to rebase**. Git is a powerful VCS and deserves your time in learning how to rebase properly. Pull Requests are updated automatically on github when you force push to your branch after rebasing. | ||
* Please **do not close a pull request due to a request to rebase**. Git is a powerful VCS and deserves your time in learning how to rebase properly. Pull Requests are updated automatically on github when you force push to your branch after rebasing. | ||
Very useful articles/help on this topic: | ||
- [GitHub Help - About Git rebase](https://help.github.com/articles/about-git-rebase/) | ||
Very useful articles/help on this topic: | ||
- [GitHub Help - About Git rebase](https://help.github.com/articles/about-git-rebase/) | ||
- [GitHub Help - Using Git rebase](https://help.github.com/articles/using-git-rebase/) | ||
* Please use descriptive commit messages. Commit messages are used during the creation of history and release notes. You'll make the job of maintaners much easier by doing this. | ||
* Please use descriptive commit messages. Commit messages are used during the creation of history and release notes. You'll make the job of maintainers much easier by doing this. | ||
##Making Changes | ||
* Any and all pull requests to change documentation or typos are welcome! | ||
* 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 approprate to sumbit a large WSDL to recreate the issue with. | ||
* 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. | ||
* If your issue is WSDL related: | ||
@@ -40,3 +40,3 @@ ```` | ||
```` | ||
1. Capture the request / response XMl via client.lastRequest and client.lastResponse as well as the WSDL. | ||
1. Capture the request / response XML via client.lastRequest and client.lastResponse as well as the WSDL. | ||
2. Make the WSDL, request, and response XML as generic as possible. | ||
@@ -57,5 +57,5 @@ 3. Only include the messages or operations that are having issues. | ||
##Issue Expiration | ||
Any pull request or issue filed is subject to an expiration date. We will close any open issue that has not recieved 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. | ||
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 | ||
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,10 @@ | ||
0.13.0 / 2016-02-16 | ||
================= | ||
* [FIX] Maintain `ignoredNamespaces` option when processing WSDL includes (#796) | ||
* [ENHANCEMENT] SOAP Headers for server response & `changeSoapHeader()` method for client & server (#792) | ||
* [ENHANCEMENT] Added XML declaration (version & encoding) to client requests (#797) | ||
* [DOC] Added example for `server.options` to README, fixed typos in CONTRIBUTING (#798) | ||
* [FIX] Keep `nsContext` stack consistent even on recursive calls (#799) | ||
* [FIX] Prevent NPE when processing an empty children array (#789) | ||
0.12.0 / 2016-02-02 | ||
@@ -2,0 +11,0 @@ ================= |
"use strict"; | ||
module.exports = require('./lib/soap'); |
@@ -35,5 +35,15 @@ /* | ||
} | ||
this.soapHeaders.push(soapHeader); | ||
return this.soapHeaders.push(soapHeader) - 1; | ||
}; | ||
Client.prototype.changeSoapHeader = function(index, soapHeader, name, namespace, xmlns) { | ||
if (!this.soapHeaders) { | ||
this.soapHeaders = []; | ||
} | ||
if (typeof soapHeader === 'object') { | ||
soapHeader = this.wsdl.objectToXML(soapHeader, name, namespace, xmlns, true); | ||
} | ||
this.soapHeaders[index] = soapHeader; | ||
}; | ||
Client.prototype.getSoapHeaders = function() { | ||
@@ -210,3 +220,4 @@ return this.soapHeaders; | ||
} | ||
xml = "<soap:Envelope " + | ||
xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + | ||
"<soap:Envelope " + | ||
xmlnsSoap + " " + | ||
@@ -213,0 +224,0 @@ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + |
@@ -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"; |
@@ -71,2 +71,30 @@ /* | ||
Server.prototype.addSoapHeader = function(soapHeader, name, namespace, xmlns) { | ||
if (!this.soapHeaders) { | ||
this.soapHeaders = []; | ||
} | ||
if (typeof soapHeader === 'object') { | ||
soapHeader = this.wsdl.objectToXML(soapHeader, name, namespace, xmlns, true); | ||
} | ||
return this.soapHeaders.push(soapHeader) - 1; | ||
}; | ||
Server.prototype.changeSoapHeader = function(index, soapHeader, name, namespace, xmlns) { | ||
if (!this.soapHeaders) { | ||
this.soapHeaders = []; | ||
} | ||
if (typeof soapHeader === 'object') { | ||
soapHeader = this.wsdl.objectToXML(soapHeader, name, namespace, xmlns, true); | ||
} | ||
this.soapHeaders[index] = soapHeader; | ||
}; | ||
Server.prototype.getSoapHeaders = function() { | ||
return this.soapHeaders; | ||
}; | ||
Server.prototype.clearSoapHeaders = function() { | ||
this.soapHeaders = null; | ||
}; | ||
Server.prototype._initializeOptions = function(options) { | ||
@@ -310,2 +338,4 @@ this.wsdl.options.attributesKey = options.attributesKey || 'attributes'; | ||
this.wsdl.xmlnsInEnvelope + '>'; | ||
var headers = ''; | ||
if (includeTimestamp) { | ||
@@ -316,4 +346,3 @@ var now = new Date(); | ||
xml += "<soap:Header>" + | ||
" <o:Security soap:mustUnderstand=\"1\" " + | ||
headers += "<o:Security soap:mustUnderstand=\"1\" " + | ||
"xmlns:o=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" " + | ||
@@ -325,5 +354,13 @@ "xmlns:u=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" + | ||
" </u:Timestamp>" + | ||
" </o:Security>" + | ||
"</soap:Header>"; | ||
" </o:Security>\n"; | ||
} | ||
if(this.soapHeaders) { | ||
headers += this.soapHeaders.join("\n"); | ||
} | ||
if(headers !== '') { | ||
xml += "<soap:Header>" + headers + "</soap:Header>"; | ||
} | ||
xml += "<soap:Body>" + | ||
@@ -330,0 +367,0 @@ body + |
@@ -0,0 +0,0 @@ /* |
@@ -0,0 +0,0 @@ |
{ | ||
"name": "soap", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "A minimal node SOAP client", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -0,0 +0,0 @@ Publishing |
104
Readme.md
@@ -103,2 +103,22 @@ # 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] | ||
### Options | ||
You can pass in server and [WSDL Options](#handling-xml-attributes-value-and-xml-wsdloptions) | ||
using an options hash. | ||
``` javascript | ||
var xml = require('fs').readFileSync('myservice.wsdl', 'utf8'); | ||
soap.listen(server, { | ||
// Server options. | ||
path: '/wsdl', | ||
services: myService, | ||
xml: xml, | ||
// WSDL options. | ||
attributesKey: 'theAttrs', | ||
valueKey: 'theVal', | ||
xmlKey: 'theXml' | ||
}); | ||
``` | ||
### Server Logging | ||
@@ -160,4 +180,34 @@ | ||
### SOAP Headers | ||
### Server security example using PasswordDigest | ||
If `server.authenticate` is not defined then no authentication will take place. | ||
``` javascript | ||
server = soap.listen(...) | ||
server.authenticate = function(security) { | ||
var created, nonce, password, user, token; | ||
token = security.UsernameToken, user = token.Username, | ||
password = token.Password, nonce = token.Nonce, created = token.Created; | ||
return user === 'user' && password === soap.passwordDigest(nonce, created, 'password'); | ||
}; | ||
``` | ||
### Server connection authorization | ||
The `server.authorizeConnection` method is called prior to the soap service method. | ||
If the method is defined and returns `false` then the incoming connection is | ||
terminated. | ||
``` javascript | ||
server = soap.listen(...) | ||
server.authorizeConnection = function(req) { | ||
return true; // or false | ||
}; | ||
``` | ||
## SOAP Headers | ||
### Received SOAP Headers | ||
A service method can look at the SOAP headers by providing a 3rd arguments. | ||
@@ -192,30 +242,30 @@ | ||
### Server security example using PasswordDigest | ||
### Outgoing SOAP Headers | ||
If `server.authenticate` is not defined then no authentication will take place. | ||
Both client & server can define SOAP headers that will be added to what they send. | ||
They provide the following methods to manage the headers. | ||
``` javascript | ||
server = soap.listen(...) | ||
server.authenticate = function(security) { | ||
var created, nonce, password, user, token; | ||
token = security.UsernameToken, user = token.Username, | ||
password = token.Password, nonce = token.Nonce, created = token.Created; | ||
return user === 'user' && password === soap.passwordDigest(nonce, created, 'password'); | ||
}; | ||
``` | ||
### Server connection authorization | ||
#### *addSoapHeader*(soapHeader[, name, namespace, xmlns]) - add soapHeader to soap:Header node | ||
##### Parameters | ||
- `soapHeader` Object({rootName: {name: "value"}}) or strict xml-string | ||
The `server.authorizeConnection` method is called prior to the soap service method. | ||
If the method is defined and returns `false` then the incoming connection is | ||
terminated. | ||
##### Returns | ||
The index where the header is inserted. | ||
``` javascript | ||
server = soap.listen(...) | ||
server.authorizeConnection = function(req) { | ||
return true; // or false | ||
}; | ||
``` | ||
##### Optional parameters when first arg is object : | ||
- `name` Unknown parameter (it could just a empty string) | ||
- `namespace` prefix of xml namespace | ||
- `xmlns` URI | ||
#### *changeSoapHeader*(index, soapHeader[, name, namespace, xmlns]) - change an already existing soapHeader | ||
##### Parameters | ||
- `index` index of the header to replace with provided new value | ||
- `soapHeader` Object({rootName: {name: "value"}}) or strict xml-string | ||
#### *getSoapHeaders*() - return all defined headers | ||
#### *clearSoapHeaders*() - remove all defined headers | ||
## Client | ||
@@ -325,12 +375,2 @@ | ||
### Client.*addSoapHeader*(soapHeader[, name, namespace, xmlns]) - add soapHeader to soap:Header node | ||
#### Options | ||
- `soapHeader` Object({rootName: {name: "value"}}) or strict xml-string | ||
##### Optional parameters when first arg is object : | ||
- `name` Unknown parameter (it could just a empty string) | ||
- `namespace` prefix of xml namespace | ||
- `xmlns` URI | ||
### Client.*lastRequest* - the property that contains last full soap request for client logging | ||
@@ -337,0 +377,0 @@ |
@@ -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 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
632
155727
25
3219