Comparing version 0.2.6 to 0.2.7
@@ -19,2 +19,12 @@ /* | ||
Client.prototype.addSoapHeader = function(soapHeader, name, namespace, xmlns) { | ||
if(!this.soapHeaders){ | ||
this.soapHeaders = []; | ||
} | ||
if(typeof soapHeader == 'object'){ | ||
soapHeader = this.wsdl.objectToXML(soapHeader, name, namespace, xmlns); | ||
} | ||
this.soapHeaders.push(soapHeader); | ||
} | ||
Client.prototype.setEndpoint = function(endpoint) { | ||
@@ -91,4 +101,5 @@ this.endpoint = endpoint; | ||
xml = null, | ||
soapAction = this.SOAPAction ? this.SOAPAction(ns, name) : (method.soapAction || (((ns.lastIndexOf("/") != ns.length - 1) ? ns + "/" : ns) + name)), | ||
headers = { | ||
SOAPAction: this.SOAPAction ? this.SOAPAction(ns, name) : (((ns.lastIndexOf("/") != ns.length - 1) ? ns + "/" : ns) + name), | ||
SOAPAction: '"' + soapAction + '"', | ||
'Content-Type': "text/xml; charset=utf-8" | ||
@@ -122,2 +133,3 @@ }, | ||
"<soap:Header>" + | ||
(self.soapHeaders ? self.soapHeaders.join("\n") : "") + | ||
(self.security ? self.security.toXML() : "") + | ||
@@ -130,2 +142,4 @@ "</soap:Header>" + | ||
self.lastRequest = xml; | ||
http.request(location, xml, function(err, response, body) { | ||
@@ -132,0 +146,0 @@ if (err) { |
@@ -13,23 +13,23 @@ /* | ||
var curl = url.parse(rurl); | ||
var secure = curl.protocol == 'https:'; | ||
var host = curl.hostname; | ||
var port = parseInt(curl.port || (secure ? 443 : 80)); | ||
var path = [curl.pathname || '/', curl.search || '', curl.hash || ''].join(''); | ||
var method = data ? "POST" : "GET"; | ||
var headers = { | ||
"User-Agent": "node-soap/" + VERSION, | ||
"Accept" : "text/html,application/xhtml+xml,application/xml", | ||
var secure = curl.protocol == 'https:'; | ||
var host = curl.hostname; | ||
var port = parseInt(curl.port || (secure ? 443 : 80)); | ||
var path = [curl.pathname || '/', curl.search || '', curl.hash || ''].join(''); | ||
var method = data ? "POST" : "GET"; | ||
var headers = { | ||
"User-Agent": "node-soap/" + VERSION, | ||
"Accept" : "text/html,application/xhtml+xml,application/xml", | ||
"Accept-Encoding": "none", | ||
"Accept-Charset": "utf-8", | ||
"Connection": "close", | ||
"Host" : host | ||
}; | ||
"Host" : host | ||
}; | ||
if (typeof data == 'string') { | ||
headers["Content-Length"] = Buffer.byteLength(data, 'utf8');; | ||
headers["Content-Type"] = "application/x-www-form-urlencoded"; | ||
} | ||
if (typeof data == 'string') { | ||
headers["Content-Length"] = Buffer.byteLength(data, 'utf8');; | ||
headers["Content-Type"] = "application/x-www-form-urlencoded"; | ||
} | ||
exheaders = exheaders || {}; | ||
for (var attr in exheaders) { headers[attr] = exheaders[attr]; } | ||
for (var attr in exheaders) { headers[attr] = exheaders[attr]; } | ||
@@ -41,3 +41,3 @@ var options = { | ||
}; | ||
exoptions = exoptions || {}; | ||
@@ -56,2 +56,1 @@ for (var attr in exoptions) { options[attr] = exoptions[attr]; } | ||
} | ||
@@ -10,3 +10,5 @@ /* | ||
crypto = require('crypto'), | ||
WSDL = require('./wsdl').WSDL; | ||
WSDL = require('./wsdl').WSDL, | ||
https = require('https'), | ||
fs = require('fs'); | ||
@@ -77,2 +79,17 @@ var WSDL = require('./wsdl').WSDL; | ||
function ClientSSLSecurity(keyPath, certPath) { | ||
this.key = fs.readFileSync(keyPath); | ||
this.cert = fs.readFileSync(certPath); | ||
} | ||
ClientSSLSecurity.prototype.toXML = function (headers) { | ||
return ""; | ||
} | ||
ClientSSLSecurity.prototype.addOptions = function (options) { | ||
options.key = this.key; | ||
options.cert = this.cert; | ||
options.agent = new https.Agent(options); | ||
} | ||
function WSSecurity(username, password, passwordType) { | ||
@@ -133,2 +150,3 @@ this._username = username; | ||
exports.WSSecurity = WSSecurity; | ||
exports.ClientSSLSecurity = ClientSSLSecurity; | ||
exports.createClient = createClient; | ||
@@ -135,0 +153,0 @@ exports.passwordDigest = passwordDigest; |
@@ -11,2 +11,3 @@ /* | ||
url = require('url'), | ||
path = require('path'), | ||
assert = require('assert').ok; | ||
@@ -633,3 +634,15 @@ | ||
if (!include) return callback() | ||
open_wsdl(url.resolve(self.uri, include.location), function(err, wsdl) { | ||
var includePath; | ||
if (!/^http/.test(self.uri) && !/^http/.test(include.location)) { | ||
includePath = path.resolve(path.dirname(self.uri), include.location); | ||
} else { | ||
includePath = url.resolve(self.uri, include.location); | ||
} | ||
open_wsdl(includePath, function(err, wsdl) { | ||
if (err) { | ||
return callback(err); | ||
} | ||
self.definitions.schemas[include.namespace || wsdl.definitions.$targetNamespace] = wsdl.definitions; | ||
@@ -639,3 +652,3 @@ self._processNextInclude(includes, function(err) { | ||
}) | ||
}); | ||
}); | ||
} | ||
@@ -774,4 +787,6 @@ | ||
value; | ||
if (name === 'int') { | ||
if (name === 'int' || name === 'integer') { | ||
value = parseInt(text, 10); | ||
} else if (name === 'bool' || name === 'boolean') { | ||
value = text.toLowerCase() === 'true' || text === '1'; | ||
} else if (name === 'dateTime') { | ||
@@ -778,0 +793,0 @@ value = new Date(text); |
{ | ||
"name": "soap", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "A minimal node SOAP client", | ||
@@ -5,0 +5,0 @@ "engines": { "node": ">=0.8.0" }, |
@@ -20,3 +20,3 @@ This module lets you connect to web services using SOAP. It also provides a server that allows you to run your own SOAP services. | ||
### soap.createClient(url, callback) - create a new SOAP client from a WSDL url | ||
### soap.createClient(url, callback) - create a new SOAP client from a WSDL url. Also supports a local filesystem path. | ||
@@ -148,3 +148,14 @@ ``` javascript | ||
``` | ||
### 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 | ||
## WSSecurity | ||
@@ -151,0 +162,0 @@ |
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
Network access
Supply chain riskThis module accesses the network.
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
234206
1892
167
0
7
5