Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: soap @ 0.25.0 .. 0.27.1

History.md

@@ -1,8 +1,44 @@
+0.27.1 / 2019-04-19
+===================
+
+* [FIX] Move @types/request to dependencies (#1059)
+
+0.27.0 / 2019-04-18
+===================
+
+* [ENHANCEMENT] Added MTOM support for binary data (#1054)
+* [ENHANCEMENT] Added callback for soap.listen (#1055)
+* [ENHANCEMENT] add rsa-sha256 support for WSSecurityCert (#1052)
+* [ENHANCEMENT] adding promise support for server method handlers.
+* [FIX] Fixed PasswordDigest Generation (#1039)
+* [FIX] Fixed some issues with xsd elements (#1057)
+* [FIX] Handle response with error status code and without response body (#1053)
+* [FIX] Stringify wsdl-related error messages to avoid non-descriptive [object Object] output. (#1037)
+* [FIX] fix(compliance): updated the npm packages
+* [FIX] fix(wsdl): array namespace override with colon(:) (#1045)
+* [MAINTENANCE] adding source-map-support for ts mapping in stack trace; enabling tslint rules; added linting to travis; removing unnecessary self variables (#1047)
+* [MAINTENANCE] converting the project to TypeScript (#1044)
+* [MAINTENANCE] npm upgrade; removing ejs and external template files (#1046)
+* [MAINTENANCE] npmignore cleanup; adding some types to Client (#1049)
+
+0.26.0 / 2019-02-11
+===================
+
+* [FIX] WSDL: make merging external schema works correctly (#1023)
+* [FIX] WSDL: pass error from parsing XML as-is, not only its message (#1022)
+* [ENHANCEMENT] server: add option enableChunkedEncoding (#1043)
+* [FIX] fix a problem about Multi-Byte character (#1042)
+* [FIX] fix double transformationentries in WSSecCert
+* [MAINTENANCE] Add bodyParser.json middleware test
+* [FIX] processRequestXml only if req.body is not empty object
+* [MAINTENANCE] Fixing v10 ssl tests and removing jshint since it sucks and doesn't support es6. (we need to migrate to eslint).
+* [FIX] Arrays deserve namespace override too
+
0.25.0 / 2018-08-19
===================
* [FIX] Improved deserialization on inline `simpleType` declarations (#1015)
* [ENHANCEMENT] Added option to allow the user to dis-/enable the timestamp in `WSSecurtityCert` (defaults to "enabled" to maintain current behaviour) (#1017)
-* [DOC] Updated the "*Async" result description (#1016)
+* [DOC] Updated the "\*Async" result description (#1016)
* [ENHANCEMENT] Added ability to resolve Schema-cross-reference namespaces in `client.describe()` (#1014)
* [FIX] Fixed `.npmignore` patterns in order to publish only the necessary files (#1012)
* [DOC] Removed formatting in code (#1011)

lib/client.d.ts

@@ -0,0 +1,72 @@
+/// <reference types="node" />
+import { EventEmitter } from 'events';
+import { IncomingHttpHeaders } from 'http';
+import * as request from 'request';
+import { IHeaders, IOptions, ISecurity } from './types';
+import { WSDL } from './wsdl';
+export interface ISoapError extends Error {
+ response?: any;
+ body?: any;
+}
+export interface Client {
+ emit(event: 'request', xml: string, eid: string): boolean;
+ emit(event: 'message', message: string, eid: string): boolean;
+ emit(event: 'soapError', error: any, eid: string): boolean;
+ emit(event: 'response', body: any, response: any, eid: string): boolean;
+ /** Emitted before a request is sent. */
+ on(event: 'request', listener: (xml: string, eid: string) => void): this;
+ /** Emitted before a request is sent, but only the body is passed to the event handler. Useful if you don't want to log /store Soap headers. */
+ on(event: 'message', listener: (message: string, eid: string) => void): this;
+ /** Emitted when an erroneous response is received. */
+ on(event: 'soapError', listener: (error: any, eid: string) => void): this;
+ /** Emitted after a response is received. This is emitted for all responses (both success and errors). */
+ on(event: 'response', listener: (body: any, response: any, eid: string) => void): this;
+}
+export declare class Client extends EventEmitter {
+ [method: string]: any;
+ /** contains last full soap request for client logging */
+ lastRequest?: string;
+ lastMessage?: string;
+ lastEndpoint?: string;
+ lastRequestHeaders?: request.Headers;
+ lastResponse?: any;
+ lastResponseHeaders?: IncomingHttpHeaders;
+ lastElapsedTime?: number;
+ private wsdl;
+ private httpClient;
+ private soapHeaders;
+ private httpHeaders;
+ private bodyAttributes;
+ private endpoint;
+ private security;
+ private SOAPAction;
+ private streamAllowed;
+ private normalizeNames;
+ constructor(wsdl: WSDL, endpoint?: string, options?: IOptions);
+ /** add soapHeader to soap:Header node */
+ addSoapHeader(soapHeader: any, name?: string, namespace?: string, xmlns?: string): number;
+ changeSoapHeader(index: number, soapHeader: any, name?: string, namespace?: string, xmlns?: string): void;
+ /** return all defined headers */
+ getSoapHeaders(): string[];
+ /** remove all defined headers */
+ clearSoapHeaders(): void;
+ addHttpHeader(name: string, value: any): void;
+ getHttpHeaders(): IHeaders;
+ clearHttpHeaders(): void;
+ addBodyAttribute(bodyAttribute: any, name?: string, namespace?: string, xmlns?: string): void;
+ getBodyAttributes(): any[];
+ clearBodyAttributes(): void;
+ /** overwrite the SOAP service endpoint address */
+ setEndpoint(endpoint: string): void;
+ /** description of services, ports and methods as a JavaScript object */
+ describe(): any;
+ /** use the specified security protocol */
+ setSecurity(security: ISecurity): void;
+ setSOAPAction(SOAPAction: string): void;
+ private _initializeServices;
+ private _initializeOptions;
+ private _defineService;
+ private _definePort;
+ private _defineMethod;
+ private _invoke;
+}

lib/client.js

@@ -1,40 +1,51 @@
+"use strict";
/*
* Copyright (c) 2011 Vinay Pulim <vinay@milewise.com>
* MIT Licensed
*/
-
-"use strict";
-
-
-var HttpClient = require('./http'),
- assert = require('assert'),
- events = require('events'),
- util = require('util'),
- debug = require('debug')('node-soap'),
- findPrefix = require('./utils').findPrefix,
- _ = require('lodash'),
- concatStream = require('concat-stream'),
- BluebirdPromise = require("bluebird"),
- uuid4 = require('uuid/v4');
-
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+exports.__esModule = true;
+var assert = require("assert");
+var BluebirdPromise = require("bluebird");
+var concatStream = require("concat-stream");
+var debugBuilder = require("debug");
+var events_1 = require("events");
+var _ = require("lodash");
+var uuid_1 = require("uuid");
+var http_1 = require("./http");
+var utils_1 = require("./utils");
+var debug = debugBuilder('node-soap');
var nonIdentifierChars = /[^a-z$_0-9]/i;
-
-var Client = function(wsdl, endpoint, options) {
- events.EventEmitter.call(this);
+var Client = /** @class */ (function (_super) {
+ __extends(Client, _super);
+ function Client(wsdl, endpoint, options) {
+ var _this = _super.call(this) || this;
options = options || {};
- this.wsdl = wsdl;
- this._initializeOptions(options);
- this._initializeServices(endpoint);
- this.httpClient = options.httpClient || new HttpClient(options);
+ _this.wsdl = wsdl;
+ _this._initializeOptions(options);
+ _this._initializeServices(endpoint);
+ _this.httpClient = options.httpClient || new http_1.HttpClient(options);
var promiseOptions = { multiArgs: true };
if (options.overridePromiseSuffix) {
promiseOptions.suffix = options.overridePromiseSuffix;
}
- BluebirdPromise.promisifyAll(this, promiseOptions);
-};
-util.inherits(Client, events.EventEmitter);
-
-Client.prototype.addSoapHeader = function(soapHeader, name, namespace, xmlns) {
+ BluebirdPromise.promisifyAll(_this, promiseOptions);
+ return _this;
+ }
+ /** add soapHeader to soap:Header node */
+ Client.prototype.addSoapHeader = function (soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {
this.soapHeaders = [];
}
@@ -42,9 +53,8 @@
soapHeader = this.wsdl.objectToXML(soapHeader, name, namespace, xmlns, true);
}
return this.soapHeaders.push(soapHeader) - 1;
-};
-
-Client.prototype.changeSoapHeader = function(index, soapHeader, name, namespace, xmlns) {
+ };
+ Client.prototype.changeSoapHeader = function (index, soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {
this.soapHeaders = [];
}
@@ -52,180 +62,231 @@
soapHeader = this.wsdl.objectToXML(soapHeader, name, namespace, xmlns, true);
}
this.soapHeaders[index] = soapHeader;
-};
-
-Client.prototype.getSoapHeaders = function() {
+ };
+ /** return all defined headers */
+ Client.prototype.getSoapHeaders = function () {
return this.soapHeaders;
-};
-
-Client.prototype.clearSoapHeaders = function() {
+ };
+ /** remove all defined headers */
+ Client.prototype.clearSoapHeaders = function () {
this.soapHeaders = null;
-};
-
-Client.prototype.addHttpHeader = function(name, value) {
+ };
+ Client.prototype.addHttpHeader = function (name, value) {
if (!this.httpHeaders) {
this.httpHeaders = {};
}
this.httpHeaders[name] = value;
-};
-
-Client.prototype.getHttpHeaders = function() {
+ };
+ Client.prototype.getHttpHeaders = function () {
return this.httpHeaders;
-};
-
-Client.prototype.clearHttpHeaders = function() {
+ };
+ Client.prototype.clearHttpHeaders = function () {
this.httpHeaders = {};
-};
-
-
-Client.prototype.addBodyAttribute = function(bodyAttribute, name, namespace, xmlns) {
+ };
+ Client.prototype.addBodyAttribute = function (bodyAttribute, name, namespace, xmlns) {
if (!this.bodyAttributes) {
this.bodyAttributes = [];
}
if (typeof bodyAttribute === 'object') {
- var composition = '';
- Object.getOwnPropertyNames(bodyAttribute).forEach(function(prop, idx, array) {
- composition += ' ' + prop + '="' + bodyAttribute[prop] + '"';
+ var composition_1 = '';
+ Object.getOwnPropertyNames(bodyAttribute).forEach(function (prop, idx, array) {
+ composition_1 += ' ' + prop + '="' + bodyAttribute[prop] + '"';
});
- bodyAttribute = composition;
+ bodyAttribute = composition_1;
+ }
+ if (bodyAttribute.substr(0, 1) !== ' ') {
+ bodyAttribute = ' ' + bodyAttribute;
}
- if (bodyAttribute.substr(0, 1) !== ' ') bodyAttribute = ' ' + bodyAttribute;
this.bodyAttributes.push(bodyAttribute);
-};
-
-Client.prototype.getBodyAttributes = function() {
+ };
+ Client.prototype.getBodyAttributes = function () {
return this.bodyAttributes;
-};
-
-Client.prototype.clearBodyAttributes = function() {
+ };
+ Client.prototype.clearBodyAttributes = function () {
this.bodyAttributes = null;
-};
-
-Client.prototype.setEndpoint = function(endpoint) {
+ };
+ /** overwrite the SOAP service endpoint address */
+ Client.prototype.setEndpoint = function (endpoint) {
this.endpoint = endpoint;
this._initializeServices(endpoint);
-};
-
-Client.prototype.describe = function() {
- var types = this.wsdl.definitions.types;
+ };
+ /** description of services, ports and methods as a JavaScript object */
+ Client.prototype.describe = function () {
return this.wsdl.describeServices();
-};
-
-Client.prototype.setSecurity = function(security) {
+ };
+ /** use the specified security protocol */
+ Client.prototype.setSecurity = function (security) {
this.security = security;
-};
-
-Client.prototype.setSOAPAction = function(SOAPAction) {
+ };
+ Client.prototype.setSOAPAction = function (SOAPAction) {
this.SOAPAction = SOAPAction;
-};
-
-Client.prototype._initializeServices = function(endpoint) {
- var definitions = this.wsdl.definitions,
- services = definitions.services;
- for (var name in services) {
- this[name] = this._defineService(services[name], endpoint);
- }
-};
-
-Client.prototype._initializeOptions = function(options) {
+ };
+ Client.prototype._initializeServices = function (endpoint) {
+ var definitions = this.wsdl.definitions;
+ var services = definitions.services;
+ for (var name_1 in services) {
+ this[name_1] = this._defineService(services[name_1], endpoint);
+ }
+ };
+ Client.prototype._initializeOptions = function (options) {
this.streamAllowed = options.stream;
this.normalizeNames = options.normalizeNames;
this.wsdl.options.attributesKey = options.attributesKey || 'attributes';
this.wsdl.options.envelopeKey = options.envelopeKey || 'soap';
this.wsdl.options.preserveWhitespace = !!options.preserveWhitespace;
- if(options.ignoredNamespaces !== undefined) {
- if(options.ignoredNamespaces.override !== undefined) {
- if(options.ignoredNamespaces.override === true) {
- if(options.ignoredNamespaces.namespaces !== undefined) {
- this.wsdl.options.ignoredNamespaces = options.ignoredNamespaces.namespaces;
+ var igNs = options.ignoredNamespaces;
+ if (igNs !== undefined && typeof igNs === 'object') {
+ if ('override' in igNs) {
+ if (igNs.override === true) {
+ if (igNs.namespaces !== undefined) {
+ this.wsdl.options.ignoredNamespaces = igNs.namespaces;
}
}
}
}
- if(options.overrideRootElement !== undefined) {
+ if (options.overrideRootElement !== undefined) {
this.wsdl.options.overrideRootElement = options.overrideRootElement;
}
this.wsdl.options.forceSoap12Headers = !!options.forceSoap12Headers;
-};
-
-Client.prototype._defineService = function(service, endpoint) {
- var ports = service.ports,
- def = {};
- for (var name in ports) {
- def[name] = this._definePort(ports[name], endpoint ? endpoint : ports[name].location);
+ };
+ Client.prototype._defineService = function (service, endpoint) {
+ var ports = service.ports;
+ var def = {};
+ for (var name_2 in ports) {
+ def[name_2] = this._definePort(ports[name_2], endpoint ? endpoint : ports[name_2].location);
}
return def;
-};
-
-Client.prototype._definePort = function(port, endpoint) {
- var location = endpoint,
- binding = port.binding,
- methods = binding.methods,
- def = {};
- for (var name in methods) {
- def[name] = this._defineMethod(methods[name], location);
- var methodName = this.normalizeNames ? name.replace(nonIdentifierChars, '_') : name;
- this[methodName] = def[name];
+ };
+ Client.prototype._definePort = function (port, endpoint) {
+ var location = endpoint;
+ var binding = port.binding;
+ var methods = binding.methods;
+ var def = {};
+ for (var name_3 in methods) {
+ def[name_3] = this._defineMethod(methods[name_3], location);
+ var methodName = this.normalizeNames ? name_3.replace(nonIdentifierChars, '_') : name_3;
+ this[methodName] = def[name_3];
}
return def;
-};
-
-Client.prototype._defineMethod = function(method, location) {
- var self = this;
+ };
+ Client.prototype._defineMethod = function (method, location) {
+ var _this = this;
var temp;
- return function(args, callback, options, extraHeaders) {
+ return function (args, callback, options, extraHeaders) {
if (typeof args === 'function') {
callback = args;
args = {};
- } else if (typeof options === 'function') {
+ }
+ else if (typeof options === 'function') {
temp = callback;
callback = options;
options = temp;
- } else if (typeof extraHeaders === 'function') {
+ }
+ else if (typeof extraHeaders === 'function') {
temp = callback;
callback = extraHeaders;
extraHeaders = options;
options = temp;
}
- self._invoke(method, args, location, function(error, result, rawResponse, soapHeader, rawRequest) {
+ _this._invoke(method, args, location, function (error, result, rawResponse, soapHeader, rawRequest) {
callback(error, result, rawResponse, soapHeader, rawRequest);
}, options, extraHeaders);
};
-};
-
-Client.prototype._invoke = function(method, args, location, callback, options, extraHeaders) {
- var self = this,
- name = method.$name,
- input = method.input,
- output = method.output,
- style = method.style,
- defs = this.wsdl.definitions,
- envelopeKey = this.wsdl.options.envelopeKey,
- ns = defs.$targetNamespace,
- encoding = '',
- message = '',
- xml = null,
- req = null,
- soapAction,
- alias = findPrefix(defs.xmlns, ns),
- headers = {
- "Content-Type": "text/xml; charset=utf-8"
- },
- xmlnsSoap = "xmlns:" + envelopeKey + "=\"http://schemas.xmlsoap.org/soap/envelope/\"";
-
+ };
+ Client.prototype._invoke = function (method, args, location, callback, options, extraHeaders) {
+ var _this = this;
+ var name = method.$name;
+ var input = method.input;
+ var output = method.output;
+ var style = method.style;
+ var defs = this.wsdl.definitions;
+ var envelopeKey = this.wsdl.options.envelopeKey;
+ var ns = defs.$targetNamespace;
+ var encoding = '';
+ var message = '';
+ var xml = null;
+ var req;
+ var soapAction;
+ var alias = utils_1.findPrefix(defs.xmlns, ns);
+ var headers = {
+ 'Content-Type': 'text/xml; charset=utf-8'
+ };
+ var xmlnsSoap = 'xmlns:' + envelopeKey + '="http://schemas.xmlsoap.org/soap/envelope/"';
+ var finish = function (obj, body, response) {
+ var result;
+ if (!output) {
+ // one-way, no output expected
+ return callback(null, null, body, obj.Header, xml);
+ }
+ // If it's not HTML and Soap Body is empty
+ if (!obj.html && !obj.Body) {
+ if (response.statusCode >= 400) {
+ var error = new Error('Error http status codes');
+ error.response = response;
+ error.body = body;
+ _this.emit('soapError', error, eid);
+ return callback(error, obj, body, obj.Header);
+ }
+ return callback(null, obj, body, obj.Header);
+ }
+ if (typeof obj.Body !== 'object') {
+ var error = new Error('Cannot parse response');
+ error.response = response;
+ error.body = body;
+ return callback(error, obj, body, undefined, xml);
+ }
+ result = obj.Body[output.$name];
+ // RPC/literal response body may contain elements with added suffixes I.E.
+ // 'Response', or 'Output', or 'Out'
+ // This doesn't necessarily equal the ouput message name. See WSDL 1.1 Section 2.4.5
+ if (!result) {
+ result = obj.Body[output.$name.replace(/(?:Out(?:put)?|Response)$/, '')];
+ }
+ if (!result) {
+ ['Response', 'Out', 'Output'].forEach(function (term) {
+ if (obj.Body.hasOwnProperty(name + term)) {
+ return result = obj.Body[name + term];
+ }
+ });
+ }
+ callback(null, result, body, obj.Header, xml);
+ };
+ var parseSync = function (body, response) {
+ var obj;
+ try {
+ obj = _this.wsdl.xmlToObject(body);
+ }
+ catch (error) {
+ // When the output element cannot be looked up in the wsdl and the body is JSON
+ // instead of sending the error, we pass the body in the response.
+ if (!output || !output.$lookupTypes) {
+ debug('Response element is not present. Unable to convert response xml to json.');
+ // If the response is JSON then return it as-is.
+ var json = _.isObject(body) ? body : tryJSONparse(body);
+ if (json) {
+ return callback(null, response, json, undefined, xml);
+ }
+ }
+ error.response = response;
+ error.body = body;
+ _this.emit('soapError', error, eid);
+ return callback(error, response, body, undefined, xml);
+ }
+ return finish(obj, body, response);
+ };
if (this.wsdl.options.forceSoap12Headers) {
- headers["Content-Type"] = "application/soap+xml; charset=utf-8";
- xmlnsSoap = "xmlns:" + envelopeKey + "=\"http://www.w3.org/2003/05/soap-envelope\"";
+ headers['Content-Type'] = 'application/soap+xml; charset=utf-8';
+ xmlnsSoap = 'xmlns:' + envelopeKey + '="http://www.w3.org/2003/05/soap-envelope"';
}
-
if (this.SOAPAction) {
soapAction = this.SOAPAction;
- } else if (method.soapAction !== undefined && method.soapAction !== null) {
+ }
+ else if (method.soapAction !== undefined && method.soapAction !== null) {
soapAction = method.soapAction;
- } else {
- soapAction = ((ns.lastIndexOf("/") !== ns.length - 1) ? ns + "/" : ns) + name;
}
-
+ else {
+ soapAction = ((ns.lastIndexOf('/') !== ns.length - 1) ? ns + '/' : ns) + name;
+ }
if (!this.wsdl.options.forceSoap12Headers) {
headers.SOAPAction = '"' + soapAction + '"';
}
@@ -229,206 +290,132 @@
if (!this.wsdl.options.forceSoap12Headers) {
headers.SOAPAction = '"' + soapAction + '"';
}
-
options = options || {};
-
- //Add extra headers
- for (var header in this.httpHeaders ) { headers[header] = this.httpHeaders[header]; }
- for (var attr in extraHeaders) { headers[attr] = extraHeaders[attr]; }
-
+ // Add extra headers
+ for (var header in this.httpHeaders) {
+ headers[header] = this.httpHeaders[header];
+ }
+ for (var attr in extraHeaders) {
+ headers[attr] = extraHeaders[attr];
+ }
// Allow the security object to add headers
- if (self.security && self.security.addHeaders)
- self.security.addHeaders(headers);
- if (self.security && self.security.addOptions)
- self.security.addOptions(options);
-
- if ((style === 'rpc')&& ( ( input.parts || input.name==="element" ) || args === null) ) {
+ if (this.security && this.security.addHeaders) {
+ this.security.addHeaders(headers);
+ }
+ if (this.security && this.security.addOptions) {
+ this.security.addOptions(options);
+ }
+ if ((style === 'rpc') && ((input.parts || input.name === 'element') || args === null)) {
assert.ok(!style || style === 'rpc', 'invalid message definition for document style binding');
- message = self.wsdl.objectToRpcXML(name, args, alias, ns,(input.name!=="element" ));
+ message = this.wsdl.objectToRpcXML(name, args, alias, ns, (input.name !== 'element'));
(method.inputSoap === 'encoded') && (encoding = 'soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ');
- } else {
+ }
+ else {
assert.ok(!style || style === 'document', 'invalid message definition for rpc style binding');
// pass `input.$lookupType` if `input.$type` could not be found
- message = self.wsdl.objectToDocumentXML(input.$name, args, input.targetNSAlias, input.targetNamespace, (input.$type || input.$lookupType));
+ message = this.wsdl.objectToDocumentXML(input.$name, args, input.targetNSAlias, input.targetNamespace, (input.$type || input.$lookupType));
}
- xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
- "<" + envelopeKey + ":Envelope " +
- xmlnsSoap + " " +
- "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
+ xml = '<?xml version="1.0" encoding="utf-8"?>' +
+ '<' + envelopeKey + ':Envelope ' +
+ xmlnsSoap + ' ' +
+ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
encoding +
this.wsdl.xmlnsInEnvelope + '>' +
- ((self.soapHeaders || self.security) ?
- (
- "<" + envelopeKey + ":Header>" +
- (self.soapHeaders ? self.soapHeaders.join("\n") : "") +
- (self.security && !self.security.postProcess ? self.security.toXML() : "") +
- "</" + envelopeKey + ":Header>"
- )
+ ((this.soapHeaders || this.security) ?
+ ('<' + envelopeKey + ':Header>' +
+ (this.soapHeaders ? this.soapHeaders.join('\n') : '') +
+ (this.security && !this.security.postProcess ? this.security.toXML() : '') +
+ '</' + envelopeKey + ':Header>')
:
- ''
- ) +
- "<" + envelopeKey + ":Body" +
- (self.bodyAttributes ? self.bodyAttributes.join(' ') : '') +
- (self.security && self.security.postProcess ? ' Id="_0"' : '') +
- ">" +
+ '') +
+ '<' + envelopeKey + ':Body' +
+ (this.bodyAttributes ? this.bodyAttributes.join(' ') : '') +
+ (this.security && this.security.postProcess ? ' Id="_0"' : '') +
+ '>' +
message +
- "</" + envelopeKey + ":Body>" +
- "</" + envelopeKey + ":Envelope>";
-
- if(self.security && self.security.postProcess){
- xml = self.security.postProcess(xml, envelopeKey);
+ '</' + envelopeKey + ':Body>' +
+ '</' + envelopeKey + ':Envelope>';
+ if (this.security && this.security.postProcess) {
+ xml = this.security.postProcess(xml, envelopeKey);
}
-
- if(options && options.postProcess){
+ if (options && options.postProcess) {
xml = options.postProcess(xml);
}
-
- self.lastMessage = message;
- self.lastRequest = xml;
- self.lastEndpoint = location;
-
- var eid = options.exchangeId || uuid4();
-
- self.emit('message', message, eid);
- self.emit('request', xml, eid);
-
- var tryJSONparse = function(body) {
+ this.lastMessage = message;
+ this.lastRequest = xml;
+ this.lastEndpoint = location;
+ var eid = options.exchangeId || uuid_1.v4();
+ this.emit('message', message, eid);
+ this.emit('request', xml, eid);
+ var tryJSONparse = function (body) {
try {
return JSON.parse(body);
}
- catch(err) {
+ catch (err) {
return undefined;
}
};
-
- if (this.streamAllowed && typeof self.httpClient.requestStream === 'function') {
+ if (this.streamAllowed && typeof this.httpClient.requestStream === 'function') {
callback = _.once(callback);
- var startTime = Date.now();
- req = self.httpClient.requestStream(location, xml, headers, options, self);
- self.lastRequestHeaders = req.headers;
- var onError = function onError(err) {
- self.lastResponse = null;
- self.lastResponseHeaders = null;
- self.lastElapsedTime = null;
- self.emit('response', null, null, eid);
-
+ var startTime_1 = Date.now();
+ req = this.httpClient.requestStream(location, xml, headers, options, this);
+ this.lastRequestHeaders = req.headers;
+ var onError_1 = function (err) {
+ _this.lastResponse = null;
+ _this.lastResponseHeaders = null;
+ _this.lastElapsedTime = null;
+ _this.emit('response', null, null, eid);
callback(err, undefined, undefined, undefined, xml);
};
- req.on('error', onError);
+ req.on('error', onError_1);
req.on('response', function (response) {
- response.on('error', onError);
-
+ response.on('error', onError_1);
// When the output element cannot be looked up in the wsdl, play it safe and
// don't stream
- if(response.statusCode !== 200 || !output || !output.$lookupTypes) {
- response.pipe(concatStream({encoding: 'string'}, function (body) {
- self.lastResponse = body;
- self.lastResponseHeaders = response && response.headers;
- self.lastElapsedTime = Date.now() - startTime;
- self.emit('response', body, response, eid);
-
+ if (response.statusCode !== 200 || !output || !output.$lookupTypes) {
+ response.pipe(concatStream({ encoding: 'string' }, function (body) {
+ _this.lastResponse = body;
+ _this.lastResponseHeaders = response && response.headers;
+ _this.lastElapsedTime = Date.now() - startTime_1;
+ _this.emit('response', body, response, eid);
return parseSync(body, response);
-
}));
return;
}
-
- self.wsdl.xmlToObject(response, function (error, obj) {
- self.lastResponse = response;
- self.lastResponseHeaders = response && response.headers;
- self.lastElapsedTime = Date.now() - startTime;
- self.emit('response', '<stream>', response, eid);
-
+ _this.wsdl.xmlToObject(response, function (error, obj) {
+ _this.lastResponse = response;
+ _this.lastResponseHeaders = response && response.headers;
+ _this.lastElapsedTime = Date.now() - startTime_1;
+ _this.emit('response', '<stream>', response, eid);
if (error) {
error.response = response;
error.body = '<stream>';
- self.emit('soapError', error, eid);
+ _this.emit('soapError', error, eid);
return callback(error, response, undefined, undefined, xml);
}
-
return finish(obj, '<stream>', response);
});
});
return;
}
-
- req = self.httpClient.request(location, xml, function(err, response, body) {
- self.lastResponse = body;
- self.lastResponseHeaders = response && response.headers;
- self.lastElapsedTime = response && response.elapsedTime;
- self.emit('response', body, response, eid);
-
+ req = this.httpClient.request(location, xml, function (err, response, body) {
+ _this.lastResponse = body;
+ _this.lastResponseHeaders = response && response.headers;
+ _this.lastElapsedTime = response && response.elapsedTime;
+ _this.emit('response', body, response, eid);
if (err) {
callback(err, undefined, undefined, undefined, xml);
- } else {
- return parseSync(body, response);
}
- }, headers, options, self);
-
- function parseSync(body, response) {
- var obj;
- try {
- obj = self.wsdl.xmlToObject(body);
- } catch (error) {
- // When the output element cannot be looked up in the wsdl and the body is JSON
- // instead of sending the error, we pass the body in the response.
- if(!output || !output.$lookupTypes) {
- debug('Response element is not present. Unable to convert response xml to json.');
- // If the response is JSON then return it as-is.
- var json = _.isObject(body) ? body : tryJSONparse(body);
- if (json) {
- return callback(null, response, json, undefined, xml);
- }
- }
- error.response = response;
- error.body = body;
- self.emit('soapError', error, eid);
- return callback(error, response, body, undefined, xml);
- }
- return finish(obj, body, response);
- }
-
- function finish(obj, body, response) {
- var result;
-
- if (!output){
- // one-way, no output expected
- return callback(null, null, body, obj.Header, xml);
- }
-
- // If it's not HTML and Soap Body is empty
- if (!obj.html && !obj.Body) {
- return callback(null, obj, body, obj.Header);
- }
-
- if( typeof obj.Body !== 'object' ) {
- var error = new Error('Cannot parse response');
- error.response = response;
- error.body = body;
- return callback(error, obj, body, undefined, xml);
- }
-
- result = obj.Body[output.$name];
- // RPC/literal response body may contain elements with added suffixes I.E.
- // 'Response', or 'Output', or 'Out'
- // This doesn't necessarily equal the ouput message name. See WSDL 1.1 Section 2.4.5
- if(!result){
- result = obj.Body[output.$name.replace(/(?:Out(?:put)?|Response)$/, '')];
- }
- if (!result) {
- ['Response', 'Out', 'Output'].forEach(function (term) {
- if (obj.Body.hasOwnProperty(name + term)) {
- return result = obj.Body[name + term];
- }
- });
- }
-
- callback(null, result, body, obj.Header, xml);
+ else {
+ return parseSync(body, response);
}
-
+ }, headers, options, this);
// Added mostly for testability, but possibly useful for debugging
- if(req && req.headers && !options.ntlm) //fixes an issue when req or req.headers is undefined, doesn't apply to ntlm requests
- self.lastRequestHeaders = req.headers;
-};
-
+ if (req && req.headers && !options.ntlm) { // fixes an issue when req or req.headers is undefined, doesn't apply to ntlm requests
+ this.lastRequestHeaders = req.headers;
+ }
+ };
+ return Client;
+}(events_1.EventEmitter));
exports.Client = Client;
+//# sourceMappingURL=client.js.map
\ No newline at end of file

lib/client.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,+BAAiC;AACjC,0CAA4C;AAC5C,4CAA8C;AAC9C,oCAAsC;AACtC,iCAAsC;AAEtC,0BAA4B;AAE5B,6BAAmC;AACnC,+BAA6C;AAE7C,iCAAqC;AAIrC,IAAM,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;AAExC,IAAM,kBAAkB,GAAG,cAAc,CAAC;AAyB1C;IAA4B,0BAAY;IAsBtC,gBAAY,IAAU,EAAE,QAAiB,EAAE,OAAkB;QAA7D,YACE,iBAAO,SAWR;QAVC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACjC,KAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QACnC,KAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,IAAI,iBAAU,CAAC,OAAO,CAAC,CAAC;QAChE,IAAM,cAAc,GAA8C,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QACtF,IAAI,OAAO,CAAC,qBAAqB,EAAE;YACjC,cAAc,CAAC,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;SACvD;QACD,eAAe,CAAC,YAAY,CAAC,KAAI,EAAE,cAAc,CAAC,CAAC;;IACrD,CAAC;IAED,yCAAyC;IAClC,8BAAa,GAApB,UAAqB,UAAe,EAAE,IAAa,EAAE,SAAkB,EAAE,KAAc;QACrF,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;SACvB;QACD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAClC,UAAU,GAAG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,CAAC,CAAC;YAE3C,IAAI,GAAG,EAAE;gBACP,QAAQ,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;aACrD;iBAAM;gBACL,OAAO,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;aAClC;QACH,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAE3B,kEAAkE;QAClE,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,sFAAsF;YAC/H,IAAI,CAAC,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAAC;SACvC;IACH,CAAC;IACH,aAAC;AAAD,CAAC,AA9bD,CAA4B,qBAAY,GA8bvC;AA9bY,wBAAM"}
\ No newline at end of file

lib/http.d.ts

@@ -0,0 +1,42 @@
+import * as req from 'request';
+import { IHeaders, IOptions } from './types';
+export interface IExOptions {
+ [key: string]: any;
+}
+export interface IAttachment {
+ name: string;
+ contentId: string;
+ mimetype: string;
+ body: ReadableStream;
+}
+export declare type Request = req.Request;
+/**
+ * A class representing the http client
+ * @param {Object} [options] Options object. It allows the customization of
+ * `request` module
+ *
+ * @constructor
+ */
+export declare class HttpClient {
+ private _request;
+ constructor(options?: IOptions);
+ /**
+ * Build the HTTP request (method, uri, headers, ...)
+ * @param {String} rurl The resource url
+ * @param {Object|String} data The payload
+ * @param {Object} exheaders Extra http headers
+ * @param {Object} exoptions Extra options
+ * @returns {Object} The http request object for the `request` module
+ */
+ buildRequest(rurl: string, data: any, exheaders?: IHeaders, exoptions?: IExOptions): any;
+ /**
+ * Handle the http response
+ * @param {Object} The req object
+ * @param {Object} res The res object
+ * @param {Object} body The http body
+ * @param {Object} The parsed body
+ */
+ handleResponse(req: req.Request, res: req.Response, body: any): any;
+ request(rurl: string, data: any, callback: (error: any, res?: any, body?: any) => any, exheaders?: IHeaders, exoptions?: IExOptions, caller?: any): req.Request;
+ requestStream(rurl: string, data: any, exheaders?: IHeaders, exoptions?: IExOptions, caller?: any): req.Request;
+}

lib/http.js

@@ -1,17 +1,17 @@
+"use strict";
/*
* Copyright (c) 2011 Vinay Pulim <vinay@milewise.com>
* MIT Licensed
*/
-
-'use strict';
-
-var url = require('url');
-var req = require('request');
-var debug = require('debug')('node-soap');
-var httpNtlm = require('httpntlm');
-
+exports.__esModule = true;
+var debugBuilder = require("debug");
+var httpNtlm = require("httpntlm");
+var _ = require("lodash");
+var req = require("request");
+var url = require("url");
+var uuid = require("uuid/v4");
+var debug = debugBuilder('node-soap');
var VERSION = require('../package.json').version;
-
/**
* A class representing the http client
* @param {Object} [options] Options object. It allows the customization of
@@ -19,12 +19,12 @@
*
* @constructor
*/
-function HttpClient(options) {
+var HttpClient = /** @class */ (function () {
+ function HttpClient(options) {
options = options || {};
this._request = options.request || req;
-}
-
-/**
+ }
+ /**
* Build the HTTP request (method, uri, headers, ...)
* @param {String} rurl The resource url
* @param {Object|String} data The payload
@@ -32,7 +32,8 @@
* @param {Object} exoptions Extra options
* @returns {Object} The http request object for the `request` module
*/
-HttpClient.prototype.buildRequest = function(rurl, data, exheaders, exoptions) {
+ HttpClient.prototype.buildRequest = function (rurl, data, exheaders, exoptions) {
+ if (exoptions === void 0) { exoptions = {}; }
var curl = url.parse(rurl);
var secure = curl.protocol === 'https:';
var host = curl.hostname;
@@ -44,14 +45,12 @@
'Accept': 'text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8',
'Accept-Encoding': 'none',
'Accept-Charset': 'utf-8',
- 'Connection': exoptions && exoptions.forever ? 'keep-alive' : 'close',
+ 'Connection': exoptions.forever ? 'keep-alive' : 'close',
'Host': host + (isNaN(port) ? '' : ':' + port)
};
- var attr;
- var header;
var mergeOptions = ['headers'];
-
- if (typeof data === 'string') {
+ var attachments = exoptions.attachments || [];
+ if (typeof data === 'string' && attachments.length === 0) {
headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
headers['Content-Type'] = 'application/x-www-form-urlencoded';
}
@@ -55,85 +54,99 @@
headers['Content-Length'] = Buffer.byteLength(data, 'utf8');
headers['Content-Type'] = 'application/x-www-form-urlencoded';
}
-
exheaders = exheaders || {};
- for (attr in exheaders) {
+ for (var attr in exheaders) {
headers[attr] = exheaders[attr];
}
-
var options = {
uri: curl,
method: method,
headers: headers,
followAllRedirects: true
};
-
-
+ if (attachments.length > 0) {
+ var start = uuid();
+ headers['Content-Type'] =
+ 'multipart/related; type="application/xop+xml"; start="<' + start + '>"; start-info="text/xml"; boundary=' + uuid();
+ var multipart_1 = [{
+ 'Content-Type': 'application/xop+xml; charset=UTF-8; type="text/xml"',
+ 'Content-ID': '<' + start + '>',
+ 'body': data
+ }];
+ attachments.forEach(function (attachment) {
+ multipart_1.push({
+ 'Content-Type': attachment.mimetype,
+ 'Content-Transfer-Encoding': 'binary',
+ 'Content-ID': '<' + attachment.contentId + '>',
+ 'Content-Disposition': 'attachment; filename="' + attachment.name + '"',
+ 'body': attachment.body
+ });
+ });
+ options.multipart = multipart_1;
+ }
+ else {
options.body = data;
-
-
- exoptions = exoptions || {};
- for (attr in exoptions) {
+ }
+ for (var attr in _.omit(exoptions, ['attachments'])) {
if (mergeOptions.indexOf(attr) !== -1) {
- for (header in exoptions[attr]) {
+ for (var header in exoptions[attr]) {
options[attr][header] = exoptions[attr][header];
}
- } else {
+ }
+ else {
options[attr] = exoptions[attr];
}
}
debug('Http request: %j', options);
return options;
-};
-
-/**
+ };
+ /**
* Handle the http response
* @param {Object} The req object
* @param {Object} res The res object
* @param {Object} body The http body
* @param {Object} The parsed body
*/
-HttpClient.prototype.handleResponse = function(req, res, body) {
+ HttpClient.prototype.handleResponse = function (req, res, body) {
debug('Http response body: %j', body);
if (typeof body === 'string') {
// Remove any extra characters that appear before or after the SOAP
// envelope.
- var match =
- body.replace(/<!--[\s\S]*?-->/, "").match(/(?:<\?[^?]*\?>[\s]*)?<([^:]*):Envelope([\S\s]*)<\/\1:Envelope>/i);
+ var match = body.replace(/<!--[\s\S]*?-->/, '').match(/(?:<\?[^?]*\?>[\s]*)?<([^:]*):Envelope([\S\s]*)<\/\1:Envelope>/i);
if (match) {
body = match[0];
}
}
return body;
-};
-
-HttpClient.prototype.request = function(rurl, data, callback, exheaders, exoptions) {
- var self = this;
- var options = self.buildRequest(rurl, data, exheaders, exoptions);
+ };
+ HttpClient.prototype.request = function (rurl, data, callback, exheaders, exoptions, caller) {
+ var _this = this;
+ var options = this.buildRequest(rurl, data, exheaders, exoptions);
var req;
-
if (exoptions !== undefined && exoptions.hasOwnProperty('ntlm')) {
// sadly when using ntlm nothing to return
// Not sure if this can be handled in a cleaner way rather than an if/else,
// will to tidy up if I get chance later, patches welcome - insanityinside
+ // TODO - should the following be uri?
options.url = rurl;
httpNtlm[options.method.toLowerCase()](options, function (err, res) {
if (err) {
return callback(err);
}
// if result is stream
- if( typeof res.body !== 'string') {
+ if (typeof res.body !== 'string') {
res.body = res.body.toString();
}
- res.body = self.handleResponse(req, res, res.body);
+ res.body = _this.handleResponse(req, res, res.body);
callback(null, res, res.body);
});
- } else {
- req = self._request(options, function (err, res, body) {
+ }
+ else {
+ req = this._request(options, function (err, res, body) {
if (err) {
return callback(err);
}
- body = self.handleResponse(req, res, body);
+ body = _this.handleResponse(req, res, body);
callback(null, res, body);
});
}
@@ -137,14 +150,13 @@
callback(null, res, body);
});
}
-
return req;
-};
-
-HttpClient.prototype.requestStream = function(rurl, data, exheaders, exoptions) {
- var self = this;
- var options = self.buildRequest(rurl, data, exheaders, exoptions);
- return self._request(options);
-};
-
-module.exports = HttpClient;
+ };
+ HttpClient.prototype.requestStream = function (rurl, data, exheaders, exoptions, caller) {
+ var options = this.buildRequest(rurl, data, exheaders, exoptions);
+ return this._request(options);
+ };
+ return HttpClient;
+}());
+exports.HttpClient = HttpClient;
+//# sourceMappingURL=http.js.map
\ No newline at end of file

lib/http.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.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,KAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;gBAC3C,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,kCAAa,GAApB,UAAqB,IAAY,EAAE,IAAS,EAAE,SAAoB,EAAE,SAAsB,EAAE,MAAO;QACjG,IAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACpE,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IACH,iBAAC;AAAD,CAAC,AAzJD,IAyJC;AAzJY,gCAAU"}
\ No newline at end of file

lib/nscontext.d.ts

@@ -0,0 +1,91 @@
+interface INamespace {
+ declared: boolean;
+ prefix: string;
+ uri: string;
+}
+/**
+ * Scope for XML namespaces
+ * @param {NamespaceScope} [parent] Parent scope
+ * @returns {NamespaceScope}
+ * @constructor
+ */
+declare class NamespaceScope {
+ parent: NamespaceScope;
+ namespaces: {
+ [key: string]: INamespace;
+ };
+ constructor(parent: NamespaceScope);
+ /**
+ * Look up the namespace URI by prefix
+ * @param {String} prefix Namespace prefix
+ * @param {Boolean} [localOnly] Search current scope only
+ * @returns {String} Namespace URI
+ */
+ getNamespaceURI(prefix: string, localOnly?: boolean): string;
+ getNamespaceMapping(prefix: string): INamespace;
+ /**
+ * Look up the namespace prefix by URI
+ * @param {String} nsUri Namespace URI
+ * @param {Boolean} [localOnly] Search current scope only
+ * @returns {String} Namespace prefix
+ */
+ getPrefix(nsUri: string, localOnly?: boolean): string;
+}
+/**
+ * Namespace context that manages hierarchical scopes
+ * @returns {NamespaceContext}
+ * @constructor
+ */
+export declare class NamespaceContext {
+ scopes: NamespaceScope[];
+ prefixCount: number;
+ currentScope?: NamespaceScope;
+ constructor();
+ /**
+ * Add a prefix/URI namespace mapping
+ * @param {String} prefix Namespace prefix
+ * @param {String} nsUri Namespace URI
+ * @param {Boolean} [localOnly] Search current scope only
+ * @returns {boolean} true if the mapping is added or false if the mapping
+ * already exists
+ */
+ addNamespace(prefix: string, nsUri: string, localOnly?: boolean): boolean;
+ /**
+ * Push a scope into the context
+ * @returns {NamespaceScope} The current scope
+ */
+ pushContext(): NamespaceScope;
+ /**
+ * Pop a scope out of the context
+ * @returns {NamespaceScope} The removed scope
+ */
+ popContext(): NamespaceScope;
+ /**
+ * Look up the namespace URI by prefix
+ * @param {String} prefix Namespace prefix
+ * @param {Boolean} [localOnly] Search current scope only
+ * @returns {String} Namespace URI
+ */
+ getNamespaceURI(prefix: string, localOnly?: boolean): string;
+ /**
+ * Look up the namespace prefix by URI
+ * @param {String} nsURI Namespace URI
+ * @param {Boolean} [localOnly] Search current scope only
+ * @returns {String} Namespace prefix
+ */
+ getPrefix(nsUri: string, localOnly?: boolean): string;
+ /**
+ * Register a namespace
+ * @param {String} nsUri Namespace URI
+ * @returns {String} The matching or generated namespace prefix
+ */
+ registerNamespace(nsUri: string): string;
+ /**
+ * Declare a namespace prefix/uri mapping
+ * @param {String} prefix Namespace prefix
+ * @param {String} nsUri Namespace URI
+ * @returns {Boolean} true if the declaration is created
+ */
+ declareNamespace(prefix: string, nsUri: string): boolean;
+}
+export {};

lib/nscontext.js

@@ -1,42 +1,23 @@
-'use strict';
-
-module.exports = NamespaceContext;
-
+"use strict";
+exports.__esModule = true;
/**
* Scope for XML namespaces
* @param {NamespaceScope} [parent] Parent scope
* @returns {NamespaceScope}
* @constructor
*/
-function NamespaceScope(parent) {
- if (!(this instanceof NamespaceScope)) {
- return new NamespaceScope(parent);
- }
+var NamespaceScope = /** @class */ (function () {
+ function NamespaceScope(parent) {
this.parent = parent;
this.namespaces = {};
-}
-
-/**
- * Namespace context that manages hierarchical scopes
- * @returns {NamespaceContext}
- * @constructor
- */
-function NamespaceContext() {
- if (!(this instanceof NamespaceContext)) {
- return new NamespaceContext();
}
- this.scopes = [];
- this.pushContext();
- this.prefixCount = 0;
-}
-
-/**
+ /**
* Look up the namespace URI by prefix
* @param {String} prefix Namespace prefix
* @param {Boolean} [localOnly] Search current scope only
* @returns {String} Namespace URI
*/
-NamespaceScope.prototype.getNamespaceURI = function(prefix, localOnly) {
+ NamespaceScope.prototype.getNamespaceURI = function (prefix, localOnly) {
switch (prefix) {
case 'xml':
return 'http://www.w3.org/XML/1998/namespace';
@@ -47,15 +28,16 @@
/*jshint -W116 */
if (nsUri != null) {
return nsUri.uri;
- } else if (!localOnly && this.parent) {
+ }
+ else if (!localOnly && this.parent) {
return this.parent.getNamespaceURI(prefix);
- } else {
+ }
+ else {
return null;
}
}
-};
-
-NamespaceScope.prototype.getNamespaceMapping = function(prefix) {
+ };
+ NamespaceScope.prototype.getNamespaceMapping = function (prefix) {
switch (prefix) {
case 'xml':
return {
@@ -74,21 +56,22 @@
/*jshint -W116 */
if (mapping != null) {
return mapping;
- } else if (this.parent) {
+ }
+ else if (this.parent) {
return this.parent.getNamespaceMapping(prefix);
- } else {
+ }
+ else {
return null;
}
}
-};
-
-/**
+ };
+ /**
* Look up the namespace prefix by URI
* @param {String} nsUri Namespace URI
* @param {Boolean} [localOnly] Search current scope only
* @returns {String} Namespace prefix
*/
-NamespaceScope.prototype.getPrefix = function(nsUri, localOnly) {
+ NamespaceScope.prototype.getPrefix = function (nsUri, localOnly) {
switch (nsUri) {
case 'http://www.w3.org/XML/1998/namespace':
return 'xml';
@@ -102,13 +85,26 @@
}
if (!localOnly && this.parent) {
return this.parent.getPrefix(nsUri);
- } else {
+ }
+ else {
return null;
}
}
-};
-
+ };
+ return NamespaceScope;
+}());
/**
+ * Namespace context that manages hierarchical scopes
+ * @returns {NamespaceContext}
+ * @constructor
+ */
+var NamespaceContext = /** @class */ (function () {
+ function NamespaceContext() {
+ this.scopes = [];
+ this.pushContext();
+ this.prefixCount = 0;
+ }
+ /**
* Add a prefix/URI namespace mapping
* @param {String} prefix Namespace prefix
* @param {String} nsUri Namespace URI
@@ -116,7 +112,7 @@
* @returns {boolean} true if the mapping is added or false if the mapping
* already exists
*/
-NamespaceContext.prototype.addNamespace = function(prefix, nsUri, localOnly) {
+ NamespaceContext.prototype.addNamespace = function (prefix, nsUri, localOnly) {
if (this.getNamespaceURI(prefix, localOnly) === nsUri) {
return false;
}
@@ -129,64 +125,61 @@
return true;
}
return false;
-};
-
-/**
+ };
+ /**
* Push a scope into the context
* @returns {NamespaceScope} The current scope
*/
-NamespaceContext.prototype.pushContext = function() {
+ NamespaceContext.prototype.pushContext = function () {
var scope = new NamespaceScope(this.currentScope);
this.scopes.push(scope);
this.currentScope = scope;
return scope;
-};
-
-/**
+ };
+ /**
* Pop a scope out of the context
* @returns {NamespaceScope} The removed scope
*/
-NamespaceContext.prototype.popContext = function() {
+ NamespaceContext.prototype.popContext = function () {
var scope = this.scopes.pop();
if (scope) {
this.currentScope = scope.parent;
- } else {
+ }
+ else {
this.currentScope = null;
}
return scope;
-};
-
-/**
+ };
+ /**
* Look up the namespace URI by prefix
* @param {String} prefix Namespace prefix
* @param {Boolean} [localOnly] Search current scope only
* @returns {String} Namespace URI
*/
-NamespaceContext.prototype.getNamespaceURI = function(prefix, localOnly) {
+ NamespaceContext.prototype.getNamespaceURI = function (prefix, localOnly) {
return this.currentScope && this.currentScope.getNamespaceURI(prefix, localOnly);
-};
-
-/**
+ };
+ /**
* Look up the namespace prefix by URI
* @param {String} nsURI Namespace URI
* @param {Boolean} [localOnly] Search current scope only
* @returns {String} Namespace prefix
*/
-NamespaceContext.prototype.getPrefix = function(nsUri, localOnly) {
+ NamespaceContext.prototype.getPrefix = function (nsUri, localOnly) {
return this.currentScope && this.currentScope.getPrefix(nsUri, localOnly);
-};
-
-/**
+ };
+ /**
* Register a namespace
* @param {String} nsUri Namespace URI
* @returns {String} The matching or generated namespace prefix
*/
-NamespaceContext.prototype.registerNamespace = function(nsUri) {
+ NamespaceContext.prototype.registerNamespace = function (nsUri) {
var prefix = this.getPrefix(nsUri);
if (prefix) {
// If the namespace has already mapped to a prefix
return prefix;
- } else {
+ }
+ else {
// Try to generate a unique namespace
while (true) {
prefix = 'ns' + (++this.prefixCount);
@@ -198,15 +191,14 @@
}
this.addNamespace(prefix, nsUri, true);
return prefix;
-};
-
-/**
+ };
+ /**
* Declare a namespace prefix/uri mapping
* @param {String} prefix Namespace prefix
* @param {String} nsUri Namespace URI
* @returns {Boolean} true if the declaration is created
*/
-NamespaceContext.prototype.declareNamespace = function(prefix, nsUri) {
+ NamespaceContext.prototype.declareNamespace = function (prefix, nsUri) {
if (this.currentScope) {
var mapping = this.currentScope.getNamespaceMapping(prefix);
if (mapping && mapping.uri === nsUri && mapping.declared) {
@@ -220,4 +212,8 @@
return true;
}
return false;
-};
+ };
+ return NamespaceContext;
+}());
+exports.NamespaceContext = NamespaceContext;
+//# sourceMappingURL=nscontext.js.map
\ No newline at end of file

lib/nscontext.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"nscontext.js","sourceRoot":"","sources":["../src/nscontext.ts"],"names":[],"mappings":";;AAOA;;;;;GAKG;AACH;IAIE,wBAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,wCAAe,GAAtB,UAAuB,MAAc,EAAE,SAAmB;QACxD,QAAQ,MAAM,EAAE;YACd,KAAK,KAAK;gBACR,OAAO,sCAAsC,CAAC;YAChD,KAAK,OAAO;gBACV,OAAO,+BAA+B,CAAC;YACzC;gBACE,IAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBACtC,iBAAiB;gBACjB,IAAI,KAAK,IAAI,IAAI,EAAE;oBACjB,OAAO,KAAK,CAAC,GAAG,CAAC;iBAClB;qBAAM,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,EAAE;oBACpC,OAAO,IAAI,CAAC,M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;YACF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACH,uBAAC;AAAD,CAAC,AA5HD,IA4HC;AA5HY,4CAAgB"}
\ No newline at end of file

lib/security/BasicAuthSecurity.d.ts

@@ -0,0 +1,10 @@
+import { IHeaders, ISecurity } from '../types';
+export declare class BasicAuthSecurity implements ISecurity {
+ private _username;
+ private _password;
+ private defaults;
+ constructor(username: string, password: string, defaults?: any);
+ addHeaders(headers: IHeaders): void;
+ toXML(): string;
+ addOptions(options: any): void;
+}

lib/security/BasicAuthSecurity.js

@@ -1,24 +1,23 @@
"use strict";
-
-var _ = require('lodash');
-
-function BasicAuthSecurity(username, password, defaults) {
+exports.__esModule = true;
+var _ = require("lodash");
+var BasicAuthSecurity = /** @class */ (function () {
+ function BasicAuthSecurity(username, password, defaults) {
this._username = username;
this._password = password;
this.defaults = {};
_.merge(this.defaults, defaults);
-}
-
-BasicAuthSecurity.prototype.addHeaders = function(headers) {
+ }
+ BasicAuthSecurity.prototype.addHeaders = function (headers) {
headers.Authorization = 'Basic ' + new Buffer((this._username + ':' + this._password) || '').toString('base64');
-};
-
-BasicAuthSecurity.prototype.toXML = function() {
+ };
+ BasicAuthSecurity.prototype.toXML = function () {
return '';
-};
-
-BasicAuthSecurity.prototype.addOptions = function(options) {
+ };
+ BasicAuthSecurity.prototype.addOptions = function (options) {
_.merge(options, this.defaults);
-};
-
-module.exports = BasicAuthSecurity;
+ };
+ return BasicAuthSecurity;
+}());
+exports.BasicAuthSecurity = BasicAuthSecurity;
+//# sourceMappingURL=BasicAuthSecurity.js.map
\ No newline at end of file

lib/security/BasicAuthSecurity.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"BasicAuthSecurity.js","sourceRoot":"","sources":["../../src/security/BasicAuthSecurity.ts"],"names":[],"mappings":";;AACA,0BAA4B;AAG5B;IAKE,2BAAY,QAAgB,EAAE,QAAgB,EAAE,QAAc;QAC5D,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC;IAEM,sCAAU,GAAjB,UAAkB,OAAiB;QACjC,OAAO,CAAC,aAAa,GAAG,QAAQ,GAAG,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClH,CAAC;IAEM,iCAAK,GAAZ;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,sCAAU,GAAjB,UAAkB,OAAY;QAC5B,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACH,wBAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,8CAAiB"}
\ No newline at end of file

lib/security/BearerSecurity.d.ts

@@ -0,0 +1,9 @@
+import { IHeaders, ISecurity } from '../types';
+export declare class BearerSecurity implements ISecurity {
+ private defaults;
+ private _token;
+ constructor(token: string, defaults?: any);
+ addHeaders(headers: IHeaders): void;
+ toXML(): string;
+ addOptions(options: any): void;
+}

lib/security/BearerSecurity.js

@@ -1,23 +1,22 @@
"use strict";
-
-var _ = require('lodash');
-
-function BearerSecurity(token, defaults) {
+exports.__esModule = true;
+var _ = require("lodash");
+var BearerSecurity = /** @class */ (function () {
+ function BearerSecurity(token, defaults) {
this._token = token;
this.defaults = {};
_.merge(this.defaults, defaults);
-}
-
-BearerSecurity.prototype.addHeaders = function(headers) {
- headers.Authorization = "Bearer " + this._token;
-};
-
-BearerSecurity.prototype.toXML = function() {
+ }
+ BearerSecurity.prototype.addHeaders = function (headers) {
+ headers.Authorization = 'Bearer ' + this._token;
+ };
+ BearerSecurity.prototype.toXML = function () {
return '';
-};
-
-BearerSecurity.prototype.addOptions = function(options) {
+ };
+ BearerSecurity.prototype.addOptions = function (options) {
_.merge(options, this.defaults);
-};
-
-module.exports = BearerSecurity;
+ };
+ return BearerSecurity;
+}());
+exports.BearerSecurity = BearerSecurity;
+//# sourceMappingURL=BearerSecurity.js.map
\ No newline at end of file

lib/security/BearerSecurity.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"BearerSecurity.js","sourceRoot":"","sources":["../../src/security/BearerSecurity.ts"],"names":[],"mappings":";;AACA,0BAA4B;AAG5B;IAIE,wBAAY,KAAa,EAAE,QAAc;QACvC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC;IAEM,mCAAU,GAAjB,UAAkB,OAAiB;QACjC,OAAO,CAAC,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;IAClD,CAAC;IAEM,8BAAK,GAAZ;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,mCAAU,GAAjB,UAAkB,OAAY;QAC5B,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACH,qBAAC;AAAD,CAAC,AArBD,IAqBC;AArBY,wCAAc"}
\ No newline at end of file

lib/security/ClientSSLSecurity.d.ts

@@ -0,0 +1,22 @@
+/// <reference types="node" />
+import { ISecurity } from '../types';
+/**
+ * activates SSL for an already existing client
+ *
+ * @module ClientSSLSecurity
+ * @param {Buffer|String} key
+ * @param {Buffer|String} cert
+ * @param {Buffer|String|Array} [ca]
+ * @param {Object} [defaults]
+ * @constructor
+ */
+export declare class ClientSSLSecurity implements ISecurity {
+ private key;
+ private cert;
+ private ca;
+ private defaults;
+ private agent;
+ constructor(key: string | Buffer, cert: string | Buffer, defaults?: any);
+ toXML(): string;
+ addOptions(options: any): void;
+}

lib/security/ClientSSLSecurity.js

@@ -1,9 +1,8 @@
-'use strict';
-
-var fs = require('fs')
- , https = require('https')
- , _ = require('lodash');
-
+"use strict";
+exports.__esModule = true;
+var fs = require("fs");
+var https = require("https");
+var _ = require("lodash");
/**
* activates SSL for an already existing client
*
@@ -14,13 +13,16 @@
* @param {Object} [defaults]
* @constructor
*/
-function ClientSSLSecurity(key, cert, ca, defaults) {
+var ClientSSLSecurity = /** @class */ (function () {
+ function ClientSSLSecurity(key, cert, ca, defaults) {
if (key) {
- if(Buffer.isBuffer(key)) {
+ if (Buffer.isBuffer(key)) {
this.key = key;
- } else if (typeof key === 'string') {
+ }
+ else if (typeof key === 'string') {
this.key = fs.readFileSync(key);
- } else {
+ }
+ else {
throw new Error('key should be a buffer or a string!');
}
}
@@ -24,13 +26,14 @@
throw new Error('key should be a buffer or a string!');
}
}
-
if (cert) {
- if(Buffer.isBuffer(cert)) {
+ if (Buffer.isBuffer(cert)) {
this.cert = cert;
- } else if (typeof cert === 'string') {
+ }
+ else if (typeof cert === 'string') {
this.cert = fs.readFileSync(cert);
- } else {
+ }
+ else {
throw new Error('cert should be a buffer or a string!');
}
}
@@ -34,13 +37,14 @@
throw new Error('cert should be a buffer or a string!');
}
}
-
if (ca) {
- if(Buffer.isBuffer(ca) || Array.isArray(ca)) {
+ if (Buffer.isBuffer(ca) || Array.isArray(ca)) {
this.ca = ca;
- } else if (typeof ca === 'string') {
+ }
+ else if (typeof ca === 'string') {
this.ca = fs.readFileSync(ca);
- } else {
+ }
+ else {
defaults = ca;
this.ca = null;
}
@@ -45,20 +49,15 @@
this.ca = null;
}
}
-
this.defaults = {};
_.merge(this.defaults, defaults);
-
this.agent = null;
-}
-
-ClientSSLSecurity.prototype.toXML = function(headers) {
+ }
+ ClientSSLSecurity.prototype.toXML = function () {
return '';
-};
-
-ClientSSLSecurity.prototype.addOptions = function(options) {
+ };
+ ClientSSLSecurity.prototype.addOptions = function (options) {
var httpsAgent = null;
-
options.key = this.key;
options.cert = this.cert;
options.ca = this.ca;
@@ -67,16 +65,16 @@
if (!!options.forever) {
if (!this.agent) {
options.keepAlive = true;
-
this.agent = new https.Agent(options);
}
-
httpsAgent = this.agent;
- } else {
+ }
+ else {
httpsAgent = new https.Agent(options);
}
-
options.agent = httpsAgent;
-};
-
-module.exports = ClientSSLSecurity;
+ };
+ return ClientSSLSecurity;
+}());
+exports.ClientSSLSecurity = ClientSSLSecurity;
+//# sourceMappingURL=ClientSSLSecurity.js.map
\ No newline at end of file

lib/security/ClientSSLSecurity.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"ClientSSLSecurity.js","sourceRoot":"","sources":["../../src/security/ClientSSLSecurity.ts"],"names":[],"mappings":";;AACA,uBAAyB;AACzB,6BAA+B;AAC/B,0BAA4B;AAG5B;;;;;;;;;GASG;AACH;IAQE,2BAAY,GAAoB,EAAE,IAAqB,EAAE,EAA4B,EAAE,QAAc;QACnG,IAAI,GAAG,EAAE;YACP,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;aAChB;iBAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBAClC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aACjC;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;aACxD;SACF;QAED,IAAI,IAAI,EAAE;YACR,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;aAClB;iBAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;gBACnC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;aACnC;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;aACzD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C,KAAK,CAAC,OAAO,CAAC,CAAC;SACvC;QAED,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC;IAC7B,CAAC;IACH,wBAAC;AAAD,CAAC,AAxED,IAwEC;AAxEY,8CAAiB"}
\ No newline at end of file

lib/security/ClientSSLSecurityPFX.d.ts

@@ -0,0 +1,18 @@
+/// <reference types="node" />
+import { ISecurity } from '../types';
+/**
+ * activates SSL for an already existing client using a PFX cert
+ *
+ * @module ClientSSLSecurityPFX
+ * @param {Buffer|String} pfx
+ * @param {String} passphrase
+ * @constructor
+ */
+export declare class ClientSSLSecurityPFX implements ISecurity {
+ private pfx;
+ private defaults;
+ private passphrase;
+ constructor(pfx: string | Buffer, defaults?: any);
+ toXML(): string;
+ addOptions(options: any): void;
+}

lib/security/ClientSSLSecurityPFX.js

@@ -1,9 +1,8 @@
-'use strict';
-
-var fs = require('fs')
- , https = require('https')
- , _ = require('lodash');
-
+"use strict";
+exports.__esModule = true;
+var fs = require("fs");
+var https = require("https");
+var _ = require("lodash");
/**
* activates SSL for an already existing client using a PFX cert
*
@@ -12,16 +11,19 @@
* @param {String} passphrase
* @constructor
*/
-function ClientSSLSecurityPFX(pfx, passphrase, defaults) {
+var ClientSSLSecurityPFX = /** @class */ (function () {
+ function ClientSSLSecurityPFX(pfx, passphrase, defaults) {
if (typeof passphrase === 'object') {
defaults = passphrase;
}
if (pfx) {
if (Buffer.isBuffer(pfx)) {
this.pfx = pfx;
- } else if (typeof pfx === 'string') {
+ }
+ else if (typeof pfx === 'string') {
this.pfx = fs.readFileSync(pfx);
- } else {
+ }
+ else {
throw new Error('supplied pfx file should be a buffer or a file location');
}
}
@@ -33,19 +34,19 @@
}
this.defaults = {};
_.merge(this.defaults, defaults);
-}
-
-ClientSSLSecurityPFX.prototype.toXML = function(headers) {
+ }
+ ClientSSLSecurityPFX.prototype.toXML = function () {
return '';
-};
-
-ClientSSLSecurityPFX.prototype.addOptions = function(options) {
+ };
+ ClientSSLSecurityPFX.prototype.addOptions = function (options) {
options.pfx = this.pfx;
if (this.passphrase) {
options.passphrase = this.passphrase;
}
_.merge(options, this.defaults);
options.agent = new https.Agent(options);
-};
-
-module.exports = ClientSSLSecurityPFX;
+ };
+ return ClientSSLSecurityPFX;
+}());
+exports.ClientSSLSecurityPFX = ClientSSLSecurityPFX;
+//# sourceMappingURL=ClientSSLSecurityPFX.js.map
\ No newline at end of file

lib/security/ClientSSLSecurityPFX.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"ClientSSLSecurityPFX.js","sourceRoot":"","sources":["../../src/security/ClientSSLSecurityPFX.ts"],"names":[],"mappings":";;AACA,uBAAyB;AACzB,6BAA+B;AAC/B,0BAA4B;AAG5B;;;;;;;GAOG;AACH;IAME,8BAAY,GAAoB,EAAE,UAAkB,EAAE,QAAc;QAClE,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAClC,QAAQ,GAAG,UAAU,CAAC;SACvB;QACD,IAAI,GAAG,EAAE;YACP,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACxB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;aAChB;iBAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBAClC,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aACjC;iBAAM;gBACL,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;aAC5E;SACF;QAED,IAAI,UAAU,EAAE;YACd,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;gBAClC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;aAC9B;SACF;QACD,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACnC,CAAC;IAEM,oCAAK,GAAZ;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,yCAAU,GAAjB,UAAkB,OAAY;QAC5B,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,EAAE;YACnB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;SACtC;QACD,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IACH,2BAAC;AAAD,CAAC,AAzCD,IAyCC;AAzCY,oDAAoB"}
\ No newline at end of file

lib/security/index.d.ts

@@ -0,0 +1,7 @@
+export * from './BasicAuthSecurity';
+export * from './BearerSecurity';
+export * from './ClientSSLSecurity';
+export * from './ClientSSLSecurityPFX';
+export * from './NTLMSecurity';
+export * from './WSSecurity';
+export * from './WSSecurityCert';

lib/security/index.js

@@ -1,11 +1,13 @@
"use strict";
-
-module.exports = {
- BasicAuthSecurity: require('./BasicAuthSecurity')
-, NTLMSecurity: require('./NTLMSecurity')
-, ClientSSLSecurity: require('./ClientSSLSecurity')
-, ClientSSLSecurityPFX: require('./ClientSSLSecurityPFX')
-, WSSecurity: require('./WSSecurity')
-, BearerSecurity: require('./BearerSecurity')
-, WSSecurityCert: require('./WSSecurityCert')
-};
+function __export(m) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+exports.__esModule = true;
+__export(require("./BasicAuthSecurity"));
+__export(require("./BearerSecurity"));
+__export(require("./ClientSSLSecurity"));
+__export(require("./ClientSSLSecurityPFX"));
+__export(require("./NTLMSecurity"));
+__export(require("./WSSecurity"));
+__export(require("./WSSecurityCert"));
+//# sourceMappingURL=index.js.map
\ No newline at end of file

lib/security/index.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":";;;;;AACA,yCAAoC;AACpC,sCAAiC;AACjC,yCAAoC;AACpC,4CAAuC;AACvC,oCAA+B;AAC/B,kCAA6B;AAC7B,sCAAiC"}
\ No newline at end of file

lib/security/NTLMSecurity.d.ts

@@ -0,0 +1,8 @@
+import { IHeaders, ISecurity } from '../types';
+export declare class NTLMSecurity implements ISecurity {
+ private defaults;
+ constructor(defaults: any);
+ addHeaders(headers: IHeaders): void;
+ toXML(): string;
+ addOptions(options: any): void;
+}

lib/security/NTLMSecurity.js

@@ -1,12 +1,13 @@
"use strict";
-
-var _ = require('lodash');
-
-function NTLMSecurity(username, password, domain, workstation) {
- if (typeof username === "object") {
+exports.__esModule = true;
+var _ = require("lodash");
+var NTLMSecurity = /** @class */ (function () {
+ function NTLMSecurity(username, password, domain, workstation) {
+ if (typeof username === 'object') {
this.defaults = username;
this.defaults.ntlm = true;
- } else {
+ }
+ else {
this.defaults = {
ntlm: true,
username: username,
@@ -15,18 +16,17 @@
workstation: workstation
};
}
-}
-
-NTLMSecurity.prototype.addHeaders = function (headers) {
+ }
+ NTLMSecurity.prototype.addHeaders = function (headers) {
headers.Connection = 'keep-alive';
-};
-
-NTLMSecurity.prototype.toXML = function () {
+ };
+ NTLMSecurity.prototype.toXML = function () {
return '';
-};
-
-NTLMSecurity.prototype.addOptions = function (options) {
+ };
+ NTLMSecurity.prototype.addOptions = function (options) {
_.merge(options, this.defaults);
-};
-
-module.exports = NTLMSecurity;
+ };
+ return NTLMSecurity;
+}());
+exports.NTLMSecurity = NTLMSecurity;
+//# sourceMappingURL=NTLMSecurity.js.map
\ No newline at end of file

lib/security/NTLMSecurity.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"NTLMSecurity.js","sourceRoot":"","sources":["../../src/security/NTLMSecurity.ts"],"names":[],"mappings":";;AACA,0BAA4B;AAG5B;IAIE,sBAAY,QAAa,EAAE,QAAiB,EAAE,MAAe,EAAE,WAAoB;QACjF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;SAC3B;aAAM;YACL,IAAI,CAAC,QAAQ,GAAG;gBACd,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,QAAQ;gBAClB,QAAQ,EAAE,QAAQ;gBAClB,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,WAAW;aACzB,CAAC;SACH;IACH,CAAC;IAEM,iCAAU,GAAjB,UAAkB,OAAiB;QACjC,OAAO,CAAC,UAAU,GAAG,YAAY,CAAC;IACpC,CAAC;IAEM,4BAAK,GAAZ;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,iCAAU,GAAjB,UAAkB,OAAY;QAC5B,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACH,mBAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,oCAAY"}
\ No newline at end of file

lib/security/templates/wsse-security-header.ejs

@@ -1,12 +0,0 @@
-<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- soap:mustUnderstand="1">
- <wsse:BinarySecurityToken
- EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
- ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"
- wsu:Id="<%-id%>"><%-binaryToken%></wsse:BinarySecurityToken><% if (hasTimeStamp === true) { %>
- <Timestamp xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" Id="_1">
- <Created><%-created%></Created>
- <Expires><%-expires%></Expires>
- </Timestamp> <% } %>
-</wsse:Security>

lib/security/templates/wsse-security-token.ejs

@@ -1,3 +0,0 @@
-<wsse:SecurityTokenReference>
- <wsse:Reference URI="#<%-x509Id%>" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
-</wsse:SecurityTokenReference>

lib/security/WSSecurityCert.d.ts

@@ -0,0 +1,17 @@
+import { ISecurity } from '../types';
+export interface IWSSecurityCertOptions {
+ hasTimeStamp?: boolean;
+ signatureTransformations?: string[];
+ signatureAlgorithm?: string;
+}
+export declare class WSSecurityCert implements ISecurity {
+ private publicP12PEM;
+ private signer;
+ private x509Id;
+ private hasTimeStamp;
+ private signatureTransformations;
+ private created;
+ private expires;
+ constructor(privatePEM: any, publicP12PEM: any, password: any, options?: IWSSecurityCertOptions);
+ postProcess(xml: any, envelopeKey: any): string;
+}

lib/security/WSSecurityCert.js

@@ -1,13 +1,7 @@
"use strict";
-
-var fs = require('fs');
-var path = require('path');
-var ejs = require('ejs');
-var SignedXml = require('xml-crypto').SignedXml;
-var uuid4 = require('uuid/v4');
-var wsseSecurityHeaderTemplate;
-var wsseSecurityTokenTemplate;
-
+exports.__esModule = true;
+var uuid_1 = require("uuid");
+var xml_crypto_1 = require("xml-crypto");
function addMinutes(date, minutes) {
return new Date(date.getTime() + minutes * 60000);
}
@@ -11,13 +5,11 @@
function addMinutes(date, minutes) {
return new Date(date.getTime() + minutes * 60000);
}
-
function dateStringForSOAP(date) {
return date.getUTCFullYear() + '-' + ('0' + (date.getUTCMonth() + 1)).slice(-2) + '-' +
- ('0' + date.getUTCDate()).slice(-2) + 'T' + ('0' + date.getUTCHours()).slice(-2) + ":" +
- ('0' + date.getUTCMinutes()).slice(-2) + ":" + ('0' + date.getUTCSeconds()).slice(-2) + "Z";
+ ('0' + date.getUTCDate()).slice(-2) + 'T' + ('0' + date.getUTCHours()).slice(-2) + ':' +
+ ('0' + date.getUTCMinutes()).slice(-2) + ':' + ('0' + date.getUTCSeconds()).slice(-2) + 'Z';
}
-
function generateCreated() {
return dateStringForSOAP(new Date());
}
@@ -29,16 +19,23 @@
function insertStr(src, dst, pos) {
return [dst.slice(0, pos), src, dst.slice(pos)].join('');
}
-
function generateId() {
- return uuid4().replace(/-/gm, '');
+ return uuid_1.v4().replace(/-/gm, '');
}
-
-function WSSecurityCert(privatePEM, publicP12PEM, password, options) {
+var oasisBaseUri = 'http://docs.oasis-open.org/wss/2004/01';
+var WSSecurityCert = /** @class */ (function () {
+ function WSSecurityCert(privatePEM, publicP12PEM, password, options) {
+ var _this = this;
options = options || {};
- this.publicP12PEM = publicP12PEM.toString().replace('-----BEGIN CERTIFICATE-----', '').replace('-----END CERTIFICATE-----', '').replace(/(\r\n|\n|\r)/gm, '');
-
- this.signer = new SignedXml();
+ this.publicP12PEM = publicP12PEM.toString()
+ .replace('-----BEGIN CERTIFICATE-----', '')
+ .replace('-----END CERTIFICATE-----', '')
+ .replace(/(\r\n|\n|\r)/gm, '');
+ this.signer = new xml_crypto_1.SignedXml();
+ if (options.signatureAlgorithm === 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256') {
+ this.signer.signatureAlgorithm = options.signatureAlgorithm;
+ this.signer.addReference('//*[name(.)="soap:Body"]', ['http://www.w3.org/2001/10/xml-exc-c14n#'], 'http://www.w3.org/2001/04/xmlenc#sha256');
+ }
this.signer.signingKey = {
key: privatePEM,
passphrase: password
@@ -46,48 +43,48 @@
this.x509Id = "x509-" + generateId();
this.hasTimeStamp = typeof options.hasTimeStamp === 'undefined' ? true : !!options.hasTimeStamp;
this.signatureTransformations = Array.isArray(options.signatureTransformations) ? options.signatureTransformations
- : ["http://www.w3.org/2000/09/xmldsig#enveloped-signature", "http://www.w3.org/2001/10/xml-exc-c14n#"];
-
- var _this = this;
+ : ['http://www.w3.org/2000/09/xmldsig#enveloped-signature', 'http://www.w3.org/2001/10/xml-exc-c14n#'];
this.signer.keyInfoProvider = {};
this.signer.keyInfoProvider.getKeyInfo = function (key) {
- if (!wsseSecurityTokenTemplate) {
- wsseSecurityTokenTemplate = ejs.compile(fs.readFileSync(path.join(__dirname, 'templates', 'wsse-security-token.ejs')).toString());
- }
-
- return wsseSecurityTokenTemplate({ x509Id: _this.x509Id });
+ return "<wsse:SecurityTokenReference>" +
+ ("<wsse:Reference URI=\"#" + _this.x509Id + "\" ValueType=\"" + oasisBaseUri + "/oasis-200401-wss-x509-token-profile-1.0#X509v3\"/>") +
+ "</wsse:SecurityTokenReference>";
};
-}
-
-WSSecurityCert.prototype.postProcess = function (xml, envelopeKey) {
+ }
+ WSSecurityCert.prototype.postProcess = function (xml, envelopeKey) {
this.created = generateCreated();
this.expires = generateExpires();
-
- if (!wsseSecurityHeaderTemplate) {
- wsseSecurityHeaderTemplate = ejs.compile(fs.readFileSync(path.join(__dirname, 'templates', 'wsse-security-header.ejs')).toString());
+ var timestampStr = '';
+ if (this.hasTimeStamp) {
+ timestampStr =
+ "<Timestamp xmlns=\"" + oasisBaseUri + "/oasis-200401-wss-wssecurity-utility-1.0.xsd\" Id=\"_1\">" +
+ ("<Created>" + this.created + "</Created>") +
+ ("<Expires>" + this.expires + "</Expires>") +
+ "</Timestamp>";
}
-
- var secHeader = wsseSecurityHeaderTemplate({
- binaryToken: this.publicP12PEM,
- created: this.created,
- expires: this.expires,
- hasTimeStamp: this.hasTimeStamp,
- id: this.x509Id
- });
-
+ var secHeader = "<wsse:Security xmlns:wsse=\"" + oasisBaseUri + "/oasis-200401-wss-wssecurity-secext-1.0.xsd\" " +
+ ("xmlns:wsu=\"" + oasisBaseUri + "/oasis-200401-wss-wssecurity-utility-1.0.xsd\" ") +
+ "soap:mustUnderstand=\"1\">" +
+ "<wsse:BinarySecurityToken " +
+ ("EncodingType=\"" + oasisBaseUri + "/oasis-200401-wss-soap-message-security-1.0#Base64Binary\" ") +
+ ("ValueType=\"" + oasisBaseUri + "/oasis-200401-wss-x509-token-profile-1.0#X509v3\" ") +
+ ("wsu:Id=\"" + this.x509Id + "\">" + this.publicP12PEM + "</wsse:BinarySecurityToken>") +
+ timestampStr +
+ "</wsse:Security>";
var xmlWithSec = insertStr(secHeader, xml, xml.indexOf('</soap:Header>'));
-
var references = this.signatureTransformations;
-
- this.signer.addReference("//*[name(.)='" + envelopeKey + ":Body']", references);
-
- if (this.hasTimeStamp) {
- this.signer.addReference("//*[name(.)='wsse:Security']/*[local-name(.)='Timestamp']", references);
+ var bodyXpath = "//*[name(.)='" + envelopeKey + ":Body']";
+ if (!(this.signer.references.filter(function (ref) { return (ref.xpath === bodyXpath); }).length > 0)) {
+ this.signer.addReference(bodyXpath, references);
+ }
+ var timestampXpath = "//*[name(.)='wsse:Security']/*[local-name(.)='Timestamp']";
+ if (this.hasTimeStamp && !(this.signer.references.filter(function (ref) { return (ref.xpath === timestampXpath); }).length > 0)) {
+ this.signer.addReference(timestampXpath, references);
}
-
this.signer.computeSignature(xmlWithSec);
-
return insertStr(this.signer.getSignatureXml(), xmlWithSec, xmlWithSec.indexOf('</wsse:Security>'));
-};
-
-module.exports = WSSecurityCert;
+ };
+ return WSSecurityCert;
+}());
+exports.WSSecurityCert = WSSecurityCert;
+//# sourceMappingURL=WSSecurityCert.js.map
\ No newline at end of file

lib/security/WSSecurityCert.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"WSSecurityCert.js","sourceRoot":"","sources":["../../src/security/WSSecurityCert.ts"],"names":[],"mappings":";;AACA,6BAAmC;AACnC,yCAAuC;AAGvC,SAAS,UAAU,CAAC,IAAU,EAAE,OAAe;IAC7C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,GAAG,KAAK,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAU;IACnC,OAAO,IAAI,CAAC,cAAc,EAAE,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG;QACnF,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GA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,UAAU,CAAC,CAAC;SACtD;QAED,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAEzC,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACtG,CAAC;IACH,qBAAC;AAAD,CAAC,AApFD,IAoFC;AApFY,wCAAc"}
\ No newline at end of file

lib/security/WSSecurity.d.ts

@@ -0,0 +1,21 @@
+import { ISecurity } from '../types';
+export interface IWSSecurityOptions {
+ passwordType?: string;
+ hasTimeStamp?: boolean;
+ hasNonce?: boolean;
+ hasTokenCreated?: boolean;
+ actor?: string;
+ mustUnderstand?: any;
+}
+export declare class WSSecurity implements ISecurity {
+ private _username;
+ private _password;
+ private _passwordType;
+ private _hasTimeStamp;
+ private _hasNonce;
+ private _hasTokenCreated;
+ private _actor;
+ private _mustUnderstand;
+ constructor(username: string, password: string, options?: string | IWSSecurityOptions);
+ toXML(): string;
+}

lib/security/WSSecurity.js

@@ -1,21 +1,21 @@
"use strict";
-
-var crypto = require('crypto');
-var passwordDigest = require('../utils').passwordDigest;
+exports.__esModule = true;
+var crypto = require("crypto");
+var utils_1 = require("../utils");
var validPasswordTypes = ['PasswordDigest', 'PasswordText'];
-
-function WSSecurity(username, password, options) {
+var WSSecurity = /** @class */ (function () {
+ function WSSecurity(username, password, options) {
options = options || {};
this._username = username;
this._password = password;
- //must account for backward compatibility for passwordType String param as well as object options defaults: passwordType = 'PasswordText', hasTimeStamp = true
+ // must account for backward compatibility for passwordType String param as well as object options defaults: passwordType = 'PasswordText', hasTimeStamp = true
if (typeof options === 'string') {
this._passwordType = options ? options : 'PasswordText';
options = {};
- } else {
+ }
+ else {
this._passwordType = options.passwordType ? options.passwordType : 'PasswordText';
}
-
if (validPasswordTypes.indexOf(this._passwordType) === -1) {
this._passwordType = 'PasswordText';
}
@@ -32,9 +31,8 @@
if (options.mustUnderstand != null) {
this._mustUnderstand = !!options.mustUnderstand;
}
-}
-
-WSSecurity.prototype.toXML = function() {
+ }
+ WSSecurity.prototype.toXML = function () {
// avoid dependency on date formatting libraries
function getDate(d) {
function pad(n) {
@@ -51,14 +49,14 @@
var created = getDate(now);
var timeStampXml = '';
if (this._hasTimeStamp) {
- var expires = getDate( new Date(now.getTime() + (1000 * 600)) );
- timeStampXml = "<wsu:Timestamp wsu:Id=\"Timestamp-"+created+"\">" +
- "<wsu:Created>"+created+"</wsu:Created>" +
- "<wsu:Expires>"+expires+"</wsu:Expires>" +
- "</wsu:Timestamp>";
+ var expires = getDate(new Date(now.getTime() + (1000 * 600)));
+ timeStampXml = '<wsu:Timestamp wsu:Id="Timestamp-' + created + '">' +
+ '<wsu:Created>' + created + '</wsu:Created>' +
+ '<wsu:Expires>' + expires + '</wsu:Expires>' +
+ '</wsu:Timestamp>';
}
-
- var password, nonce;
+ var password;
+ var nonce;
if (this._hasNonce || this._passwordType !== 'PasswordText') {
// nonce = base64 ( sha1 ( created + random ) )
var nHash = crypto.createHash('sha1');
@@ -66,25 +64,29 @@
nonce = nHash.digest('base64');
}
if (this._passwordType === 'PasswordText') {
- password = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">" + this._password + "</wsse:Password>";
+ password = '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' + this._password + '</wsse:Password>';
if (nonce) {
- password += "<wsse:Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">" + nonce + "</wsse:Nonce>";
+ password += '<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">' + nonce + '</wsse:Nonce>';
+ }
}
- } else {
- password = "<wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest\">" + passwordDigest(nonce, created, this._password) + "</wsse:Password>" +
- "<wsse:Nonce EncodingType=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary\">" + nonce + "</wsse:Nonce>";
- }
-
- return "<wsse:Security " + (this._actor ? "soap:actor=\"" + this._actor + "\" " : "") +
- (this._mustUnderstand ? "soap:mustUnderstand=\"1\" " : "") +
- "xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" +
+ else {
+ /* Specific Testcase for passwordDigest calculation cover this code
+ /* istanbul ignore next */
+ password = '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">' + utils_1.passwordDigest(nonce, created, this._password) + '</wsse:Password>' +
+ '<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">' + nonce + '</wsse:Nonce>';
+ }
+ return '<wsse:Security ' + (this._actor ? 'soap:actor="' + this._actor + '" ' : '') +
+ (this._mustUnderstand ? 'soap:mustUnderstand="1" ' : '') +
+ 'xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' +
timeStampXml +
- "<wsse:UsernameToken xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" wsu:Id=\"SecurityToken-" + created + "\">" +
- "<wsse:Username>" + this._username + "</wsse:Username>" +
+ '<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-' + created + '">' +
+ '<wsse:Username>' + this._username + '</wsse:Username>' +
password +
- (this._hasTokenCreated ? "<wsu:Created>" + created + "</wsu:Created>" : "") +
- "</wsse:UsernameToken>" +
- "</wsse:Security>";
-};
-
-module.exports = WSSecurity;
+ (this._hasTokenCreated ? '<wsu:Created>' + created + '</wsu:Created>' : '') +
+ '</wsse:UsernameToken>' +
+ '</wsse:Security>';
+ };
+ return WSSecurity;
+}());
+exports.WSSecurity = WSSecurity;
+//# sourceMappingURL=WSSecurity.js.map
\ No newline at end of file

lib/security/WSSecurity.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"WSSecurity.js","sourceRoot":"","sources":["../../src/security/WSSecurity.ts"],"names":[],"mappings":";;AACA,+BAAiC;AAEjC,kCAA0C;AAE1C,IAAM,kBAAkB,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAW9D;IAUE,oBAAY,QAAgB,EAAE,QAAgB,EAAE,OAAqC;QACnF,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,+JAA+J;QAC/J,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;YAC/B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC;YACxD,OAAO,GAAG,EAAE,CAAC;SACd;aAAM;YACL,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC;SACnF;QAED,IAAI,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;YACzD,IAAI,CAAC,aAAa,GAAG,cAAc,CAAC;SACrC;QAED,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY,IAAI,OAAO,OAAO,CAAC,YAAY,KAAK,SAAS,CAAC,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MAAM,CAAC,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACjF,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,gMAAgM;YAChM,YAAY;YACZ,2IAA2I,GAAG,OAAO,GAAG,IAAI;YAC5J,iBAAiB,GAAG,IAAI,CAAC,SAAS,GAAG,kBAAkB;YACvD,QAAQ;YACR,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,GAAG,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3E,uBAAuB;YACvB,kBAAkB,CAAC;IACvB,CAAC;IACH,iBAAC;AAAD,CAAC,AA/FD,IA+FC;AA/FY,gCAAU"}
\ No newline at end of file

lib/server.d.ts

@@ -0,0 +1,51 @@
+/// <reference types="node" />
+import { EventEmitter } from 'events';
+import * as http from 'http';
+import { ISecurity, IServerOptions, IServices } from './types';
+import { WSDL } from './wsdl';
+interface IExpressApp {
+ route: any;
+ use: any;
+}
+export declare type ServerType = http.Server | IExpressApp;
+declare type Request = http.IncomingMessage & {
+ body?: any;
+};
+declare type Response = http.ServerResponse;
+export interface Server {
+ emit(event: 'request', request: any, methodName: string): boolean;
+ emit(event: 'headers', headers: any, methodName: string): boolean;
+ /** Emitted for every received messages. */
+ on(event: 'request', listener: (request: any, methodName: string) => void): this;
+ /** Emitted when the SOAP Headers are not empty. */
+ on(event: 'headers', listener: (headers: any, methodName: string) => void): this;
+}
+export declare class Server extends EventEmitter {
+ path: string;
+ services: IServices;
+ log: (type: string, data: any) => any;
+ authorizeConnection: (req: Request, res?: Response) => boolean;
+ authenticate: (security: ISecurity, processAuthResult?: any) => boolean;
+ private wsdl;
+ private suppressStack;
+ private returnFault;
+ private onewayOptions;
+ private enableChunkedEncoding;
+ private soapHeaders;
+ private callback?;
+ constructor(server: ServerType, path: string, services: IServices, wsdl: WSDL, options?: IServerOptions);
+ addSoapHeader(soapHeader: any, name?: string, namespace?: any, xmlns?: string): number;
+ changeSoapHeader(index: any, soapHeader: any, name?: any, namespace?: any, xmlns?: any): void;
+ getSoapHeaders(): string[];
+ clearSoapHeaders(): void;
+ private _processSoapHeader;
+ private _initializeOptions;
+ private _processRequestXml;
+ private _requestListener;
+ private _process;
+ private _executeMethod;
+ private _envelope;
+ private _sendError;
+ private _sendHttpResponse;
+}
+export {};

lib/server.js

@@ -1,10 +1,37 @@
+"use strict";
/*
* Copyright (c) 2011 Vinay Pulim <vinay@milewise.com>
* MIT Licensed
*/
-
-"use strict";
-
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+exports.__esModule = true;
+var events_1 = require("events");
+var url = require("url");
+var utils_1 = require("./utils");
+var zlib;
+try {
+ zlib = require('zlib');
+}
+catch (error) {
+}
+function isExpress(server) {
+ return (typeof server.route === 'function' && typeof server.use === 'function');
+}
+function isPromiseLike(obj) {
+ return (!!obj && typeof obj.then === 'function');
+}
function getDateString(d) {
function pad(n) {
return n < 10 ? '0' + n : n;
@@ -16,51 +43,46 @@
+ pad(d.getUTCMinutes()) + ':'
+ pad(d.getUTCSeconds()) + 'Z';
}
-
-var url = require('url'),
- zlib = null,
- events = require('events'),
- util = require('util'),
- findPrefix = require('./utils').findPrefix;
-
-try {
- zlib = require("zlib");
-} catch (error) {
-}
-
-var Server = function (server, path, services, wsdl, options) {
- var self = this;
-
- events.EventEmitter.call(this);
-
- options = options || {};
- this.path = path;
- this.services = services;
- this.wsdl = wsdl;
- this.suppressStack = options && options.suppressStack;
- this.returnFault = options && options.returnFault;
- this.onewayOptions = options && options.oneWay || {};
-
- if (path[path.length - 1] !== '/')
+var Server = /** @class */ (function (_super) {
+ __extends(Server, _super);
+ function Server(server, path, services, wsdl, options) {
+ var _this_1 = _super.call(this) || this;
+ options = options || {
+ path: path,
+ services: services
+ };
+ _this_1.path = path;
+ _this_1.services = services;
+ _this_1.wsdl = wsdl;
+ _this_1.suppressStack = options && options.suppressStack;
+ _this_1.returnFault = options && options.returnFault;
+ _this_1.onewayOptions = options && options.oneWay || {};
+ _this_1.enableChunkedEncoding =
+ options.enableChunkedEncoding === undefined ? true : !!options.enableChunkedEncoding;
+ _this_1.callback = options.callback ? options.callback : function () { };
+ if (path[path.length - 1] !== '/') {
path += '/';
+ }
wsdl.onReady(function (err) {
- if (typeof server.route === 'function' && typeof server.use === 'function') {
- //handle only the required URL path for express server
- server.route(path).all(function (req, res, next) {
- if (typeof self.authorizeConnection === 'function') {
- if (!self.authorizeConnection(req, res)) {
+ if (isExpress(server)) {
+ // handle only the required URL path for express server
+ server.route(path).all(function (req, res) {
+ if (typeof _this_1.authorizeConnection === 'function') {
+ if (!_this_1.authorizeConnection(req, res)) {
res.end();
return;
}
}
- self._requestListener(req, res);
+ _this_1._requestListener(req, res);
});
- } else {
- var listeners = server.listeners('request').slice();
+ _this_1.callback(err, _this_1);
+ }
+ else {
+ var listeners_1 = server.listeners('request').slice();
server.removeAllListeners('request');
server.addListener('request', function (req, res) {
- if (typeof self.authorizeConnection === 'function') {
- if (!self.authorizeConnection(req, res)) {
+ if (typeof _this_1.authorizeConnection === 'function') {
+ if (!_this_1.authorizeConnection(req, res)) {
res.end();
return;
}
@@ -70,184 +92,166 @@
reqPath += '/';
}
if (path === reqPath) {
- self._requestListener(req, res);
- } else {
- for (var i = 0, len = listeners.length; i < len; i++) {
- listeners[i].call(this, req, res);
+ _this_1._requestListener(req, res);
}
+ else {
+ for (var i = 0, len = listeners_1.length; i < len; i++) {
+ listeners_1[i].call(_this_1, req, res);
}
- });
}
});
-
- this._initializeOptions(options);
-};
-util.inherits(Server, events.EventEmitter);
-
-Server.prototype._processSoapHeader = function (soapHeader, name, namespace, xmlns) {
- var self = this;
-
- switch (typeof soapHeader) {
- case 'object':
- return this.wsdl.objectToXML(soapHeader, name, namespace, xmlns, true);
- case 'function':
- return function() {
- var result = soapHeader.apply(null, arguments);
-
- if (typeof result === 'object') {
- return self.wsdl.objectToXML(result, name, namespace, xmlns, true);
- } else {
- return result;
+ _this_1.callback(err, _this_1);
}
- };
- default:
- return soapHeader;
+ });
+ _this_1._initializeOptions(options);
+ return _this_1;
}
-};
-
-Server.prototype.addSoapHeader = function (soapHeader, name, namespace, xmlns) {
+ Server.prototype.addSoapHeader = function (soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {
this.soapHeaders = [];
}
soapHeader = this._processSoapHeader(soapHeader, name, namespace, xmlns);
return this.soapHeaders.push(soapHeader) - 1;
-};
-
-Server.prototype.changeSoapHeader = function (index, soapHeader, name, namespace, xmlns) {
+ };
+ Server.prototype.changeSoapHeader = function (index, soapHeader, name, namespace, xmlns) {
if (!this.soapHeaders) {
this.soapHeaders = [];
}
soapHeader = this._processSoapHeader(soapHeader, name, namespace, xmlns);
this.soapHeaders[index] = soapHeader;
-};
-
-Server.prototype.getSoapHeaders = function () {
+ };
+ Server.prototype.getSoapHeaders = function () {
return this.soapHeaders;
-};
-
-Server.prototype.clearSoapHeaders = function () {
+ };
+ Server.prototype.clearSoapHeaders = function () {
this.soapHeaders = null;
-};
-
-Server.prototype._initializeOptions = function (options) {
+ };
+ Server.prototype._processSoapHeader = function (soapHeader, name, namespace, xmlns) {
+ switch (typeof soapHeader) {
+ case 'object':
+ return this.wsdl.objectToXML(soapHeader, name, namespace, xmlns, true);
+ case 'function':
+ var _this_2 = this;
+ // arrow function does not support arguments variable
+ // tslint:disable-next-line
+ return function () {
+ var result = soapHeader.apply(null, arguments);
+ if (typeof result === 'object') {
+ return _this_2.wsdl.objectToXML(result, name, namespace, xmlns, true);
+ }
+ else {
+ return result;
+ }
+ };
+ default:
+ return soapHeader;
+ }
+ };
+ Server.prototype._initializeOptions = function (options) {
this.wsdl.options.attributesKey = options.attributesKey || 'attributes';
- this.onewayOptions.statusCode = this.onewayOptions.responseCode || 200;
+ this.onewayOptions.statusCode = this.onewayOptions.responseCode || 200;
this.onewayOptions.emptyBody = !!this.onewayOptions.emptyBody;
-};
-
-Server.prototype._processRequestXml = function (req, res, xml) {
- var self = this;
- var result;
+ };
+ Server.prototype._processRequestXml = function (req, res, xml) {
+ var _this_1 = this;
var error;
try {
- if (typeof self.log === 'function') {
- self.log("received", xml);
- }
- self._process(xml, req, function (result, statusCode) {
- if (statusCode) {
- res.statusCode = statusCode;
+ if (typeof this.log === 'function') {
+ this.log('received', xml);
}
- res.write(result);
- res.end();
- if (typeof self.log === 'function') {
- self.log("replied", result);
+ this._process(xml, req, function (result, statusCode) {
+ _this_1._sendHttpResponse(res, statusCode, result);
+ if (typeof _this_1.log === 'function') {
+ _this_1.log('replied', result);
}
});
- } catch (err) {
+ }
+ catch (err) {
if (err.Fault !== undefined) {
- return self._sendError(err.Fault, function (result, statusCode) {
- res.statusCode = statusCode || 500;
- res.write(result);
- res.end();
- if (typeof self.log === 'function') {
- self.log("error", err);
+ return this._sendError(err.Fault, function (result, statusCode) {
+ _this_1._sendHttpResponse(res, statusCode || 500, result);
+ if (typeof _this_1.log === 'function') {
+ _this_1.log('error', err);
}
}, new Date().toISOString());
- } else {
- error = err.stack ? (self.suppressStack === true ? err.message : err.stack) : err;
- res.statusCode = 500;
- res.write(error);
- res.end();
- if (typeof self.log === 'function') {
- self.log("error", error);
+ }
+ else {
+ error = err.stack ? (this.suppressStack === true ? err.message : err.stack) : err;
+ this._sendHttpResponse(res, /* statusCode */ 500, error);
+ if (typeof this.log === 'function') {
+ this.log('error', error);
}
}
}
-};
-
-Server.prototype._requestListener = function (req, res) {
- var self = this;
+ };
+ Server.prototype._requestListener = function (req, res) {
+ var _this_1 = this;
var reqParse = url.parse(req.url);
var reqPath = reqParse.pathname;
var reqQuery = reqParse.search;
-
- if (typeof self.log === 'function') {
- self.log("info", "Handling " + req.method + " on " + req.url);
+ if (typeof this.log === 'function') {
+ this.log('info', 'Handling ' + req.method + ' on ' + req.url);
}
-
if (req.method === 'GET') {
if (reqQuery && reqQuery.toLowerCase() === '?wsdl') {
- if (typeof self.log === 'function') {
- self.log("info", "Wants the WSDL");
+ if (typeof this.log === 'function') {
+ this.log('info', 'Wants the WSDL');
}
- res.setHeader("Content-Type", "application/xml");
- res.write(self.wsdl.toXML());
+ res.setHeader('Content-Type', 'application/xml');
+ res.write(this.wsdl.toXML());
}
res.end();
- } else if (req.method === 'POST') {
- if (typeof req.headers['content-type'] !== "undefined") {
+ }
+ else if (req.method === 'POST') {
+ if (typeof req.headers['content-type'] !== 'undefined') {
res.setHeader('Content-Type', req.headers['content-type']);
- } else {
- res.setHeader('Content-Type', "application/xml");
}
-
- //request body is already provided by an express middleware
- //in this case unzipping should also be done by the express middleware itself
- if (req.body) {
- return self._processRequestXml(req, res, req.body.toString());
- }
-
- var chunks = [], gunzip, source = req;
- if (req.headers["content-encoding"] === "gzip") {
+ else {
+ res.setHeader('Content-Type', 'application/xml');
+ }
+ // request body is already provided by an express middleware
+ // in this case unzipping should also be done by the express middleware itself
+ if (req.body && Object.keys(req.body).length > 0) {
+ return this._processRequestXml(req, res, req.body.toString());
+ }
+ var chunks_1 = [];
+ var gunzip = void 0;
+ var source = req;
+ if (req.headers['content-encoding'] === 'gzip') {
gunzip = zlib.createGunzip();
req.pipe(gunzip);
source = gunzip;
}
source.on('data', function (chunk) {
- chunks.push(chunk);
+ chunks_1.push(chunk);
});
source.on('end', function () {
- var xml = chunks.join('');
- var result;
- var error;
- self._processRequestXml(req, res, xml);
+ var xml = Buffer.concat(chunks_1).toString();
+ _this_1._processRequestXml(req, res, xml);
});
}
else {
res.end();
}
-};
-
-Server.prototype._process = function (input, req, callback) {
- var self = this,
- pathname = url.parse(req.url).pathname.replace(/\/$/, ''),
- obj = this.wsdl.xmlToObject(input),
- body = obj.Body,
- headers = obj.Header,
- bindings = this.wsdl.definitions.bindings, binding,
- method, methodName,
- serviceName, portName,
- includeTimestamp = obj.Header && obj.Header.Security && obj.Header.Security.Timestamp,
- authenticate = self.authenticate || function defaultAuthenticate() { return true; };
-
- function process() {
-
- if (typeof self.log === 'function') {
- self.log("info", "Attempting to bind to " + pathname);
- }
-
- //Avoid Cannot convert undefined or null to object due to Object.keys(body)
- //and throw more meaningful error
+ };
+ Server.prototype._process = function (input, req, callback) {
+ var _this_1 = this;
+ var pathname = url.parse(req.url).pathname.replace(/\/$/, '');
+ var obj = this.wsdl.xmlToObject(input);
+ var body = obj.Body;
+ var headers = obj.Header;
+ var binding;
+ var methodName;
+ var serviceName;
+ var portName;
+ var includeTimestamp = obj.Header && obj.Header.Security && obj.Header.Security.Timestamp;
+ var authenticate = this.authenticate || function defaultAuthenticate() { return true; };
+ var process = function () {
+ if (typeof _this_1.log === 'function') {
+ _this_1.log('info', 'Attempting to bind to ' + pathname);
+ }
+ // Avoid Cannot convert undefined or null to object due to Object.keys(body)
+ // and throw more meaningful error
if (!body) {
throw new Error('Failed to parse the SOAP Message body');
}
@@ -251,10 +255,9 @@
if (!body) {
throw new Error('Failed to parse the SOAP Message body');
}
-
// use port.location and current url to find the right binding
binding = (function () {
- var services = self.wsdl.definitions.services;
+ var services = _this_1.wsdl.definitions.services;
var firstPort;
var name;
for (name in services) {
@@ -265,14 +268,12 @@
portName = name;
var port = ports[portName];
var portPathname = url.parse(port.location).pathname.replace(/\/$/, '');
-
- if (typeof self.log === 'function') {
- self.log("info", "Trying " + portName + " from path " + portPathname);
+ if (typeof _this_1.log === 'function') {
+ _this_1.log('info', 'Trying ' + portName + ' from path ' + portPathname);
}
-
- if (portPathname === pathname)
+ if (portPathname === pathname) {
return port.binding;
-
+ }
// The port path is almost always wrong for generated WSDLs
if (!firstPort) {
firstPort = port;
@@ -285,16 +285,14 @@
if (!binding) {
throw new Error('Failed to bind to WSDL');
}
-
try {
if (binding.style === 'rpc') {
methodName = Object.keys(body)[0];
-
- self.emit('request', obj, methodName);
- if (headers)
- self.emit('headers', headers, methodName);
-
- self._executeMethod({
+ _this_1.emit('request', obj, methodName);
+ if (headers) {
+ _this_1.emit('headers', headers, methodName);
+ }
+ _this_1._executeMethod({
serviceName: serviceName,
portName: portName,
methodName: methodName,
@@ -303,15 +301,15 @@
headers: headers,
style: 'rpc'
}, req, callback);
- } else {
+ }
+ else {
var messageElemName = (Object.keys(body)[0] === 'attributes' ? Object.keys(body)[1] : Object.keys(body)[0]);
var pair = binding.topElements[messageElemName];
-
- self.emit('request', obj, pair.methodName);
- if (headers)
- self.emit('headers', headers, pair.methodName);
-
- self._executeMethod({
+ _this_1.emit('request', obj, pair.methodName);
+ if (headers) {
+ _this_1.emit('headers', headers, pair.methodName);
+ }
+ _this_1._executeMethod({
serviceName: serviceName,
portName: portName,
methodName: pair.methodName,
@@ -324,35 +322,26 @@
}
catch (error) {
if (error.Fault !== undefined) {
- return self._sendError(error.Fault, callback, includeTimestamp);
+ return _this_1._sendError(error.Fault, callback, includeTimestamp);
}
-
throw error;
}
- }
-
+ };
// Authentication
-
if (typeof authenticate === 'function') {
-
- var authResultProcessed = false,
- processAuthResult = function (authResult) {
-
- if (!authResultProcessed && (authResult || authResult === false)) {
-
- authResultProcessed = true;
-
+ var authResultProcessed_1 = false;
+ var processAuthResult = function (authResult) {
+ if (!authResultProcessed_1 && (authResult || authResult === false)) {
+ authResultProcessed_1 = true;
if (authResult) {
-
try {
process();
- } catch (error) {
-
+ }
+ catch (error) {
if (error.Fault !== undefined) {
- return self._sendError(error.Fault, callback, includeTimestamp);
+ return _this_1._sendError(error.Fault, callback, includeTimestamp);
}
-
- return self._sendError({
+ return _this_1._sendError({
Code: {
Value: 'SOAP-ENV:Server',
Subcode: { value: 'InternalServerError' }
@@ -361,10 +350,9 @@
statusCode: 500
}, callback, includeTimestamp);
}
-
- } else {
-
- return self._sendError({
+ }
+ else {
+ return _this_1._sendError({
Code: {
Value: 'SOAP-ENV:Client',
Subcode: { value: 'AuthenticationFailure' }
@@ -375,146 +363,177 @@
}
}
};
-
processAuthResult(authenticate(obj.Header && obj.Header.Security, processAuthResult));
-
- } else {
+ }
+ else {
throw new Error('Invalid authenticate function (not a function)');
}
-};
-
-Server.prototype._executeMethod = function (options, req, callback, includeTimestamp) {
+ };
+ Server.prototype._executeMethod = function (options, req, callback, includeTimestamp) {
+ var _this_1 = this;
options = options || {};
- var self = this,
- method, body, headers,
- serviceName = options.serviceName,
- portName = options.portName,
- methodName = options.methodName,
- outputName = options.outputName,
- args = options.args,
- style = options.style,
- handled = false;
-
+ var method;
+ var body;
+ var headers;
+ var serviceName = options.serviceName;
+ var portName = options.portName;
+ var methodName = options.methodName;
+ var outputName = options.outputName;
+ var args = options.args;
+ var style = options.style;
if (this.soapHeaders) {
- headers = this.soapHeaders.map(function(header) {
+ headers = this.soapHeaders.map(function (header) {
if (typeof header === 'function') {
return header(methodName, args, options.headers, req);
- } else {
+ }
+ else {
return header;
}
- }).join("\n");
+ }).join('\n');
}
-
try {
method = this.services[serviceName][portName][methodName];
- } catch (error) {
+ }
+ catch (error) {
return callback(this._envelope('', headers, includeTimestamp));
}
-
- function handleResult(error, result) {
- if (handled)
+ var handled = false;
+ var handleResult = function (error, result) {
+ if (handled) {
return;
+ }
handled = true;
-
- if (error && error.Fault !== undefined) {
- return self._sendError(error.Fault, callback, includeTimestamp);
+ if (error) {
+ if (error.Fault !== undefined) {
+ return _this_1._sendError(error.Fault, callback, includeTimestamp);
+ }
+ else {
+ return _this_1._sendError({
+ Code: {
+ Value: 'SOAP-ENV:Server',
+ Subcode: { value: 'InternalServerError' }
+ },
+ Reason: { Text: error.toString() },
+ statusCode: 500
+ }, callback, includeTimestamp);
}
- else if (result === undefined) {
- // Backward compatibility to support one argument callback style
- result = error;
}
-
if (style === 'rpc') {
- body = self.wsdl.objectToRpcXML(outputName, result, '', self.wsdl.definitions.$targetNamespace);
- } else {
- var element = self.wsdl.definitions.services[serviceName].ports[portName].binding.methods[methodName].output;
- body = self.wsdl.objectToDocumentXML(outputName, result, element.targetNSAlias, element.targetNamespace);
+ body = _this_1.wsdl.objectToRpcXML(outputName, result, '', _this_1.wsdl.definitions.$targetNamespace);
}
- callback(self._envelope(body, headers, includeTimestamp));
+ else {
+ var element = _this_1.wsdl.definitions.services[serviceName].ports[portName].binding.methods[methodName].output;
+ body = _this_1.wsdl.objectToDocumentXML(outputName, result, element.targetNSAlias, element.targetNamespace);
}
-
- if (!self.wsdl.definitions.services[serviceName].ports[portName].binding.methods[methodName].output) {
+ callback(_this_1._envelope(body, headers, includeTimestamp));
+ };
+ if (!this.wsdl.definitions.services[serviceName].ports[portName].binding.methods[methodName].output) {
// no output defined = one-way operation so return empty response
handled = true;
body = '';
if (this.onewayOptions.emptyBody) {
- body = self._envelope('', headers, includeTimestamp);
+ body = this._envelope('', headers, includeTimestamp);
}
callback(body, this.onewayOptions.responseCode);
}
-
- var result = method(args, handleResult, options.headers, req);
+ var methodCallback = function (error, result) {
+ if (error && error.Fault !== undefined) {
+ // do nothing
+ }
+ else if (result === undefined) {
+ // Backward compatibility to support one argument callback style
+ result = error;
+ error = null;
+ }
+ handleResult(error, result);
+ };
+ var result = method(args, methodCallback, options.headers, req);
if (typeof result !== 'undefined') {
- handleResult(result);
+ if (isPromiseLike(result)) {
+ result.then(function (value) {
+ handleResult(null, value);
+ }, function (err) {
+ handleResult(err);
+ });
}
-};
-
-Server.prototype._envelope = function (body, headers, includeTimestamp) {
- var defs = this.wsdl.definitions,
- ns = defs.$targetNamespace,
- encoding = '',
- alias = findPrefix(defs.xmlns, ns);
-
+ else {
+ handleResult(null, result);
+ }
+ }
+ };
+ Server.prototype._envelope = function (body, headers, includeTimestamp) {
+ var defs = this.wsdl.definitions;
+ var ns = defs.$targetNamespace;
+ var encoding = '';
+ var alias = utils_1.findPrefix(defs.xmlns, ns);
var envelopeDefinition = this.wsdl.options.forceSoap12Headers
- ? "http://www.w3.org/2003/05/soap-envelope"
- : "http://schemas.xmlsoap.org/soap/envelope/";
-
- var xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
- "<soap:Envelope xmlns:soap=\"" + envelopeDefinition + "\" " +
+ ? 'http://www.w3.org/2003/05/soap-envelope'
+ : 'http://schemas.xmlsoap.org/soap/envelope/';
+ var xml = '<?xml version="1.0" encoding="utf-8"?>' +
+ '<soap:Envelope xmlns:soap="' + envelopeDefinition + '" ' +
encoding +
this.wsdl.xmlnsInEnvelope + '>';
-
headers = headers || '';
-
if (includeTimestamp) {
var now = new Date();
var created = getDateString(now);
var expires = getDateString(new Date(now.getTime() + (1000 * 600)));
-
- headers += "<o:Security soap:mustUnderstand=\"1\" " +
- "xmlns:o=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" " +
- "xmlns:u=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\">" +
- " <u:Timestamp u:Id=\"_0\">" +
- " <u:Created>" + created + "</u:Created>" +
- " <u:Expires>" + expires + "</u:Expires>" +
- " </u:Timestamp>" +
- " </o:Security>\n";
+ headers += '<o:Security soap:mustUnderstand="1" ' +
+ 'xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" ' +
+ 'xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' +
+ ' <u:Timestamp u:Id="_0">' +
+ ' <u:Created>' + created + '</u:Created>' +
+ ' <u:Expires>' + expires + '</u:Expires>' +
+ ' </u:Timestamp>' +
+ ' </o:Security>\n';
}
-
if (headers !== '') {
- xml += "<soap:Header>" + headers + "</soap:Header>";
+ xml += '<soap:Header>' + headers + '</soap:Header>';
}
-
- xml += body ? "<soap:Body>" + body + "</soap:Body>" : "<soap:Body/>";
-
- xml += "</soap:Envelope>";
+ xml += body ? '<soap:Body>' + body + '</soap:Body>' : '<soap:Body/>';
+ xml += '</soap:Envelope>';
return xml;
-};
-
-Server.prototype._sendError = function (soapFault, callback, includeTimestamp) {
- var self = this,
- fault;
-
+ };
+ Server.prototype._sendError = function (soapFault, callback, includeTimestamp) {
+ var fault;
var statusCode;
if (soapFault.statusCode) {
statusCode = soapFault.statusCode;
soapFault.statusCode = undefined;
}
-
- if (soapFault.faultcode) {
+ if ('faultcode' in soapFault) {
// Soap 1.1 error style
// Root element will be prependend with the soap NS
// It must match the NS defined in the Envelope (set by the _envelope method)
- fault = self.wsdl.objectToDocumentXML("soap:Fault", soapFault, undefined);
+ fault = this.wsdl.objectToDocumentXML('soap:Fault', soapFault, undefined);
}
else {
// Soap 1.2 error style.
// 3rd param is the NS prepended to all elements
// It must match the NS defined in the Envelope (set by the _envelope method)
- fault = self.wsdl.objectToDocumentXML("Fault", soapFault, "soap");
+ fault = this.wsdl.objectToDocumentXML('Fault', soapFault, 'soap');
+ }
+ return callback(this._envelope(fault, '', includeTimestamp), statusCode);
+ };
+ Server.prototype._sendHttpResponse = function (res, statusCode, result) {
+ if (statusCode) {
+ res.statusCode = statusCode;
}
-
- return callback(self._envelope(fault, '', includeTimestamp), statusCode);
-};
-
+ /*
+ * Calling res.write(result) follow by res.end() will cause Node.js to use
+ * chunked encoding, while calling res.end(result) directly will cause
+ * Node.js to calculate and send Content-Length header. See
+ * nodejs/node#26005.
+ */
+ if (this.enableChunkedEncoding) {
+ res.write(result);
+ res.end();
+ }
+ else {
+ res.end(result);
+ }
+ };
+ return Server;
+}(events_1.EventEmitter));
exports.Server = Server;
+//# sourceMappingURL=server.js.map
\ No newline at end of file

lib/server.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;AAEH,iCAAsC;AAEtC,yBAA2B;AAE3B,iCAAqC;AAIrC,IAAI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E,CAAC;IAEO,kCAAiB,GAAzB,UAA0B,GAAa,EAAE,UAAkB,EAAE,MAAM;QACjE,IAAI,UAAU,EAAE;YACd,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC;SAC7B;QAED;;;;;UAKE;QAEF,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC9B,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAClB,GAAG,CAAC,GAAG,EAAE,CAAC;SACX;aAAM;YACL,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SACjB;IACH,CAAC;IACH,aAAC;AAAD,CAAC,AA3hBD,CAA4B,qBAAY,GA2hBvC;AA3hBY,wBAAM"}
\ No newline at end of file

lib/soap.d.ts

@@ -1,331 +1,18 @@
-/// <reference types="node" />
-
-import { EventEmitter } from 'events';
import * as BluebirdPromise from 'bluebird';
-
-export interface ISoapMethod {
- (args: any, callback: (err: any, result: any, raw: any, soapHeader: any) => void, options?: any, extraHeaders?: any): void;
-}
-
-export interface ISoapServiceMethod {
- (args:any, callback?: (data: any) => void, headers?: any, req?: any): any;
-}
-
-// SOAP Fault 1.1 & 1.2
-export type ISoapFault = ISoapFault12 | ISoapFault11;
-
-// SOAP Fault 1.1
-export interface ISoapFault11 {
- Fault: {
- faultcode: number | string;
- faultstring: string;
- detail?: string;
- statusCode?: number;
- };
-}
-
-// SOAP Fault 1.2
-// 1.2 also supports additional, optional elements:
-// Role, Node, Detail. Should be added when soap module implements them
-// https://www.w3.org/TR/soap12/#soapfault
-export interface ISoapFault12 {
- Fault: {
- Code: { Value: string; Subcode?: { Value: string; }; };
- Reason: { Text: string; };
- statusCode?: number;
- };
-}
-
-export interface ISecurity {
- addOptions(options: any): void;
- toXML(): string;
-}
-
-export interface IServicePort {
- [methodName: string]: ISoapServiceMethod;
-}
-
-export interface IService {
- [portName: string]: IServicePort;
-}
-
-export interface IServices {
- [serviceName: string]: IService;
-}
-
-export interface IXmlAttribute {
- name: string;
- value: string;
-}
-
-export interface IWsdlBaseOptions {
- attributesKey?: string;
- valueKey?: string;
- xmlKey?: string;
- overrideRootElement?: { namespace: string; xmlnsAttributes?: IXmlAttribute[]; };
- ignoredNamespaces?: boolean | string[] | { namespaces?: string[]; override?: boolean; };
- ignoreBaseNameSpaces?: boolean;
- escapeXML?: boolean;
- returnFault?: boolean;
- handleNilAsNull?: boolean;
- wsdl_headers?: { [key: string]: any };
- wsdl_options?: { [key: string]: any };
-}
-
-export interface IOptions extends IWsdlBaseOptions {
- disableCache?: boolean;
- endpoint?: string;
- envelopeKey?: string;
- httpClient?: HttpClient;
- request?: (options: any, callback?: (error: any, res: any, body: any) => void) => void;
- stream?: boolean;
- // wsdl options that only work for client
- forceSoap12Headers?: boolean;
- customDeserializer?: any;
- [key: string]: any;
-}
-
-export interface IOneWayOptions {
- responseCode?: number;
- emptyBody?: boolean;
-}
-
-export interface IServerOptions extends IWsdlBaseOptions {
- path: string;
- services: IServices;
- xml?: string;
- uri?: string;
- suppressStack?: boolean;
- oneWay?: IOneWayOptions;
- [key: string]: any;
-}
-
-export interface Definitions {
- descriptions: object;
- ignoredNamespaces: string[];
- messages: WsdlMessages;
- portTypes: WsdlPortTypes;
- bindings: WsdlBindings;
- services: WsdlServices;
- schemas: WsdlSchemas;
- valueKey: string;
- xmlKey: string;
- xmlns: WsdlXmlns;
- '$targetNamespace': string;
- '$name': string;
-}
-
-export interface XsdTypeBase {
- ignoredNamespaces: string[];
- valueKey: string;
- xmlKey: string;
- xmlns?: WsdlXmlns,
-}
-
-
-export interface WsdlSchemas {
- [prop: string]: WsdlSchema;
-}
-export interface WsdlSchema extends XsdTypeBase {
- children: any[];
- complexTypes?: WsdlElements;
- elements?: WsdlElements;
- includes: any[];
- name: string;
- nsName: string;
- prefix: string;
- types?: WsdlElements;
- xmlns: WsdlXmlns;
-}
-export interface WsdlElements {
- [prop: string]: XsdElement;
-}
-export type XsdElement = XsdElementType | XsdComplexType;
-
-export interface WsdlXmlns {
- wsu?: string;
- wsp?: string;
- wsam?: string;
- soap?: string;
- tns?: string;
- xsd?: string;
- __tns__?: string;
- [prop: string]: string | void;
-}
-
-export interface XsdComplexType extends XsdTypeBase {
- children: XsdElement[] | void;
- name: string;
- nsName: string;
- prefix: string;
- '$name': string;
- [prop: string]: any;
-}
-
-export interface XsdElementType extends XsdTypeBase {
- children: XsdElement[] | void;
- name: string;
- nsName: string;
- prefix: string;
- targetNSAlias: string;
- targetNamespace: string;
- '$lookupType': string;
- '$lookupTypes': any[];
- '$name': string;
- '$type': string;
- [prop: string]: any;
-}
-
-export interface WsdlMessages {
- [prop: string]: WsdlMessage;
-}
-export interface WsdlMessage extends XsdTypeBase {
- element: XsdElement;
- parts: { [prop: string]: any };
- '$name': string;
-}
-
-export interface WsdlPortTypes {
- [prop: string]: WsdlPortType;
-}
-export interface WsdlPortType extends XsdTypeBase {
- methods: { [prop: string]: XsdElement }
-}
-
-export interface WsdlBindings {
- [prop: string]: WsdlBinding;
-}
-export interface WsdlBinding extends XsdTypeBase {
- methods: WsdlElements;
- style: string;
- transport: string;
- topElements: {[prop: string]: any};
-}
-
-export interface WsdlServices {
- [prop: string]: WsdlService;
-}
-export interface WsdlService extends XsdTypeBase {
- ports: {[prop: string]: any};
-}
-
-export class WSDL {
- constructor(definition: any, uri: string, options?: IOptions);
- ignoredNamespaces: string[];
- ignoreBaseNameSpaces: boolean;
- valueKey: string;
- xmlKey: string;
- xmlnsInEnvelope: string;
- onReady(callback: (err:Error) => void): void;
- processIncludes(callback: (err:Error) => void): void;
- describeServices(): { [k: string]: any };
- toXML(): string;
- xmlToObject(xml: any, callback?: (err:Error, result:any) => void): any;
- findSchemaObject(nsURI: string, qname: string): XsdElement | null | undefined;
- objectToDocumentXML(name: string, params: any, nsPrefix?: string, nsURI?: string, type?: string): any;
- objectToRpcXML(name: string, params: any, nsPrefix?: string, nsURI?: string, isParts?: any): string;
- isIgnoredNameSpace(ns: string): boolean;
- filterOutIgnoredNameSpace(ns: string): string;
- objectToXML(obj: any, name: string, nsPrefix?: any, nsURI?: string, isFirst?: boolean, xmlnsAttr?: any, schemaObject?: any, nsContext?: any): string;
- processAttributes(child: any, nsContext: any): string;
- findSchemaType(name: any, nsURI: any): any;
- findChildSchemaObject(parameterTypeObj: any, childName: any, backtrace?: any): any;
- uri: string;
- definitions: Definitions;
-}
-
-export class Client extends EventEmitter {
- constructor(wsdl: WSDL, endpoint?: string, options?: IOptions);
- addBodyAttribute(bodyAttribute: any, name?: string, namespace?: string, xmlns?: string): void;
- addHttpHeader(name: string, value: any): void;
- addSoapHeader(soapHeader: any, name?: string, namespace?: any, xmlns?: string): number;
- changeSoapHeader(index: number, soapHeader: any, name?: string, namespace?: string, xmlns?: string): void;
- clearBodyAttributes(): void;
- clearHttpHeaders(): void;
- clearSoapHeaders(): void;
- describe(): any;
- getBodyAttributes(): any[];
- getHttpHeaders(): { [k:string]: string };
- getSoapHeaders(): string[];
- setEndpoint(endpoint: string): void;
- setSOAPAction(action: string): void;
- setSecurity(security: ISecurity): void;
- wsdl: WSDL;
- [method: string]: ISoapMethod | WSDL | Function;
-}
-
-export function createClient(url: string, callback: (err: any, client: Client) => void): void;
-export function createClient(url: string, options: IOptions, callback: (err: any, client: Client) => void): void;
-export function createClientAsync(url: string, options?: IOptions, endpoint?: string): BluebirdPromise<Client>;
-
-export class Server extends EventEmitter {
- constructor(server: any, path: string, services: IServices, wsdl: WSDL, options: IServerOptions);
- path: string;
- services: IServices;
- wsdl: WSDL;
- addSoapHeader(soapHeader: any, name?: string, namespace?: any, xmlns?: string): number;
- changeSoapHeader(index: any, soapHeader: any, name?: any, namespace?: any, xmlns?: any): void;
- getSoapHeaders(): string[];
- clearSoapHeaders(): void;
- log(type: string, data: any): any;
- authorizeConnection(req: any): boolean;
- authenticate(security: ISecurity): boolean;
-}
-
-export function listen(server: any, path: string, service: any, wsdl: string): Server;
-export function listen(server: any, options: IServerOptions): Server;
-
-export class HttpClient {
- constructor(options?: IOptions);
- buildRequest(rurl: string, data: any | string, exheaders?: { [key: string]: any }, exoptions?: { [key: string]: any }): any;
- handleResponse(req: any, res: any, body: any | string): any | string;
- request(rurl: string, data: any | string, callback: (err: any, res: any, body: any | string) => void, exheaders?: { [key: string]: any }, exoptions?: { [key: string]: any }): any;
- requestStream(rurl: string, data: any | string, exheaders?: { [key: string]: any }, exoptions?: { [key: string]: any }): any;
-}
-
-export class BasicAuthSecurity implements ISecurity {
- constructor(username: string, password: string, defaults?: any);
- addHeaders(headers: any): void;
- addOptions(options: any): void;
- toXML(): string;
-}
-
-export class BearerSecurity implements ISecurity {
- constructor(token: string, defaults?: any);
- addHeaders(headers: any): void;
- addOptions(options: any): void;
- toXML(): string;
-}
-
-export class WSSecurity implements ISecurity {
- constructor(username: string, password: string, options?: any);
- addOptions(options: any): void;
- toXML(): string;
-}
-
-export class WSSecurityCert implements ISecurity {
- constructor(privatePEM: any, publicP12PEM: any, password: any, options?: any);
- addOptions(options: any): void;
- toXML(): string;
-}
-
-export class ClientSSLSecurity implements ISecurity {
- constructor(key: string | Buffer, cert: string | Buffer, ca?: string | any[] | Buffer, defaults?: any);
- constructor(key: string | Buffer, cert: string | Buffer, defaults?: any);
- addOptions(options: any): void;
- toXML(): string;
-}
-
-export class ClientSSLSecurityPFX implements ISecurity {
- constructor(pfx: string | Buffer, passphrase: string, defaults?: any);
- constructor(pfx: string | Buffer, defaults?: any);
- addOptions(options: any): void;
- toXML(): string;
-}
-
-export function passwordDigest(nonce: string, created: string, password: string): string;
-
-// Below are added for backwards compatibility for previous @types/soap users.
-export interface Security extends ISecurity {}
-export interface SoapMethod extends ISoapMethod {}
-export interface Option extends IOptions {}
+import { Client } from './client';
+import * as _security from './security';
+import { Server, ServerType } from './server';
+import { IOptions, IServerOptions, IServices } from './types';
+export declare const security: typeof _security;
+export { Client } from './client';
+export { HttpClient } from './http';
+export { BasicAuthSecurity, BearerSecurity, ClientSSLSecurity, ClientSSLSecurityPFX, NTLMSecurity, WSSecurity, WSSecurityCert } from './security';
+export { Server } from './server';
+export { passwordDigest } from './utils';
+export * from './types';
+export declare type CreateClientCallback = (err: any, client: Client) => void;
+export declare function createClient(url: string, callback: CreateClientCallback, endpoint?: string): void;
+export declare function createClient(url: string, options: IOptions, callback: CreateClientCallback, endpoint?: string): void;
+export declare function createClientAsync(url: string, options: IOptions, endpoint?: string): BluebirdPromise<Client>;
+export declare function listen(server: ServerType, path: string, services: IServices, wsdl: string, callback?: (err: any, res: any) => void): Server;
+export declare function listen(server: ServerType, options: IServerOptions): Server;

lib/soap.js

@@ -1,19 +1,33 @@
+"use strict";
/*
* Copyright (c) 2011 Vinay Pulim <vinay@milewise.com>
* MIT Licensed
*/
-
-"use strict";
-
-var Client = require('./client').Client,
- Server = require('./server').Server,
- HttpClient = require('./http'),
- security = require('./security'),
- passwordDigest = require('./utils').passwordDigest,
- BluebirdPromise = require('bluebird'),
- wsdl = require('./wsdl'),
- WSDL = require('./wsdl').WSDL;
-
+exports.__esModule = true;
+var BluebirdPromise = require("bluebird");
+var debugBuilder = require("debug");
+var client_1 = require("./client");
+var _security = require("./security");
+var server_1 = require("./server");
+var wsdl_1 = require("./wsdl");
+var debug = debugBuilder('node-soap:soap');
+exports.security = _security;
+var client_2 = require("./client");
+exports.Client = client_2.Client;
+var http_1 = require("./http");
+exports.HttpClient = http_1.HttpClient;
+var security_1 = require("./security");
+exports.BasicAuthSecurity = security_1.BasicAuthSecurity;
+exports.BearerSecurity = security_1.BearerSecurity;
+exports.ClientSSLSecurity = security_1.ClientSSLSecurity;
+exports.ClientSSLSecurityPFX = security_1.ClientSSLSecurityPFX;
+exports.NTLMSecurity = security_1.NTLMSecurity;
+exports.WSSecurity = security_1.WSSecurity;
+exports.WSSecurityCert = security_1.WSSecurityCert;
+var server_2 = require("./server");
+exports.Server = server_2.Server;
+var utils_1 = require("./utils");
+exports.passwordDigest = utils_1.passwordDigest;
function createCache() {
var cache = {};
return function (key, load, callback) {
@@ -25,7 +39,8 @@
cache[key] = result;
callback(null, result);
});
- } else {
+ }
+ else {
process.nextTick(function () {
callback(null, cache[key]);
});
@@ -33,39 +48,47 @@
};
}
var getFromCache = createCache();
-
function _requestWSDL(url, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
- var openWsdl = wsdl.open_wsdl.bind(null, url, options);
-
+ var openWsdl = function (callback) {
+ wsdl_1.open_wsdl(url, options, callback);
+ };
if (options.disableCache === true) {
openWsdl(callback);
- } else {
+ }
+ else {
getFromCache(url, openWsdl, callback);
}
}
-
-function createClient(url, options, callback, endpoint) {
- if (typeof options === 'function') {
- endpoint = callback;
- callback = options;
+function createClient(url, p2, p3, p4) {
+ var endpoint = p4;
+ var callback;
+ var options;
+ if (typeof p2 === 'function') {
+ callback = p2;
+ endpoint = p3;
options = {};
}
+ else if (typeof p3 === 'function') {
+ options = p2;
+ callback = p3;
+ endpoint = p4;
+ }
endpoint = options.endpoint || endpoint;
- _requestWSDL(url, options, function(err, wsdl) {
- callback(err, wsdl && new Client(wsdl, endpoint, options));
+ _requestWSDL(url, options, function (err, wsdl) {
+ callback(err, wsdl && new client_1.Client(wsdl, endpoint, options));
});
}
-
+exports.createClient = createClient;
function createClientAsync(url, options, endpoint) {
if (typeof options === 'undefined') {
options = {};
}
- return new BluebirdPromise(function(resolve, reject) {
- createClient(url, options, function(err, client) {
+ return new BluebirdPromise(function (resolve, reject) {
+ createClient(url, options, function (err, client) {
if (err) {
reject(err);
}
@@ -73,39 +96,32 @@
}, endpoint);
});
}
-
-function listen(server, pathOrOptions, services, xml) {
- var options = {},
- path = pathOrOptions,
- uri = "";
-
- if (typeof pathOrOptions === 'object') {
- options = pathOrOptions;
+exports.createClientAsync = createClientAsync;
+function listen(server, p2, services, xml, callback) {
+ var options;
+ var path;
+ var uri = '';
+ if (typeof p2 === 'object') {
+ // p2 is options
+ // server, options
+ options = p2;
path = options.path;
services = options.services;
xml = options.xml;
uri = options.uri;
}
-
- var wsdl = new WSDL(xml || services, uri, options);
- return new Server(server, path, services, wsdl, options);
+ else {
+ // p2 is path
+ // server, path, services, wsdl
+ path = p2;
+ options = {
+ path: p2,
+ services: services,
+ callback: callback
+ };
+ }
+ var wsdl = new wsdl_1.WSDL(xml || services, uri, options);
+ return new server_1.Server(server, path, services, wsdl, options);
}
-
-exports.security = security;
-exports.BasicAuthSecurity = security.BasicAuthSecurity;
-exports.NTLMSecurity = security.NTLMSecurity;
-exports.WSSecurity = security.WSSecurity;
-exports.WSSecurityCert = security.WSSecurityCert;
-exports.ClientSSLSecurity = security.ClientSSLSecurity;
-exports.ClientSSLSecurityPFX = security.ClientSSLSecurityPFX;
-exports.BearerSecurity = security.BearerSecurity;
-exports.createClient = createClient;
-exports.createClientAsync = createClientAsync;
-exports.passwordDigest = passwordDigest;
exports.listen = listen;
-exports.WSDL = WSDL;
-
-// Export Client and Server to allow customization
-exports.Server = Server;
-exports.Client = Client;
-exports.HttpClient = HttpClient;
+//# sourceMappingURL=soap.js.map
\ No newline at end of file

lib/soap.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"soap.js","sourceRoot":"","sources":["../src/soap.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,0CAA4C;AAC5C,oCAAsC;AACtC,mCAAkC;AAClC,sCAAwC;AACxC,mCAA8C;AAE9C,+BAAyC;AAEzC,IAAM,KAAK,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAEhC,QAAA,QAAQ,GAAG,SAAS,CAAC;AAClC,mCAAkC;AAAzB,0BAAA,MAAM,CAAA;AACf,+BAAoC;AAA3B,4BAAA,UAAU,CAAA;AACnB,uCAAkJ;AAAzI,uCAAA,iBAAiB,CAAA;AAAE,oCAAA,cAAc,CAAA;AAAE,uCAAA,iBAAiB,CAAA;AAAE,0CAAA,oBAAoB,CAAA;AAAE,kCAAA,YAAY,CAAA;AAAE,gCAAA,UAAU,CAAA;AAAE,oCAAA,cAAc,CAAA;AAC7H,mCAAkC;AAAzB,0BAAA,MAAM,CAAA;AACf,iCAAyC;AAAhC,iCAAA,cAAc,CAAA;AAKvB,SA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B,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACpB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC5B,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QAClB,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;KACnB;SAAM;QACL,aAAa;QACb,+BAA+B;QAC/B,IAAI,GAAG,EAAE,CAAC;QACV,OAAO,GAAG;YACR,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,QAAQ;SACnB,CAAC;KACH;IAED,IAAM,IAAI,GAAG,IAAI,WAAI,CAAC,GAAG,IAAI,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,IAAI,eAAM,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC;AA1BD,wBA0BC"}
\ No newline at end of file

lib/types.d.ts

@@ -0,0 +1,123 @@
+import * as req from 'request';
+import { HttpClient } from './http';
+export interface IHeaders {
+ [k: string]: any;
+}
+/** @deprecated use SoapMethod */
+export declare type ISoapMethod = SoapMethod;
+export declare type SoapMethod = (args: any, callback: (err: any, result: any, rawResponse: any, soapHeader: any, rawRequest: any) => void, options?: any, extraHeaders?: any) => void;
+export declare type ISoapServiceMethod = (args: any, callback?: (data: any) => void, headers?: any, req?: any) => any;
+export interface ISoapFaultError {
+ Fault: ISoapFault;
+}
+export declare type ISoapFault = ISoapFault11 | ISoapFault12;
+export interface ISoapFault11 {
+ faultcode: number | string;
+ faultstring: string;
+ detail?: string;
+ statusCode?: number;
+}
+export interface ISoapFault12 {
+ Code: {
+ Value: string;
+ Subcode?: {
+ value: string;
+ };
+ };
+ Reason: {
+ Text: string;
+ };
+ statusCode?: number;
+}
+/** @deprecated use ISecurity */
+export declare type Security = ISecurity;
+export interface ISecurity {
+ addOptions?(options: any): void;
+ toXML?(): string;
+ addHeaders?(headers: IHeaders): void;
+ postProcess?(xml: any, envelopeKey: any): string;
+}
+export interface IServicePort {
+ [methodName: string]: ISoapServiceMethod;
+}
+export interface IService {
+ [portName: string]: IServicePort;
+}
+export interface IServices {
+ [serviceName: string]: IService;
+}
+export interface IXmlAttribute {
+ name: string;
+ value: string;
+}
+export interface IWsdlBaseOptions {
+ attributesKey?: string;
+ valueKey?: string;
+ xmlKey?: string;
+ overrideRootElement?: {
+ namespace: string;
+ xmlnsAttributes?: IXmlAttribute[];
+ };
+ ignoredNamespaces?: boolean | string[] | {
+ namespaces?: string[];
+ override?: boolean;
+ };
+ ignoreBaseNameSpaces?: boolean;
+ /** escape special XML characters in SOAP message (e.g. &, >, < etc), default: true. */
+ escapeXML?: boolean;
+ /** return an Invalid XML SOAP fault on a bad request, default: false. */
+ returnFault?: boolean;
+ handleNilAsNull?: boolean;
+ /** if your wsdl operations contains names with non identifier characters ([^a-z$_0-9]), replace them with _. Note: if using this option, clients using wsdls with two operations like soap:method and soap-method will be overwritten. Then, use bracket notation instead (client['soap:method']()). */
+ normalizeNames?: boolean;
+ /** to preserve leading and trailing whitespace characters in text and cdata. */
+ preserveWhitespace?: boolean;
+ /** provides support for nonstandard array semantics. If true, JSON arrays of the form {list: [{elem: 1}, {elem: 2}]} are marshalled into xml as <list><elem>1</elem></list> <list><elem>2</elem></list>. If false, marshalls into <list> <elem>1</elem> <elem>2</elem> </list>. Default: true. */
+ namespaceArrayElements?: boolean;
+ useEmptyTag?: boolean;
+ strict?: boolean;
+ /** custom HTTP headers to be sent on WSDL requests. */
+ wsdl_headers?: {
+ [key: string]: any;
+ };
+ /** custom options for the request module on WSDL requests. */
+ wsdl_options?: {
+ [key: string]: any;
+ };
+}
+/** @deprecated use IOptions */
+export declare type Option = IOptions;
+export interface IOptions extends IWsdlBaseOptions {
+ /** don't cache WSDL files, request them every time. */
+ disableCache?: boolean;
+ /** override the SOAP service's host specified in the .wsdl file. */
+ endpoint?: string;
+ /** set specific key instead of <pre><soap:Body></soap:Body></pre>. */
+ envelopeKey?: string;
+ /** provide your own http client that implements request(rurl, data, callback, exheaders, exoptions) */
+ httpClient?: HttpClient;
+ /** override the request module. */
+ request?: req.RequestAPI<req.Request, req.CoreOptions, req.RequiredUriUrl>;
+ stream?: boolean;
+ /** set proper headers for SOAP v1.2. */
+ forceSoap12Headers?: boolean;
+ customDeserializer?: any;
+ /** if your wsdl operations contains names with Async suffix, you will need to override the default promise suffix to a custom one, default: Async. */
+ overridePromiseSuffix?: string;
+}
+export interface IOneWayOptions {
+ responseCode?: number;
+ emptyBody?: boolean;
+}
+export interface IServerOptions extends IWsdlBaseOptions {
+ path: string;
+ services: IServices;
+ xml?: string;
+ uri?: string;
+ callback?: (err: any, res: any) => void;
+ /** suppress the full stack trace for error messages. */
+ suppressStack?: boolean;
+ oneWay?: IOneWayOptions;
+ /** A boolean for controlling chunked transfer encoding in response. Some client (such as Windows 10's MDM enrollment SOAP client) is sensitive to transfer-encoding mode and can't accept chunked response. This option let user disable chunked transfer encoding for such a client. Default to true for backward compatibility. */
+ enableChunkedEncoding?: boolean;
+}

lib/types.js

@@ -0,0 +1,3 @@
+"use strict";
+exports.__esModule = true;
+//# sourceMappingURL=types.js.map
\ No newline at end of file

lib/types.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
\ No newline at end of file

lib/utils.d.ts

@@ -0,0 +1,16 @@
+export declare function passwordDigest(nonce: string, created: string, password: string): string;
+export declare const TNS_PREFIX = "__tns__";
+/**
+ * Find a key from an object based on the value
+ * @param {Object} Namespace prefix/uri mapping
+ * @param {*} nsURI value
+ * @returns {String} The matching key
+ */
+export declare function findPrefix(xmlnsMapping: any, nsURI: any): string;
+export declare function splitQName<T>(nsName: T): {
+ prefix: string;
+ name: T;
+} | {
+ prefix: string;
+ name: string;
+};

lib/utils.js

@@ -1,30 +1,48 @@
-
"use strict";
-var crypto = require('crypto');
-exports.passwordDigest = function passwordDigest(nonce, created, password) {
+exports.__esModule = true;
+var crypto = require("crypto");
+function passwordDigest(nonce, created, password) {
// digest = base64 ( sha1 ( nonce + created + password ) )
var pwHash = crypto.createHash('sha1');
- var rawNonce = new Buffer(nonce || '', 'base64').toString('binary');
- pwHash.update(rawNonce + created + password);
+ var NonceBytes = Buffer.from(nonce || '', 'base64');
+ var CreatedBytes = Buffer.from(created || '', 'utf8');
+ var PasswordBytes = Buffer.from(password || '', 'utf8');
+ var FullBytes = Buffer.concat([NonceBytes, CreatedBytes, PasswordBytes]);
+ pwHash.update(FullBytes);
return pwHash.digest('base64');
-};
-
-
-var TNS_PREFIX = '__tns__'; // Prefix for targetNamespace
-
-exports.TNS_PREFIX = TNS_PREFIX;
-
+}
+exports.passwordDigest = passwordDigest;
+exports.TNS_PREFIX = '__tns__'; // Prefix for targetNamespace
/**
* Find a key from an object based on the value
* @param {Object} Namespace prefix/uri mapping
* @param {*} nsURI value
* @returns {String} The matching key
*/
-exports.findPrefix = function(xmlnsMapping, nsURI) {
+function findPrefix(xmlnsMapping, nsURI) {
for (var n in xmlnsMapping) {
- if (n === TNS_PREFIX) continue;
+ if (n === exports.TNS_PREFIX) {
+ continue;
+ }
if (xmlnsMapping[n] === nsURI) {
return n;
}
}
-};
+}
+exports.findPrefix = findPrefix;
+function splitQName(nsName) {
+ if (typeof nsName !== 'string') {
+ return {
+ prefix: exports.TNS_PREFIX,
+ name: nsName
+ };
+ }
+ var topLevelName = nsName.split('|')[0];
+ var prefixOffset = topLevelName.indexOf(':');
+ return {
+ prefix: topLevelName.substring(0, prefixOffset) || exports.TNS_PREFIX,
+ name: topLevelName.substring(prefixOffset + 1)
+ };
+}
+exports.splitQName = splitQName;
+//# sourceMappingURL=utils.js.map
\ No newline at end of file

lib/utils.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;AACA,+BAAiC;AAEjC,SAAgB,cAAc,CAAC,KAAa,EAA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,CAAC,EAAE,YAAY,CAAC,IAAI,kBAAU;QAC7D,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,YAAY,GAAG,CAAC,CAAC;KAC/C,CAAC;AACJ,CAAC;AAhBD,gCAgBC"}
\ No newline at end of file

lib/wsdl/elements.d.ts

@@ -0,0 +1,317 @@
+import { IWsdlBaseOptions } from '../types';
+export interface IWsdlXmlns {
+ wsu?: string;
+ wsp?: string;
+ wsam?: string;
+ soap?: string;
+ tns?: string;
+ xsd?: string;
+ __tns__?: string;
+ [prop: string]: string | void;
+}
+export interface IXmlNs {
+ [key: string]: string;
+}
+export declare class Element {
+ readonly allowedChildren?: {
+ [k: string]: typeof Element;
+ };
+ $name?: string;
+ $targetNamespace?: any;
+ children: Element[];
+ ignoredNamespaces: any;
+ name?: string;
+ nsName?: any;
+ prefix?: string;
+ schemaXmlns?: any;
+ valueKey: string;
+ xmlKey: any;
+ xmlns?: IXmlNs;
+ constructor(nsName: string, attrs: any, options?: IWsdlBaseOptions, schemaAttrs?: any);
+ deleteFixedAttrs(): void;
+ startElement(stack: Element[], nsName: string, attrs: any, options: IWsdlBaseOptions, schemaXmlns: any): void;
+ endElement(stack: Element[], nsName: string): void;
+ addChild(child: Element): void;
+ unexpected(name: string): void;
+ description(definitions?: DefinitionsElement, xmlns?: IXmlNs): any;
+ init(): void;
+ private _initializeOptions;
+}
+export declare class ElementElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ $minOccurs?: number | string;
+ $maxOccurs?: number | string;
+ $type?: string;
+ $ref?: string;
+ targetNSAlias?: string;
+ targetNamespace?: string;
+ $lookupType?: string;
+ $lookupTypes?: any[];
+ description(definitions: DefinitionsElement, xmlns?: IXmlNs): {};
+}
+export declare class AnyElement extends Element {
+}
+export declare class InputElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ use: string;
+ encodingStyle: string;
+ $type: string;
+ $lookupType: string;
+ targetNSAlias?: string;
+ targetNamespace?: string;
+ parts?: any;
+ addChild(child: Element): void;
+}
+export declare class OutputElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ targetNSAlias?: string;
+ targetNamespace?: string;
+ use?: string;
+ encodingStyle?: string;
+ $lookupTypes: any;
+ addChild(child: Element): void;
+}
+export declare class SimpleTypeElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ description(definitions: DefinitionsElement): {};
+}
+export declare class RestrictionElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ $base: string;
+ description(definitions?: DefinitionsElement, xmlns?: IXmlNs): any;
+}
+export declare class ExtensionElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ $base: string;
+ description(definitions: DefinitionsElement, xmlns?: IXmlNs): {};
+}
+export declare class ChoiceElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ description(definitions: DefinitionsElement, xmlns: IXmlNs): {};
+}
+export declare class EnumerationElement extends Element {
+ description(): string;
+}
+export declare class ComplexTypeElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ description(definitions: DefinitionsElement, xmlns: IXmlNs): {};
+}
+export declare class ComplexContentElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ description(definitions: DefinitionsElement, xmlns: IXmlNs): {};
+}
+export declare class SimpleContentElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ description(definitions: DefinitionsElement, xmlns: IXmlNs): {};
+}
+export declare class SequenceElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ description(definitions: DefinitionsElement, xmlns: IXmlNs): {};
+}
+export declare class AllElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ description(definitions: DefinitionsElement, xmlns: IXmlNs): {};
+}
+export declare class MessageElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ element: ElementElement;
+ parts: any;
+ postProcess(definitions: DefinitionsElement): void;
+ description(definitions: DefinitionsElement): {};
+ /**
+ * Takes a given namespaced String(for example: 'alias:property') and creates a lookupType
+ * object for further use in as first (lookup) `parameterTypeObj` within the `objectToXML`
+ * method and provides an entry point for the already existing code in `findChildSchemaObject`.
+ *
+ * @method _createLookupTypeObject
+ * @param {String} nsString The NS String (for example "alias:type").
+ * @param {Object} xmlns The fully parsed `wsdl` definitions object (including all schemas).
+ * @returns {Object}
+ * @private
+ */
+ private _createLookupTypeObject;
+ /**
+ * Iterates through the element and every nested child to find any defined `$type`
+ * property and returns it in a underscore ('_') separated String (using '^' as default
+ * value if no `$type` property was found).
+ *
+ * @method _getNestedLookupTypeString
+ * @param {Object} element The element which (probably) contains nested `$type` values.
+ * @returns {String}
+ * @private
+ */
+ private _getNestedLookupTypeString;
+}
+export declare class DocumentationElement extends Element {
+}
+export interface IInclude {
+ namespace: string;
+ location: string;
+}
+export declare class SchemaElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ complexTypes: {
+ [name: string]: ComplexTypeElement;
+ };
+ types: {
+ [name: string]: SimpleTypeElement;
+ };
+ elements: {
+ [name: string]: ElementElement;
+ };
+ includes: IInclude[];
+ $elementFormDefault: any;
+ merge(source: SchemaElement): this;
+ addChild(child: Element): void;
+}
+export declare class TypesElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ schemas: {
+ [name: string]: SchemaElement;
+ };
+ addChild(child: any): void;
+}
+export declare class OperationElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ input: InputElement;
+ output: OutputElement;
+ inputSoap: any;
+ outputSoap: any;
+ style: string;
+ soapAction: string;
+ $soapAction?: string;
+ $style?: string;
+ addChild(child: any): void;
+ postProcess(definitions: DefinitionsElement, tag: string): void;
+ description(definitions: DefinitionsElement): {
+ input: any;
+ output: any;
+ };
+}
+export declare class PortTypeElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ methods: {
+ [name: string]: OperationElement;
+ };
+ postProcess(definitions: DefinitionsElement): void;
+ description(definitions: DefinitionsElement): {};
+}
+export interface ITopElement {
+ methodName: string;
+ outputName: string;
+}
+export interface ITopElements {
+ [name: string]: ITopElement;
+}
+export declare class BindingElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ topElements?: ITopElements;
+ transport: string;
+ style: string;
+ methods: {
+ [name: string]: OperationElement;
+ };
+ $type?: string;
+ addChild(child: any): void;
+ postProcess(definitions: DefinitionsElement): void;
+ description(definitions: DefinitionsElement): {};
+}
+export declare class PortElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ location: any;
+ addChild(child: any): void;
+}
+export interface IPort {
+ location: string;
+ binding: BindingElement;
+}
+export declare class ServiceElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ ports: {
+ [name: string]: IPort;
+ };
+ postProcess(definitions: DefinitionsElement): void;
+ description(definitions: DefinitionsElement): {};
+}
+export declare class DefinitionsElement extends Element {
+ readonly allowedChildren: {
+ [k: string]: typeof Element;
+ };
+ complexTypes: any;
+ messages: {
+ [name: string]: MessageElement;
+ };
+ portTypes: {
+ [name: string]: PortTypeElement;
+ };
+ bindings: {
+ [name: string]: BindingElement;
+ };
+ services: {
+ [name: string]: ServiceElement;
+ };
+ schemas: {
+ [name: string]: SchemaElement;
+ };
+ descriptions: {
+ types: {
+ [key: string]: Element;
+ };
+ };
+ init(): void;
+ addChild(child: any): void;
+}
+export declare class BodyElement extends Element {
+ $use?: string;
+ $encodingStyle?: string;
+}
+export declare class IncludeElement extends Element {
+ $schemaLocation?: any;
+ $location?: any;
+ $namespace?: any;
+}
+export declare class ImportElement extends Element {
+ $schemaLocation?: any;
+ $location?: any;
+ $namespace?: any;
+}

lib/wsdl/elements.js

@@ -0,0 +1,1188 @@
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+exports.__esModule = true;
+var assert_1 = require("assert");
+var debugBuilder = require("debug");
+var _ = require("lodash");
+var utils_1 = require("../utils");
+var debug = debugBuilder('node-soap');
+var Primitives = {
+ string: 1,
+ boolean: 1,
+ decimal: 1,
+ float: 1,
+ double: 1,
+ anyType: 1,
+ byte: 1,
+ int: 1,
+ long: 1,
+ short: 1,
+ negativeInteger: 1,
+ nonNegativeInteger: 1,
+ positiveInteger: 1,
+ nonPositiveInteger: 1,
+ unsignedByte: 1,
+ unsignedInt: 1,
+ unsignedLong: 1,
+ unsignedShort: 1,
+ duration: 0,
+ dateTime: 0,
+ time: 0,
+ date: 0,
+ gYearMonth: 0,
+ gYear: 0,
+ gMonthDay: 0,
+ gDay: 0,
+ gMonth: 0,
+ hexBinary: 0,
+ base64Binary: 0,
+ anyURI: 0,
+ QName: 0,
+ NOTATION: 0
+};
+var Element = /** @class */ (function () {
+ function Element(nsName, attrs, options, schemaAttrs) {
+ this.allowedChildren = {};
+ this.children = [];
+ var parts = utils_1.splitQName(nsName);
+ this.nsName = nsName;
+ this.prefix = parts.prefix;
+ this.name = parts.name;
+ this.children = [];
+ this.xmlns = {};
+ this.schemaXmlns = {};
+ this._initializeOptions(options);
+ for (var key in attrs) {
+ var match = /^xmlns:?(.*)$/.exec(key);
+ if (match) {
+ this.xmlns[match[1] ? match[1] : utils_1.TNS_PREFIX] = attrs[key];
+ }
+ else {
+ if (key === 'value') {
+ this[this.valueKey] = attrs[key];
+ }
+ else {
+ this['$' + key] = attrs[key];
+ }
+ }
+ }
+ for (var schemaKey in schemaAttrs) {
+ var schemaMatch = /^xmlns:?(.*)$/.exec(schemaKey);
+ if (schemaMatch && schemaMatch[1]) {
+ this.schemaXmlns[schemaMatch[1]] = schemaAttrs[schemaKey];
+ }
+ }
+ if (this.$targetNamespace !== undefined) {
+ // Add targetNamespace to the mapping
+ this.xmlns[utils_1.TNS_PREFIX] = this.$targetNamespace;
+ }
+ this.init();
+ }
+ Element.prototype.deleteFixedAttrs = function () {
+ this.children && this.children.length === 0 && delete this.children;
+ this.xmlns && Object.keys(this.xmlns).length === 0 && delete this.xmlns;
+ delete this.nsName;
+ delete this.prefix;
+ delete this.name;
+ };
+ Element.prototype.startElement = function (stack, nsName, attrs, options, schemaXmlns) {
+ if (!this.allowedChildren) {
+ return;
+ }
+ var ChildClass = this.allowedChildren[utils_1.splitQName(nsName).name];
+ if (ChildClass) {
+ var child = new ChildClass(nsName, attrs, options, schemaXmlns);
+ child.init();
+ stack.push(child);
+ }
+ else {
+ this.unexpected(nsName);
+ }
+ };
+ Element.prototype.endElement = function (stack, nsName) {
+ if (this.nsName === nsName) {
+ if (stack.length < 2) {
+ return;
+ }
+ var parent_1 = stack[stack.length - 2];
+ if (this !== stack[0]) {
+ _.defaultsDeep(stack[0].xmlns, this.xmlns);
+ // delete this.xmlns;
+ parent_1.children.push(this);
+ parent_1.addChild(this);
+ }
+ stack.pop();
+ }
+ };
+ Element.prototype.addChild = function (child) {
+ return;
+ };
+ Element.prototype.unexpected = function (name) {
+ throw new Error('Found unexpected element (' + name + ') inside ' + this.nsName);
+ };
+ Element.prototype.description = function (definitions, xmlns) {
+ return this.$name || this.name;
+ };
+ Element.prototype.init = function () {
+ };
+ Element.prototype._initializeOptions = function (options) {
+ if (options) {
+ this.valueKey = options.valueKey || '$value';
+ this.xmlKey = options.xmlKey || '$xml';
+ this.ignoredNamespaces = options.ignoredNamespaces || [];
+ }
+ else {
+ this.valueKey = '$value';
+ this.xmlKey = '$xml';
+ this.ignoredNamespaces = [];
+ }
+ };
+ return Element;
+}());
+exports.Element = Element;
+var ElementElement = /** @class */ (function (_super) {
+ __extends(ElementElement, _super);
+ function ElementElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'annotation',
+ 'complexType',
+ 'simpleType',
+ ]);
+ return _this;
+ }
+ ElementElement.prototype.description = function (definitions, xmlns) {
+ var element = {};
+ var name = this.$name;
+ var isMany = !this.$maxOccurs ? false : (typeof this.$maxOccurs === 'string' ? (this.$maxOccurs === 'unbounded') : (this.$maxOccurs > 1));
+ if (this.$minOccurs !== this.$maxOccurs && isMany) {
+ name += '[]';
+ }
+ if (xmlns && xmlns[utils_1.TNS_PREFIX]) {
+ this.$targetNamespace = xmlns[utils_1.TNS_PREFIX];
+ }
+ var type = this.$type || this.$ref;
+ if (type) {
+ type = utils_1.splitQName(type);
+ var typeName = type.name;
+ var ns = xmlns && xmlns[type.prefix] ||
+ ((definitions.xmlns[type.prefix] !== undefined || definitions.xmlns[this.targetNSAlias] !== undefined) && this.schemaXmlns[type.prefix]) ||
+ definitions.xmlns[type.prefix];
+ var schema = definitions.schemas[ns];
+ var typeElement = schema && (this.$type ? schema.complexTypes[typeName] || schema.types[typeName] : schema.elements[typeName]);
+ if (ns && definitions.schemas[ns]) {
+ xmlns = definitions.schemas[ns].xmlns;
+ }
+ if (typeElement && !(typeName in Primitives)) {
+ if (!(typeName in definitions.descriptions.types)) {
+ var elem_1 = {};
+ definitions.descriptions.types[typeName] = elem_1;
+ var description_1 = typeElement.description(definitions, xmlns);
+ if (typeof description_1 === 'string') {
+ elem_1 = description_1;
+ }
+ else {
+ Object.keys(description_1).forEach(function (key) {
+ elem_1[key] = description_1[key];
+ });
+ }
+ if (this.$ref) {
+ element = elem_1;
+ }
+ else {
+ element[name] = elem_1;
+ }
+ if (typeof elem_1 === 'object') {
+ elem_1.targetNSAlias = type.prefix;
+ elem_1.targetNamespace = ns;
+ }
+ definitions.descriptions.types[typeName] = elem_1;
+ }
+ else {
+ if (this.$ref) {
+ element = definitions.descriptions.types[typeName];
+ }
+ else {
+ element[name] = definitions.descriptions.types[typeName];
+ }
+ }
+ }
+ else {
+ element[name] = this.$type;
+ }
+ }
+ else {
+ var children = this.children;
+ element[name] = {};
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
+ var child = children_1[_i];
+ if (child instanceof ComplexTypeElement || child instanceof SimpleTypeElement) {
+ element[name] = child.description(definitions, xmlns);
+ }
+ }
+ }
+ return element;
+ };
+ return ElementElement;
+}(Element));
+exports.ElementElement = ElementElement;
+var AnyElement = /** @class */ (function (_super) {
+ __extends(AnyElement, _super);
+ function AnyElement() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return AnyElement;
+}(Element));
+exports.AnyElement = AnyElement;
+var InputElement = /** @class */ (function (_super) {
+ __extends(InputElement, _super);
+ function InputElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'body',
+ 'documentation',
+ 'header',
+ 'SecuritySpecRef',
+ ]);
+ return _this;
+ }
+ InputElement.prototype.addChild = function (child) {
+ if (child instanceof BodyElement) {
+ this.use = child.$use;
+ if (this.use === 'encoded') {
+ this.encodingStyle = child.$encodingStyle;
+ }
+ this.children.pop();
+ }
+ };
+ return InputElement;
+}(Element));
+exports.InputElement = InputElement;
+var OutputElement = /** @class */ (function (_super) {
+ __extends(OutputElement, _super);
+ function OutputElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'body',
+ 'documentation',
+ 'header',
+ 'SecuritySpecRef',
+ ]);
+ return _this;
+ }
+ OutputElement.prototype.addChild = function (child) {
+ if (child instanceof BodyElement) {
+ this.use = child.$use;
+ if (this.use === 'encoded') {
+ this.encodingStyle = child.$encodingStyle;
+ }
+ this.children.pop();
+ }
+ };
+ return OutputElement;
+}(Element));
+exports.OutputElement = OutputElement;
+var SimpleTypeElement = /** @class */ (function (_super) {
+ __extends(SimpleTypeElement, _super);
+ function SimpleTypeElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'restriction',
+ ]);
+ return _this;
+ }
+ SimpleTypeElement.prototype.description = function (definitions) {
+ for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (child instanceof RestrictionElement) {
+ return [this.$name, child.description()].filter(Boolean).join('|');
+ }
+ }
+ return {};
+ };
+ return SimpleTypeElement;
+}(Element));
+exports.SimpleTypeElement = SimpleTypeElement;
+var RestrictionElement = /** @class */ (function (_super) {
+ __extends(RestrictionElement, _super);
+ function RestrictionElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'all',
+ 'choice',
+ 'enumeration',
+ 'sequence',
+ ]);
+ return _this;
+ }
+ RestrictionElement.prototype.description = function (definitions, xmlns) {
+ var children = this.children;
+ var desc;
+ for (var i = 0, child = void 0; child = children[i]; i++) {
+ if (child instanceof SequenceElement || child instanceof ChoiceElement) {
+ desc = child.description(definitions, xmlns);
+ break;
+ }
+ }
+ if (desc && this.$base) {
+ var type = utils_1.splitQName(this.$base);
+ var typeName = type.name;
+ var ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
+ var schema_1 = definitions.schemas[ns];
+ var typeElement_1 = schema_1 && (schema_1.complexTypes[typeName] || schema_1.types[typeName] || schema_1.elements[typeName]);
+ desc.getBase = function () {
+ return typeElement_1.description(definitions, schema_1.xmlns);
+ };
+ return desc;
+ }
+ // then simple element
+ var base = this.$base ? this.$base + '|' : '';
+ var restrictions = this.children.map(function (child) {
+ return child.description();
+ }).join(',');
+ return [this.$base, restrictions].filter(Boolean).join('|');
+ };
+ return RestrictionElement;
+}(Element));
+exports.RestrictionElement = RestrictionElement;
+var ExtensionElement = /** @class */ (function (_super) {
+ __extends(ExtensionElement, _super);
+ function ExtensionElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'all',
+ 'choice',
+ 'sequence',
+ ]);
+ return _this;
+ }
+ ExtensionElement.prototype.description = function (definitions, xmlns) {
+ var desc = {};
+ for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (child instanceof SequenceElement || child instanceof ChoiceElement) {
+ desc = child.description(definitions, xmlns);
+ }
+ }
+ if (this.$base) {
+ var type = utils_1.splitQName(this.$base);
+ var typeName = type.name;
+ var ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
+ var schema = definitions.schemas[ns];
+ if (typeName in Primitives) {
+ return this.$base;
+ }
+ else {
+ var typeElement = schema && (schema.complexTypes[typeName] ||
+ schema.types[typeName] || schema.elements[typeName]);
+ if (typeElement) {
+ var base = typeElement.description(definitions, schema.xmlns);
+ desc = typeof base === 'string' ? base : _.defaultsDeep(base, desc);
+ }
+ }
+ }
+ return desc;
+ };
+ return ExtensionElement;
+}(Element));
+exports.ExtensionElement = ExtensionElement;
+var ChoiceElement = /** @class */ (function (_super) {
+ __extends(ChoiceElement, _super);
+ function ChoiceElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'any',
+ 'choice',
+ 'element',
+ 'sequence',
+ ]);
+ return _this;
+ }
+ ChoiceElement.prototype.description = function (definitions, xmlns) {
+ var choice = {};
+ for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ var description = child.description(definitions, xmlns);
+ for (var key in description) {
+ choice[key] = description[key];
+ }
+ }
+ return choice;
+ };
+ return ChoiceElement;
+}(Element));
+exports.ChoiceElement = ChoiceElement;
+var EnumerationElement = /** @class */ (function (_super) {
+ __extends(EnumerationElement, _super);
+ function EnumerationElement() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ // no children
+ EnumerationElement.prototype.description = function () {
+ return this[this.valueKey];
+ };
+ return EnumerationElement;
+}(Element));
+exports.EnumerationElement = EnumerationElement;
+var ComplexTypeElement = /** @class */ (function (_super) {
+ __extends(ComplexTypeElement, _super);
+ function ComplexTypeElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'all',
+ 'annotation',
+ 'choice',
+ 'complexContent',
+ 'sequence',
+ 'simpleContent',
+ ]);
+ return _this;
+ }
+ ComplexTypeElement.prototype.description = function (definitions, xmlns) {
+ var children = this.children || [];
+ for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
+ var child = children_2[_i];
+ if (child instanceof ChoiceElement ||
+ child instanceof SequenceElement ||
+ child instanceof AllElement ||
+ child instanceof SimpleContentElement ||
+ child instanceof ComplexContentElement) {
+ return child.description(definitions, xmlns);
+ }
+ }
+ return {};
+ };
+ return ComplexTypeElement;
+}(Element));
+exports.ComplexTypeElement = ComplexTypeElement;
+var ComplexContentElement = /** @class */ (function (_super) {
+ __extends(ComplexContentElement, _super);
+ function ComplexContentElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'extension',
+ ]);
+ return _this;
+ }
+ ComplexContentElement.prototype.description = function (definitions, xmlns) {
+ for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (child instanceof ExtensionElement) {
+ return child.description(definitions, xmlns);
+ }
+ }
+ return {};
+ };
+ return ComplexContentElement;
+}(Element));
+exports.ComplexContentElement = ComplexContentElement;
+var SimpleContentElement = /** @class */ (function (_super) {
+ __extends(SimpleContentElement, _super);
+ function SimpleContentElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'extension',
+ ]);
+ return _this;
+ }
+ SimpleContentElement.prototype.description = function (definitions, xmlns) {
+ for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (child instanceof ExtensionElement) {
+ return child.description(definitions, xmlns);
+ }
+ }
+ return {};
+ };
+ return SimpleContentElement;
+}(Element));
+exports.SimpleContentElement = SimpleContentElement;
+var SequenceElement = /** @class */ (function (_super) {
+ __extends(SequenceElement, _super);
+ function SequenceElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'any',
+ 'choice',
+ 'element',
+ 'sequence',
+ ]);
+ return _this;
+ }
+ SequenceElement.prototype.description = function (definitions, xmlns) {
+ var sequence = {};
+ for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (child instanceof AnyElement) {
+ continue;
+ }
+ var description = child.description(definitions, xmlns);
+ for (var key in description) {
+ sequence[key] = description[key];
+ }
+ }
+ return sequence;
+ };
+ return SequenceElement;
+}(Element));
+exports.SequenceElement = SequenceElement;
+var AllElement = /** @class */ (function (_super) {
+ __extends(AllElement, _super);
+ function AllElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'choice',
+ 'element',
+ ]);
+ return _this;
+ }
+ AllElement.prototype.description = function (definitions, xmlns) {
+ var sequence = {};
+ for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
+ var child = _a[_i];
+ if (child instanceof AnyElement) {
+ continue;
+ }
+ var description = child.description(definitions, xmlns);
+ for (var key in description) {
+ sequence[key] = description[key];
+ }
+ }
+ return sequence;
+ };
+ return AllElement;
+}(Element));
+exports.AllElement = AllElement;
+var MessageElement = /** @class */ (function (_super) {
+ __extends(MessageElement, _super);
+ function MessageElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'part',
+ 'documentation',
+ ]);
+ _this.element = null;
+ _this.parts = null;
+ return _this;
+ }
+ MessageElement.prototype.postProcess = function (definitions) {
+ var part = null;
+ var children = this.children || [];
+ for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
+ var child = children_3[_i];
+ if (child.name === 'part') {
+ part = child;
+ break;
+ }
+ }
+ if (!part) {
+ return;
+ }
+ if (part.$element) {
+ var lookupTypes = [];
+ delete this.parts;
+ var nsName = utils_1.splitQName(part.$element);
+ var ns = nsName.prefix;
+ var schema = definitions.schemas[definitions.xmlns[ns]];
+ this.element = schema.elements[nsName.name];
+ if (!this.element) {
+ debug(nsName.name + ' is not present in wsdl and cannot be processed correctly.');
+ return;
+ }
+ this.element.targetNSAlias = ns;
+ this.element.targetNamespace = definitions.xmlns[ns];
+ // set the optional $lookupType to be used within `client#_invoke()` when
+ // calling `wsdl#objectToDocumentXML()
+ this.element.$lookupType = part.$element;
+ var elementChildren = this.element.children;
+ // get all nested lookup types (only complex types are followed)
+ if (elementChildren.length > 0) {
+ for (var _a = 0, elementChildren_1 = elementChildren; _a < elementChildren_1.length; _a++) {
+ var child = elementChildren_1[_a];
+ lookupTypes.push(this._getNestedLookupTypeString(child));
+ }
+ }
+ // if nested lookup types where found, prepare them for furter usage
+ if (lookupTypes.length > 0) {
+ lookupTypes = lookupTypes.
+ join('_').
+ split('_').
+ filter(function removeEmptyLookupTypes(type) {
+ return type !== '^';
+ });
+ var schemaXmlns = definitions.schemas[this.element.targetNamespace].xmlns;
+ for (var i = 0; i < lookupTypes.length; i++) {
+ lookupTypes[i] = this._createLookupTypeObject(lookupTypes[i], schemaXmlns);
+ }
+ }
+ this.element.$lookupTypes = lookupTypes;
+ if (this.element.$type) {
+ var type = utils_1.splitQName(this.element.$type);
+ var typeNs = schema.xmlns && schema.xmlns[type.prefix] || definitions.xmlns[type.prefix];
+ if (typeNs) {
+ if (type.name in Primitives) {
+ // this.element = this.element.$type;
+ }
+ else {
+ // first check local mapping of ns alias to namespace
+ schema = definitions.schemas[typeNs];
+ var ctype = schema.complexTypes[type.name] || schema.types[type.name] || schema.elements[type.name];
+ if (ctype) {
+ this.parts = ctype.description(definitions, schema.xmlns);
+ }
+ }
+ }
+ }
+ else {
+ var method = this.element.description(definitions, schema.xmlns);
+ this.parts = method[nsName.name];
+ }
+ this.children.splice(0, 1);
+ }
+ else {
+ // rpc encoding
+ this.parts = {};
+ delete this.element;
+ for (var i = 0; part = this.children[i]; i++) {
+ if (part.name === 'documentation') {
+ // <wsdl:documentation can be present under <wsdl:message>
+ continue;
+ }
+ assert_1.ok(part.name === 'part', 'Expected part element');
+ var nsName = utils_1.splitQName(part.$type);
+ var ns = definitions.xmlns[nsName.prefix];
+ var type = nsName.name;
+ var schemaDefinition = definitions.schemas[ns];
+ if (typeof schemaDefinition !== 'undefined') {
+ this.parts[part.$name] = definitions.schemas[ns].types[type] || definitions.schemas[ns].complexTypes[type];
+ }
+ else {
+ this.parts[part.$name] = part.$type;
+ }
+ if (typeof this.parts[part.$name] === 'object') {
+ this.parts[part.$name].prefix = nsName.prefix;
+ this.parts[part.$name].xmlns = ns;
+ }
+ this.children.splice(i--, 1);
+ }
+ }
+ this.deleteFixedAttrs();
+ };
+ MessageElement.prototype.description = function (definitions) {
+ if (this.element) {
+ return this.element && this.element.description(definitions);
+ }
+ var desc = {};
+ desc[this.$name] = this.parts;
+ return desc;
+ };
+ /**
+ * Takes a given namespaced String(for example: 'alias:property') and creates a lookupType
+ * object for further use in as first (lookup) `parameterTypeObj` within the `objectToXML`
+ * method and provides an entry point for the already existing code in `findChildSchemaObject`.
+ *
+ * @method _createLookupTypeObject
+ * @param {String} nsString The NS String (for example "alias:type").
+ * @param {Object} xmlns The fully parsed `wsdl` definitions object (including all schemas).
+ * @returns {Object}
+ * @private
+ */
+ MessageElement.prototype._createLookupTypeObject = function (nsString, xmlns) {
+ var splittedNSString = utils_1.splitQName(nsString);
+ var nsAlias = splittedNSString.prefix;
+ var splittedName = splittedNSString.name.split('#');
+ var type = splittedName[0];
+ var name = splittedName[1];
+ return {
+ $namespace: xmlns[nsAlias],
+ $type: nsAlias + ':' + type,
+ $name: name
+ };
+ };
+ /**
+ * Iterates through the element and every nested child to find any defined `$type`
+ * property and returns it in a underscore ('_') separated String (using '^' as default
+ * value if no `$type` property was found).
+ *
+ * @method _getNestedLookupTypeString
+ * @param {Object} element The element which (probably) contains nested `$type` values.
+ * @returns {String}
+ * @private
+ */
+ MessageElement.prototype._getNestedLookupTypeString = function (element) {
+ var _this = this;
+ var resolvedType = '^';
+ var excluded = this.ignoredNamespaces.concat('xs'); // do not process $type values wich start with
+ if (element.hasOwnProperty('$type') && typeof element.$type === 'string') {
+ if (excluded.indexOf(element.$type.split(':')[0]) === -1) {
+ resolvedType += ('_' + element.$type + '#' + element.$name);
+ }
+ }
+ if (element.children.length > 0) {
+ element.children.forEach(function (child) {
+ var resolvedChildType = _this._getNestedLookupTypeString(child).replace(/\^_/, '');
+ if (resolvedChildType && typeof resolvedChildType === 'string') {
+ resolvedType += ('_' + resolvedChildType);
+ }
+ });
+ }
+ return resolvedType;
+ };
+ return MessageElement;
+}(Element));
+exports.MessageElement = MessageElement;
+var DocumentationElement = /** @class */ (function (_super) {
+ __extends(DocumentationElement, _super);
+ function DocumentationElement() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return DocumentationElement;
+}(Element));
+exports.DocumentationElement = DocumentationElement;
+var SchemaElement = /** @class */ (function (_super) {
+ __extends(SchemaElement, _super);
+ function SchemaElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'complexType',
+ 'element',
+ 'import',
+ 'include',
+ 'simpleType',
+ ]);
+ _this.complexTypes = {};
+ _this.types = {};
+ _this.elements = {};
+ _this.includes = [];
+ return _this;
+ }
+ SchemaElement.prototype.merge = function (source) {
+ var _this = this;
+ assert_1.ok(source instanceof SchemaElement);
+ _.merge(this.complexTypes, source.complexTypes);
+ _.merge(this.types, source.types);
+ _.merge(this.elements, source.elements);
+ _.merge(this.xmlns, source.xmlns);
+ // Merge attributes from source without overwriting our's
+ _.merge(this, _.pickBy(source, function (value, key) {
+ return key.startsWith('$') && !_this.hasOwnProperty(key);
+ }));
+ return this;
+ };
+ SchemaElement.prototype.addChild = function (child) {
+ if (child.$name in Primitives) {
+ return;
+ }
+ if (child instanceof IncludeElement || child instanceof ImportElement) {
+ var location_1 = child.$schemaLocation || child.$location;
+ if (location_1) {
+ this.includes.push({
+ namespace: child.$namespace || child.$targetNamespace || this.$targetNamespace,
+ location: location_1
+ });
+ }
+ }
+ else if (child instanceof ComplexTypeElement) {
+ this.complexTypes[child.$name] = child;
+ }
+ else if (child instanceof ElementElement) {
+ this.elements[child.$name] = child;
+ }
+ else if (child instanceof SimpleTypeElement) {
+ this.types[child.$name] = child;
+ }
+ this.children.pop();
+ // child.deleteFixedAttrs();
+ };
+ return SchemaElement;
+}(Element));
+exports.SchemaElement = SchemaElement;
+var TypesElement = /** @class */ (function (_super) {
+ __extends(TypesElement, _super);
+ function TypesElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'documentation',
+ 'schema',
+ ]);
+ _this.schemas = {};
+ return _this;
+ }
+ // fix#325
+ TypesElement.prototype.addChild = function (child) {
+ assert_1.ok(child instanceof SchemaElement);
+ var targetNamespace = child.$targetNamespace;
+ if (!this.schemas.hasOwnProperty(targetNamespace)) {
+ this.schemas[targetNamespace] = child;
+ }
+ else {
+ console.error('Target-Namespace "' + targetNamespace + '" already in use by another Schema!');
+ }
+ };
+ return TypesElement;
+}(Element));
+exports.TypesElement = TypesElement;
+var OperationElement = /** @class */ (function (_super) {
+ __extends(OperationElement, _super);
+ function OperationElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'documentation',
+ 'fault',
+ 'input',
+ 'operation',
+ 'output',
+ ]);
+ _this.input = null;
+ _this.output = null;
+ _this.inputSoap = null;
+ _this.outputSoap = null;
+ _this.style = '';
+ _this.soapAction = '';
+ return _this;
+ }
+ OperationElement.prototype.addChild = function (child) {
+ if (child instanceof OperationElement) {
+ this.soapAction = child.$soapAction || '';
+ this.style = child.$style || '';
+ this.children.pop();
+ }
+ };
+ OperationElement.prototype.postProcess = function (definitions, tag) {
+ var children = this.children;
+ for (var i = 0, child = void 0; child = children[i]; i++) {
+ if (child.name !== 'input' && child.name !== 'output') {
+ continue;
+ }
+ if (tag === 'binding') {
+ this[child.name] = child;
+ children.splice(i--, 1);
+ continue;
+ }
+ var messageName = utils_1.splitQName(child.$message).name;
+ var message = definitions.messages[messageName];
+ message.postProcess(definitions);
+ if (message.element) {
+ definitions.messages[message.element.$name] = message;
+ this[child.name] = message.element;
+ }
+ else {
+ this[child.name] = message;
+ }
+ children.splice(i--, 1);
+ }
+ this.deleteFixedAttrs();
+ };
+ OperationElement.prototype.description = function (definitions) {
+ var inputDesc = this.input ? this.input.description(definitions) : null;
+ var outputDesc = this.output ? this.output.description(definitions) : null;
+ return {
+ input: inputDesc && inputDesc[Object.keys(inputDesc)[0]],
+ output: outputDesc && outputDesc[Object.keys(outputDesc)[0]]
+ };
+ };
+ return OperationElement;
+}(Element));
+exports.OperationElement = OperationElement;
+var PortTypeElement = /** @class */ (function (_super) {
+ __extends(PortTypeElement, _super);
+ function PortTypeElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'documentation',
+ 'operation',
+ ]);
+ _this.methods = {};
+ return _this;
+ }
+ PortTypeElement.prototype.postProcess = function (definitions) {
+ var children = this.children;
+ if (typeof children === 'undefined') {
+ return;
+ }
+ for (var i = 0, child = void 0; child = children[i]; i++) {
+ if (child.name !== 'operation') {
+ continue;
+ }
+ child.postProcess(definitions, 'portType');
+ this.methods[child.$name] = child;
+ children.splice(i--, 1);
+ }
+ delete this.$name;
+ this.deleteFixedAttrs();
+ };
+ PortTypeElement.prototype.description = function (definitions) {
+ var methods = {};
+ for (var name_1 in this.methods) {
+ var method = this.methods[name_1];
+ methods[name_1] = method.description(definitions);
+ }
+ return methods;
+ };
+ return PortTypeElement;
+}(Element));
+exports.PortTypeElement = PortTypeElement;
+var BindingElement = /** @class */ (function (_super) {
+ __extends(BindingElement, _super);
+ function BindingElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'binding',
+ 'documentation',
+ 'operation',
+ 'SecuritySpec',
+ ]);
+ _this.transport = '';
+ _this.style = '';
+ _this.methods = {};
+ return _this;
+ }
+ BindingElement.prototype.addChild = function (child) {
+ if (child.name === 'binding') {
+ this.transport = child.$transport;
+ this.style = child.$style;
+ this.children.pop();
+ }
+ };
+ BindingElement.prototype.postProcess = function (definitions) {
+ var type = utils_1.splitQName(this.$type).name;
+ var portType = definitions.portTypes[type];
+ var style = this.style;
+ var children = this.children;
+ if (portType) {
+ portType.postProcess(definitions);
+ this.methods = portType.methods;
+ for (var i = 0, child = void 0; child = children[i]; i++) {
+ if (child.name !== 'operation') {
+ continue;
+ }
+ child.postProcess(definitions, 'binding');
+ children.splice(i--, 1);
+ child.style || (child.style = style);
+ var method = this.methods[child.$name];
+ if (method) {
+ method.style = child.style;
+ method.soapAction = child.soapAction;
+ method.inputSoap = child.input || null;
+ method.outputSoap = child.output || null;
+ method.inputSoap && method.inputSoap.deleteFixedAttrs();
+ method.outputSoap && method.outputSoap.deleteFixedAttrs();
+ }
+ }
+ }
+ delete this.$name;
+ delete this.$type;
+ this.deleteFixedAttrs();
+ };
+ BindingElement.prototype.description = function (definitions) {
+ var methods = {};
+ for (var name_2 in this.methods) {
+ var method = this.methods[name_2];
+ methods[name_2] = method.description(definitions);
+ }
+ return methods;
+ };
+ return BindingElement;
+}(Element));
+exports.BindingElement = BindingElement;
+var PortElement = /** @class */ (function (_super) {
+ __extends(PortElement, _super);
+ function PortElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'address',
+ 'documentation',
+ ]);
+ _this.location = null;
+ return _this;
+ }
+ PortElement.prototype.addChild = function (child) {
+ if (child.name === 'address' && typeof (child.$location) !== 'undefined') {
+ this.location = child.$location;
+ }
+ };
+ return PortElement;
+}(Element));
+exports.PortElement = PortElement;
+var ServiceElement = /** @class */ (function (_super) {
+ __extends(ServiceElement, _super);
+ function ServiceElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'documentation',
+ 'port',
+ ]);
+ _this.ports = {};
+ return _this;
+ }
+ ServiceElement.prototype.postProcess = function (definitions) {
+ var children = this.children;
+ var bindings = definitions.bindings;
+ if (children && children.length > 0) {
+ for (var i = 0, child = void 0; child = children[i]; i++) {
+ if (child.name !== 'port') {
+ continue;
+ }
+ var bindingName = utils_1.splitQName(child.$binding).name;
+ var binding = bindings[bindingName];
+ if (binding) {
+ binding.postProcess(definitions);
+ this.ports[child.$name] = {
+ location: child.location,
+ binding: binding
+ };
+ children.splice(i--, 1);
+ }
+ }
+ }
+ delete this.$name;
+ this.deleteFixedAttrs();
+ };
+ ServiceElement.prototype.description = function (definitions) {
+ var ports = {};
+ for (var name_3 in this.ports) {
+ var port = this.ports[name_3];
+ ports[name_3] = port.binding.description(definitions);
+ }
+ return ports;
+ };
+ return ServiceElement;
+}(Element));
+exports.ServiceElement = ServiceElement;
+var DefinitionsElement = /** @class */ (function (_super) {
+ __extends(DefinitionsElement, _super);
+ function DefinitionsElement() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.allowedChildren = buildAllowedChildren([
+ 'binding',
+ 'documentation',
+ 'import',
+ 'message',
+ 'portType',
+ 'service',
+ 'types',
+ ]);
+ _this.messages = {};
+ _this.portTypes = {};
+ _this.bindings = {};
+ _this.services = {};
+ _this.schemas = {};
+ _this.descriptions = {
+ types: {}
+ };
+ return _this;
+ }
+ DefinitionsElement.prototype.init = function () {
+ if (this.name !== 'definitions') {
+ this.unexpected(this.nsName);
+ }
+ };
+ DefinitionsElement.prototype.addChild = function (child) {
+ if (child instanceof TypesElement) {
+ // Merge types.schemas into definitions.schemas
+ _.merge(this.schemas, child.schemas);
+ }
+ else if (child instanceof MessageElement) {
+ this.messages[child.$name] = child;
+ }
+ else if (child.name === 'import') {
+ var schemaElement = new SchemaElement(child.$namespace, {});
+ schemaElement.init();
+ this.schemas[child.$namespace] = schemaElement;
+ this.schemas[child.$namespace].addChild(child);
+ }
+ else if (child instanceof PortTypeElement) {
+ this.portTypes[child.$name] = child;
+ }
+ else if (child instanceof BindingElement) {
+ if (child.transport === 'http://schemas.xmlsoap.org/soap/http' ||
+ child.transport === 'http://www.w3.org/2003/05/soap/bindings/HTTP/') {
+ this.bindings[child.$name] = child;
+ }
+ }
+ else if (child instanceof ServiceElement) {
+ this.services[child.$name] = child;
+ }
+ else if (child instanceof DocumentationElement) {
+ }
+ this.children.pop();
+ };
+ return DefinitionsElement;
+}(Element));
+exports.DefinitionsElement = DefinitionsElement;
+var BodyElement = /** @class */ (function (_super) {
+ __extends(BodyElement, _super);
+ function BodyElement() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return BodyElement;
+}(Element));
+exports.BodyElement = BodyElement;
+var IncludeElement = /** @class */ (function (_super) {
+ __extends(IncludeElement, _super);
+ function IncludeElement() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return IncludeElement;
+}(Element));
+exports.IncludeElement = IncludeElement;
+var ImportElement = /** @class */ (function (_super) {
+ __extends(ImportElement, _super);
+ function ImportElement() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ return ImportElement;
+}(Element));
+exports.ImportElement = ImportElement;
+var ElementTypeMap = {
+ // group: [GroupElement, 'element group'],
+ all: AllElement,
+ any: AnyElement,
+ binding: BindingElement,
+ body: BodyElement,
+ choice: ChoiceElement,
+ complexContent: ComplexContentElement,
+ complexType: ComplexTypeElement,
+ definitions: DefinitionsElement,
+ documentation: DocumentationElement,
+ element: ElementElement,
+ enumeration: EnumerationElement,
+ extension: ExtensionElement,
+ fault: Element,
+ "import": ImportElement,
+ include: IncludeElement,
+ input: InputElement,
+ message: MessageElement,
+ operation: OperationElement,
+ output: OutputElement,
+ port: PortElement,
+ portType: PortTypeElement,
+ restriction: RestrictionElement,
+ schema: SchemaElement,
+ sequence: SequenceElement,
+ service: ServiceElement,
+ simpleContent: SimpleContentElement,
+ simpleType: SimpleTypeElement,
+ types: TypesElement
+};
+function buildAllowedChildren(elementList) {
+ var rtn = {};
+ for (var _i = 0, elementList_1 = elementList; _i < elementList_1.length; _i++) {
+ var element = elementList_1[_i];
+ rtn[element.replace(/^_/, '')] = ElementTypeMap[element] || Element;
+ }
+ return rtn;
+}
+//# sourceMappingURL=elements.js.map
\ No newline at end of file

lib/wsdl/elements.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../src/wsdl/elements.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iCAAsC;AACtC,oCAAsC;AACtC,0BAA4B;AAE5B,kCAAkD;AAElD,IAAM,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;AAExC,IAAM,UAAU,GAEZ;IACF,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,eAAe,EAAE,CAAC;IAClB,kBAAkB,EAAE,CAAC;IACrB,eAAe,EAAE,CAAC;IAClB,kBAAkB,EAAE,CAAC;IACrB,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC;IACX,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,UAAU,EAAE,CAAC;IACb,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,CAAC;IACf,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;CAC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AqB;IACrC,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,kBAAkB;IAC/B,aAAa,EAAE,oBAAoB;IACnC,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,kBAAkB;IAC/B,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,OAAO;IACd,QAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,gBAAgB;IAC3B,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,eAAe;IACzB,WAAW,EAAE,kBAAkB;IAC/B,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,cAAc;IACvB,aAAa,EAAE,oBAAoB;IACnC,UAAU,EAAE,iBAAiB;IAC7B,KAAK,EAAE,YAAY;CACpB,CAAC;AAEF,SAAS,oBAAoB,CAAC,WAAqB;IACjD,IAAM,GAAG,GAAG,EAAE,CAAC;IACf,KAAsB,UAAW,EAAX,2BAAW,EAAX,yBAAW,EAAX,IAAW,EAAE;QAA9B,IAAM,OAAO,oBAAA;QAChB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;KACrE;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
\ No newline at end of file

lib/wsdl/index.d.ts

@@ -0,0 +1,87 @@
+import { NamespaceContext } from '../nscontext';
+import { IOptions } from '../types';
+import * as elements from './elements';
+interface IInitializedOptions extends IOptions {
+ ignoredNamespaces?: string[];
+}
+export declare class WSDL {
+ ignoredNamespaces: string[];
+ ignoreBaseNameSpaces: boolean;
+ valueKey: string;
+ xmlKey: string;
+ xmlnsInEnvelope: string;
+ uri: string;
+ definitions: elements.DefinitionsElement;
+ options: IInitializedOptions;
+ private callback;
+ private services;
+ private xml;
+ private _includesWsdl;
+ private _originalIgnoredNamespaces;
+ constructor(definition: any, uri: string, options: IOptions);
+ onReady(callback: (err: Error) => void): void;
+ processIncludes(callback: any): void;
+ describeServices(): {};
+ toXML(): string;
+ xmlToObject(xml: any, callback?: any): any;
+ /**
+ * Look up a XSD type or element by namespace URI and name
+ * @param {String} nsURI Namespace URI
+ * @param {String} qname Local or qualified name
+ * @returns {*} The XSD type/element definition
+ */
+ findSchemaObject(nsURI: string, qname: string): any;
+ /**
+ * Create document style xml string from the parameters
+ * @param {String} name
+ * @param {*} params
+ * @param {String} nsPrefix
+ * @param {String} nsURI
+ * @param {String} type
+ */
+ objectToDocumentXML(name: string, params: any, nsPrefix: string, nsURI?: string, type?: string): any;
+ /**
+ * Create RPC style xml string from the parameters
+ * @param {String} name
+ * @param {*} params
+ * @param {String} nsPrefix
+ * @param {String} nsURI
+ * @returns {string}
+ */
+ objectToRpcXML(name: string, params: any, nsPrefix: string, nsURI: string, isParts?: boolean): string;
+ isIgnoredNameSpace(ns: string): boolean;
+ filterOutIgnoredNameSpace(ns: string): string;
+ /**
+ * 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} nsPrefix the namespace prefix of the object I.E. xsd.
+ * @param {String} nsURI 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 {NamespaceContext} nsContext Namespace context
+ */
+ objectToXML(obj: any, name: string, nsPrefix: any, nsURI: string, isFirst?: boolean, xmlnsAttr?: any, schemaObject?: any, nsContext?: NamespaceContext): any;
+ processAttributes(child: any, nsContext: NamespaceContext): string;
+ /**
+ * Look up a schema type definition
+ * @param name
+ * @param nsURI
+ * @returns {*}
+ */
+ findSchemaType(name: any, nsURI: any): any;
+ findChildSchemaObject(parameterTypeObj: any, childName: any, backtrace?: any): any;
+ private _initializeOptions;
+ private _processNextInclude;
+ private _parse;
+ private _fromXML;
+ private _fromServices;
+ private _xmlnsMap;
+}
+declare type WSDLCallback = (error: any, result?: WSDL) => any;
+export declare function open_wsdl(uri: any, callback: WSDLCallback): any;
+export declare function open_wsdl(uri: any, options: IOptions, callback: WSDLCallback): any;
+export {};

lib/wsdl/index.js

@@ -0,0 +1,1247 @@
+"use strict";
+/*
+ * Copyright (c) 2011 Vinay Pulim <vinay@milewise.com>
+ * MIT Licensed
+ *
+ */
+/*jshint proto:true*/
+exports.__esModule = true;
+var assert_1 = require("assert");
+var debugBuilder = require("debug");
+var fs = require("fs");
+var _ = require("lodash");
+var path = require("path");
+var sax = require("sax");
+var stripBom = require("strip-bom");
+var url = require("url");
+var http_1 = require("../http");
+var nscontext_1 = require("../nscontext");
+var utils_1 = require("../utils");
+var elements = require("./elements");
+var debug = debugBuilder('node-soap');
+function xmlEscape(obj) {
+ if (typeof (obj) === 'string') {
+ if (obj.substr(0, 9) === '<![CDATA[' && obj.substr(-3) === ']]>') {
+ return obj;
+ }
+ return obj
+ .replace(/&/g, '&amp;')
+ .replace(/</g, '&lt;')
+ .replace(/>/g, '&gt;')
+ .replace(/"/g, '&quot;')
+ .replace(/'/g, '&apos;');
+ }
+ return obj;
+}
+var trimLeft = /^[\s\xA0]+/;
+var trimRight = /[\s\xA0]+$/;
+function trim(text) {
+ return text.replace(trimLeft, '').replace(trimRight, '');
+}
+function deepMerge(destination, source) {
+ return _.mergeWith(destination, source, function (a, b) {
+ return _.isArray(a) ? a.concat(b) : undefined;
+ });
+}
+function appendColon(ns) {
+ return (ns && ns.charAt(ns.length - 1) !== ':') ? ns + ':' : ns;
+}
+function noColonNameSpace(ns) {
+ return (ns && ns.charAt(ns.length - 1) === ':') ? ns.substring(0, ns.length - 1) : ns;
+}
+var WSDL = /** @class */ (function () {
+ function WSDL(definition, uri, options) {
+ var _this = this;
+ this.ignoredNamespaces = ['tns', 'targetNamespace', 'typedNamespace'];
+ this.ignoreBaseNameSpaces = false;
+ this.valueKey = '$value';
+ this.xmlKey = '$xml';
+ var fromFunc;
+ this.uri = uri;
+ this.callback = function () { };
+ this._includesWsdl = [];
+ // initialize WSDL cache
+ this.WSDL_CACHE = {};
+ if (options && options.WSDL_CACHE) {
+ this.WSDL_CACHE = options.WSDL_CACHE;
+ }
+ this._initializeOptions(options);
+ if (typeof definition === 'string') {
+ definition = stripBom(definition);
+ fromFunc = this._fromXML;
+ }
+ else if (typeof definition === 'object') {
+ fromFunc = this._fromServices;
+ }
+ else {
+ throw new Error('WSDL constructor takes either an XML string or service definition');
+ }
+ process.nextTick(function () {
+ try {
+ fromFunc.call(_this, definition);
+ }
+ catch (e) {
+ return _this.callback(e);
+ }
+ _this.processIncludes(function (err) {
+ var name;
+ if (err) {
+ return _this.callback(err);
+ }
+ _this.definitions.deleteFixedAttrs();
+ var services = _this.services = _this.definitions.services;
+ if (services) {
+ for (name in services) {
+ services[name].postProcess(_this.definitions);
+ }
+ }
+ var complexTypes = _this.definitions.complexTypes;
+ if (complexTypes) {
+ for (name in complexTypes) {
+ complexTypes[name].deleteFixedAttrs();
+ }
+ }
+ // for document style, for every binding, prepare input message element name to (methodName, output message element name) mapping
+ var bindings = _this.definitions.bindings;
+ for (var bindingName in bindings) {
+ var binding = bindings[bindingName];
+ if (typeof binding.style === 'undefined') {
+ binding.style = 'document';
+ }
+ if (binding.style !== 'document') {
+ continue;
+ }
+ var methods = binding.methods;
+ var topEls = binding.topElements = {};
+ for (var methodName in methods) {
+ if (methods[methodName].input) {
+ var inputName = methods[methodName].input.$name;
+ var outputName = '';
+ if (methods[methodName].output) {
+ outputName = methods[methodName].output.$name;
+ }
+ topEls[inputName] = { methodName: methodName, outputName: outputName };
+ }
+ }
+ }
+ // prepare soap envelope xmlns definition string
+ _this.xmlnsInEnvelope = _this._xmlnsMap();
+ _this.callback(err, _this);
+ });
+ });
+ }
+ WSDL.prototype.onReady = function (callback) {
+ if (callback) {
+ this.callback = callback;
+ }
+ };
+ WSDL.prototype.processIncludes = function (callback) {
+ var schemas = this.definitions.schemas;
+ var includes = [];
+ for (var ns in schemas) {
+ var schema = schemas[ns];
+ includes = includes.concat(schema.includes || []);
+ }
+ this._processNextInclude(includes, callback);
+ };
+ WSDL.prototype.describeServices = function () {
+ var services = {};
+ for (var name_1 in this.services) {
+ var service = this.services[name_1];
+ services[name_1] = service.description(this.definitions);
+ }
+ return services;
+ };
+ WSDL.prototype.toXML = function () {
+ return this.xml || '';
+ };
+ WSDL.prototype.xmlToObject = function (xml, callback) {
+ var _this = this;
+ var p = typeof callback === 'function' ? {} : sax.parser(true, null);
+ var objectName = null;
+ var root = {};
+ var schema = {
+ Envelope: {
+ Header: {
+ Security: {
+ UsernameToken: {
+ Username: 'string',
+ Password: 'string'
+ }
+ }
+ },
+ Body: {
+ Fault: {
+ faultcode: 'string',
+ faultstring: 'string',
+ detail: 'string'
+ }
+ }
+ }
+ };
+ var stack = [{ name: null, object: root, schema: schema }];
+ var xmlns = {};
+ var refs = {};
+ var id; // {id:{hrefs:[],obj:}, ...}
+ p.onopentag = function (node) {
+ var nsName = node.name;
+ var attrs = node.attributes;
+ var name = utils_1.splitQName(nsName).name;
+ var attributeName;
+ var top = stack[stack.length - 1];
+ var topSchema = top.schema;
+ var elementAttributes = {};
+ var hasNonXmlnsAttribute = false;
+ var hasNilAttribute = false;
+ var obj = {};
+ var originalName = name;
+ if (!objectName && top.name === 'Body' && name !== 'Fault') {
+ var message = _this.definitions.messages[name];
+ // Support RPC/literal messages where response body contains one element named
+ // after the operation + 'Response'. See http://www.w3.org/TR/wsdl#_names
+ if (!message) {
+ try {
+ // Determine if this is request or response
+ var isInput = false;
+ var isOutput = false;
+ if ((/Response$/).test(name)) {
+ isOutput = true;
+ name = name.replace(/Response$/, '');
+ }
+ else if ((/Request$/).test(name)) {
+ isInput = true;
+ name = name.replace(/Request$/, '');
+ }
+ else if ((/Solicit$/).test(name)) {
+ isInput = true;
+ name = name.replace(/Solicit$/, '');
+ }
+ // Look up the appropriate message as given in the portType's operations
+ var portTypes = _this.definitions.portTypes;
+ var portTypeNames = Object.keys(portTypes);
+ // Currently this supports only one portType definition.
+ var portType = portTypes[portTypeNames[0]];
+ if (isInput) {
+ name = portType.methods[name].input.$name;
+ }
+ else {
+ name = portType.methods[name].output.$name;
+ }
+ message = _this.definitions.messages[name];
+ // 'cache' this alias to speed future lookups
+ _this.definitions.messages[originalName] = _this.definitions.messages[name];
+ }
+ catch (e) {
+ if (_this.options.returnFault) {
+ p.onerror(e);
+ }
+ }
+ }
+ topSchema = message.description(_this.definitions);
+ objectName = originalName;
+ }
+ if (attrs.href) {
+ id = attrs.href.substr(1);
+ if (!refs[id]) {
+ refs[id] = { hrefs: [], obj: null };
+ }
+ refs[id].hrefs.push({ par: top.object, key: name, obj: obj });
+ }
+ if (id = attrs.id) {
+ if (!refs[id]) {
+ refs[id] = { hrefs: [], obj: null };
+ }
+ }
+ // Handle element attributes
+ for (attributeName in attrs) {
+ if (/^xmlns:|^xmlns$/.test(attributeName)) {
+ xmlns[utils_1.splitQName(attributeName).name] = attrs[attributeName];
+ continue;
+ }
+ hasNonXmlnsAttribute = true;
+ elementAttributes[attributeName] = attrs[attributeName];
+ }
+ for (attributeName in elementAttributes) {
+ var res = utils_1.splitQName(attributeName);
+ if (res.name === 'nil' && xmlns[res.prefix] === 'http://www.w3.org/2001/XMLSchema-instance' && elementAttributes[attributeName] &&
+ (elementAttributes[attributeName].toLowerCase() === 'true' || elementAttributes[attributeName] === '1')) {
+ hasNilAttribute = true;
+ break;
+ }
+ }
+ if (hasNonXmlnsAttribute) {
+ obj[_this.options.attributesKey] = elementAttributes;
+ }
+ // Pick up the schema for the type specified in element's xsi:type attribute.
+ var xsiTypeSchema;
+ var xsiType = elementAttributes['xsi:type'];
+ if (xsiType) {
+ var type = utils_1.splitQName(xsiType);
+ var typeURI = void 0;
+ if (type.prefix === utils_1.TNS_PREFIX) {
+ // In case of xsi:type = "MyType"
+ typeURI = xmlns[type.prefix] || xmlns.xmlns;
+ }
+ else {
+ typeURI = xmlns[type.prefix];
+ }
+ var typeDef = _this.findSchemaObject(typeURI, type.name);
+ if (typeDef) {
+ xsiTypeSchema = typeDef.description(_this.definitions);
+ }
+ }
+ if (topSchema && topSchema[name + '[]']) {
+ name = name + '[]';
+ }
+ stack.push({ name: originalName, object: obj, schema: (xsiTypeSchema || (topSchema && topSchema[name])), id: attrs.id, nil: hasNilAttribute });
+ };
+ p.onclosetag = function (nsName) {
+ var cur = stack.pop();
+ var obj = cur.object;
+ var top = stack[stack.length - 1];
+ var topObject = top.object;
+ var topSchema = top.schema;
+ var name = utils_1.splitQName(nsName).name;
+ if (typeof cur.schema === 'string' && (cur.schema === 'string' || cur.schema.split(':')[1] === 'string')) {
+ if (typeof obj === 'object' && Object.keys(obj).length === 0) {
+ obj = cur.object = '';
+ }
+ }
+ if (cur.nil === true) {
+ if (_this.options.handleNilAsNull) {
+ obj = null;
+ }
+ else {
+ return;
+ }
+ }
+ if (_.isPlainObject(obj) && !Object.keys(obj).length) {
+ obj = null;
+ }
+ if (topSchema && topSchema[name + '[]']) {
+ if (!topObject[name]) {
+ topObject[name] = [];
+ }
+ topObject[name].push(obj);
+ }
+ else if (name in topObject) {
+ if (!Array.isArray(topObject[name])) {
+ topObject[name] = [topObject[name]];
+ }
+ topObject[name].push(obj);
+ }
+ else {
+ topObject[name] = obj;
+ }
+ if (cur.id) {
+ refs[cur.id].obj = obj;
+ }
+ };
+ p.oncdata = function (text) {
+ var originalText = text;
+ text = trim(text);
+ if (!text.length) {
+ return;
+ }
+ if (/<\?xml[\s\S]+\?>/.test(text)) {
+ var top_1 = stack[stack.length - 1];
+ var value = _this.xmlToObject(text);
+ if (top_1.object[_this.options.attributesKey]) {
+ top_1.object[_this.options.valueKey] = value;
+ }
+ else {
+ top_1.object = value;
+ }
+ }
+ else {
+ p.ontext(originalText);
+ }
+ };
+ p.onerror = function (e) {
+ p.resume();
+ throw {
+ Fault: {
+ faultcode: 500,
+ faultstring: 'Invalid XML',
+ detail: new Error(e).message,
+ statusCode: 500
+ }
+ };
+ };
+ p.ontext = function (text) {
+ var originalText = text;
+ text = trim(text);
+ if (!text.length) {
+ return;
+ }
+ var top = stack[stack.length - 1];
+ var name = utils_1.splitQName(top.schema).name;
+ var value;
+ if (_this.options && _this.options.customDeserializer && _this.options.customDeserializer[name]) {
+ value = _this.options.customDeserializer[name](text, top);
+ }
+ else {
+ 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' || name === 'date') {
+ value = new Date(text);
+ }
+ else {
+ if (_this.options.preserveWhitespace) {
+ text = originalText;
+ }
+ // handle string or other types
+ if (typeof top.object !== 'string') {
+ value = text;
+ }
+ else {
+ value = top.object + text;
+ }
+ }
+ }
+ if (top.object[_this.options.attributesKey]) {
+ top.object[_this.options.valueKey] = value;
+ }
+ else {
+ top.object = value;
+ }
+ };
+ if (typeof callback === 'function') {
+ // we be streaming
+ var saxStream = sax.createStream(true, null);
+ saxStream.on('opentag', p.onopentag);
+ saxStream.on('closetag', p.onclosetag);
+ saxStream.on('cdata', p.oncdata);
+ saxStream.on('text', p.ontext);
+ xml.pipe(saxStream)
+ .on('error', function (err) {
+ callback(err);
+ })
+ .on('end', function () {
+ var r;
+ try {
+ r = finish();
+ }
+ catch (e) {
+ return callback(e);
+ }
+ callback(null, r);
+ });
+ return;
+ }
+ p.write(xml).close();
+ return finish();
+ function finish() {
+ // MultiRef support: merge objects instead of replacing
+ for (var n in refs) {
+ var ref = refs[n];
+ for (var _i = 0, _a = ref.hrefs; _i < _a.length; _i++) {
+ var href = _a[_i];
+ _.assign(href.obj, ref.obj);
+ }
+ }
+ if (root.Envelope) {
+ var body = root.Envelope.Body;
+ if (body && body.Fault) {
+ var code = body.Fault.faultcode && body.Fault.faultcode.$value;
+ var string = body.Fault.faultstring && body.Fault.faultstring.$value;
+ var detail = body.Fault.detail && body.Fault.detail.$value;
+ code = code || body.Fault.faultcode;
+ string = string || body.Fault.faultstring;
+ detail = detail || body.Fault.detail;
+ var error = new Error(code + ': ' + string + (detail ? ': ' + JSON.stringify(detail) : ''));
+ error.root = root;
+ throw error;
+ }
+ return root.Envelope;
+ }
+ return root;
+ }
+ };
+ /**
+ * Look up a XSD type or element by namespace URI and name
+ * @param {String} nsURI Namespace URI
+ * @param {String} qname Local or qualified name
+ * @returns {*} The XSD type/element definition
+ */
+ WSDL.prototype.findSchemaObject = function (nsURI, qname) {
+ if (!nsURI || !qname) {
+ return null;
+ }
+ var def = null;
+ if (this.definitions.schemas) {
+ var schema = this.definitions.schemas[nsURI];
+ if (schema) {
+ if (qname.indexOf(':') !== -1) {
+ qname = qname.substring(qname.indexOf(':') + 1, qname.length);
+ }
+ // if the client passed an input element which has a `$lookupType` property instead of `$type`
+ // the `def` is found in `schema.elements`.
+ def = schema.complexTypes[qname] || schema.types[qname] || schema.elements[qname];
+ }
+ }
+ return def;
+ };
+ /**
+ * Create document style xml string from the parameters
+ * @param {String} name
+ * @param {*} params
+ * @param {String} nsPrefix
+ * @param {String} nsURI
+ * @param {String} type
+ */
+ WSDL.prototype.objectToDocumentXML = function (name, params, nsPrefix, nsURI, type) {
+ // If user supplies XML already, just use that. XML Declaration should not be present.
+ if (params && params._xml) {
+ return params._xml;
+ }
+ var args = {};
+ args[name] = params;
+ var parameterTypeObj = type ? this.findSchemaObject(nsURI, type) : null;
+ return this.objectToXML(args, null, nsPrefix, nsURI, true, null, parameterTypeObj);
+ };
+ /**
+ * Create RPC style xml string from the parameters
+ * @param {String} name
+ * @param {*} params
+ * @param {String} nsPrefix
+ * @param {String} nsURI
+ * @returns {string}
+ */
+ WSDL.prototype.objectToRpcXML = function (name, params, nsPrefix, nsURI, isParts) {
+ var parts = [];
+ var defs = this.definitions;
+ var nsAttrName = '_xmlns';
+ nsPrefix = nsPrefix || utils_1.findPrefix(defs.xmlns, nsURI);
+ nsURI = nsURI || defs.xmlns[nsPrefix];
+ nsPrefix = nsPrefix === utils_1.TNS_PREFIX ? '' : (nsPrefix + ':');
+ parts.push(['<', nsPrefix, name, '>'].join(''));
+ for (var key in params) {
+ if (!params.hasOwnProperty(key)) {
+ continue;
+ }
+ if (key !== nsAttrName) {
+ var value = params[key];
+ var prefixedKey = (isParts ? '' : nsPrefix) + key;
+ var attributes = [];
+ if (typeof value === 'object' && value.hasOwnProperty(this.options.attributesKey)) {
+ var attrs = value[this.options.attributesKey];
+ for (var n in attrs) {
+ attributes.push(' ' + n + '=' + '"' + attrs[n] + '"');
+ }
+ }
+ parts.push(['<', prefixedKey].concat(attributes).concat('>').join(''));
+ parts.push((typeof value === 'object') ? this.objectToXML(value, key, nsPrefix, nsURI) : xmlEscape(value));
+ parts.push(['</', prefixedKey, '>'].join(''));
+ }
+ }
+ parts.push(['</', nsPrefix, name, '>'].join(''));
+ return parts.join('');
+ };
+ WSDL.prototype.isIgnoredNameSpace = function (ns) {
+ return this.options.ignoredNamespaces.indexOf(ns) > -1;
+ };
+ WSDL.prototype.filterOutIgnoredNameSpace = function (ns) {
+ var namespace = noColonNameSpace(ns);
+ return this.isIgnoredNameSpace(namespace) ? '' : namespace;
+ };
+ /**
+ * 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} nsPrefix the namespace prefix of the object I.E. xsd.
+ * @param {String} nsURI 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 {NamespaceContext} nsContext Namespace context
+ */
+ WSDL.prototype.objectToXML = function (obj, name, nsPrefix, nsURI, isFirst, xmlnsAttr, schemaObject, nsContext) {
+ var schema = this.definitions.schemas[nsURI];
+ var parentNsPrefix = nsPrefix ? nsPrefix.parent : undefined;
+ if (typeof parentNsPrefix !== 'undefined') {
+ // we got the parentNsPrefix for our array. setting the namespace-variable back to the current namespace string
+ nsPrefix = nsPrefix.current;
+ }
+ parentNsPrefix = noColonNameSpace(parentNsPrefix);
+ if (this.isIgnoredNameSpace(parentNsPrefix)) {
+ parentNsPrefix = '';
+ }
+ var soapHeader = !schema;
+ var qualified = schema && schema.$elementFormDefault === 'qualified';
+ var parts = [];
+ var prefixNamespace = (nsPrefix || qualified) && nsPrefix !== utils_1.TNS_PREFIX;
+ var xmlnsAttrib = '';
+ if (nsURI && isFirst) {
+ if (this.options.overrideRootElement && this.options.overrideRootElement.xmlnsAttributes) {
+ this.options.overrideRootElement.xmlnsAttributes.forEach(function (attribute) {
+ xmlnsAttrib += ' ' + attribute.name + '="' + attribute.value + '"';
+ });
+ }
+ else {
+ if (prefixNamespace && !this.isIgnoredNameSpace(nsPrefix)) {
+ // resolve the prefix namespace
+ xmlnsAttrib += ' xmlns:' + nsPrefix + '="' + nsURI + '"';
+ }
+ // only add default namespace if the schema elementFormDefault is qualified
+ if (qualified || soapHeader) {
+ xmlnsAttrib += ' xmlns="' + nsURI + '"';
+ }
+ }
+ }
+ if (!nsContext) {
+ nsContext = new nscontext_1.NamespaceContext();
+ nsContext.declareNamespace(nsPrefix, nsURI);
+ }
+ else {
+ nsContext.pushContext();
+ }
+ // explicitly use xmlns attribute if available
+ if (xmlnsAttr && !(this.options.overrideRootElement && this.options.overrideRootElement.xmlnsAttributes)) {
+ xmlnsAttrib = xmlnsAttr;
+ }
+ var ns = '';
+ if (this.options.overrideRootElement && isFirst) {
+ ns = this.options.overrideRootElement.namespace;
+ }
+ else if (prefixNamespace && (qualified || isFirst || soapHeader) && !this.isIgnoredNameSpace(nsPrefix)) {
+ ns = nsPrefix;
+ }
+ var i;
+ var n;
+ // start building out XML string.
+ if (Array.isArray(obj)) {
+ var nonSubNameSpace = '';
+ var emptyNonSubNameSpaceForArray = false;
+ var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
+ if (nameWithNsRegex) {
+ nonSubNameSpace = nameWithNsRegex[1];
+ name = nameWithNsRegex[2];
+ }
+ else if (name[0] === ':') {
+ emptyNonSubNameSpaceForArray = true;
+ name = name.substr(1);
+ }
+ for (i = 0, n = obj.length; i < n; i++) {
+ var item = obj[i];
+ var arrayAttr = this.processAttributes(item, nsContext);
+ var correctOuterNsPrefix = nonSubNameSpace || parentNsPrefix || ns; // using the parent namespace prefix if given
+ var body = this.objectToXML(item, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
+ var openingTagParts = ['<', name, arrayAttr, xmlnsAttrib];
+ if (!emptyNonSubNameSpaceForArray) {
+ openingTagParts = ['<', appendColon(correctOuterNsPrefix), name, arrayAttr, xmlnsAttrib];
+ }
+ if (body === '' && this.options.useEmptyTag) {
+ // Use empty (self-closing) tags if no contents
+ openingTagParts.push(' />');
+ parts.push(openingTagParts.join(''));
+ }
+ else {
+ openingTagParts.push('>');
+ if (this.options.namespaceArrayElements || i === 0) {
+ parts.push(openingTagParts.join(''));
+ }
+ parts.push(body);
+ if (this.options.namespaceArrayElements || i === n - 1) {
+ if (emptyNonSubNameSpaceForArray) {
+ parts.push(['</', name, '>'].join(''));
+ }
+ else {
+ parts.push(['</', appendColon(correctOuterNsPrefix), name, '>'].join(''));
+ }
+ }
+ }
+ }
+ }
+ else if (typeof obj === 'object') {
+ for (name in obj) {
+ if (!obj.hasOwnProperty(name)) {
+ continue;
+ }
+ // don't process attributes as element
+ if (name === this.options.attributesKey) {
+ continue;
+ }
+ // Its the value of a xml object. Return it directly.
+ if (name === this.options.xmlKey) {
+ nsContext.popContext();
+ return obj[name];
+ }
+ // Its the value of an item. Return it directly.
+ if (name === this.options.valueKey) {
+ nsContext.popContext();
+ return xmlEscape(obj[name]);
+ }
+ var child = obj[name];
+ if (typeof child === 'undefined') {
+ continue;
+ }
+ var attr = this.processAttributes(child, nsContext);
+ var value = '';
+ var nonSubNameSpace = '';
+ var emptyNonSubNameSpace = false;
+ var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
+ if (nameWithNsRegex) {
+ nonSubNameSpace = nameWithNsRegex[1] + ':';
+ name = nameWithNsRegex[2];
+ }
+ else if (name[0] === ':') {
+ emptyNonSubNameSpace = true;
+ name = name.substr(1);
+ }
+ if (isFirst) {
+ value = this.objectToXML(child, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
+ }
+ else {
+ if (this.definitions.schemas) {
+ if (schema) {
+ var childSchemaObject = this.findChildSchemaObject(schemaObject, name);
+ // find sub namespace if not a primitive
+ if (childSchemaObject &&
+ ((childSchemaObject.$type && (childSchemaObject.$type.indexOf('xsd:') === -1)) ||
+ childSchemaObject.$ref || childSchemaObject.$name)) {
+ /*if the base name space of the children is not in the ingoredSchemaNamspaces we use it.
+ This is because in some services the child nodes do not need the baseNameSpace.
+ */
+ var childNsPrefix = '';
+ var childName = '';
+ var childNsURI = void 0;
+ var childXmlnsAttrib = '';
+ var elementQName = childSchemaObject.$ref || childSchemaObject.$name;
+ if (elementQName) {
+ elementQName = utils_1.splitQName(elementQName);
+ childName = elementQName.name;
+ if (elementQName.prefix === utils_1.TNS_PREFIX) {
+ // Local element
+ childNsURI = childSchemaObject.$targetNamespace;
+ childNsPrefix = nsContext.registerNamespace(childNsURI);
+ if (this.isIgnoredNameSpace(childNsPrefix)) {
+ childNsPrefix = nsPrefix;
+ }
+ }
+ else {
+ childNsPrefix = elementQName.prefix;
+ if (this.isIgnoredNameSpace(childNsPrefix)) {
+ childNsPrefix = nsPrefix;
+ }
+ childNsURI = schema.xmlns[childNsPrefix] || this.definitions.xmlns[childNsPrefix];
+ }
+ var unqualified = false;
+ // Check qualification form for local elements
+ if (childSchemaObject.$name && childSchemaObject.targetNamespace === undefined) {
+ if (childSchemaObject.$form === 'unqualified') {
+ unqualified = true;
+ }
+ else if (childSchemaObject.$form === 'qualified') {
+ unqualified = false;
+ }
+ else {
+ unqualified = schema.$elementFormDefault !== 'qualified';
+ }
+ }
+ if (unqualified) {
+ childNsPrefix = '';
+ }
+ if (childNsURI && childNsPrefix) {
+ if (nsContext.declareNamespace(childNsPrefix, childNsURI)) {
+ childXmlnsAttrib = ' xmlns:' + childNsPrefix + '="' + childNsURI + '"';
+ xmlnsAttrib += childXmlnsAttrib;
+ }
+ }
+ }
+ var resolvedChildSchemaObject = void 0;
+ if (childSchemaObject.$type) {
+ var typeQName = utils_1.splitQName(childSchemaObject.$type);
+ var typePrefix = typeQName.prefix;
+ var typeURI = schema.xmlns[typePrefix] || this.definitions.xmlns[typePrefix];
+ childNsURI = typeURI;
+ if (typeURI !== 'http://www.w3.org/2001/XMLSchema' && typePrefix !== utils_1.TNS_PREFIX) {
+ // Add the prefix/namespace mapping, but not declare it
+ nsContext.addNamespace(typePrefix, typeURI);
+ }
+ resolvedChildSchemaObject =
+ this.findSchemaType(typeQName.name, typeURI) || childSchemaObject;
+ }
+ else {
+ resolvedChildSchemaObject =
+ this.findSchemaObject(childNsURI, childName) || childSchemaObject;
+ }
+ if (childSchemaObject.$baseNameSpace && this.options.ignoreBaseNameSpaces) {
+ childNsPrefix = nsPrefix;
+ childNsURI = nsURI;
+ }
+ if (this.options.ignoreBaseNameSpaces) {
+ childNsPrefix = '';
+ childNsURI = '';
+ }
+ ns = childNsPrefix;
+ if (Array.isArray(child)) {
+ // for arrays, we need to remember the current namespace
+ childNsPrefix = {
+ current: childNsPrefix,
+ parent: ns
+ };
+ }
+ else {
+ // parent (array) already got the namespace
+ childXmlnsAttrib = null;
+ }
+ value = this.objectToXML(child, name, childNsPrefix, childNsURI, false, childXmlnsAttrib, resolvedChildSchemaObject, nsContext);
+ }
+ else if (obj[this.options.attributesKey] && obj[this.options.attributesKey].xsi_type) {
+ // if parent object has complex type defined and child not found in parent
+ var completeChildParamTypeObject = this.findChildSchemaObject(obj[this.options.attributesKey].xsi_type.type, obj[this.options.attributesKey].xsi_type.xmlns);
+ nonSubNameSpace = obj[this.options.attributesKey].xsi_type.prefix;
+ nsContext.addNamespace(obj[this.options.attributesKey].xsi_type.prefix, obj[this.options.attributesKey].xsi_type.xmlns);
+ value = this.objectToXML(child, name, obj[this.options.attributesKey].xsi_type.prefix, obj[this.options.attributesKey].xsi_type.xmlns, false, null, null, nsContext);
+ }
+ else {
+ if (Array.isArray(child)) {
+ if (emptyNonSubNameSpace) {
+ name = ':' + name;
+ }
+ else {
+ name = nonSubNameSpace + name;
+ }
+ }
+ value = this.objectToXML(child, name, nsPrefix, nsURI, false, null, null, nsContext);
+ }
+ }
+ else {
+ value = this.objectToXML(child, name, nsPrefix, nsURI, false, null, null, nsContext);
+ }
+ }
+ }
+ ns = noColonNameSpace(ns);
+ if (prefixNamespace && !qualified && isFirst && !this.options.overrideRootElement) {
+ ns = nsPrefix;
+ }
+ else if (this.isIgnoredNameSpace(ns)) {
+ ns = '';
+ }
+ var useEmptyTag = !value && this.options.useEmptyTag;
+ if (!Array.isArray(child)) {
+ // start tag
+ parts.push(['<', emptyNonSubNameSpace ? '' : appendColon(nonSubNameSpace || ns), name, attr, xmlnsAttrib,
+ (child === null ? ' xsi:nil="true"' : ''),
+ useEmptyTag ? ' />' : '>',
+ ].join(''));
+ }
+ if (!useEmptyTag) {
+ parts.push(value);
+ if (!Array.isArray(child)) {
+ // end tag
+ parts.push(['</', emptyNonSubNameSpace ? '' : appendColon(nonSubNameSpace || ns), name, '>'].join(''));
+ }
+ }
+ }
+ }
+ else if (obj !== undefined) {
+ parts.push((this.options.escapeXML) ? xmlEscape(obj) : obj);
+ }
+ nsContext.popContext();
+ return parts.join('');
+ };
+ WSDL.prototype.processAttributes = function (child, nsContext) {
+ var attr = '';
+ if (child === null) {
+ child = [];
+ }
+ var attrObj = child[this.options.attributesKey];
+ if (attrObj && attrObj.xsi_type) {
+ var xsiType = attrObj.xsi_type;
+ var prefix = xsiType.prefix || xsiType.namespace;
+ // Generate a new namespace for complex extension if one not provided
+ if (!prefix) {
+ prefix = nsContext.registerNamespace(xsiType.xmlns);
+ }
+ else {
+ nsContext.declareNamespace(prefix, xsiType.xmlns);
+ }
+ xsiType.prefix = prefix;
+ }
+ if (attrObj) {
+ for (var attrKey in attrObj) {
+ // handle complex extension separately
+ if (attrKey === 'xsi_type') {
+ var attrValue = attrObj[attrKey];
+ attr += ' xsi:type="' + attrValue.prefix + ':' + attrValue.type + '"';
+ attr += ' xmlns:' + attrValue.prefix + '="' + attrValue.xmlns + '"';
+ continue;
+ }
+ else {
+ attr += ' ' + attrKey + '="' + xmlEscape(attrObj[attrKey]) + '"';
+ }
+ }
+ }
+ return attr;
+ };
+ /**
+ * Look up a schema type definition
+ * @param name
+ * @param nsURI
+ * @returns {*}
+ */
+ WSDL.prototype.findSchemaType = function (name, nsURI) {
+ if (!this.definitions.schemas || !name || !nsURI) {
+ return null;
+ }
+ var schema = this.definitions.schemas[nsURI];
+ if (!schema || !schema.complexTypes) {
+ return null;
+ }
+ return schema.complexTypes[name];
+ };
+ WSDL.prototype.findChildSchemaObject = function (parameterTypeObj, childName, backtrace) {
+ if (!parameterTypeObj || !childName) {
+ return null;
+ }
+ if (!backtrace) {
+ backtrace = [];
+ }
+ if (backtrace.indexOf(parameterTypeObj) >= 0) {
+ // We've recursed back to ourselves; break.
+ return null;
+ }
+ else {
+ backtrace = backtrace.concat([parameterTypeObj]);
+ }
+ var found = null;
+ var i = 0;
+ var child;
+ var ref;
+ if (Array.isArray(parameterTypeObj.$lookupTypes) && parameterTypeObj.$lookupTypes.length) {
+ var types = parameterTypeObj.$lookupTypes;
+ for (i = 0; i < types.length; i++) {
+ var typeObj = types[i];
+ if (typeObj.$name === childName) {
+ found = typeObj;
+ break;
+ }
+ }
+ }
+ var object = parameterTypeObj;
+ if (object.$name === childName && object.name === 'element') {
+ return object;
+ }
+ if (object.$ref) {
+ ref = utils_1.splitQName(object.$ref);
+ if (ref.name === childName) {
+ return object;
+ }
+ }
+ var childNsURI;
+ // want to avoid unecessary recursion to improve performance
+ if (object.$type && backtrace.length === 1) {
+ var typeInfo = utils_1.splitQName(object.$type);
+ if (typeInfo.prefix === utils_1.TNS_PREFIX) {
+ childNsURI = parameterTypeObj.$targetNamespace;
+ }
+ else {
+ childNsURI = this.definitions.xmlns[typeInfo.prefix];
+ }
+ var typeDef = this.findSchemaType(typeInfo.name, childNsURI);
+ if (typeDef) {
+ return this.findChildSchemaObject(typeDef, childName, backtrace);
+ }
+ }
+ if (object.children) {
+ for (i = 0, child; child = object.children[i]; i++) {
+ found = this.findChildSchemaObject(child, childName, backtrace);
+ if (found) {
+ break;
+ }
+ if (child.$base) {
+ var baseQName = utils_1.splitQName(child.$base);
+ var childNameSpace = baseQName.prefix === utils_1.TNS_PREFIX ? '' : baseQName.prefix;
+ childNsURI = child.xmlns[baseQName.prefix] || this.definitions.xmlns[baseQName.prefix];
+ var foundBase = this.findSchemaType(baseQName.name, childNsURI);
+ if (foundBase) {
+ found = this.findChildSchemaObject(foundBase, childName, backtrace);
+ if (found) {
+ found.$baseNameSpace = childNameSpace;
+ found.$type = childNameSpace + ':' + childName;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (!found && object.$name === childName) {
+ return object;
+ }
+ return found;
+ };
+ WSDL.prototype._initializeOptions = function (options) {
+ this._originalIgnoredNamespaces = (options || {}).ignoredNamespaces;
+ this.options = {};
+ var ignoredNamespaces = options ? options.ignoredNamespaces : null;
+ if (ignoredNamespaces &&
+ (Array.isArray(ignoredNamespaces.namespaces) || typeof ignoredNamespaces.namespaces === 'string')) {
+ if (ignoredNamespaces.override) {
+ this.options.ignoredNamespaces = ignoredNamespaces.namespaces;
+ }
+ else {
+ this.options.ignoredNamespaces = this.ignoredNamespaces.concat(ignoredNamespaces.namespaces);
+ }
+ }
+ else {
+ this.options.ignoredNamespaces = this.ignoredNamespaces;
+ }
+ this.options.valueKey = options.valueKey || this.valueKey;
+ this.options.xmlKey = options.xmlKey || this.xmlKey;
+ if (options.escapeXML !== undefined) {
+ this.options.escapeXML = options.escapeXML;
+ }
+ else {
+ this.options.escapeXML = true;
+ }
+ if (options.returnFault !== undefined) {
+ this.options.returnFault = options.returnFault;
+ }
+ else {
+ this.options.returnFault = false;
+ }
+ this.options.handleNilAsNull = !!options.handleNilAsNull;
+ if (options.namespaceArrayElements !== undefined) {
+ this.options.namespaceArrayElements = options.namespaceArrayElements;
+ }
+ else {
+ this.options.namespaceArrayElements = true;
+ }
+ // Allow any request headers to keep passing through
+ this.options.wsdl_headers = options.wsdl_headers;
+ this.options.wsdl_options = options.wsdl_options;
+ if (options.httpClient) {
+ this.options.httpClient = options.httpClient;
+ }
+ // The supplied request-object should be passed through
+ if (options.request) {
+ this.options.request = options.request;
+ }
+ var ignoreBaseNameSpaces = options ? options.ignoreBaseNameSpaces : null;
+ if (ignoreBaseNameSpaces !== null && typeof ignoreBaseNameSpaces !== 'undefined') {
+ this.options.ignoreBaseNameSpaces = ignoreBaseNameSpaces;
+ }
+ else {
+ this.options.ignoreBaseNameSpaces = this.ignoreBaseNameSpaces;
+ }
+ // Works only in client
+ this.options.forceSoap12Headers = options.forceSoap12Headers;
+ this.options.customDeserializer = options.customDeserializer;
+ if (options.overrideRootElement !== undefined) {
+ this.options.overrideRootElement = options.overrideRootElement;
+ }
+ this.options.useEmptyTag = !!options.useEmptyTag;
+ };
+ WSDL.prototype._processNextInclude = function (includes, callback) {
+ var _this = this;
+ var include = includes.shift();
+ if (!include) {
+ return callback();
+ }
+ var includePath;
+ if (!/^https?:/.test(this.uri) && !/^https?:/.test(include.location)) {
+ includePath = path.resolve(path.dirname(this.uri), include.location);
+ }
+ else {
+ includePath = url.resolve(this.uri || '', include.location);
+ }
+ var options = _.assign({}, this.options);
+ // follow supplied ignoredNamespaces option
+ options.ignoredNamespaces = this._originalIgnoredNamespaces || this.options.ignoredNamespaces;
+ options.WSDL_CACHE = this.WSDL_CACHE;
+ open_wsdl_recursive(includePath, options, function (err, wsdl) {
+ if (err) {
+ return callback(err);
+ }
+ _this._includesWsdl.push(wsdl);
+ if (wsdl.definitions instanceof elements.DefinitionsElement) {
+ _.mergeWith(_this.definitions, wsdl.definitions, function (a, b) {
+ return (a instanceof elements.SchemaElement) ? a.merge(b) : undefined;
+ });
+ }
+ else {
+ return callback(new Error('wsdl.defintions is not an instance of elements.DefinitionsElement'));
+ }
+ _this._processNextInclude(includes, function (err) {
+ callback(err);
+ });
+ });
+ };
+ WSDL.prototype._parse = function (xml) {
+ var _this = this;
+ var p = sax.parser(true, null);
+ var stack = [];
+ var root = null;
+ var types = null;
+ var schema = null;
+ var schemaAttrs = null;
+ var options = this.options;
+ p.onopentag = function (node) {
+ var nsName = node.name;
+ var attrs = node.attributes;
+ var top = stack[stack.length - 1];
+ var name = utils_1.splitQName(nsName).name;
+ if (name === 'schema') {
+ schemaAttrs = attrs;
+ }
+ if (top) {
+ try {
+ top.startElement(stack, nsName, attrs, options, schemaAttrs);
+ }
+ catch (e) {
+ if (_this.options.strict) {
+ throw e;
+ }
+ else {
+ stack.push(new elements.Element(nsName, attrs, options, schemaAttrs));
+ }
+ }
+ }
+ else {
+ if (name === 'definitions') {
+ root = new elements.DefinitionsElement(nsName, attrs, options);
+ stack.push(root);
+ }
+ else if (name === 'schema') {
+ // Shim a structure in here to allow the proper objects to be created when merging back.
+ root = new elements.DefinitionsElement('definitions', {}, {});
+ types = new elements.TypesElement('types', {}, {});
+ schema = new elements.SchemaElement(nsName, attrs, options);
+ types.addChild(schema);
+ root.addChild(types);
+ stack.push(schema);
+ }
+ else {
+ throw new Error('Unexpected root element of WSDL or include');
+ }
+ }
+ };
+ p.onclosetag = function (name) {
+ var top = stack[stack.length - 1];
+ assert_1.ok(top, 'Unmatched close tag: ' + name);
+ top.endElement(stack, name);
+ };
+ p.write(xml).close();
+ return root;
+ };
+ WSDL.prototype._fromXML = function (xml) {
+ this.definitions = this._parse(xml);
+ this.definitions.descriptions = {
+ types: {}
+ };
+ this.xml = xml;
+ };
+ WSDL.prototype._fromServices = function (services) {
+ };
+ WSDL.prototype._xmlnsMap = function () {
+ var xmlns = this.definitions.xmlns;
+ var str = '';
+ for (var alias in xmlns) {
+ if (alias === '' || alias === utils_1.TNS_PREFIX) {
+ continue;
+ }
+ var ns = xmlns[alias];
+ switch (ns) {
+ case 'http://xml.apache.org/xml-soap': // apachesoap
+ case 'http://schemas.xmlsoap.org/wsdl/': // wsdl
+ case 'http://schemas.xmlsoap.org/wsdl/soap/': // wsdlsoap
+ case 'http://schemas.xmlsoap.org/wsdl/soap12/': // wsdlsoap12
+ case 'http://schemas.xmlsoap.org/soap/encoding/': // soapenc
+ case 'http://www.w3.org/2001/XMLSchema': // xsd
+ continue;
+ }
+ if (~ns.indexOf('http://schemas.xmlsoap.org/')) {
+ continue;
+ }
+ if (~ns.indexOf('http://www.w3.org/')) {
+ continue;
+ }
+ if (~ns.indexOf('http://xml.apache.org/')) {
+ continue;
+ }
+ str += ' xmlns:' + alias + '="' + ns + '"';
+ }
+ return str;
+ };
+ return WSDL;
+}());
+exports.WSDL = WSDL;
+function open_wsdl_recursive(uri, p2, p3) {
+ var fromCache;
+ var WSDL_CACHE;
+ var options;
+ var callback;
+ if (typeof p2 === 'function') {
+ options = {};
+ callback = p2;
+ }
+ else {
+ options = p2;
+ callback = p3;
+ }
+ WSDL_CACHE = options.WSDL_CACHE;
+ if (fromCache = WSDL_CACHE[uri]) {
+ return callback.call(fromCache, null, fromCache);
+ }
+ return open_wsdl(uri, options, callback);
+}
+function open_wsdl(uri, p2, p3) {
+ var options;
+ var callback;
+ if (typeof p2 === 'function') {
+ options = {};
+ callback = p2;
+ }
+ else if (typeof p3 === 'function') {
+ options = p2;
+ callback = p3;
+ }
+ // initialize cache when calling open_wsdl directly
+ var WSDL_CACHE = options.WSDL_CACHE || {};
+ var request_headers = options.wsdl_headers;
+ var request_options = options.wsdl_options;
+ var wsdl;
+ if (!/^https?:/.test(uri)) {
+ debug('Reading file: %s', uri);
+ fs.readFile(uri, 'utf8', function (err, definition) {
+ if (err) {
+ callback(err);
+ }
+ else {
+ wsdl = new WSDL(definition, uri, options);
+ WSDL_CACHE[uri] = wsdl;
+ wsdl.WSDL_CACHE = WSDL_CACHE;
+ wsdl.onReady(callback);
+ }
+ });
+ }
+ else {
+ debug('Reading url: %s', uri);
+ var httpClient = options.httpClient || new http_1.HttpClient(options);
+ httpClient.request(uri, null /* options */, function (err, response, definition) {
+ if (err) {
+ callback(err);
+ }
+ else if (response && response.statusCode === 200) {
+ wsdl = new WSDL(definition, uri, options);
+ WSDL_CACHE[uri] = wsdl;
+ wsdl.WSDL_CACHE = WSDL_CACHE;
+ wsdl.onReady(callback);
+ }
+ else {
+ callback(new Error('Invalid WSDL URL: ' + uri + '\n\n\r Code: ' + response.statusCode + '\n\n\r Response Body: ' + response.body));
+ }
+ }, request_headers, request_options);
+ }
+ return wsdl;
+}
+exports.open_wsdl = open_wsdl;
+//# sourceMappingURL=index.js.map
\ No newline at end of file

lib/wsdl/index.js.map

@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/wsdl/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,qBAAqB;;AAErB,iCAAsC;AACtC,oCAAsC;AACtC,uBAAyB;AACzB,0BAA4B;AAC5B,2BAA6B;AAC7B,yBAA2B;AAC3B,oCAAsC;AACtC,yBAA2B;AAC3B,gCAAqC;AACrC,0CAAgD;AAEhD,kCAA8D;AAC9D,qCAAuC;AAEvC,IAAM,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;AAExC,SAAS,SAAS,CAAC,GAAG;IACpB,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;QAC7B,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,WAAW,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE;YAChE,OAAO,GAAG,CAAC;SACZ;QACD,OAAO,GAAG;aACP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;aACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;aACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;aACrB,OAAO,CAAC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aACxB;iBAAM;gBACL,QAAQ,CAAC,IAAI,KAAK,CAAC,oBAAoB,GAAG,GAAG,GAAG,eAAe,GAAG,QAAQ,CAAC,UAAU,GAAG,wBAAwB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;aACpI;QACH,CAAC,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;KACtC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AA/CD,8BA+CC"}
\ No newline at end of file

lib/wsdl.js

@@ -1,2315 +0,0 @@
-/*
- * Copyright (c) 2011 Vinay Pulim <vinay@milewise.com>
- * MIT Licensed
- *
- */
-/*jshint proto:true*/
-
-"use strict";
-
-var sax = require('sax');
-var inherits = require('util').inherits;
-var HttpClient = require('./http');
-var NamespaceContext = require('./nscontext');
-var fs = require('fs');
-var url = require('url');
-var path = require('path');
-var assert = require('assert').ok;
-var stripBom = require('strip-bom');
-var debug = require('debug')('node-soap');
-var _ = require('lodash');
-var utils = require('./utils');
-var TNS_PREFIX = utils.TNS_PREFIX;
-var findPrefix = utils.findPrefix;
-
-var Primitives = {
- string: 1,
- boolean: 1,
- decimal: 1,
- float: 1,
- double: 1,
- anyType: 1,
- byte: 1,
- int: 1,
- long: 1,
- short: 1,
- negativeInteger: 1,
- nonNegativeInteger: 1,
- positiveInteger: 1,
- nonPositiveInteger:1,
- unsignedByte: 1,
- unsignedInt: 1,
- unsignedLong: 1,
- unsignedShort: 1,
- duration: 0,
- dateTime: 0,
- time: 0,
- date: 0,
- gYearMonth: 0,
- gYear: 0,
- gMonthDay: 0,
- gDay: 0,
- gMonth: 0,
- hexBinary: 0,
- base64Binary: 0,
- anyURI: 0,
- QName: 0,
- NOTATION: 0
-};
-
-function splitQName(nsName) {
- if(typeof nsName !== 'string') {
- return {
- prefix: TNS_PREFIX,
- name: nsName,
- };
- }
-
- const [topLevelName] = nsName.split('|');
-
- const prefixOffset = topLevelName.indexOf(':');
-
- return {
- prefix: topLevelName.substring(0, prefixOffset) || TNS_PREFIX,
- name: topLevelName.substring(prefixOffset + 1)
- };
-}
-
-function xmlEscape(obj) {
- if (typeof (obj) === 'string') {
- if (obj.substr(0,9) === '<![CDATA[' && obj.substr(-3) === "]]>") {
- return obj;
- }
- return obj
- .replace(/&/g, '&amp;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/"/g, '&quot;')
- .replace(/'/g, '&apos;');
- }
-
- return obj;
-}
-
-var trimLeft = /^[\s\xA0]+/;
-var trimRight = /[\s\xA0]+$/;
-
-function trim(text) {
- return text.replace(trimLeft, '').replace(trimRight, '');
-}
-
-function deepMerge(destination, source) {
- return _.mergeWith(destination || {}, source, function(a, b) {
- return _.isArray(a) ? a.concat(b) : undefined;
- });
-}
-
-var Element = function(nsName, attrs, options, schemaAttrs) {
- var parts = splitQName(nsName);
-
- this.nsName = nsName;
- this.prefix = parts.prefix;
- this.name = parts.name;
- this.children = [];
- this.xmlns = {};
- this.schemaXmlns = {};
-
- this._initializeOptions(options);
-
- for (var key in attrs) {
- var match = /^xmlns:?(.*)$/.exec(key);
- if (match) {
- this.xmlns[match[1] ? match[1] : TNS_PREFIX] = attrs[key];
- }
- else {
- if(key === 'value') {
- this[this.valueKey] = attrs[key];
- } else {
- this['$' + key] = attrs[key];
- }
- }
- }
- for (var schemaKey in schemaAttrs) {
- var schemaMatch = /^xmlns:?(.*)$/.exec(schemaKey);
- if (schemaMatch && schemaMatch[1]) {
- this.schemaXmlns[schemaMatch[1]] = schemaAttrs[schemaKey];
- }
- }
- if (this.$targetNamespace !== undefined) {
- // Add targetNamespace to the mapping
- this.xmlns[TNS_PREFIX] = this.$targetNamespace;
- }
-};
-
-Element.prototype._initializeOptions = function (options) {
- if(options) {
- this.valueKey = options.valueKey || '$value';
- this.xmlKey = options.xmlKey || '$xml';
- this.ignoredNamespaces = options.ignoredNamespaces || [];
- } else {
- this.valueKey = '$value';
- this.xmlKey = '$xml';
- this.ignoredNamespaces = [];
- }
-};
-
-Element.prototype.deleteFixedAttrs = function() {
- this.children && this.children.length === 0 && delete this.children;
- this.xmlns && Object.keys(this.xmlns).length === 0 && delete this.xmlns;
- delete this.nsName;
- delete this.prefix;
- delete this.name;
-};
-
-Element.prototype.allowedChildren = [];
-
-Element.prototype.startElement = function(stack, nsName, attrs, options, schemaXmlns) {
- if (!this.allowedChildren) {
- return;
- }
-
- var ChildClass = this.allowedChildren[splitQName(nsName).name],
- element = null;
-
- if (ChildClass) {
- stack.push(new ChildClass(nsName, attrs, options, schemaXmlns));
- }
- else {
- this.unexpected(nsName);
- }
-
-};
-
-Element.prototype.endElement = function(stack, nsName) {
- if (this.nsName === nsName) {
- if (stack.length < 2)
- return;
- var parent = stack[stack.length - 2];
- if (this !== stack[0]) {
- _.defaultsDeep(stack[0].xmlns, this.xmlns);
- // delete this.xmlns;
- parent.children.push(this);
- parent.addChild(this);
- }
- stack.pop();
- }
-};
-
-Element.prototype.addChild = function(child) {
- return;
-};
-
-Element.prototype.unexpected = function(name) {
- throw new Error('Found unexpected element (' + name + ') inside ' + this.nsName);
-};
-
-Element.prototype.description = function(definitions) {
- return this.$name || this.name;
-};
-
-Element.prototype.init = function() {
-};
-
-Element.createSubClass = function() {
- var root = this;
- var subElement = function() {
- root.apply(this, arguments);
- this.init();
- };
- // inherits(subElement, root);
- subElement.prototype.__proto__ = root.prototype;
- return subElement;
-};
-
-
-var ElementElement = Element.createSubClass();
-var AnyElement = Element.createSubClass();
-var InputElement = Element.createSubClass();
-var OutputElement = Element.createSubClass();
-var SimpleTypeElement = Element.createSubClass();
-var RestrictionElement = Element.createSubClass();
-var ExtensionElement = Element.createSubClass();
-var ChoiceElement = Element.createSubClass();
-var EnumerationElement = Element.createSubClass();
-var ComplexTypeElement = Element.createSubClass();
-var ComplexContentElement = Element.createSubClass();
-var SimpleContentElement = Element.createSubClass();
-var SequenceElement = Element.createSubClass();
-var AllElement = Element.createSubClass();
-var MessageElement = Element.createSubClass();
-var DocumentationElement = Element.createSubClass();
-
-var SchemaElement = Element.createSubClass();
-var TypesElement = Element.createSubClass();
-var OperationElement = Element.createSubClass();
-var PortTypeElement = Element.createSubClass();
-var BindingElement = Element.createSubClass();
-var PortElement = Element.createSubClass();
-var ServiceElement = Element.createSubClass();
-var DefinitionsElement = Element.createSubClass();
-
-var ElementTypeMap = {
- types: [TypesElement, 'schema documentation'],
- schema: [SchemaElement, 'element complexType simpleType include import'],
- element: [ElementElement, 'annotation complexType simpleType'],
- any: [AnyElement, ''],
- simpleType: [SimpleTypeElement, 'restriction'],
- restriction: [RestrictionElement, 'enumeration all choice sequence'],
- extension: [ExtensionElement, 'all sequence choice'],
- choice: [ChoiceElement, 'element sequence choice any'],
- // group: [GroupElement, 'element group'],
- enumeration: [EnumerationElement, ''],
- complexType: [ComplexTypeElement, 'annotation sequence all complexContent simpleContent choice'],
- complexContent: [ComplexContentElement, 'extension'],
- simpleContent: [SimpleContentElement, 'extension'],
- sequence: [SequenceElement, 'element sequence choice any'],
- all: [AllElement, 'element choice'],
-
- service: [ServiceElement, 'port documentation'],
- port: [PortElement, 'address documentation'],
- binding: [BindingElement, '_binding SecuritySpec operation documentation'],
- portType: [PortTypeElement, 'operation documentation'],
- message: [MessageElement, 'part documentation'],
- operation: [OperationElement, 'documentation input output fault _operation'],
- input: [InputElement, 'body SecuritySpecRef documentation header'],
- output: [OutputElement, 'body SecuritySpecRef documentation header'],
- fault: [Element, '_fault documentation'],
- definitions: [DefinitionsElement, 'types message portType binding service import documentation'],
- documentation: [DocumentationElement, '']
-};
-
-function mapElementTypes(types) {
- var rtn = {};
- types = types.split(' ');
- types.forEach(function(type) {
- rtn[type.replace(/^_/, '')] = (ElementTypeMap[type] || [Element]) [0];
- });
- return rtn;
-}
-
-for (var n in ElementTypeMap) {
- var v = ElementTypeMap[n];
- v[0].prototype.allowedChildren = mapElementTypes(v[1]);
-}
-
-MessageElement.prototype.init = function() {
- this.element = null;
- this.parts = null;
-};
-
-SchemaElement.prototype.init = function() {
- this.complexTypes = {};
- this.types = {};
- this.elements = {};
- this.includes = [];
-};
-
-TypesElement.prototype.init = function() {
- this.schemas = {};
-};
-
-OperationElement.prototype.init = function() {
- this.input = null;
- this.output = null;
- this.inputSoap = null;
- this.outputSoap = null;
- this.style = '';
- this.soapAction = '';
-};
-
-PortTypeElement.prototype.init = function() {
- this.methods = {};
-};
-
-BindingElement.prototype.init = function() {
- this.transport = '';
- this.style = '';
- this.methods = {};
-};
-
-PortElement.prototype.init = function() {
- this.location = null;
-};
-
-ServiceElement.prototype.init = function() {
- this.ports = {};
-};
-
-DefinitionsElement.prototype.init = function() {
- if (this.name !== 'definitions')this.unexpected(this.nsName);
- this.messages = {};
- this.portTypes = {};
- this.bindings = {};
- this.services = {};
- this.schemas = {};
-};
-
-DocumentationElement.prototype.init = function() {
-};
-
-SchemaElement.prototype.merge = function(source) {
- assert(source instanceof SchemaElement);
- if (this.$targetNamespace === source.$targetNamespace) {
- _.merge(this.complexTypes, source.complexTypes);
- _.merge(this.types, source.types);
- _.merge(this.elements, source.elements);
- _.merge(this.xmlns, source.xmlns);
- }
- return this;
-};
-
-
-SchemaElement.prototype.addChild = function(child) {
- if (child.$name in Primitives)
- return;
- if (child.name === 'include' || child.name === 'import') {
- var location = child.$schemaLocation || child.$location;
- if (location) {
- this.includes.push({
- namespace: child.$namespace || child.$targetNamespace || this.$targetNamespace,
- location: location
- });
- }
- }
- else if (child.name === 'complexType') {
- this.complexTypes[child.$name] = child;
- }
- else if (child.name === 'element') {
- this.elements[child.$name] = child;
- }
- else if (child.$name) {
- this.types[child.$name] = child;
- }
- this.children.pop();
- // child.deleteFixedAttrs();
-};
-//fix#325
-TypesElement.prototype.addChild = function (child) {
- assert(child instanceof SchemaElement);
-
- var targetNamespace = child.$targetNamespace;
-
- if(!this.schemas.hasOwnProperty(targetNamespace)) {
- this.schemas[targetNamespace] = child;
- } else {
- console.error('Target-Namespace "'+ targetNamespace +'" already in use by another Schema!');
- }
-};
-
-InputElement.prototype.addChild = function(child) {
- if (child.name === 'body') {
- this.use = child.$use;
- if (this.use === 'encoded') {
- this.encodingStyle = child.$encodingStyle;
- }
- this.children.pop();
- }
-};
-
-OutputElement.prototype.addChild = function(child) {
- if (child.name === 'body') {
- this.use = child.$use;
- if (this.use === 'encoded') {
- this.encodingStyle = child.$encodingStyle;
- }
- this.children.pop();
- }
-};
-
-OperationElement.prototype.addChild = function(child) {
- if (child.name === 'operation') {
- this.soapAction = child.$soapAction || '';
- this.style = child.$style || '';
- this.children.pop();
- }
-};
-
-BindingElement.prototype.addChild = function(child) {
- if (child.name === 'binding') {
- this.transport = child.$transport;
- this.style = child.$style;
- this.children.pop();
- }
-};
-
-PortElement.prototype.addChild = function(child) {
- if (child.name === 'address' && typeof (child.$location) !== 'undefined') {
- this.location = child.$location;
- }
-};
-
-DefinitionsElement.prototype.addChild = function(child) {
- var self = this;
- if (child instanceof TypesElement) {
- // Merge types.schemas into definitions.schemas
- _.merge(self.schemas, child.schemas);
- }
- else if (child instanceof MessageElement) {
- self.messages[child.$name] = child;
- }
- else if (child.name === 'import') {
- self.schemas[child.$namespace] = new SchemaElement(child.$namespace, {});
- self.schemas[child.$namespace].addChild(child);
- }
- else if (child instanceof PortTypeElement) {
- self.portTypes[child.$name] = child;
- }
- else if (child instanceof BindingElement) {
- if (child.transport === 'http://schemas.xmlsoap.org/soap/http' ||
- child.transport === 'http://www.w3.org/2003/05/soap/bindings/HTTP/')
- self.bindings[child.$name] = child;
- }
- else if (child instanceof ServiceElement) {
- self.services[child.$name] = child;
- }
- else if (child instanceof DocumentationElement) {
- }
- this.children.pop();
-};
-
-MessageElement.prototype.postProcess = function(definitions) {
- var part = null;
- var child;
- var children = this.children || [];
- var ns;
- var nsName;
- var i;
- var type;
-
- for (i in children) {
- if ((child = children[i]).name === 'part') {
- part = child;
- break;
- }
- }
-
- if (!part) {
- return;
- }
-
- if (part.$element) {
- var lookupTypes = [],
- elementChildren ;
-
- delete this.parts;
-
- nsName = splitQName(part.$element);
- ns = nsName.prefix;
- var schema = definitions.schemas[definitions.xmlns[ns]];
- this.element = schema.elements[nsName.name];
- if(!this.element) {
- debug(nsName.name + " is not present in wsdl and cannot be processed correctly.");
- return;
- }
- this.element.targetNSAlias = ns;
- this.element.targetNamespace = definitions.xmlns[ns];
-
- // set the optional $lookupType to be used within `client#_invoke()` when
- // calling `wsdl#objectToDocumentXML()
- this.element.$lookupType = part.$element;
-
- elementChildren = this.element.children;
-
- // get all nested lookup types (only complex types are followed)
- if (elementChildren.length > 0) {
- for (i = 0; i < elementChildren.length; i++) {
- lookupTypes.push(this._getNestedLookupTypeString(elementChildren[i]));
- }
- }
-
- // if nested lookup types where found, prepare them for furter usage
- if (lookupTypes.length > 0) {
- lookupTypes = lookupTypes.
- join('_').
- split('_').
- filter(function removeEmptyLookupTypes (type) {
- return type !== '^';
- });
-
- var schemaXmlns = definitions.schemas[this.element.targetNamespace].xmlns;
-
- for (i = 0; i < lookupTypes.length; i++) {
- lookupTypes[i] = this._createLookupTypeObject(lookupTypes[i], schemaXmlns);
- }
- }
-
- this.element.$lookupTypes = lookupTypes;
-
- if (this.element.$type) {
- type = splitQName(this.element.$type);
- var typeNs = schema.xmlns && schema.xmlns[type.prefix] || definitions.xmlns[type.prefix];
-
- if (typeNs) {
- if (type.name in Primitives) {
- // this.element = this.element.$type;
- }
- else {
- // first check local mapping of ns alias to namespace
- schema = definitions.schemas[typeNs];
- var ctype = schema.complexTypes[type.name] || schema.types[type.name] || schema.elements[type.name];
-
-
- if (ctype) {
- this.parts = ctype.description(definitions, schema.xmlns);
- }
- }
- }
- }
- else {
- var method = this.element.description(definitions, schema.xmlns);
- this.parts = method[nsName.name];
- }
-
-
- this.children.splice(0, 1);
- } else {
- // rpc encoding
- this.parts = {};
- delete this.element;
- for (i = 0; part = this.children[i]; i++) {
- if (part.name === 'documentation') {
- // <wsdl:documentation can be present under <wsdl:message>
- continue;
- }
- assert(part.name === 'part', 'Expected part element');
- nsName = splitQName(part.$type);
- ns = definitions.xmlns[nsName.prefix];
- type = nsName.name;
- var schemaDefinition = definitions.schemas[ns];
- if (typeof schemaDefinition !== 'undefined') {
- this.parts[part.$name] = definitions.schemas[ns].types[type] || definitions.schemas[ns].complexTypes[type];
- } else {
- this.parts[part.$name] = part.$type;
- }
-
- if (typeof this.parts[part.$name] === 'object') {
- this.parts[part.$name].prefix = nsName.prefix;
- this.parts[part.$name].xmlns = ns;
- }
-
- this.children.splice(i--, 1);
- }
- }
- this.deleteFixedAttrs();
-};
-
-/**
- * Takes a given namespaced String(for example: 'alias:property') and creates a lookupType
- * object for further use in as first (lookup) `parameterTypeObj` within the `objectToXML`
- * method and provides an entry point for the already existing code in `findChildSchemaObject`.
- *
- * @method _createLookupTypeObject
- * @param {String} nsString The NS String (for example "alias:type").
- * @param {Object} xmlns The fully parsed `wsdl` definitions object (including all schemas).
- * @returns {Object}
- * @private
- */
-MessageElement.prototype._createLookupTypeObject = function (nsString, xmlns) {
- var splittedNSString = splitQName(nsString),
- nsAlias = splittedNSString.prefix,
- splittedName = splittedNSString.name.split('#'),
- type = splittedName[0],
- name = splittedName[1],
- lookupTypeObj = {};
-
- lookupTypeObj.$namespace = xmlns[nsAlias];
- lookupTypeObj.$type = nsAlias + ':' + type;
- lookupTypeObj.$name = name;
-
- return lookupTypeObj;
-};
-
-/**
- * Iterates through the element and every nested child to find any defined `$type`
- * property and returns it in a underscore ('_') separated String (using '^' as default
- * value if no `$type` property was found).
- *
- * @method _getNestedLookupTypeString
- * @param {Object} element The element which (probably) contains nested `$type` values.
- * @returns {String}
- * @private
- */
-MessageElement.prototype._getNestedLookupTypeString = function (element) {
- var resolvedType = '^',
- excluded = this.ignoredNamespaces.concat('xs'); // do not process $type values wich start with
-
- if (element.hasOwnProperty('$type') && typeof element.$type === 'string') {
- if (excluded.indexOf(element.$type.split(':')[0]) === -1) {
- resolvedType += ('_' + element.$type + '#' + element.$name);
- }
- }
-
- if (element.children.length > 0) {
- var self = this;
-
- element.children.forEach(function (child) {
- var resolvedChildType = self._getNestedLookupTypeString(child).replace(/\^_/, '');
-
- if (resolvedChildType && typeof resolvedChildType === 'string') {
- resolvedType += ('_' + resolvedChildType);
- }
- });
- }
-
- return resolvedType;
-};
-
-OperationElement.prototype.postProcess = function(definitions, tag) {
- var children = this.children;
- for (var i = 0, child; child = children[i]; i++) {
- if (child.name !== 'input' && child.name !== 'output')
- continue;
- if (tag === 'binding') {
- this[child.name] = child;
- children.splice(i--, 1);
- continue;
- }
- var messageName = splitQName(child.$message).name;
- var message = definitions.messages[messageName];
- message.postProcess(definitions);
- if (message.element) {
- definitions.messages[message.element.$name] = message;
- this[child.name] = message.element;
- }
- else {
- this[child.name] = message;
- }
- children.splice(i--, 1);
- }
- this.deleteFixedAttrs();
-};
-
-PortTypeElement.prototype.postProcess = function(definitions) {
- var children = this.children;
- if (typeof children === 'undefined')
- return;
- for (var i = 0, child; child = children[i]; i++) {
- if (child.name !== 'operation')
- continue;
- child.postProcess(definitions, 'portType');
- this.methods[child.$name] = child;
- children.splice(i--, 1);
- }
- delete this.$name;
- this.deleteFixedAttrs();
-};
-
-BindingElement.prototype.postProcess = function(definitions) {
- var type = splitQName(this.$type).name,
- portType = definitions.portTypes[type],
- style = this.style,
- children = this.children;
- if (portType){
- portType.postProcess(definitions);
- this.methods = portType.methods;
-
- for (var i = 0, child; child = children[i]; i++) {
- if (child.name !== 'operation')
- continue;
- child.postProcess(definitions, 'binding');
- children.splice(i--, 1);
- child.style || (child.style = style);
- var method = this.methods[child.$name];
-
- if (method) {
- method.style = child.style;
- method.soapAction = child.soapAction;
- method.inputSoap = child.input || null;
- method.outputSoap = child.output || null;
- method.inputSoap && method.inputSoap.deleteFixedAttrs();
- method.outputSoap && method.outputSoap.deleteFixedAttrs();
- }
- }
- }
- delete this.$name;
- delete this.$type;
- this.deleteFixedAttrs();
-};
-
-ServiceElement.prototype.postProcess = function(definitions) {
- var children = this.children,
- bindings = definitions.bindings;
- if (children && children.length > 0) {
- for (var i = 0, child; child = children[i]; i++) {
- if (child.name !== 'port')
- continue;
- var bindingName = splitQName(child.$binding).name;
- var binding = bindings[bindingName];
- if (binding) {
- binding.postProcess(definitions);
- this.ports[child.$name] = {
- location: child.location,
- binding: binding
- };
- children.splice(i--, 1);
- }
- }
- }
- delete this.$name;
- this.deleteFixedAttrs();
-};
-
-
-SimpleTypeElement.prototype.description = function(definitions) {
- var children = this.children;
- for (var i = 0, child; child = children[i]; i++) {
- if (child instanceof RestrictionElement)
- return [this.$name, child.description()].filter(Boolean).join('|');
- }
- return {};
-};
-
-RestrictionElement.prototype.description = function(definitions, xmlns) {
- var children = this.children;
- var desc;
- for (var i=0, child; child=children[i]; i++) {
- if (child instanceof SequenceElement ||
- child instanceof ChoiceElement) {
- desc = child.description(definitions, xmlns);
- break;
- }
- }
- if (desc && this.$base) {
- var type = splitQName(this.$base),
- typeName = type.name,
- ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix],
- schema = definitions.schemas[ns],
- typeElement = schema && ( schema.complexTypes[typeName] || schema.types[typeName] || schema.elements[typeName] );
-
- desc.getBase = function() {
- return typeElement.description(definitions, schema.xmlns);
- };
- return desc;
- }
-
- // then simple element
- var base = this.$base ? this.$base + "|" : "";
- var restrictions = this.children.map(function(child) {
- return child.description();
- }).join(",");
-
- return [this.$base, restrictions].filter(Boolean).join('|');
-};
-
-ExtensionElement.prototype.description = function(definitions, xmlns) {
- var children = this.children;
- var desc = {};
- for (var i=0, child; child=children[i]; i++) {
- if (child instanceof SequenceElement ||
- child instanceof ChoiceElement) {
- desc = child.description(definitions, xmlns);
- }
- }
- if (this.$base) {
- var type = splitQName(this.$base),
- typeName = type.name,
- ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix],
- schema = definitions.schemas[ns];
-
- if (typeName in Primitives) {
- return this.$base;
- }
- else {
- var typeElement = schema && ( schema.complexTypes[typeName] ||
- schema.types[typeName] || schema.elements[typeName] );
-
- if (typeElement) {
- var base = typeElement.description(definitions, schema.xmlns);
- desc = _.defaultsDeep(base, desc);
- }
- }
- }
- return desc;
-};
-
-EnumerationElement.prototype.description = function() {
- return this[this.valueKey];
-};
-
-ComplexTypeElement.prototype.description = function(definitions, xmlns) {
- var children = this.children || [];
- for (var i=0, child; child=children[i]; i++) {
- if (child instanceof ChoiceElement ||
- child instanceof SequenceElement ||
- child instanceof AllElement ||
- child instanceof SimpleContentElement ||
- child instanceof ComplexContentElement) {
-
- return child.description(definitions, xmlns);
- }
- }
- return {};
-};
-
-ComplexContentElement.prototype.description = function(definitions, xmlns) {
- var children = this.children;
- for (var i = 0, child; child = children[i]; i++) {
- if (child instanceof ExtensionElement) {
- return child.description(definitions, xmlns);
- }
- }
- return {};
-};
-
-SimpleContentElement.prototype.description = function(definitions, xmlns) {
- var children = this.children;
- for (var i = 0, child; child = children[i]; i++) {
- if (child instanceof ExtensionElement) {
- return child.description(definitions, xmlns);
- }
- }
- return {};
-};
-
-ElementElement.prototype.description = function(definitions, xmlns) {
- var element = {},
- name = this.$name;
- var isMany = !this.$maxOccurs ? false : (isNaN(this.$maxOccurs) ? (this.$maxOccurs === 'unbounded') : (this.$maxOccurs > 1));
- if (this.$minOccurs !== this.$maxOccurs && isMany) {
- name += '[]';
- }
-
- if (xmlns && xmlns[TNS_PREFIX]) {
- this.$targetNamespace = xmlns[TNS_PREFIX];
- }
- var type = this.$type || this.$ref;
- if (type) {
- type = splitQName(type);
- var typeName = type.name,
- ns = xmlns && xmlns[type.prefix] ||
- (definitions.xmlns[type.prefix] !== undefined && this.schemaXmlns[type.prefix]) ||
- definitions.xmlns[type.prefix],
- schema = definitions.schemas[ns],
- typeElement = schema && ( this.$type? schema.complexTypes[typeName] || schema.types[typeName] : schema.elements[typeName] );
-
- if (ns && definitions.schemas[ns]) {
- xmlns = definitions.schemas[ns].xmlns;
- }
-
- if (typeElement && !(typeName in Primitives)) {
-
- if (!(typeName in definitions.descriptions.types)) {
-
- var elem = {};
- definitions.descriptions.types[typeName] = elem;
- var description = typeElement.description(definitions, xmlns);
- if (typeof description === 'string') {
- elem = description;
- }
- else {
- Object.keys(description).forEach(function (key) {
- elem[key] = description[key];
- });
- }
-
- if (this.$ref) {
- element = elem;
- }
- else {
- element[name] = elem;
- }
-
- if (typeof elem === 'object') {
- elem.targetNSAlias = type.prefix;
- elem.targetNamespace = ns;
- }
-
- definitions.descriptions.types[typeName] = elem;
- }
- else {
- if (this.$ref) {
- element = definitions.descriptions.types[typeName];
- }
- else {
- element[name] = definitions.descriptions.types[typeName];
- }
- }
-
- }
- else {
- element[name] = this.$type;
- }
- }
- else {
- var children = this.children;
- element[name] = {};
- for (var i = 0, child; child = children[i]; i++) {
- if (
- child instanceof ComplexTypeElement
- || child instanceof SimpleTypeElement
- ) {
- element[name] = child.description(definitions, xmlns);
- }
- }
- }
- return element;
-};
-
-AllElement.prototype.description =
-SequenceElement.prototype.description = function(definitions, xmlns) {
- var children = this.children;
- var sequence = {};
- for (var i = 0, child; child = children[i]; i++) {
- if (child instanceof AnyElement) {
- continue;
- }
- var description = child.description(definitions, xmlns);
- for (var key in description) {
- sequence[key] = description[key];
- }
- }
- return sequence;
-};
-
-ChoiceElement.prototype.description = function(definitions, xmlns) {
- var children = this.children;
- var choice = {};
- for (var i=0, child; child=children[i]; i++) {
- var description = child.description(definitions, xmlns);
- for (var key in description) {
- choice[key] = description[key];
- }
- }
- return choice;
-};
-
-MessageElement.prototype.description = function(definitions) {
- if (this.element) {
- return this.element && this.element.description(definitions);
- }
- var desc = {};
- desc[this.$name] = this.parts;
- return desc;
-};
-
-PortTypeElement.prototype.description = function(definitions) {
- var methods = {};
- for (var name in this.methods) {
- var method = this.methods[name];
- methods[name] = method.description(definitions);
- }
- return methods;
-};
-
-OperationElement.prototype.description = function(definitions) {
- var inputDesc = this.input ? this.input.description(definitions) : null;
- var outputDesc = this.output ? this.output.description(definitions) : null;
- return {
- input: inputDesc && inputDesc[Object.keys(inputDesc)[0]],
- output: outputDesc && outputDesc[Object.keys(outputDesc)[0]]
- };
-};
-
-BindingElement.prototype.description = function(definitions) {
- var methods = {};
- for (var name in this.methods) {
- var method = this.methods[name];
- methods[name] = method.description(definitions);
- }
- return methods;
-};
-
-ServiceElement.prototype.description = function(definitions) {
- var ports = {};
- for (var name in this.ports) {
- var port = this.ports[name];
- ports[name] = port.binding.description(definitions);
- }
- return ports;
-};
-
-var WSDL = function(definition, uri, options) {
- var self = this,
- fromFunc;
-
- this.uri = uri;
- this.callback = function() {
- };
- this._includesWsdl = [];
-
- // initialize WSDL cache
- this.WSDL_CACHE = (options || {}).WSDL_CACHE || {};
-
- this._initializeOptions(options);
-
- if (typeof definition === 'string') {
- definition = stripBom(definition);
- fromFunc = this._fromXML;
- }
- else if (typeof definition === 'object') {
- fromFunc = this._fromServices;
- }
- else {
- throw new Error('WSDL constructor takes either an XML string or service definition');
- }
-
- process.nextTick(function() {
- try {
- fromFunc.call(self, definition);
- } catch (e) {
- return self.callback(e.message);
- }
-
- self.processIncludes(function(err) {
- var name;
- if (err) {
- return self.callback(err);
- }
-
- self.definitions.deleteFixedAttrs();
- var services = self.services = self.definitions.services;
- if (services) {
- for (name in services) {
- services[name].postProcess(self.definitions);
- }
- }
- var complexTypes = self.definitions.complexTypes;
- if (complexTypes) {
- for (name in complexTypes) {
- complexTypes[name].deleteFixedAttrs();
- }
- }
-
- // for document style, for every binding, prepare input message element name to (methodName, output message element name) mapping
- var bindings = self.definitions.bindings;
- for (var bindingName in bindings) {
- var binding = bindings[bindingName];
- if (typeof binding.style === 'undefined') {
- binding.style = 'document';
- }
- if (binding.style !== 'document')
- continue;
- var methods = binding.methods;
- var topEls = binding.topElements = {};
- for (var methodName in methods) {
- if (methods[methodName].input) {
- var inputName = methods[methodName].input.$name;
- var outputName="";
- if(methods[methodName].output )
- outputName = methods[methodName].output.$name;
- topEls[inputName] = {"methodName": methodName, "outputName": outputName};
- }
- }
- }
-
- // prepare soap envelope xmlns definition string
- self.xmlnsInEnvelope = self._xmlnsMap();
-
- self.callback(err, self);
- });
-
- });
-};
-
-WSDL.prototype.ignoredNamespaces = ['tns', 'targetNamespace', 'typedNamespace'];
-
-WSDL.prototype.ignoreBaseNameSpaces = false;
-
-WSDL.prototype.valueKey = '$value';
-WSDL.prototype.xmlKey = '$xml';
-
-WSDL.prototype._initializeOptions = function (options) {
- this._originalIgnoredNamespaces = (options || {}).ignoredNamespaces;
- this.options = {};
-
- var ignoredNamespaces = options ? options.ignoredNamespaces : null;
-
- if (ignoredNamespaces &&
- (Array.isArray(ignoredNamespaces.namespaces) || typeof ignoredNamespaces.namespaces === 'string')) {
- if (ignoredNamespaces.override) {
- this.options.ignoredNamespaces = ignoredNamespaces.namespaces;
- } else {
- this.options.ignoredNamespaces = this.ignoredNamespaces.concat(ignoredNamespaces.namespaces);
- }
- } else {
- this.options.ignoredNamespaces = this.ignoredNamespaces;
- }
-
- this.options.valueKey = options.valueKey || this.valueKey;
- this.options.xmlKey = options.xmlKey || this.xmlKey;
- if (options.escapeXML !== undefined) {
- this.options.escapeXML = options.escapeXML;
- } else {
- this.options.escapeXML = true;
- }
- if (options.returnFault !== undefined) {
- this.options.returnFault = options.returnFault;
- } else {
- this.options.returnFault = false;
- }
- this.options.handleNilAsNull = !!options.handleNilAsNull;
-
- if (options.namespaceArrayElements !== undefined) {
- this.options.namespaceArrayElements = options.namespaceArrayElements;
- } else {
- this.options.namespaceArrayElements = true;
- }
-
- // Allow any request headers to keep passing through
- this.options.wsdl_headers = options.wsdl_headers;
- this.options.wsdl_options = options.wsdl_options;
- if (options.httpClient) {
- this.options.httpClient = options.httpClient;
- }
-
- // The supplied request-object should be passed through
- if (options.request) {
- this.options.request = options.request;
- }
-
- var ignoreBaseNameSpaces = options ? options.ignoreBaseNameSpaces : null;
- if (ignoreBaseNameSpaces !== null && typeof ignoreBaseNameSpaces !== 'undefined') {
- this.options.ignoreBaseNameSpaces = ignoreBaseNameSpaces;
- } else {
- this.options.ignoreBaseNameSpaces = this.ignoreBaseNameSpaces;
- }
-
- // Works only in client
- this.options.forceSoap12Headers = options.forceSoap12Headers;
- this.options.customDeserializer = options.customDeserializer;
-
- if (options.overrideRootElement !== undefined) {
- this.options.overrideRootElement = options.overrideRootElement;
- }
-
- this.options.useEmptyTag = !!options.useEmptyTag;
-};
-
-WSDL.prototype.onReady = function(callback) {
- if (callback)
- this.callback = callback;
-};
-
-WSDL.prototype._processNextInclude = function(includes, callback) {
- var self = this,
- include = includes.shift(),
- options;
-
- if (!include)
- return callback();
-
- var includePath;
- if (!/^https?:/.test(self.uri) && !/^https?:/.test(include.location)) {
- includePath = path.resolve(path.dirname(self.uri), include.location);
- } else {
- includePath = url.resolve(self.uri||'', include.location);
- }
-
- options = _.assign({}, this.options);
- // follow supplied ignoredNamespaces option
- options.ignoredNamespaces = this._originalIgnoredNamespaces || this.options.ignoredNamespaces;
- options.WSDL_CACHE = this.WSDL_CACHE;
-
- open_wsdl_recursive(includePath, options, function(err, wsdl) {
- if (err) {
- return callback(err);
- }
-
- self._includesWsdl.push(wsdl);
-
- if (wsdl.definitions instanceof DefinitionsElement) {
- _.mergeWith(self.definitions, wsdl.definitions, function(a,b) {
- return (a instanceof SchemaElement) ? a.merge(b) : undefined;
- });
- } else {
- self.definitions.schemas[include.namespace || wsdl.definitions.$targetNamespace] = deepMerge(self.definitions.schemas[include.namespace || wsdl.definitions.$targetNamespace], wsdl.definitions);
- }
- self._processNextInclude(includes, function(err) {
- callback(err);
- });
- });
-};
-
-WSDL.prototype.processIncludes = function(callback) {
- var schemas = this.definitions.schemas,
- includes = [];
-
- for (var ns in schemas) {
- var schema = schemas[ns];
- includes = includes.concat(schema.includes || []);
- }
-
- this._processNextInclude(includes, callback);
-};
-
-WSDL.prototype.describeServices = function() {
- var services = {};
- for (var name in this.services) {
- var service = this.services[name];
- services[name] = service.description(this.definitions);
- }
- return services;
-};
-
-WSDL.prototype.toXML = function() {
- return this.xml || '';
-};
-
-WSDL.prototype.xmlToObject = function(xml, callback) {
- var self = this;
- var p = typeof callback === 'function' ? {} : sax.parser(true);
- var objectName = null;
- var root = {};
- var schema = {
- Envelope: {
- Header: {
- Security: {
- UsernameToken: {
- Username: 'string',
- Password: 'string'
- }
- }
- },
- Body: {
- Fault: {
- faultcode: 'string',
- faultstring: 'string',
- detail: 'string'
- }
- }
- }
- };
- var stack = [{name: null, object: root, schema: schema}];
- var xmlns = {};
-
- var refs = {}, id; // {id:{hrefs:[],obj:}, ...}
-
- p.onopentag = function(node) {
- var nsName = node.name;
- var attrs = node.attributes;
-
- var name = splitQName(nsName).name,
- attributeName,
- top = stack[stack.length - 1],
- topSchema = top.schema,
- elementAttributes = {},
- hasNonXmlnsAttribute = false,
- hasNilAttribute = false,
- obj = {};
- var originalName = name;
-
- if (!objectName && top.name === 'Body' && name !== 'Fault') {
- var message = self.definitions.messages[name];
- // Support RPC/literal messages where response body contains one element named
- // after the operation + 'Response'. See http://www.w3.org/TR/wsdl#_names
- if (!message) {
- try {
- // Determine if this is request or response
- var isInput = false;
- var isOutput = false;
- if ((/Response$/).test(name)) {
- isOutput = true;
- name = name.replace(/Response$/, '');
- } else if ((/Request$/).test(name)) {
- isInput = true;
- name = name.replace(/Request$/, '');
- } else if ((/Solicit$/).test(name)) {
- isInput = true;
- name = name.replace(/Solicit$/, '');
- }
- // Look up the appropriate message as given in the portType's operations
- var portTypes = self.definitions.portTypes;
- var portTypeNames = Object.keys(portTypes);
- // Currently this supports only one portType definition.
- var portType = portTypes[portTypeNames[0]];
- if (isInput) {
- name = portType.methods[name].input.$name;
- } else {
- name = portType.methods[name].output.$name;
- }
- message = self.definitions.messages[name];
- // 'cache' this alias to speed future lookups
- self.definitions.messages[originalName] = self.definitions.messages[name];
- } catch (e) {
- if (self.options.returnFault) {
- p.onerror(e);
- }
- }
- }
-
- topSchema = message.description(self.definitions);
- objectName = originalName;
- }
-
- if (attrs.href) {
- id = attrs.href.substr(1);
- if (!refs[id]) {
- refs[id] = {hrefs: [], obj: null};
- }
- refs[id].hrefs.push({par: top.object, key: name, obj: obj});
- }
- if (id = attrs.id) {
- if (!refs[id]) {
- refs[id] = {hrefs: [], obj: null};
- }
- }
-
- //Handle element attributes
- for (attributeName in attrs) {
- if (/^xmlns:|^xmlns$/.test(attributeName)) {
- xmlns[splitQName(attributeName).name] = attrs[attributeName];
- continue;
- }
- hasNonXmlnsAttribute = true;
- elementAttributes[attributeName] = attrs[attributeName];
- }
-
- for(attributeName in elementAttributes){
- var res = splitQName(attributeName);
- if (res.name === 'nil' && xmlns[res.prefix] === 'http://www.w3.org/2001/XMLSchema-instance' && elementAttributes[attributeName] &&
- (elementAttributes[attributeName].toLowerCase() === 'true' || elementAttributes[attributeName] === '1')
- ) {
- hasNilAttribute = true;
- break;
- }
- }
-
- if (hasNonXmlnsAttribute) {
- obj[self.options.attributesKey] = elementAttributes;
- }
-
- // Pick up the schema for the type specified in element's xsi:type attribute.
- var xsiTypeSchema;
- var xsiType = elementAttributes['xsi:type'];
- if (xsiType) {
- var type = splitQName(xsiType);
- var typeURI;
- if (type.prefix === TNS_PREFIX) {
- // In case of xsi:type = "MyType"
- typeURI = xmlns[type.prefix] || xmlns.xmlns;
- } else {
- typeURI = xmlns[type.prefix];
- }
- var typeDef = self.findSchemaObject(typeURI, type.name);
- if (typeDef) {
- xsiTypeSchema = typeDef.description(self.definitions);
- }
- }
-
- if (topSchema && topSchema[name + '[]']) {
- name = name + '[]';
- }
- stack.push({name: originalName, object: obj, schema: (xsiTypeSchema || (topSchema && topSchema[name])), id: attrs.id, nil: hasNilAttribute});
- };
-
- p.onclosetag = function(nsName) {
- var cur = stack.pop(),
- obj = cur.object,
- top = stack[stack.length - 1],
- topObject = top.object,
- topSchema = top.schema,
- name = splitQName(nsName).name;
-
- if (typeof cur.schema === 'string' && (cur.schema === 'string' || cur.schema.split(':')[1] === 'string')) {
- if (typeof obj === 'object' && Object.keys(obj).length === 0) obj = cur.object = '';
- }
-
- if (cur.nil === true) {
- if (self.options.handleNilAsNull) {
- obj = null;
- } else {
- return;
- }
- }
-
- if (_.isPlainObject(obj) && !Object.keys(obj).length) {
- obj = null;
- }
-
- if (topSchema && topSchema[name + '[]']) {
- if (!topObject[name]) {
- topObject[name] = [];
- }
- topObject[name].push(obj);
- } else if (name in topObject) {
- if (!Array.isArray(topObject[name])) {
- topObject[name] = [topObject[name]];
- }
- topObject[name].push(obj);
- } else {
- topObject[name] = obj;
- }
-
- if (cur.id) {
- refs[cur.id].obj = obj;
- }
- };
-
- p.oncdata = function (text) {
- var originalText = text;
- text = trim(text);
- if (!text.length) {
- return;
- }
-
- if (/<\?xml[\s\S]+\?>/.test(text)) {
- var top = stack[stack.length - 1];
- var value = self.xmlToObject(text);
- if (top.object[self.options.attributesKey]) {
- top.object[self.options.valueKey] = value;
- } else {
- top.object = value;
- }
- } else {
- p.ontext(originalText);
- }
- };
-
- p.onerror = function(e) {
- p.resume();
- throw {
- Fault: {
- faultcode: 500,
- faultstring: 'Invalid XML',
- detail: new Error(e).message,
- statusCode: 500
- }
- };
- };
-
- p.ontext = function(text) {
- var originalText = text;
- text = trim(text);
- if (!text.length) {
- return;
- }
-
- var top = stack[stack.length - 1];
- var name = splitQName(top.schema).name,
- value;
-
- if (self.options && self.options.customDeserializer && self.options.customDeserializer[name]) {
- value = self.options.customDeserializer[name](text, top);
- }
- else {
- 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' || name === 'date') {
- value = new Date(text);
- } else {
- if (self.options.preserveWhitespace) {
- text = originalText;
- }
- // handle string or other types
- if (typeof top.object !== 'string') {
- value = text;
- } else {
- value = top.object + text;
- }
- }
- }
-
- if (top.object[self.options.attributesKey]) {
- top.object[self.options.valueKey] = value;
- } else {
- top.object = value;
- }
- };
-
- if (typeof callback === 'function') {
- // we be streaming
- var saxStream = sax.createStream(true);
- saxStream.on('opentag', p.onopentag);
- saxStream.on('closetag', p.onclosetag);
- saxStream.on('cdata', p.oncdata);
- saxStream.on('text', p.ontext);
- xml.pipe(saxStream)
- .on('error', function (err) {
- callback(err);
- })
- .on('end', function () {
- var r;
- try {
- r = finish();
- } catch (e) {
- return callback(e);
- }
- callback(null, r);
- });
- return;
- }
- p.write(xml).close();
-
- return finish();
-
- function finish() {
- // MultiRef support: merge objects instead of replacing
- for (var n in refs) {
- var ref = refs[n];
- for (var i = 0; i < ref.hrefs.length; i++) {
- _.assign(ref.hrefs[i].obj, ref.obj);
- }
- }
-
- if (root.Envelope) {
- var body = root.Envelope.Body;
- if (body && body.Fault) {
- var code = body.Fault.faultcode && body.Fault.faultcode.$value;
- var string = body.Fault.faultstring && body.Fault.faultstring.$value;
- var detail = body.Fault.detail && body.Fault.detail.$value;
-
- code = code || body.Fault.faultcode;
- string = string || body.Fault.faultstring;
- detail = detail || body.Fault.detail;
-
- var error = new Error(code + ': ' + string + (detail ? ': ' + detail : ''));
-
- error.root = root;
- throw error;
- }
- return root.Envelope;
- }
- return root;
- }
-};
-
-/**
- * Look up a XSD type or element by namespace URI and name
- * @param {String} nsURI Namespace URI
- * @param {String} qname Local or qualified name
- * @returns {*} The XSD type/element definition
- */
-WSDL.prototype.findSchemaObject = function(nsURI, qname) {
- if (!nsURI || !qname) {
- return null;
- }
-
- var def = null;
-
- if (this.definitions.schemas) {
- var schema = this.definitions.schemas[nsURI];
- if (schema) {
- if (qname.indexOf(':') !== -1) {
- qname = qname.substring(qname.indexOf(':') + 1, qname.length);
- }
-
- // if the client passed an input element which has a `$lookupType` property instead of `$type`
- // the `def` is found in `schema.elements`.
- def = schema.complexTypes[qname] || schema.types[qname] || schema.elements[qname];
- }
- }
-
- return def;
-};
-
-/**
- * Create document style xml string from the parameters
- * @param {String} name
- * @param {*} params
- * @param {String} nsPrefix
- * @param {String} nsURI
- * @param {String} type
- */
-WSDL.prototype.objectToDocumentXML = function(name, params, nsPrefix, nsURI, type) {
- //If user supplies XML already, just use that. XML Declaration should not be present.
- if (params && params._xml) {
- return params._xml;
- }
- var args = {};
- args[name] = params;
- var parameterTypeObj = type ? this.findSchemaObject(nsURI, type) : null;
- return this.objectToXML(args, null, nsPrefix, nsURI, true, null, parameterTypeObj);
-};
-
-/**
- * Create RPC style xml string from the parameters
- * @param {String} name
- * @param {*} params
- * @param {String} nsPrefix
- * @param {String} nsURI
- * @returns {string}
- */
-WSDL.prototype.objectToRpcXML = function(name, params, nsPrefix, nsURI,isParts) {
- var parts = [];
- var defs = this.definitions;
- var nsAttrName = '_xmlns';
-
- nsPrefix = nsPrefix || findPrefix(defs.xmlns, nsURI);
-
- nsURI = nsURI || defs.xmlns[nsPrefix];
- nsPrefix = nsPrefix === TNS_PREFIX ? '' : (nsPrefix + ':');
-
- parts.push(['<', nsPrefix, name, '>'].join(''));
-
- for (var key in params) {
- if (!params.hasOwnProperty(key)) {
- continue;
- }
- if (key !== nsAttrName) {
- var value = params[key];
- var prefixedKey = (isParts ? '' : nsPrefix) + key;
- var attributes = [];
- if (typeof value === 'object' && value.hasOwnProperty(this.options.attributesKey)) {
- var attrs = value[this.options.attributesKey];
- for (var n in attrs) {
- attributes.push(' ' + n + '=' + '"' + attrs[n] + '"');
- }
- }
- parts.push(['<', prefixedKey ].concat(attributes).concat('>').join(''));
- parts.push((typeof value === 'object') ? this.objectToXML(value, key, nsPrefix, nsURI) : xmlEscape(value));
- parts.push(['</', prefixedKey, '>'].join(''));
- }
- }
- parts.push(['</', nsPrefix, name, '>'].join(''));
- return parts.join('');
-};
-
-
-function appendColon(ns) {
- return (ns && ns.charAt(ns.length - 1) !== ':') ? ns + ':' : ns;
-}
-
-function noColonNameSpace(ns) {
- return (ns && ns.charAt(ns.length - 1) === ':') ? ns.substring(0, ns.length - 1) : ns;
-}
-
-WSDL.prototype.isIgnoredNameSpace = function(ns) {
- return this.options.ignoredNamespaces.indexOf(ns) > -1;
-};
-
-WSDL.prototype.filterOutIgnoredNameSpace = function(ns) {
- var namespace = noColonNameSpace(ns);
- return this.isIgnoredNameSpace(namespace) ? '' : namespace;
-};
-
-
-
-/**
- * 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} nsPrefix the namespace prefix of the object I.E. xsd.
- * @param {String} nsURI 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 {NamespaceContext} nsContext Namespace context
- */
-WSDL.prototype.objectToXML = function(obj, name, nsPrefix, nsURI, isFirst, xmlnsAttr, schemaObject, nsContext) {
- var self = this;
- var schema = this.definitions.schemas[nsURI];
-
- var parentNsPrefix = nsPrefix ? nsPrefix.parent : undefined;
- if (typeof parentNsPrefix !== 'undefined') {
- //we got the parentNsPrefix for our array. setting the namespace-variable back to the current namespace string
- nsPrefix = nsPrefix.current;
- }
-
- parentNsPrefix = noColonNameSpace(parentNsPrefix);
- if (this.isIgnoredNameSpace(parentNsPrefix)) {
- parentNsPrefix = '';
- }
-
- var soapHeader = !schema;
- var qualified = schema && schema.$elementFormDefault === 'qualified';
- var parts = [];
- var prefixNamespace = (nsPrefix || qualified) && nsPrefix !== TNS_PREFIX;
-
- var xmlnsAttrib = '';
- if (nsURI && isFirst) {
- if(self.options.overrideRootElement && self.options.overrideRootElement.xmlnsAttributes) {
- self.options.overrideRootElement.xmlnsAttributes.forEach(function(attribute) {
- xmlnsAttrib += ' ' + attribute.name + '="' + attribute.value + '"';
- });
- } else {
- if (prefixNamespace && !this.isIgnoredNameSpace(nsPrefix)) {
- // resolve the prefix namespace
- xmlnsAttrib += ' xmlns:' + nsPrefix + '="' + nsURI + '"';
- }
- // only add default namespace if the schema elementFormDefault is qualified
- if (qualified || soapHeader) xmlnsAttrib += ' xmlns="' + nsURI + '"';
- }
- }
-
- if (!nsContext) {
- nsContext = new NamespaceContext();
- nsContext.declareNamespace(nsPrefix, nsURI);
- } else {
- nsContext.pushContext();
- }
-
- // explicitly use xmlns attribute if available
- if (xmlnsAttr && !(self.options.overrideRootElement && self.options.overrideRootElement.xmlnsAttributes)) {
- xmlnsAttrib = xmlnsAttr;
- }
-
- var ns = '';
-
- if (self.options.overrideRootElement && isFirst) {
- ns = self.options.overrideRootElement.namespace;
- } else if (prefixNamespace && (qualified || isFirst || soapHeader) && !this.isIgnoredNameSpace(nsPrefix)) {
- ns = nsPrefix;
- }
-
- var i, n;
- // start building out XML string.
- if (Array.isArray(obj)) {
- for (i = 0, n = obj.length; i < n; i++) {
- var item = obj[i];
- var arrayAttr = self.processAttributes(item, nsContext),
- correctOuterNsPrefix = parentNsPrefix || ns; //using the parent namespace prefix if given
-
- var body = self.objectToXML(item, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
-
- var openingTagParts = ['<', appendColon(correctOuterNsPrefix), name, arrayAttr, xmlnsAttrib];
-
- if (body === '' && self.options.useEmptyTag) {
- // Use empty (self-closing) tags if no contents
- openingTagParts.push(' />');
- parts.push(openingTagParts.join(''));
- } else {
- openingTagParts.push('>');
- if(self.options.namespaceArrayElements || i === 0) {
- parts.push(openingTagParts.join(''));
- }
- parts.push(body);
- if(self.options.namespaceArrayElements || i === n-1) {
- parts.push(['</', appendColon(correctOuterNsPrefix), name, '>'].join(''));
- }
- }
- }
- } else if (typeof obj === 'object') {
- for (name in obj) {
- if (!obj.hasOwnProperty(name)) continue;
- //don't process attributes as element
- if (name === self.options.attributesKey) {
- continue;
- }
- //Its the value of a xml object. Return it directly.
- if (name === self.options.xmlKey){
- nsContext.popContext();
- return obj[name];
- }
- //Its the value of an item. Return it directly.
- if (name === self.options.valueKey) {
- nsContext.popContext();
- return xmlEscape(obj[name]);
- }
-
- var child = obj[name];
- if (typeof child === 'undefined') {
- continue;
- }
-
- var attr = self.processAttributes(child, nsContext);
-
- var value = '';
- var nonSubNameSpace = '';
- var emptyNonSubNameSpace = false;
-
- var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
- if (nameWithNsRegex) {
- nonSubNameSpace = nameWithNsRegex[1] + ':';
- name = nameWithNsRegex[2];
- } else if(name[0] === ':'){
- emptyNonSubNameSpace = true;
- name = name.substr(1);
- }
-
- if (isFirst) {
- value = self.objectToXML(child, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
- } else {
-
- if (self.definitions.schemas) {
- if (schema) {
- var childSchemaObject = self.findChildSchemaObject(schemaObject, name);
- //find sub namespace if not a primitive
- if (childSchemaObject &&
- ((childSchemaObject.$type && (childSchemaObject.$type.indexOf('xsd:') === -1)) ||
- childSchemaObject.$ref || childSchemaObject.$name)) {
- /*if the base name space of the children is not in the ingoredSchemaNamspaces we use it.
- This is because in some services the child nodes do not need the baseNameSpace.
- */
-
- var childNsPrefix = '';
- var childName = '';
- var childNsURI;
- var childXmlnsAttrib = '';
-
- var elementQName = childSchemaObject.$ref || childSchemaObject.$name;
- if (elementQName) {
- elementQName = splitQName(elementQName);
- childName = elementQName.name;
- if (elementQName.prefix === TNS_PREFIX) {
- // Local element
- childNsURI = childSchemaObject.$targetNamespace;
- childNsPrefix = nsContext.registerNamespace(childNsURI);
- if (this.isIgnoredNameSpace(childNsPrefix)) {
- childNsPrefix = nsPrefix;
- }
- } else {
- childNsPrefix = elementQName.prefix;
- if (this.isIgnoredNameSpace(childNsPrefix)) {
- childNsPrefix = nsPrefix;
- }
- childNsURI = schema.xmlns[childNsPrefix] || self.definitions.xmlns[childNsPrefix];
- }
-
- var unqualified = false;
- // Check qualification form for local elements
- if (childSchemaObject.$name && childSchemaObject.targetNamespace === undefined) {
- if (childSchemaObject.$form === 'unqualified') {
- unqualified = true;
- } else if (childSchemaObject.$form === 'qualified') {
- unqualified = false;
- } else {
- unqualified = schema.$elementFormDefault !== 'qualified';
- }
- }
- if (unqualified) {
- childNsPrefix = '';
- }
-
- if (childNsURI && childNsPrefix) {
- if (nsContext.declareNamespace(childNsPrefix, childNsURI)) {
- childXmlnsAttrib = ' xmlns:' + childNsPrefix + '="' + childNsURI + '"';
- xmlnsAttrib += childXmlnsAttrib;
- }
- }
- }
-
- var resolvedChildSchemaObject;
- if (childSchemaObject.$type) {
- var typeQName = splitQName(childSchemaObject.$type);
- var typePrefix = typeQName.prefix;
- var typeURI = schema.xmlns[typePrefix] || self.definitions.xmlns[typePrefix];
- childNsURI = typeURI;
- if (typeURI !== 'http://www.w3.org/2001/XMLSchema' && typePrefix !== TNS_PREFIX) {
- // Add the prefix/namespace mapping, but not declare it
- nsContext.addNamespace(typePrefix, typeURI);
- }
- resolvedChildSchemaObject =
- self.findSchemaType(typeQName.name, typeURI) || childSchemaObject;
- } else {
- resolvedChildSchemaObject =
- self.findSchemaObject(childNsURI, childName) || childSchemaObject;
- }
-
- if (childSchemaObject.$baseNameSpace && this.options.ignoreBaseNameSpaces) {
- childNsPrefix = nsPrefix;
- childNsURI = nsURI;
- }
-
- if (this.options.ignoreBaseNameSpaces) {
- childNsPrefix = '';
- childNsURI = '';
- }
-
- ns = childNsPrefix;
-
- if (Array.isArray(child)) {
- //for arrays, we need to remember the current namespace
- childNsPrefix = {
- current: childNsPrefix,
- parent: ns
- };
- } else {
- //parent (array) already got the namespace
- childXmlnsAttrib = null;
- }
-
- value = self.objectToXML(child, name, childNsPrefix, childNsURI,
- false, childXmlnsAttrib, resolvedChildSchemaObject, nsContext);
- } else if (obj[self.options.attributesKey] && obj[self.options.attributesKey].xsi_type) {
- //if parent object has complex type defined and child not found in parent
- var completeChildParamTypeObject = self.findChildSchemaObject(
- obj[self.options.attributesKey].xsi_type.type,
- obj[self.options.attributesKey].xsi_type.xmlns);
-
- nonSubNameSpace = obj[self.options.attributesKey].xsi_type.prefix;
- nsContext.addNamespace(obj[self.options.attributesKey].xsi_type.prefix,
- obj[self.options.attributesKey].xsi_type.xmlns);
- value = self.objectToXML(child, name, obj[self.options.attributesKey].xsi_type.prefix,
- obj[self.options.attributesKey].xsi_type.xmlns, false, null, null, nsContext);
- } else {
- if(Array.isArray(child)) {
- name = nonSubNameSpace + name;
- }
-
- value = self.objectToXML(child, name, nsPrefix, nsURI, false, null, null, nsContext);
- }
- } else {
- value = self.objectToXML(child, name, nsPrefix, nsURI, false, null, null, nsContext);
- }
- }
- }
-
- ns = noColonNameSpace(ns);
- if (prefixNamespace && !qualified && isFirst && !self.options.overrideRootElement) {
- ns = nsPrefix;
- } else if (this.isIgnoredNameSpace(ns)) {
- ns = '';
- }
-
- var useEmptyTag = !value && self.options.useEmptyTag;
- if (!Array.isArray(child)) {
- // start tag
- parts.push(['<', emptyNonSubNameSpace ? '' : appendColon(nonSubNameSpace || ns), name, attr, xmlnsAttrib,
- (child === null ? ' xsi:nil="true"' : ''),
- useEmptyTag ? ' />' : '>'
- ].join(''));
- }
-
- if (!useEmptyTag) {
- parts.push(value);
- if (!Array.isArray(child)) {
- // end tag
- parts.push(['</', emptyNonSubNameSpace ? '' : appendColon(nonSubNameSpace || ns), name, '>'].join(''));
- }
- }
- }
- } else if (obj !== undefined) {
- parts.push((self.options.escapeXML) ? xmlEscape(obj) : obj);
- }
- nsContext.popContext();
- return parts.join('');
-};
-
-WSDL.prototype.processAttributes = function(child, nsContext) {
- var attr = '';
-
- if(child === null) {
- child = [];
- }
-
- var attrObj = child[this.options.attributesKey];
- if (attrObj && attrObj.xsi_type) {
- var xsiType = attrObj.xsi_type;
-
- var prefix = xsiType.prefix || xsiType.namespace;
- // Generate a new namespace for complex extension if one not provided
- if (!prefix) {
- prefix = nsContext.registerNamespace(xsiType.xmlns);
- } else {
- nsContext.declareNamespace(prefix, xsiType.xmlns);
- }
- xsiType.prefix = prefix;
- }
-
-
- if (attrObj) {
- for (var attrKey in attrObj) {
- //handle complex extension separately
- if (attrKey === 'xsi_type') {
- var attrValue = attrObj[attrKey];
- attr += ' xsi:type="' + attrValue.prefix + ':' + attrValue.type + '"';
- attr += ' xmlns:' + attrValue.prefix + '="' + attrValue.xmlns + '"';
-
- continue;
- } else {
- attr += ' ' + attrKey + '="' + xmlEscape(attrObj[attrKey]) + '"';
- }
- }
- }
-
- return attr;
-};
-
-/**
- * Look up a schema type definition
- * @param name
- * @param nsURI
- * @returns {*}
- */
-WSDL.prototype.findSchemaType = function(name, nsURI) {
- if (!this.definitions.schemas || !name || !nsURI) {
- return null;
- }
-
- var schema = this.definitions.schemas[nsURI];
- if (!schema || !schema.complexTypes) {
- return null;
- }
-
- return schema.complexTypes[name];
-};
-
-WSDL.prototype.findChildSchemaObject = function(parameterTypeObj, childName, backtrace) {
- if (!parameterTypeObj || !childName) {
- return null;
- }
-
- if (!backtrace) {
- backtrace = [];
- }
-
- if (backtrace.indexOf(parameterTypeObj) >= 0) {
- // We've recursed back to ourselves; break.
- return null;
- } else {
- backtrace = backtrace.concat([parameterTypeObj]);
- }
-
- var found = null,
- i = 0,
- child,
- ref;
-
- if (Array.isArray(parameterTypeObj.$lookupTypes) && parameterTypeObj.$lookupTypes.length) {
- var types = parameterTypeObj.$lookupTypes;
-
- for(i = 0; i < types.length; i++) {
- var typeObj = types[i];
-
- if(typeObj.$name === childName) {
- found = typeObj;
- break;
- }
- }
- }
-
- var object = parameterTypeObj;
- if (object.$name === childName && object.name === 'element') {
- return object;
- }
- if (object.$ref) {
- ref = splitQName(object.$ref);
- if (ref.name === childName) {
- return object;
- }
- }
-
- var childNsURI;
-
- // want to avoid unecessary recursion to improve performance
- if (object.$type && backtrace.length === 1) {
- var typeInfo = splitQName(object.$type);
- if (typeInfo.prefix === TNS_PREFIX) {
- childNsURI = parameterTypeObj.$targetNamespace;
- } else {
- childNsURI = this.definitions.xmlns[typeInfo.prefix];
- }
- var typeDef = this.findSchemaType(typeInfo.name, childNsURI);
- if (typeDef) {
- return this.findChildSchemaObject(typeDef, childName, backtrace);
- }
- }
-
- if (object.children) {
- for (i = 0, child; child = object.children[i]; i++) {
- found = this.findChildSchemaObject(child, childName, backtrace);
- if (found) {
- break;
- }
-
- if (child.$base) {
- var baseQName = splitQName(child.$base);
- var childNameSpace = baseQName.prefix === TNS_PREFIX ? '' : baseQName.prefix;
- childNsURI = child.xmlns[baseQName.prefix] || this.definitions.xmlns[baseQName.prefix];
-
- var foundBase = this.findSchemaType(baseQName.name, childNsURI);
-
- if (foundBase) {
- found = this.findChildSchemaObject(foundBase, childName, backtrace);
-
- if (found) {
- found.$baseNameSpace = childNameSpace;
- found.$type = childNameSpace + ':' + childName;
- break;
- }
- }
- }
- }
-
- }
-
- if (!found && object.$name === childName) {
- return object;
- }
-
- return found;
-};
-
-WSDL.prototype._parse = function(xml) {
- var self = this,
- p = sax.parser(true),
- stack = [],
- root = null,
- types = null,
- schema = null,
- schemaAttrs = null,
- options = self.options;
-
- p.onopentag = function(node) {
- var nsName = node.name;
- var attrs = node.attributes;
-
- var top = stack[stack.length - 1];
- var name = splitQName(nsName).name;
-
- if (name === 'schema') {
- schemaAttrs = attrs;
- }
- if (top) {
- try {
- top.startElement(stack, nsName, attrs, options, schemaAttrs);
- } catch (e) {
- if (self.options.strict) {
- throw e;
- } else {
- stack.push(new Element(nsName, attrs, options, schemaAttrs));
- }
- }
- } else {
- if (name === 'definitions') {
- root = new DefinitionsElement(nsName, attrs, options);
- stack.push(root);
- } else if (name === 'schema') {
- // Shim a structure in here to allow the proper objects to be created when merging back.
- root = new DefinitionsElement('definitions', {}, {});
- types = new TypesElement('types', {}, {});
- schema = new SchemaElement(nsName, attrs, options);
- types.addChild(schema);
- root.addChild(types);
- stack.push(schema);
- } else {
- throw new Error('Unexpected root element of WSDL or include');
- }
- }
- };
-
- p.onclosetag = function(name) {
- var top = stack[stack.length - 1];
- assert(top, 'Unmatched close tag: ' + name);
-
- top.endElement(stack, name);
- };
-
- p.write(xml).close();
-
- return root;
-};
-
-WSDL.prototype._fromXML = function(xml) {
- this.definitions = this._parse(xml);
- this.definitions.descriptions = {
- types:{}
- };
- this.xml = xml;
-};
-
-WSDL.prototype._fromServices = function(services) {
-
-};
-
-
-
-WSDL.prototype._xmlnsMap = function() {
- var xmlns = this.definitions.xmlns;
- var str = '';
- for (var alias in xmlns) {
- if (alias === '' || alias === TNS_PREFIX) {
- continue;
- }
- var ns = xmlns[alias];
- switch (ns) {
- case "http://xml.apache.org/xml-soap" : // apachesoap
- case "http://schemas.xmlsoap.org/wsdl/" : // wsdl
- case "http://schemas.xmlsoap.org/wsdl/soap/" : // wsdlsoap
- case "http://schemas.xmlsoap.org/wsdl/soap12/": // wsdlsoap12
- case "http://schemas.xmlsoap.org/soap/encoding/" : // soapenc
- case "http://www.w3.org/2001/XMLSchema" : // xsd
- continue;
- }
- if (~ns.indexOf('http://schemas.xmlsoap.org/')) {
- continue;
- }
- if (~ns.indexOf('http://www.w3.org/')) {
- continue;
- }
- if (~ns.indexOf('http://xml.apache.org/')) {
- continue;
- }
- str += ' xmlns:' + alias + '="' + ns + '"';
- }
- return str;
-};
-
-/*
- * Have another function to load previous WSDLs as we
- * don't want this to be invoked externally (expect for tests)
- * This will attempt to fix circular dependencies with XSD files,
- * Given
- * - file.wsdl
- * - xs:import namespace="A" schemaLocation: A.xsd
- * - A.xsd
- * - xs:import namespace="B" schemaLocation: B.xsd
- * - B.xsd
- * - xs:import namespace="A" schemaLocation: A.xsd
- * file.wsdl will start loading, import A, then A will import B, which will then import A
- * Because A has already started to load previously it will be returned right away and
- * have an internal circular reference
- * B would then complete loading, then A, then file.wsdl
- * By the time file A starts processing its includes its definitions will be already loaded,
- * this is the only thing that B will depend on when "opening" A
- */
-function open_wsdl_recursive(uri, options, callback) {
- var fromCache,
- WSDL_CACHE;
-
- if (typeof options === 'function') {
- callback = options;
- options = {};
- }
-
- WSDL_CACHE = options.WSDL_CACHE;
-
- if (fromCache = WSDL_CACHE[ uri ]) {
- return callback.call(fromCache, null, fromCache);
- }
-
- return open_wsdl(uri, options, callback);
-}
-
-function open_wsdl(uri, options, callback) {
- if (typeof options === 'function') {
- callback = options;
- options = {};
- }
-
- // initialize cache when calling open_wsdl directly
- var WSDL_CACHE = options.WSDL_CACHE || {};
- var request_headers = options.wsdl_headers;
- var request_options = options.wsdl_options;
-
- var wsdl;
- if (!/^https?:/.test(uri)) {
- debug('Reading file: %s', uri);
- fs.readFile(uri, 'utf8', function(err, definition) {
- if (err) {
- callback(err);
- }
- else {
- wsdl = new WSDL(definition, uri, options);
- WSDL_CACHE[ uri ] = wsdl;
- wsdl.WSDL_CACHE = WSDL_CACHE;
- wsdl.onReady(callback);
- }
- });
- }
- else {
- debug('Reading url: %s', uri);
- var httpClient = options.httpClient || new HttpClient(options);
- httpClient.request(uri, null /* options */, function(err, response, definition) {
- if (err) {
- callback(err);
- } else if (response && response.statusCode === 200) {
- wsdl = new WSDL(definition, uri, options);
- WSDL_CACHE[ uri ] = wsdl;
- wsdl.WSDL_CACHE = WSDL_CACHE;
- wsdl.onReady(callback);
- } else {
- callback(new Error('Invalid WSDL URL: ' + uri + "\n\n\r Code: " + response.statusCode + "\n\n\r Response Body: " + response.body));
- }
- }, request_headers, request_options);
- }
-
- return wsdl;
-}
-
-exports.open_wsdl = open_wsdl;
-exports.WSDL = WSDL;

package.json

@@ -1,6 +1,6 @@
{
"name": "soap",
- "version": "0.25.0",
+ "version": "0.27.1",
"description": "A minimal node SOAP client",
"engines": {
"node": ">=4.0.0"
@@ -8,18 +8,17 @@
"author": "Vinay Pulim <v@pulim.com>",
"dependencies": {
"bluebird": "^3.5.0",
- "concat-stream": "^1.5.1",
- "debug": "^2.6.9",
- "ejs": "~2.5.5",
- "finalhandler": "^1.0.3",
- "lodash": "^4.17.5",
+ "concat-stream": "^2.0.0",
+ "debug": "^4.1.1",
"httpntlm": "^1.5.2",
+ "lodash": "^4.17.5",
"request": ">=2.9.0",
"sax": ">=0.6",
"serve-static": "^1.11.1",
- "strip-bom": "~0.3.1",
+ "strip-bom": "^3.0.0",
+ "@types/request": "^2.48.1",
"uuid": "^3.1.0",
- "xml-crypto": "~0.8.0"
+ "xml-crypto": "^1.2.0"
},
"repository": {
"type": "git",
@@ -28,36 +27,53 @@
"main": "./index.js",
"types": "./lib/soap.d.ts",
"directories": {
- "lib": "./lib"
+ "lib": "./lib",
+ "test": "./test"
},
"scripts": {
+ "prepare": "npm run build",
+ "build": "tsc -p .",
+ "clean": "rm -rf lib",
+ "watch": "tsc -w -p .",
+ "lint": "tslint -p tsconfig.json",
"toc": "./node_modules/.bin/doctoc Readme.md --github --maxlevel 3",
- "pretest": "jshint index.js lib test",
- "cover": "nyc --reporter=lcov --reporter=html --reporter=text mocha --exit test/*-test.js test/security/*.js",
+ "cover": "nyc --reporter=lcov --reporter=html --reporter=text mocha --timeout 15000 --exit test/*-test.js test/security/*.js",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js -v",
- "test": "mocha --timeout 10000 --exit test/*-test.js test/security/*.js"
+ "docs": "typedoc --out docs",
+ "test": "mocha --timeout 15000 --bail --exit test/*-test.js test/security/*.js"
},
"keywords": [
"soap"
],
"license": "MIT",
"devDependencies": {
- "@types/bluebird": "^3.5.1",
+ "@types/bluebird": "^3.5.26",
+ "@types/debug": "^4.1.2",
+ "@types/express": "^4.16.1",
+ "@types/lodash": "^4.14.122",
+ "@types/node": "^11.11.0",
+ "@types/sax": "^1.0.1",
+ "@types/uuid": "^3.4.4",
"body-parser": "^1.15.2",
- "colors": "^1.1.2",
- "coveralls": "^3.0.1",
- "diff": "^2.2.1",
- "doctoc": "^1.0.0",
+ "colors": "^1.3.3",
+ "coveralls": "^3.0.3",
+ "diff": "^4.0.1",
+ "doctoc": "^1.4.0",
"duplexer": "~0.1.1",
- "express": "^4.14.0",
- "glob": "~3.2.8",
- "jshint": "2.3.0",
- "mocha": "~5.2.0",
- "nyc": "^11.4.1",
+ "express": "^4.16.4",
+ "finalhandler": "^1.1.1",
+ "glob": "^7.1.3",
+ "jshint": "^2.10.1",
+ "mocha": "^6.0.2",
+ "nyc": "^13.3.0",
"readable-stream": "~2.0.2",
- "semver": "~5.0.3",
- "should": "~3.3.0",
- "sinon": "^1.17.5",
- "timekeeper": "~0.0.4"
+ "semver": "^5.6.0",
+ "should": "^13.2.3",
+ "sinon": "^1.17.7",
+ "source-map-support": "^0.5.10",
+ "timekeeper": "^2.1.2",
+ "tslint": "^5.13.1",
+ "typedoc": "^0.14.2",
+ "typescript": "^3.3.3333"
}
}

Readme.md

@@ -159,7 +159,7 @@
};
},
- // This is how to define an asynchronous function.
+ // This is how to define an asynchronous function with a callback.
MyAsyncFunction: function(args, callback) {
// do some work
callback({
@@ -167,6 +167,16 @@
});
},
+ // This is how to define an asynchronous function with a Promise.
+ MyPromiseFunction: function(args) {
+ return new Promise((resolve) => {
+ // do some work
+ resolve({
+ name: args.name
+ });
+ });
+ },
+
// This is how to receive incoming headers
HeadersAwareFunction: function(args, cb, headers) {
return {
@@ -219,6 +229,7 @@
- `ca`: An array of strings or Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs will be used, like VeriSign. These are used to authorize connections.
- `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
- `ciphers`: A string describing the ciphers to use or exclude, separated by :. The default cipher suite is:
+- `enableChunkedEncoding`: A boolean for controlling chunked transfer encoding in response. Some client (such as Windows 10's MDM enrollment SOAP client) is sensitive to transfer-encoding mode and can't accept chunked response. This option let user disable chunked transfer encoding for such a client. Default to `true` for backward compatibility.
``` javascript
var xml = require('fs').readFileSync('myservice.wsdl', 'utf8');

tsconfig.json

@@ -0,0 +1,17 @@
+{
+ "compileOnSave": true,
+ "compilerOptions": {
+ "target": "es3",
+ "module": "commonjs",
+ "outDir": "lib",
+ "sourceMap": true,
+ "declaration": true,
+ "stripInternal": true
+ },
+ "include": [
+ "src/**/*"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
+}

tslint.json

@@ -0,0 +1,24 @@
+{
+ "defaultSeverity": "error",
+ "extends": [
+ "tslint:recommended"
+ ],
+ "jsRules": {},
+ "rules": {
+ "quotemark": [true, "single"],
+ "variable-name": false,
+ "max-line-length": false,
+ "forin": false,
+ "object-literal-sort-keys": false,
+ "no-var-requires": false,
+ "no-unused-expression": false,
+ "no-shadowed-variable": false,
+ "object-literal-shorthand": false,
+ "max-classes-per-file": false,
+ "no-empty": false,
+ "no-conditional-assignment": false,
+ "no-bitwise": false,
+ "no-console": false
+ },
+ "rulesDirectory": []
+}