Socket
Socket
Sign inDemoInstall

soap

Package Overview
Dependencies
Maintainers
3
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soap - npm Package Compare versions

Comparing version 0.4.0 to 0.4.2

CONTRIBUTING.md

12

History.md

@@ -0,1 +1,13 @@

0.4.1 / 2014-03-04
=================
* package; increased minor version to 0.4.1
* Adding an npmignore on test/
* Tests are linted
* Attributes may be added to requests and parsed from responses
* Tests were added for ssl and client authentication
* Support for import elements in WSDL documents.
* Version in server response matches package.json
* Describe errors fixed on OutputElements.
* Support for Fault handling.
0.4.0 / 2014-02-15

@@ -2,0 +14,0 @@ ==================

10

lib/client.js

@@ -33,2 +33,10 @@ /*

Client.prototype.getSoapHeaders = function() {
return this.soapHeaders;
};
Client.prototype.clearSoapHeaders = function() {
this.soapHeaders = null;
};
Client.prototype.setEndpoint = function(endpoint) {

@@ -128,3 +136,3 @@ this.endpoint = endpoint;

assert.ok(!style || style === 'document', 'invalid message definition for rpc style binding');
message = self.wsdl.objectToDocumentXML(input.$name, args, input.targetNSAlias, input.targetNamespace);
message = self.wsdl.objectToDocumentXML(input.$name, args, input.targetNSAlias, input.targetNamespace, input.$type);
}

@@ -131,0 +139,0 @@ xml = "<soap:Envelope " +

2

lib/http.js

@@ -11,3 +11,3 @@ /*

var VERSION = "0.2.0";
var VERSION = require('../package.json').version;

@@ -14,0 +14,0 @@ exports.request = function(rurl, data, callback, exheaders, exoptions) {

@@ -51,3 +51,3 @@ /*

var i = typeof nsName === 'string' ? nsName.indexOf(':') : -1;
return i < 0 ? {namespace: null, name: nsName} : {namespace: nsName.substring(0, i), name: nsName.substring(i + 1)};
return i < 0 ? {namespace: 'xmlns', name: nsName} : {namespace: nsName.substring(0, i), name: nsName.substring(i + 1)};
}

@@ -101,3 +101,3 @@

if (match) {
this.xmlns[match[1]] = attrs[key];
this.xmlns[match[1] ? match[1] : 'xmlns'] = attrs[key];
}

@@ -632,4 +632,4 @@ else {

OperationElement.prototype.description = function(definitions) {
var inputDesc = this.input.description(definitions);
var outputDesc = this.output.description(definitions);
var inputDesc = this.input ? this.input.description(definitions) : null;
var outputDesc = this.output ? this.output.description(definitions) : null;
return {

@@ -958,3 +958,5 @@ input: inputDesc && inputDesc[Object.keys(inputDesc)[0]],

if (body.Fault) {
throw new Error(body.Fault.faultcode + ': ' + body.Fault.faultstring + (body.Fault.detail ? ': ' + body.Fault.detail : ''));
var error = new Error(body.Fault.faultcode + ': ' + body.Fault.faultstring + (body.Fault.detail ? ': ' + body.Fault.detail : ''));
error.root = root;
throw error;
}

@@ -964,6 +966,28 @@ return root.Envelope;

WSDL.prototype.objectToDocumentXML = function(name, params, ns, xmlns) {
WSDL.prototype.findParameterObject = function(xmlns, parameterType) {
if (!xmlns || !parameterType) {
return null;
}
var parameterTypeObj = null;
if (this.definitions.schemas) {
var schema = this.definitions.schemas[xmlns];
if (schema) {
if (parameterType.indexOf(':') !== -1) {
parameterType = parameterType.substring(parameterType.indexOf(':') + 1, parameterType.length);
}
parameterTypeObj = schema.complexTypes[parameterType];
}
}
return parameterTypeObj;
};
WSDL.prototype.objectToDocumentXML = function(name, params, ns, xmlns, type) {
var args = {};
args[name] = params;
return this.objectToXML(args, null, ns, xmlns, true);
var parameterTypeObj = type ? this.findParameterObject(xmlns, type) : null;
return this.objectToXML(args, null, ns, xmlns, true, null, parameterTypeObj);
};

@@ -979,3 +1003,4 @@

xmlns = xmlns || defs.xmlns[namespace];
parts.push(['<', namespace, ':', name, '>'].join(''));
namespace = namespace === 'xmlns' ? '' : (namespace + ':');
parts.push(['<', namespace, name, '>'].join(''));

@@ -990,3 +1015,3 @@ for (var key in params) {

}
parts.push(['</', namespace, ':', name, '>'].join(''));
parts.push(['</', namespace, name, '>'].join(''));

@@ -996,9 +1021,18 @@ return parts.join('');

WSDL.prototype.objectToXML = function(obj, name, namespace, xmlns, first) {
WSDL.prototype.objectToXML = function(obj, name, namespace, xmlns, first, xmlnsAttr, parameterTypeObject, ancestorXmlns) {
var self = this;
var parts = [];
var xmlnsAttrib = first
? ' xmlns:' + namespace + '="' + xmlns + '"' + ' xmlns="' + xmlns + '"'
? ((namespace !== 'xmlns' ? ' xmlns:' + namespace + '="' + xmlns + '"' : '') + ' xmlns="' + xmlns + '"')
: '';
var ns = namespace ? namespace + ':' : '';
var ancXmlns = first ? new Array(xmlns) : ancestorXmlns;
// explicitly use xmlns attribute if available
if (xmlnsAttr) {
xmlnsAttrib = xmlnsAttr;
}
var ns = namespace && namespace !== 'xmlns' ? namespace + ':' : '';

@@ -1015,5 +1049,43 @@ if (Array.isArray(obj)) {

for (name in obj) {
//don't process attributes as element
if (name === 'attributes') {
continue;
}
var child = obj[name];
parts.push(['<', ns, name, xmlnsAttrib, '>'].join(''));
parts.push(self.objectToXML(child, name, namespace, xmlns));
var attr = self.processAttributes(child);
parts.push(['<', ns, name, attr, xmlnsAttrib, '>'].join(''));
if (first) {
parts.push(self.objectToXML(child, name, namespace, xmlns, false, null, parameterTypeObject, ancXmlns));
} else {
if (self.definitions.schemas) {
var schema = this.definitions.schemas[xmlns];
if (schema) {
var childParameterTypeObject = self.findChildParameterObject(parameterTypeObject, name);
if (childParameterTypeObject) {
var childParameterType = childParameterTypeObject.$type;
var childNamespace = '';
if (childParameterType.indexOf(':') !== -1) {
childNamespace = childParameterType.substring(0, childParameterType.indexOf(':'));
}
var childXmlns = schema.xmlns[childNamespace];
var childXmlnsAttrib = ' xmlns:' + childNamespace + '="' + childXmlns+ '"';
if (ancXmlns.indexOf(childXmlns) !== -1) {
childXmlnsAttrib = '';
} else {
ancXmlns.push(childXmlns);
}
parts.push(self.objectToXML(child, name, childNamespace, childXmlns, false, childXmlnsAttrib, childParameterTypeObject));
} else {
parts.push(self.objectToXML(child, name, namespace, xmlns));
}
}
}
}
parts.push(['</', ns, name, '>'].join(''));

@@ -1027,2 +1099,35 @@ }

WSDL.prototype.processAttributes = function(child) {
var attr = '';
if (child.attributes) {
for (var attrKey in child.attributes) {
attr += ' ' + attrKey + '="' + xmlEscape(child.attributes[attrKey]) + '"';
}
}
return attr;
};
WSDL.prototype.findChildParameterObject = function(parameterTypeObj, childName) {
if (!parameterTypeObj || !childName) {
return null;
}
var object = parameterTypeObj;
if (object.$name === childName) {
return object;
}
if (object.children) {
for (var i = 0, child; child = object.children[i]; i++) {
var found = this.findChildParameterObject(child, childName);
if (found) {
return found;
}
}
}
return null;
};
WSDL.prototype._parse = function(xml) {

@@ -1090,3 +1195,3 @@ var self = this,

for (var alias in xmlns) {
if (alias === '')
if (alias === '' || alias === 'xmlns')
continue;

@@ -1093,0 +1198,0 @@ var ns = xmlns[alias];

{
"name": "soap",
"version": "0.4.0",
"version": "0.4.2",
"description": "A minimal node SOAP client",

@@ -23,3 +23,3 @@ "engines": {

"mocha": "mocha -R spec -u exports test/*-test.js",
"jshint": "jshint index.js lib/http.js lib/client.js lib/soap.js lib/server.js lib/wsdl.js",
"jshint": "jshint index.js lib test",
"test": "npm run-script jshint && npm run-script mocha"

@@ -26,0 +26,0 @@ },

This module lets you connect to web services using SOAP. It also provides a server that allows you to run your own SOAP services.
[![Build Status](https://travis-ci.org/milewise/node-soap.png?branch=master)](https://travis-ci.org/milewise/node-soap)
[![Build Status](https://travis-ci.org/vpulim/node-soap.png?branch=master)](https://travis-ci.org/vpulim/node-soap)

@@ -5,0 +5,0 @@ Features:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc