soap 0.45.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/History.md +7 -0
  2. package/Readme.md +12 -0
  3. package/lib/client.d.ts +1 -0
  4. package/lib/client.js +168 -187
  5. package/lib/client.js.map +1 -1
  6. package/lib/http.d.ts +1 -0
  7. package/lib/http.js +91 -101
  8. package/lib/http.js.map +1 -1
  9. package/lib/nscontext.js +38 -40
  10. package/lib/nscontext.js.map +1 -1
  11. package/lib/security/BasicAuthSecurity.js +11 -12
  12. package/lib/security/BasicAuthSecurity.js.map +1 -1
  13. package/lib/security/BearerSecurity.js +11 -12
  14. package/lib/security/BearerSecurity.js.map +1 -1
  15. package/lib/security/ClientSSLSecurity.js +12 -13
  16. package/lib/security/ClientSSLSecurity.js.map +1 -1
  17. package/lib/security/ClientSSLSecurityPFX.js +11 -12
  18. package/lib/security/ClientSSLSecurityPFX.js.map +1 -1
  19. package/lib/security/NTLMSecurity.js +12 -13
  20. package/lib/security/NTLMSecurity.js.map +1 -1
  21. package/lib/security/WSSecurity.js +21 -22
  22. package/lib/security/WSSecurity.js.map +1 -1
  23. package/lib/security/WSSecurityCert.d.ts +1 -0
  24. package/lib/security/WSSecurityCert.js +74 -56
  25. package/lib/security/WSSecurityCert.js.map +1 -1
  26. package/lib/security/WSSecurityPlusCert.d.ts +9 -0
  27. package/lib/security/WSSecurityPlusCert.js +17 -0
  28. package/lib/security/WSSecurityPlusCert.js.map +1 -0
  29. package/lib/security/index.d.ts +1 -0
  30. package/lib/security/index.js +8 -3
  31. package/lib/security/index.js.map +1 -1
  32. package/lib/server.d.ts +1 -0
  33. package/lib/server.js +189 -209
  34. package/lib/server.js.map +1 -1
  35. package/lib/soap.d.ts +1 -1
  36. package/lib/soap.js +45 -40
  37. package/lib/soap.js.map +1 -1
  38. package/lib/types.d.ts +1 -0
  39. package/lib/types.js +1 -1
  40. package/lib/utils.d.ts +1 -1
  41. package/lib/utils.js +55 -53
  42. package/lib/utils.js.map +1 -1
  43. package/lib/wsdl/elements.js +393 -515
  44. package/lib/wsdl/elements.js.map +1 -1
  45. package/lib/wsdl/index.js +322 -322
  46. package/lib/wsdl/index.js.map +1 -1
  47. package/package.json +8 -7
  48. package/tsconfig.json +2 -1
package/lib/wsdl/index.js CHANGED
@@ -5,29 +5,29 @@
5
5
  *
6
6
  */
7
7
  /*jshint proto:true*/
8
- exports.__esModule = true;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.open_wsdl = exports.WSDL = void 0;
10
- var assert_1 = require("assert");
11
- var debugBuilder = require("debug");
12
- var fs = require("fs");
13
- var _ = require("lodash");
14
- var path = require("path");
15
- var sax = require("sax");
16
- var stripBom = require("strip-bom");
17
- var url = require("url");
18
- var http_1 = require("../http");
19
- var nscontext_1 = require("../nscontext");
20
- var utils_1 = require("../utils");
21
- var elements = require("./elements");
22
- var debug = debugBuilder('node-soap');
23
- var XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
24
- var trimLeft = /^[\s\xA0]+/;
25
- var trimRight = /[\s\xA0]+$/;
10
+ const assert_1 = require("assert");
11
+ const debugBuilder = require("debug");
12
+ const fs = require("fs");
13
+ const _ = require("lodash");
14
+ const path = require("path");
15
+ const sax = require("sax");
16
+ const stripBom = require("strip-bom");
17
+ const url = require("url");
18
+ const http_1 = require("../http");
19
+ const nscontext_1 = require("../nscontext");
20
+ const utils_1 = require("../utils");
21
+ const elements = require("./elements");
22
+ const debug = debugBuilder('node-soap');
23
+ const XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
24
+ const trimLeft = /^[\s\xA0]+/;
25
+ const trimRight = /[\s\xA0]+$/;
26
26
  function trim(text) {
27
27
  return text.replace(trimLeft, '').replace(trimRight, '');
28
28
  }
29
29
  function deepMerge(destination, source) {
30
- return _.mergeWith(destination, source, function (a, b) {
30
+ return _.mergeWith(destination, source, (a, b) => {
31
31
  return Array.isArray(a) ? a.concat(b) : undefined;
32
32
  });
33
33
  }
@@ -37,16 +37,15 @@ function appendColon(ns) {
37
37
  function noColonNameSpace(ns) {
38
38
  return (ns && ns.charAt(ns.length - 1) === ':') ? ns.substring(0, ns.length - 1) : ns;
39
39
  }
40
- var WSDL = /** @class */ (function () {
41
- function WSDL(definition, uri, options) {
42
- var _this = this;
40
+ class WSDL {
41
+ constructor(definition, uri, options) {
43
42
  this.ignoredNamespaces = ['tns', 'targetNamespace', 'typedNamespace'];
44
43
  this.ignoreBaseNameSpaces = false;
45
44
  this.valueKey = '$value';
46
45
  this.xmlKey = '$xml';
47
- var fromFunc;
46
+ let fromFunc;
48
47
  this.uri = uri;
49
- this.callback = function () { };
48
+ this.callback = () => { };
50
49
  this._includesWsdl = [];
51
50
  // initialize WSDL cache
52
51
  this.WSDL_CACHE = {};
@@ -64,48 +63,48 @@ var WSDL = /** @class */ (function () {
64
63
  else {
65
64
  throw new Error('WSDL constructor takes either an XML string or service definition');
66
65
  }
67
- process.nextTick(function () {
66
+ process.nextTick(() => {
68
67
  try {
69
- fromFunc.call(_this, definition);
68
+ fromFunc.call(this, definition);
70
69
  }
71
70
  catch (e) {
72
- return _this.callback(e);
71
+ return this.callback(e);
73
72
  }
74
- _this.processIncludes(function (err) {
75
- var name;
73
+ this.processIncludes((err) => {
74
+ let name;
76
75
  if (err) {
77
- return _this.callback(err);
76
+ return this.callback(err);
78
77
  }
79
78
  try {
80
- _this.definitions.deleteFixedAttrs();
81
- var services = _this.services = _this.definitions.services;
79
+ this.definitions.deleteFixedAttrs();
80
+ const services = this.services = this.definitions.services;
82
81
  if (services) {
83
82
  for (name in services) {
84
- services[name].postProcess(_this.definitions);
83
+ services[name].postProcess(this.definitions);
85
84
  }
86
85
  }
87
- var complexTypes = _this.definitions.complexTypes;
86
+ const complexTypes = this.definitions.complexTypes;
88
87
  if (complexTypes) {
89
88
  for (name in complexTypes) {
90
89
  complexTypes[name].deleteFixedAttrs();
91
90
  }
92
91
  }
93
92
  // for document style, for every binding, prepare input message element name to (methodName, output message element name) mapping
94
- var bindings = _this.definitions.bindings;
95
- for (var bindingName in bindings) {
96
- var binding = bindings[bindingName];
93
+ const bindings = this.definitions.bindings;
94
+ for (const bindingName in bindings) {
95
+ const binding = bindings[bindingName];
97
96
  if (typeof binding.style === 'undefined') {
98
97
  binding.style = 'document';
99
98
  }
100
- var methods = binding.methods;
101
- var topEls = binding.topElements = {};
102
- for (var methodName in methods) {
99
+ const methods = binding.methods;
100
+ const topEls = binding.topElements = {};
101
+ for (const methodName in methods) {
103
102
  if ((methods[methodName].style || binding.style) !== 'document') {
104
103
  continue;
105
104
  }
106
105
  if (methods[methodName].input) {
107
- var inputName = methods[methodName].input.$name;
108
- var outputName = '';
106
+ const inputName = methods[methodName].input.$name;
107
+ let outputName = '';
109
108
  if (methods[methodName].output) {
110
109
  outputName = methods[methodName].output.$name;
111
110
  }
@@ -114,94 +113,93 @@ var WSDL = /** @class */ (function () {
114
113
  }
115
114
  }
116
115
  // prepare soap envelope xmlns definition string
117
- _this.xmlnsInEnvelope = _this._xmlnsMap();
118
- _this.callback(err, _this);
116
+ this.xmlnsInEnvelope = this._xmlnsMap();
117
+ this.callback(err, this);
119
118
  }
120
119
  catch (e) {
121
- _this.callback(e);
120
+ this.callback(e);
122
121
  }
123
122
  });
124
123
  });
125
124
  }
126
- WSDL.prototype.onReady = function (callback) {
125
+ onReady(callback) {
127
126
  if (callback) {
128
127
  this.callback = callback;
129
128
  }
130
- };
131
- WSDL.prototype.processIncludes = function (callback) {
132
- var schemas = this.definitions.schemas;
133
- var includes = [];
134
- for (var ns in schemas) {
135
- var schema = schemas[ns];
129
+ }
130
+ processIncludes(callback) {
131
+ const schemas = this.definitions.schemas;
132
+ let includes = [];
133
+ for (const ns in schemas) {
134
+ const schema = schemas[ns];
136
135
  includes = includes.concat(schema.includes || []);
137
136
  }
138
137
  this._processNextInclude(includes, callback);
139
- };
140
- WSDL.prototype.describeServices = function () {
141
- var services = {};
142
- for (var name_1 in this.services) {
143
- var service = this.services[name_1];
144
- services[name_1] = service.description(this.definitions);
138
+ }
139
+ describeServices() {
140
+ const services = {};
141
+ for (const name in this.services) {
142
+ const service = this.services[name];
143
+ services[name] = service.description(this.definitions);
145
144
  }
146
145
  return services;
147
- };
148
- WSDL.prototype.toXML = function () {
146
+ }
147
+ toXML() {
149
148
  return this.xml || '';
150
- };
151
- WSDL.prototype.getSaxStream = function (xml) {
152
- var saxStream = sax.createStream(true, null);
149
+ }
150
+ getSaxStream(xml) {
151
+ const saxStream = sax.createStream(true, null);
153
152
  xml.pipe(saxStream);
154
153
  return saxStream;
155
- };
156
- WSDL.prototype.xmlToObject = function (xml, callback) {
157
- var _this = this;
158
- var p = typeof callback === 'function' ? {} : sax.parser(true, null);
159
- var objectName = null;
160
- var root = {};
161
- var schema = {
154
+ }
155
+ xmlToObject(xml, callback) {
156
+ const p = typeof callback === 'function' ? {} : sax.parser(true, null);
157
+ let objectName = null;
158
+ const root = {};
159
+ const schema = {
162
160
  Envelope: {
163
161
  Header: {
164
162
  Security: {
165
163
  UsernameToken: {
166
164
  Username: 'string',
167
- Password: 'string'
168
- }
169
- }
165
+ Password: 'string',
166
+ },
167
+ },
170
168
  },
171
169
  Body: {
172
170
  Fault: {
173
171
  faultcode: 'string',
174
172
  faultstring: 'string',
175
- detail: 'string'
176
- }
177
- }
178
- }
173
+ detail: 'string',
174
+ },
175
+ },
176
+ },
179
177
  };
180
- var stack = [{ name: null, object: root, schema: schema }];
181
- var xmlns = {};
182
- var refs = {};
183
- var id; // {id:{hrefs:[],obj:}, ...}
184
- p.onopentag = function (node) {
185
- var nsName = node.name;
186
- var attrs = node.attributes;
187
- var name = utils_1.splitQName(nsName).name;
188
- var attributeName;
189
- var top = stack[stack.length - 1];
190
- var topSchema = top.schema;
191
- var elementAttributes = {};
192
- var hasNonXmlnsAttribute = false;
193
- var hasNilAttribute = false;
194
- var obj = {};
195
- var originalName = name;
178
+ const stack = [{ name: null, object: root, schema: schema }];
179
+ const xmlns = {};
180
+ const refs = {};
181
+ let id; // {id:{hrefs:[],obj:}, ...}
182
+ p.onopentag = (node) => {
183
+ const nsName = node.name;
184
+ const attrs = node.attributes;
185
+ let name = (0, utils_1.splitQName)(nsName).name;
186
+ let attributeName;
187
+ const top = stack[stack.length - 1];
188
+ let topSchema = top.schema;
189
+ const elementAttributes = {};
190
+ let hasNonXmlnsAttribute = false;
191
+ let hasNilAttribute = false;
192
+ const obj = {};
193
+ const originalName = name;
196
194
  if (!objectName && top.name === 'Body' && name !== 'Fault') {
197
- var message = _this.definitions.messages[name];
195
+ let message = this.definitions.messages[name];
198
196
  // Support RPC/literal messages where response body contains one element named
199
197
  // after the operation + 'Response'. See http://www.w3.org/TR/wsdl#_names
200
198
  if (!message) {
201
199
  try {
202
200
  // Determine if this is request or response
203
- var isInput = false;
204
- var isOutput = false;
201
+ let isInput = false;
202
+ let isOutput = false;
205
203
  if ((/Response$/).test(name)) {
206
204
  isOutput = true;
207
205
  name = name.replace(/Response$/, '');
@@ -215,27 +213,27 @@ var WSDL = /** @class */ (function () {
215
213
  name = name.replace(/Solicit$/, '');
216
214
  }
217
215
  // Look up the appropriate message as given in the portType's operations
218
- var portTypes = _this.definitions.portTypes;
219
- var portTypeNames = Object.keys(portTypes);
216
+ const portTypes = this.definitions.portTypes;
217
+ const portTypeNames = Object.keys(portTypes);
220
218
  // Currently this supports only one portType definition.
221
- var portType = portTypes[portTypeNames[0]];
219
+ const portType = portTypes[portTypeNames[0]];
222
220
  if (isInput) {
223
221
  name = portType.methods[name].input.$name;
224
222
  }
225
223
  else {
226
224
  name = portType.methods[name].output.$name;
227
225
  }
228
- message = _this.definitions.messages[name];
226
+ message = this.definitions.messages[name];
229
227
  // 'cache' this alias to speed future lookups
230
- _this.definitions.messages[originalName] = _this.definitions.messages[name];
228
+ this.definitions.messages[originalName] = this.definitions.messages[name];
231
229
  }
232
230
  catch (e) {
233
- if (_this.options.returnFault) {
231
+ if (this.options.returnFault) {
234
232
  p.onerror(e);
235
233
  }
236
234
  }
237
235
  }
238
- topSchema = message.description(_this.definitions);
236
+ topSchema = message.description(this.definitions);
239
237
  objectName = originalName;
240
238
  }
241
239
  if (attrs.href) {
@@ -253,14 +251,14 @@ var WSDL = /** @class */ (function () {
253
251
  // Handle element attributes
254
252
  for (attributeName in attrs) {
255
253
  if (/^xmlns:|^xmlns$/.test(attributeName)) {
256
- xmlns[utils_1.splitQName(attributeName).name] = attrs[attributeName];
254
+ xmlns[(0, utils_1.splitQName)(attributeName).name] = attrs[attributeName];
257
255
  continue;
258
256
  }
259
257
  hasNonXmlnsAttribute = true;
260
258
  elementAttributes[attributeName] = attrs[attributeName];
261
259
  }
262
260
  for (attributeName in elementAttributes) {
263
- var res = utils_1.splitQName(attributeName);
261
+ const res = (0, utils_1.splitQName)(attributeName);
264
262
  if (res.name === 'nil' && xmlns[res.prefix] === XSI_URI && elementAttributes[attributeName] &&
265
263
  (elementAttributes[attributeName].toLowerCase() === 'true' || elementAttributes[attributeName] === '1')) {
266
264
  hasNilAttribute = true;
@@ -268,20 +266,20 @@ var WSDL = /** @class */ (function () {
268
266
  }
269
267
  }
270
268
  if (hasNonXmlnsAttribute) {
271
- obj[_this.options.attributesKey] = elementAttributes;
269
+ obj[this.options.attributesKey] = elementAttributes;
272
270
  }
273
271
  // Pick up the schema for the type specified in element's xsi:type attribute.
274
- var xsiTypeSchema;
275
- var xsiType;
276
- for (var prefix in xmlns) {
277
- if (xmlns[prefix] === XSI_URI && (prefix + ":type" in elementAttributes)) {
278
- xsiType = elementAttributes[prefix + ":type"];
272
+ let xsiTypeSchema;
273
+ let xsiType;
274
+ for (const prefix in xmlns) {
275
+ if (xmlns[prefix] === XSI_URI && (`${prefix}:type` in elementAttributes)) {
276
+ xsiType = elementAttributes[`${prefix}:type`];
279
277
  break;
280
278
  }
281
279
  }
282
280
  if (xsiType) {
283
- var type = utils_1.splitQName(xsiType);
284
- var typeURI = void 0;
281
+ const type = (0, utils_1.splitQName)(xsiType);
282
+ let typeURI;
285
283
  if (type.prefix === utils_1.TNS_PREFIX) {
286
284
  // In case of xsi:type = "MyType"
287
285
  typeURI = xmlns[type.prefix] || xmlns.xmlns;
@@ -289,9 +287,9 @@ var WSDL = /** @class */ (function () {
289
287
  else {
290
288
  typeURI = xmlns[type.prefix];
291
289
  }
292
- var typeDef = _this.findSchemaObject(typeURI, type.name);
290
+ const typeDef = this.findSchemaObject(typeURI, type.name);
293
291
  if (typeDef) {
294
- xsiTypeSchema = typeDef.description(_this.definitions);
292
+ xsiTypeSchema = typeDef.description(this.definitions);
295
293
  }
296
294
  }
297
295
  if (topSchema && topSchema[name + '[]']) {
@@ -299,20 +297,20 @@ var WSDL = /** @class */ (function () {
299
297
  }
300
298
  stack.push({ name: originalName, object: obj, schema: (xsiTypeSchema || (topSchema && topSchema[name])), id: attrs.id, nil: hasNilAttribute });
301
299
  };
302
- p.onclosetag = function (nsName) {
303
- var cur = stack.pop();
304
- var obj = cur.object;
305
- var top = stack[stack.length - 1];
306
- var topObject = top.object;
307
- var topSchema = top.schema;
308
- var name = utils_1.splitQName(nsName).name;
300
+ p.onclosetag = (nsName) => {
301
+ const cur = stack.pop();
302
+ let obj = cur.object;
303
+ const top = stack[stack.length - 1];
304
+ const topObject = top.object;
305
+ const topSchema = top.schema;
306
+ const name = (0, utils_1.splitQName)(nsName).name;
309
307
  if (typeof cur.schema === 'string' && (cur.schema === 'string' || cur.schema.split(':')[1] === 'string')) {
310
308
  if (typeof obj === 'object' && Object.keys(obj).length === 0) {
311
309
  obj = cur.object = '';
312
310
  }
313
311
  }
314
312
  if (cur.nil === true) {
315
- if (_this.options.handleNilAsNull) {
313
+ if (this.options.handleNilAsNull) {
316
314
  obj = null;
317
315
  }
318
316
  else {
@@ -341,48 +339,48 @@ var WSDL = /** @class */ (function () {
341
339
  refs[cur.id].obj = obj;
342
340
  }
343
341
  };
344
- p.oncdata = function (text) {
345
- var originalText = text;
342
+ p.oncdata = (text) => {
343
+ const originalText = text;
346
344
  text = trim(text);
347
345
  if (!text.length) {
348
346
  return;
349
347
  }
350
348
  if (/<\?xml[\s\S]+\?>/.test(text)) {
351
- var top_1 = stack[stack.length - 1];
352
- var value = _this.xmlToObject(text);
353
- if (top_1.object[_this.options.attributesKey]) {
354
- top_1.object[_this.options.valueKey] = value;
349
+ const top = stack[stack.length - 1];
350
+ const value = this.xmlToObject(text);
351
+ if (top.object[this.options.attributesKey]) {
352
+ top.object[this.options.valueKey] = value;
355
353
  }
356
354
  else {
357
- top_1.object = value;
355
+ top.object = value;
358
356
  }
359
357
  }
360
358
  else {
361
359
  p.ontext(originalText);
362
360
  }
363
361
  };
364
- p.onerror = function (e) {
362
+ p.onerror = (e) => {
365
363
  p.resume();
366
364
  throw {
367
365
  Fault: {
368
366
  faultcode: 500,
369
367
  faultstring: 'Invalid XML',
370
368
  detail: new Error(e).message,
371
- statusCode: 500
372
- }
369
+ statusCode: 500,
370
+ },
373
371
  };
374
372
  };
375
- p.ontext = function (text) {
376
- var originalText = text;
373
+ p.ontext = (text) => {
374
+ const originalText = text;
377
375
  text = trim(text);
378
376
  if (!text.length) {
379
377
  return;
380
378
  }
381
- var top = stack[stack.length - 1];
382
- var name = utils_1.splitQName(top.schema).name;
383
- var value;
384
- if (_this.options && _this.options.customDeserializer && _this.options.customDeserializer[name]) {
385
- value = _this.options.customDeserializer[name](text, top);
379
+ const top = stack[stack.length - 1];
380
+ const name = (0, utils_1.splitQName)(top.schema).name;
381
+ let value;
382
+ if (this.options && this.options.customDeserializer && this.options.customDeserializer[name]) {
383
+ value = this.options.customDeserializer[name](text, top);
386
384
  }
387
385
  else {
388
386
  if (name === 'int' || name === 'integer' || name === 'short' || name === 'long') {
@@ -398,7 +396,7 @@ var WSDL = /** @class */ (function () {
398
396
  value = new Date(text);
399
397
  }
400
398
  else {
401
- if (_this.options.preserveWhitespace) {
399
+ if (this.options.preserveWhitespace) {
402
400
  text = originalText;
403
401
  }
404
402
  // handle string or other types
@@ -410,8 +408,8 @@ var WSDL = /** @class */ (function () {
410
408
  }
411
409
  }
412
410
  }
413
- if (top.object[_this.options.attributesKey]) {
414
- top.object[_this.options.valueKey] = value;
411
+ if (top.object[this.options.attributesKey]) {
412
+ top.object[this.options.valueKey] = value;
415
413
  }
416
414
  else {
417
415
  top.object = value;
@@ -419,17 +417,17 @@ var WSDL = /** @class */ (function () {
419
417
  };
420
418
  if (typeof callback === 'function') {
421
419
  // we be streaming
422
- var saxStream = sax.createStream(true, null);
420
+ const saxStream = sax.createStream(true, null);
423
421
  saxStream.on('opentag', p.onopentag);
424
422
  saxStream.on('closetag', p.onclosetag);
425
423
  saxStream.on('cdata', p.oncdata);
426
424
  saxStream.on('text', p.ontext);
427
425
  xml.pipe(saxStream)
428
- .on('error', function (err) {
426
+ .on('error', (err) => {
429
427
  callback(err);
430
428
  })
431
- .on('end', function () {
432
- var r;
429
+ .on('end', () => {
430
+ let r;
433
431
  try {
434
432
  r = finish();
435
433
  }
@@ -444,23 +442,22 @@ var WSDL = /** @class */ (function () {
444
442
  return finish();
445
443
  function finish() {
446
444
  // MultiRef support: merge objects instead of replacing
447
- for (var n in refs) {
448
- var ref = refs[n];
449
- for (var _i = 0, _a = ref.hrefs; _i < _a.length; _i++) {
450
- var href = _a[_i];
445
+ for (const n in refs) {
446
+ const ref = refs[n];
447
+ for (const href of ref.hrefs) {
451
448
  Object.assign(href.obj, ref.obj);
452
449
  }
453
450
  }
454
451
  if (root.Envelope) {
455
- var body = root.Envelope.Body;
452
+ const body = root.Envelope.Body;
456
453
  if (body && body.Fault) {
457
- var code = body.Fault.faultcode && body.Fault.faultcode.$value;
458
- var string = body.Fault.faultstring && body.Fault.faultstring.$value;
459
- var detail = body.Fault.detail && body.Fault.detail.$value;
454
+ let code = body.Fault.faultcode && body.Fault.faultcode.$value;
455
+ let string = body.Fault.faultstring && body.Fault.faultstring.$value;
456
+ let detail = body.Fault.detail && body.Fault.detail.$value;
460
457
  code = code || body.Fault.faultcode;
461
458
  string = string || body.Fault.faultstring;
462
459
  detail = detail || body.Fault.detail;
463
- var error = new Error(code + ': ' + string + (detail ? ': ' + JSON.stringify(detail) : ''));
460
+ const error = new Error(code + ': ' + string + (detail ? ': ' + JSON.stringify(detail) : ''));
464
461
  error.root = root;
465
462
  throw error;
466
463
  }
@@ -468,20 +465,20 @@ var WSDL = /** @class */ (function () {
468
465
  }
469
466
  return root;
470
467
  }
471
- };
468
+ }
472
469
  /**
473
470
  * Look up a XSD type or element by namespace URI and name
474
471
  * @param {String} nsURI Namespace URI
475
472
  * @param {String} qname Local or qualified name
476
473
  * @returns {*} The XSD type/element definition
477
474
  */
478
- WSDL.prototype.findSchemaObject = function (nsURI, qname) {
475
+ findSchemaObject(nsURI, qname) {
479
476
  if (!nsURI || !qname) {
480
477
  return null;
481
478
  }
482
- var def = null;
479
+ let def = null;
483
480
  if (this.definitions.schemas) {
484
- var schema = this.definitions.schemas[nsURI];
481
+ const schema = this.definitions.schemas[nsURI];
485
482
  if (schema) {
486
483
  if (qname.indexOf(':') !== -1) {
487
484
  qname = qname.substring(qname.indexOf(':') + 1, qname.length);
@@ -492,7 +489,7 @@ var WSDL = /** @class */ (function () {
492
489
  }
493
490
  }
494
491
  return def;
495
- };
492
+ }
496
493
  /**
497
494
  * Create document style xml string from the parameters
498
495
  * @param {String} name
@@ -501,16 +498,16 @@ var WSDL = /** @class */ (function () {
501
498
  * @param {String} nsURI
502
499
  * @param {String} type
503
500
  */
504
- WSDL.prototype.objectToDocumentXML = function (name, params, nsPrefix, nsURI, type) {
501
+ objectToDocumentXML(name, params, nsPrefix, nsURI, type) {
505
502
  // If user supplies XML already, just use that. XML Declaration should not be present.
506
503
  if (params && params._xml) {
507
504
  return params._xml;
508
505
  }
509
- var args = {};
506
+ const args = {};
510
507
  args[name] = params;
511
- var parameterTypeObj = type ? this.findSchemaObject(nsURI, type) : null;
508
+ const parameterTypeObj = type ? this.findSchemaObject(nsURI, type) : null;
512
509
  return this.objectToXML(args, null, nsPrefix, nsURI, true, null, parameterTypeObj);
513
- };
510
+ }
514
511
  /**
515
512
  * Create RPC style xml string from the parameters
516
513
  * @param {String} name
@@ -519,43 +516,43 @@ var WSDL = /** @class */ (function () {
519
516
  * @param {String} nsURI
520
517
  * @returns {string}
521
518
  */
522
- WSDL.prototype.objectToRpcXML = function (name, params, nsPrefix, nsURI, isParts) {
523
- var parts = [];
524
- var defs = this.definitions;
525
- var nsAttrName = '_xmlns';
526
- nsPrefix = nsPrefix || utils_1.findPrefix(defs.xmlns, nsURI);
519
+ objectToRpcXML(name, params, nsPrefix, nsURI, isParts) {
520
+ const parts = [];
521
+ const defs = this.definitions;
522
+ const nsAttrName = '_xmlns';
523
+ nsPrefix = nsPrefix || (0, utils_1.findPrefix)(defs.xmlns, nsURI);
527
524
  nsURI = nsURI || defs.xmlns[nsPrefix];
528
525
  nsPrefix = nsPrefix === utils_1.TNS_PREFIX ? '' : (nsPrefix + ':');
529
526
  parts.push(['<', nsPrefix, name, '>'].join(''));
530
- for (var key in params) {
527
+ for (const key in params) {
531
528
  if (!params.hasOwnProperty(key)) {
532
529
  continue;
533
530
  }
534
531
  if (key !== nsAttrName) {
535
- var value = params[key];
536
- var prefixedKey = (isParts ? '' : nsPrefix) + key;
537
- var attributes = [];
532
+ const value = params[key];
533
+ const prefixedKey = (isParts ? '' : nsPrefix) + key;
534
+ const attributes = [];
538
535
  if (typeof value === 'object' && value.hasOwnProperty(this.options.attributesKey)) {
539
- var attrs = value[this.options.attributesKey];
540
- for (var n in attrs) {
536
+ const attrs = value[this.options.attributesKey];
537
+ for (const n in attrs) {
541
538
  attributes.push(' ' + n + '=' + '"' + attrs[n] + '"');
542
539
  }
543
540
  }
544
541
  parts.push(['<', prefixedKey].concat(attributes).concat('>').join(''));
545
- parts.push((typeof value === 'object') ? this.objectToXML(value, key, nsPrefix, nsURI) : utils_1.xmlEscape(value));
542
+ parts.push((typeof value === 'object') ? this.objectToXML(value, key, nsPrefix, nsURI) : (0, utils_1.xmlEscape)(value));
546
543
  parts.push(['</', prefixedKey, '>'].join(''));
547
544
  }
548
545
  }
549
546
  parts.push(['</', nsPrefix, name, '>'].join(''));
550
547
  return parts.join('');
551
- };
552
- WSDL.prototype.isIgnoredNameSpace = function (ns) {
548
+ }
549
+ isIgnoredNameSpace(ns) {
553
550
  return this.options.ignoredNamespaces.indexOf(ns) > -1;
554
- };
555
- WSDL.prototype.filterOutIgnoredNameSpace = function (ns) {
556
- var namespace = noColonNameSpace(ns);
551
+ }
552
+ filterOutIgnoredNameSpace(ns) {
553
+ const namespace = noColonNameSpace(ns);
557
554
  return this.isIgnoredNameSpace(namespace) ? '' : namespace;
558
- };
555
+ }
559
556
  /**
560
557
  * Convert an object to XML. This is a recursive method as it calls itself.
561
558
  *
@@ -569,9 +566,9 @@ var WSDL = /** @class */ (function () {
569
566
  * @param {?} parameterTypeObject
570
567
  * @param {NamespaceContext} nsContext Namespace context
571
568
  */
572
- WSDL.prototype.objectToXML = function (obj, name, nsPrefix, nsURI, isFirst, xmlnsAttr, schemaObject, nsContext) {
573
- var schema = this.definitions.schemas[nsURI];
574
- var parentNsPrefix = nsPrefix ? nsPrefix.parent : undefined;
569
+ objectToXML(obj, name, nsPrefix, nsURI, isFirst, xmlnsAttr, schemaObject, nsContext) {
570
+ const schema = this.definitions.schemas[nsURI];
571
+ let parentNsPrefix = nsPrefix ? nsPrefix.parent : undefined;
575
572
  if (typeof parentNsPrefix !== 'undefined') {
576
573
  // we got the parentNsPrefix for our array. setting the namespace-variable back to the current namespace string
577
574
  nsPrefix = nsPrefix.current;
@@ -580,14 +577,14 @@ var WSDL = /** @class */ (function () {
580
577
  if (this.isIgnoredNameSpace(parentNsPrefix)) {
581
578
  parentNsPrefix = '';
582
579
  }
583
- var soapHeader = !schema;
584
- var qualified = schema && schema.$elementFormDefault === 'qualified';
585
- var parts = [];
586
- var prefixNamespace = (nsPrefix || qualified) && nsPrefix !== utils_1.TNS_PREFIX;
587
- var xmlnsAttrib = '';
580
+ const soapHeader = !schema;
581
+ const qualified = schema && schema.$elementFormDefault === 'qualified';
582
+ const parts = [];
583
+ const prefixNamespace = (nsPrefix || qualified) && nsPrefix !== utils_1.TNS_PREFIX;
584
+ let xmlnsAttrib = '';
588
585
  if (nsURI && isFirst) {
589
586
  if (this.options.overrideRootElement && this.options.overrideRootElement.xmlnsAttributes) {
590
- this.options.overrideRootElement.xmlnsAttributes.forEach(function (attribute) {
587
+ this.options.overrideRootElement.xmlnsAttributes.forEach((attribute) => {
591
588
  xmlnsAttrib += ' ' + attribute.name + '="' + attribute.value + '"';
592
589
  });
593
590
  }
@@ -613,20 +610,20 @@ var WSDL = /** @class */ (function () {
613
610
  if (xmlnsAttr && !(this.options.overrideRootElement && this.options.overrideRootElement.xmlnsAttributes)) {
614
611
  xmlnsAttrib = xmlnsAttr;
615
612
  }
616
- var ns = '';
613
+ let ns = '';
617
614
  if (this.options.overrideRootElement && isFirst) {
618
615
  ns = this.options.overrideRootElement.namespace;
619
616
  }
620
617
  else if (prefixNamespace && (qualified || isFirst || soapHeader) && !this.isIgnoredNameSpace(nsPrefix)) {
621
618
  ns = nsPrefix;
622
619
  }
623
- var i;
624
- var n;
620
+ let i;
621
+ let n;
625
622
  // start building out XML string.
626
623
  if (Array.isArray(obj)) {
627
- var nonSubNameSpace = '';
628
- var emptyNonSubNameSpaceForArray = false;
629
- var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
624
+ let nonSubNameSpace = '';
625
+ let emptyNonSubNameSpaceForArray = false;
626
+ const nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
630
627
  if (nameWithNsRegex) {
631
628
  nonSubNameSpace = nameWithNsRegex[1];
632
629
  name = nameWithNsRegex[2];
@@ -636,11 +633,11 @@ var WSDL = /** @class */ (function () {
636
633
  name = name.substr(1);
637
634
  }
638
635
  for (i = 0, n = obj.length; i < n; i++) {
639
- var item = obj[i];
640
- var arrayAttr = this.processAttributes(item, nsContext);
641
- var correctOuterNsPrefix = nonSubNameSpace || parentNsPrefix || ns; // using the parent namespace prefix if given
642
- var body = this.objectToXML(item, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
643
- var openingTagParts = ['<', name, arrayAttr, xmlnsAttrib];
636
+ const item = obj[i];
637
+ const arrayAttr = this.processAttributes(item, nsContext);
638
+ const correctOuterNsPrefix = nonSubNameSpace || parentNsPrefix || ns; // using the parent namespace prefix if given
639
+ const body = this.objectToXML(item, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
640
+ let openingTagParts = ['<', name, arrayAttr, xmlnsAttrib];
644
641
  if (!emptyNonSubNameSpaceForArray) {
645
642
  openingTagParts = ['<', appendColon(correctOuterNsPrefix), name, arrayAttr, xmlnsAttrib];
646
643
  }
@@ -667,7 +664,7 @@ var WSDL = /** @class */ (function () {
667
664
  }
668
665
  }
669
666
  else if (typeof obj === 'object') {
670
- var currentChildXmlnsAttrib = '';
667
+ let currentChildXmlnsAttrib = '';
671
668
  for (name in obj) {
672
669
  // Happens when Object.create(null) is used, it will not inherit the Object prototype
673
670
  if (!obj.hasOwnProperty) {
@@ -688,17 +685,17 @@ var WSDL = /** @class */ (function () {
688
685
  // Its the value of an item. Return it directly.
689
686
  if (name === this.options.valueKey) {
690
687
  nsContext.popContext();
691
- return utils_1.xmlEscape(obj[name]);
688
+ return (0, utils_1.xmlEscape)(obj[name]);
692
689
  }
693
- var child = obj[name];
690
+ const child = obj[name];
694
691
  if (typeof child === 'undefined') {
695
692
  continue;
696
693
  }
697
- var attr = this.processAttributes(child, nsContext);
698
- var value = '';
699
- var nonSubNameSpace = '';
700
- var emptyNonSubNameSpace = false;
701
- var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
694
+ const attr = this.processAttributes(child, nsContext);
695
+ let value = '';
696
+ let nonSubNameSpace = '';
697
+ let emptyNonSubNameSpace = false;
698
+ const nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
702
699
  if (nameWithNsRegex) {
703
700
  nonSubNameSpace = nameWithNsRegex[1] + ':';
704
701
  name = nameWithNsRegex[2];
@@ -713,7 +710,7 @@ var WSDL = /** @class */ (function () {
713
710
  else {
714
711
  if (this.definitions.schemas) {
715
712
  if (schema) {
716
- var childSchemaObject = this.findChildSchemaObject(schemaObject, name);
713
+ const childSchemaObject = this.findChildSchemaObject(schemaObject, name);
717
714
  // find sub namespace if not a primitive
718
715
  if (childSchemaObject &&
719
716
  ((childSchemaObject.$type && (childSchemaObject.$type.indexOf('xsd:') === -1)) ||
@@ -721,13 +718,13 @@ var WSDL = /** @class */ (function () {
721
718
  /*if the base name space of the children is not in the ingoredSchemaNamspaces we use it.
722
719
  This is because in some services the child nodes do not need the baseNameSpace.
723
720
  */
724
- var childNsPrefix = '';
725
- var childName = '';
726
- var childNsURI = void 0;
727
- var childXmlnsAttrib = '';
728
- var elementQName = childSchemaObject.$ref || childSchemaObject.$name;
721
+ let childNsPrefix = '';
722
+ let childName = '';
723
+ let childNsURI;
724
+ let childXmlnsAttrib = '';
725
+ let elementQName = childSchemaObject.$ref || childSchemaObject.$name;
729
726
  if (elementQName) {
730
- elementQName = utils_1.splitQName(elementQName);
727
+ elementQName = (0, utils_1.splitQName)(elementQName);
731
728
  childName = elementQName.name;
732
729
  if (elementQName.prefix === utils_1.TNS_PREFIX) {
733
730
  // Local element
@@ -744,7 +741,7 @@ var WSDL = /** @class */ (function () {
744
741
  }
745
742
  childNsURI = schema.xmlns[childNsPrefix] || this.definitions.xmlns[childNsPrefix];
746
743
  }
747
- var unqualified = false;
744
+ let unqualified = false;
748
745
  // Check qualification form for local elements
749
746
  if (childSchemaObject.$name && childSchemaObject.targetNamespace === undefined) {
750
747
  if (childSchemaObject.$form === 'unqualified') {
@@ -770,11 +767,11 @@ var WSDL = /** @class */ (function () {
770
767
  }
771
768
  }
772
769
  }
773
- var resolvedChildSchemaObject = void 0;
770
+ let resolvedChildSchemaObject;
774
771
  if (childSchemaObject.$type) {
775
- var typeQName = utils_1.splitQName(childSchemaObject.$type);
776
- var typePrefix = typeQName.prefix;
777
- var typeURI = schema.xmlns[typePrefix] || this.definitions.xmlns[typePrefix];
772
+ const typeQName = (0, utils_1.splitQName)(childSchemaObject.$type);
773
+ const typePrefix = typeQName.prefix;
774
+ const typeURI = schema.xmlns[typePrefix] || this.definitions.xmlns[typePrefix];
778
775
  childNsURI = typeURI;
779
776
  if (typeURI !== 'http://www.w3.org/2001/XMLSchema' && typePrefix !== utils_1.TNS_PREFIX) {
780
777
  // Add the prefix/namespace mapping, but not declare it
@@ -800,7 +797,7 @@ var WSDL = /** @class */ (function () {
800
797
  // for arrays, we need to remember the current namespace
801
798
  childNsPrefix = {
802
799
  current: childNsPrefix,
803
- parent: ns
800
+ parent: ns,
804
801
  };
805
802
  childXmlnsAttrib = childXmlnsAttrib && childXmlnsAttrib.length ? childXmlnsAttrib : currentChildXmlnsAttrib;
806
803
  }
@@ -812,7 +809,7 @@ var WSDL = /** @class */ (function () {
812
809
  }
813
810
  else if (obj[this.options.attributesKey] && obj[this.options.attributesKey].xsi_type) {
814
811
  // if parent object has complex type defined and child not found in parent
815
- var completeChildParamTypeObject = this.findChildSchemaObject(obj[this.options.attributesKey].xsi_type.type, obj[this.options.attributesKey].xsi_type.xmlns);
812
+ const completeChildParamTypeObject = this.findChildSchemaObject(obj[this.options.attributesKey].xsi_type.type, obj[this.options.attributesKey].xsi_type.xmlns);
816
813
  nonSubNameSpace = obj[this.options.attributesKey].xsi_type.prefix;
817
814
  nsContext.addNamespace(obj[this.options.attributesKey].xsi_type.prefix, obj[this.options.attributesKey].xsi_type.xmlns);
818
815
  value = this.objectToXML(child, name, obj[this.options.attributesKey].xsi_type.prefix, obj[this.options.attributesKey].xsi_type.xmlns, false, null, null, nsContext);
@@ -841,7 +838,7 @@ var WSDL = /** @class */ (function () {
841
838
  else if (this.isIgnoredNameSpace(ns)) {
842
839
  ns = '';
843
840
  }
844
- var useEmptyTag = !value && this.options.useEmptyTag;
841
+ const useEmptyTag = !value && this.options.useEmptyTag;
845
842
  if (!Array.isArray(child)) {
846
843
  // start tag
847
844
  parts.push(['<', emptyNonSubNameSpace ? '' : appendColon(nonSubNameSpace || ns), name, attr, xmlnsAttrib,
@@ -859,20 +856,20 @@ var WSDL = /** @class */ (function () {
859
856
  }
860
857
  }
861
858
  else if (obj !== undefined) {
862
- parts.push((this.options.escapeXML) ? utils_1.xmlEscape(obj) : obj);
859
+ parts.push((this.options.escapeXML) ? (0, utils_1.xmlEscape)(obj) : obj);
863
860
  }
864
861
  nsContext.popContext();
865
862
  return parts.join('');
866
- };
867
- WSDL.prototype.processAttributes = function (child, nsContext) {
868
- var attr = '';
863
+ }
864
+ processAttributes(child, nsContext) {
865
+ let attr = '';
869
866
  if (child === null || child === undefined) {
870
867
  child = [];
871
868
  }
872
- var attrObj = child[this.options.attributesKey] || {};
869
+ const attrObj = child[this.options.attributesKey] || {};
873
870
  if (attrObj && attrObj.xsi_type) {
874
- var xsiType = attrObj.xsi_type;
875
- var prefix = xsiType.prefix || xsiType.namespace;
871
+ const xsiType = attrObj.xsi_type;
872
+ let prefix = xsiType.prefix || xsiType.namespace;
876
873
  if (xsiType.xmlns) {
877
874
  // Generate a new namespace for complex extension if one not provided
878
875
  if (!prefix) {
@@ -884,41 +881,41 @@ var WSDL = /** @class */ (function () {
884
881
  xsiType.prefix = prefix;
885
882
  }
886
883
  }
887
- Object.keys(attrObj).forEach(function (k) {
888
- var v = attrObj[k];
884
+ Object.keys(attrObj).forEach((k) => {
885
+ const v = attrObj[k];
889
886
  if (k === 'xsi_type') {
890
- var name_2 = v.type;
887
+ let name = v.type;
891
888
  if (v.prefix) {
892
- name_2 = v.prefix + ":" + name_2;
889
+ name = `${v.prefix}:${name}`;
893
890
  }
894
- attr += " xsi:type=\"" + name_2 + "\"";
891
+ attr += ` xsi:type="${name}"`;
895
892
  if (v.xmlns) {
896
- attr += " xmlns:" + v.prefix + "=\"" + v.xmlns + "\"";
893
+ attr += ` xmlns:${v.prefix}="${v.xmlns}"`;
897
894
  }
898
895
  }
899
896
  else {
900
- attr += " " + k + "=\"" + utils_1.xmlEscape(v) + "\"";
897
+ attr += ` ${k}="${(0, utils_1.xmlEscape)(v)}"`;
901
898
  }
902
899
  });
903
900
  return attr;
904
- };
901
+ }
905
902
  /**
906
903
  * Look up a schema type definition
907
904
  * @param name
908
905
  * @param nsURI
909
906
  * @returns {*}
910
907
  */
911
- WSDL.prototype.findSchemaType = function (name, nsURI) {
908
+ findSchemaType(name, nsURI) {
912
909
  if (!this.definitions.schemas || !name || !nsURI) {
913
910
  return null;
914
911
  }
915
- var schema = this.definitions.schemas[nsURI];
912
+ const schema = this.definitions.schemas[nsURI];
916
913
  if (!schema || !schema.complexTypes) {
917
914
  return null;
918
915
  }
919
916
  return schema.complexTypes[name];
920
- };
921
- WSDL.prototype.findChildSchemaObject = function (parameterTypeObj, childName, backtrace) {
917
+ }
918
+ findChildSchemaObject(parameterTypeObj, childName, backtrace) {
922
919
  if (!parameterTypeObj || !childName) {
923
920
  return null;
924
921
  }
@@ -932,53 +929,53 @@ var WSDL = /** @class */ (function () {
932
929
  else {
933
930
  backtrace = backtrace.concat([parameterTypeObj]);
934
931
  }
935
- var found = null;
936
- var i = 0;
937
- var child;
938
- var ref;
932
+ let found = null;
933
+ let i = 0;
934
+ let child;
935
+ let ref;
939
936
  if (Array.isArray(parameterTypeObj.$lookupTypes) && parameterTypeObj.$lookupTypes.length) {
940
- var types = parameterTypeObj.$lookupTypes;
937
+ const types = parameterTypeObj.$lookupTypes;
941
938
  for (i = 0; i < types.length; i++) {
942
- var typeObj = types[i];
939
+ const typeObj = types[i];
943
940
  if (typeObj.$name === childName) {
944
941
  found = typeObj;
945
942
  break;
946
943
  }
947
944
  }
948
945
  }
949
- var object = parameterTypeObj;
946
+ const object = parameterTypeObj;
950
947
  if (object.$name === childName && object.name === 'element') {
951
948
  return object;
952
949
  }
953
950
  if (object.$ref) {
954
- ref = utils_1.splitQName(object.$ref);
951
+ ref = (0, utils_1.splitQName)(object.$ref);
955
952
  if (ref.name === childName) {
956
953
  return object;
957
954
  }
958
955
  }
959
- var childNsURI;
956
+ let childNsURI;
960
957
  // want to avoid unecessary recursion to improve performance
961
958
  if (object.$type && backtrace.length === 1) {
962
- var typeInfo = utils_1.splitQName(object.$type);
959
+ const typeInfo = (0, utils_1.splitQName)(object.$type);
963
960
  if (typeInfo.prefix === utils_1.TNS_PREFIX) {
964
961
  childNsURI = parameterTypeObj.$targetNamespace;
965
962
  }
966
963
  else {
967
964
  childNsURI = this.definitions.xmlns[typeInfo.prefix];
968
965
  }
969
- var typeDef = this.findSchemaType(typeInfo.name, childNsURI);
966
+ const typeDef = this.findSchemaType(typeInfo.name, childNsURI);
970
967
  if (typeDef) {
971
968
  return this.findChildSchemaObject(typeDef, childName, backtrace);
972
969
  }
973
970
  }
974
971
  // handle $base (e.g. for ExtensionElement) like $type
975
972
  if (object.$base && (!Array.isArray(object.children) || !object.children.length)) {
976
- var baseInfo = utils_1.splitQName(object.$base);
973
+ const baseInfo = (0, utils_1.splitQName)(object.$base);
977
974
  childNsURI = parameterTypeObj.$targetNamespace;
978
975
  if (baseInfo.prefix !== utils_1.TNS_PREFIX) {
979
976
  childNsURI = this.definitions.xmlns[baseInfo.prefix];
980
977
  }
981
- var baseDef = this.findSchemaType(baseInfo.name, childNsURI);
978
+ const baseDef = this.findSchemaType(baseInfo.name, childNsURI);
982
979
  if (baseDef) {
983
980
  return this.findChildSchemaObject(baseDef, childName, backtrace);
984
981
  }
@@ -990,10 +987,10 @@ var WSDL = /** @class */ (function () {
990
987
  break;
991
988
  }
992
989
  if (child.$base) {
993
- var baseQName = utils_1.splitQName(child.$base);
994
- var childNameSpace = baseQName.prefix === utils_1.TNS_PREFIX ? '' : baseQName.prefix;
990
+ const baseQName = (0, utils_1.splitQName)(child.$base);
991
+ const childNameSpace = baseQName.prefix === utils_1.TNS_PREFIX ? '' : baseQName.prefix;
995
992
  childNsURI = child.xmlns[baseQName.prefix] || child.schemaXmlns[baseQName.prefix];
996
- var foundBase = this.findSchemaType(baseQName.name, childNsURI);
993
+ const foundBase = this.findSchemaType(baseQName.name, childNsURI);
997
994
  if (foundBase) {
998
995
  found = this.findChildSchemaObject(foundBase, childName, backtrace);
999
996
  if (found) {
@@ -1009,11 +1006,11 @@ var WSDL = /** @class */ (function () {
1009
1006
  return object;
1010
1007
  }
1011
1008
  return found;
1012
- };
1013
- WSDL.prototype._initializeOptions = function (options) {
1009
+ }
1010
+ _initializeOptions(options) {
1014
1011
  this._originalIgnoredNamespaces = (options || {}).ignoredNamespaces;
1015
1012
  this.options = {};
1016
- var ignoredNamespaces = options ? options.ignoredNamespaces : null;
1013
+ const ignoredNamespaces = options ? options.ignoredNamespaces : null;
1017
1014
  if (ignoredNamespaces &&
1018
1015
  (Array.isArray(ignoredNamespaces.namespaces) || typeof ignoredNamespaces.namespaces === 'string')) {
1019
1016
  if (ignoredNamespaces.override) {
@@ -1057,7 +1054,7 @@ var WSDL = /** @class */ (function () {
1057
1054
  if (options.request) {
1058
1055
  this.options.request = options.request;
1059
1056
  }
1060
- var ignoreBaseNameSpaces = options ? options.ignoreBaseNameSpaces : null;
1057
+ const ignoreBaseNameSpaces = options ? options.ignoreBaseNameSpaces : null;
1061
1058
  if (ignoreBaseNameSpaces !== null && typeof ignoreBaseNameSpaces !== 'undefined') {
1062
1059
  this.options.ignoreBaseNameSpaces = ignoreBaseNameSpaces;
1063
1060
  }
@@ -1071,16 +1068,15 @@ var WSDL = /** @class */ (function () {
1071
1068
  this.options.overrideRootElement = options.overrideRootElement;
1072
1069
  }
1073
1070
  this.options.useEmptyTag = !!options.useEmptyTag;
1074
- };
1075
- WSDL.prototype._processNextInclude = function (includes, callback) {
1076
- var _this = this;
1077
- var include = includes.shift();
1071
+ }
1072
+ _processNextInclude(includes, callback) {
1073
+ const include = includes.shift();
1078
1074
  if (!include) {
1079
1075
  return callback();
1080
1076
  }
1081
- var includePath;
1077
+ let includePath;
1082
1078
  if (!/^https?:/i.test(this.uri) && !/^https?:/i.test(include.location)) {
1083
- var isFixed = (this.options.wsdl_options !== undefined && this.options.wsdl_options.hasOwnProperty('fixedPath')) ? this.options.wsdl_options.fixedPath : false;
1079
+ const isFixed = (this.options.wsdl_options !== undefined && this.options.wsdl_options.hasOwnProperty('fixedPath')) ? this.options.wsdl_options.fixedPath : false;
1084
1080
  if (isFixed) {
1085
1081
  includePath = path.resolve(path.dirname(this.uri), path.parse(include.location).base);
1086
1082
  }
@@ -1094,42 +1090,41 @@ var WSDL = /** @class */ (function () {
1094
1090
  if (this.options.wsdl_options !== undefined && typeof this.options.wsdl_options.overrideImportLocation === 'function') {
1095
1091
  includePath = this.options.wsdl_options.overrideImportLocation(includePath);
1096
1092
  }
1097
- var options = Object.assign({}, this.options);
1093
+ const options = Object.assign({}, this.options);
1098
1094
  // follow supplied ignoredNamespaces option
1099
1095
  options.ignoredNamespaces = this._originalIgnoredNamespaces || this.options.ignoredNamespaces;
1100
1096
  options.WSDL_CACHE = this.WSDL_CACHE;
1101
- open_wsdl_recursive(includePath, options, function (err, wsdl) {
1097
+ open_wsdl_recursive(includePath, options, (err, wsdl) => {
1102
1098
  if (err) {
1103
1099
  return callback(err);
1104
1100
  }
1105
- _this._includesWsdl.push(wsdl);
1101
+ this._includesWsdl.push(wsdl);
1106
1102
  if (wsdl.definitions instanceof elements.DefinitionsElement) {
1107
- _.mergeWith(_this.definitions, wsdl.definitions, function (a, b) {
1103
+ _.mergeWith(this.definitions, wsdl.definitions, (a, b) => {
1108
1104
  return (a instanceof elements.SchemaElement) ? a.merge(b) : undefined;
1109
1105
  });
1110
1106
  }
1111
1107
  else {
1112
1108
  return callback(new Error('wsdl.defintions is not an instance of elements.DefinitionsElement'));
1113
1109
  }
1114
- _this._processNextInclude(includes, function (err) {
1110
+ this._processNextInclude(includes, (err) => {
1115
1111
  callback(err);
1116
1112
  });
1117
1113
  });
1118
- };
1119
- WSDL.prototype._parse = function (xml) {
1120
- var _this = this;
1121
- var p = sax.parser(true, null);
1122
- var stack = [];
1123
- var root = null;
1124
- var types = null;
1125
- var schema = null;
1126
- var schemaAttrs = null;
1127
- var options = this.options;
1128
- p.onopentag = function (node) {
1129
- var nsName = node.name;
1130
- var attrs = node.attributes;
1131
- var top = stack[stack.length - 1];
1132
- var name = utils_1.splitQName(nsName).name;
1114
+ }
1115
+ _parse(xml) {
1116
+ const p = sax.parser(true, null);
1117
+ const stack = [];
1118
+ let root = null;
1119
+ let types = null;
1120
+ let schema = null;
1121
+ let schemaAttrs = null;
1122
+ const options = this.options;
1123
+ p.onopentag = (node) => {
1124
+ const nsName = node.name;
1125
+ const attrs = node.attributes;
1126
+ const top = stack[stack.length - 1];
1127
+ const name = (0, utils_1.splitQName)(nsName).name;
1133
1128
  if (name === 'schema') {
1134
1129
  schemaAttrs = attrs;
1135
1130
  }
@@ -1138,7 +1133,7 @@ var WSDL = /** @class */ (function () {
1138
1133
  top.startElement(stack, nsName, attrs, options, schemaAttrs);
1139
1134
  }
1140
1135
  catch (e) {
1141
- if (_this.options.strict) {
1136
+ if (this.options.strict) {
1142
1137
  throw e;
1143
1138
  }
1144
1139
  else {
@@ -1165,32 +1160,32 @@ var WSDL = /** @class */ (function () {
1165
1160
  }
1166
1161
  }
1167
1162
  };
1168
- p.onclosetag = function (name) {
1169
- var top = stack[stack.length - 1];
1170
- assert_1.ok(top, 'Unmatched close tag: ' + name);
1163
+ p.onclosetag = (name) => {
1164
+ const top = stack[stack.length - 1];
1165
+ (0, assert_1.ok)(top, 'Unmatched close tag: ' + name);
1171
1166
  top.endElement(stack, name);
1172
1167
  };
1173
1168
  p.write(xml).close();
1174
1169
  return root;
1175
- };
1176
- WSDL.prototype._fromXML = function (xml) {
1170
+ }
1171
+ _fromXML(xml) {
1177
1172
  this.definitions = this._parse(xml);
1178
1173
  this.definitions.descriptions = {
1179
1174
  types: {},
1180
- elements: {}
1175
+ elements: {},
1181
1176
  };
1182
1177
  this.xml = xml;
1183
- };
1184
- WSDL.prototype._fromServices = function (services) {
1185
- };
1186
- WSDL.prototype._xmlnsMap = function () {
1187
- var xmlns = this.definitions.xmlns;
1188
- var str = '';
1189
- for (var alias in xmlns) {
1178
+ }
1179
+ _fromServices(services) {
1180
+ }
1181
+ _xmlnsMap() {
1182
+ const xmlns = this.definitions.xmlns;
1183
+ let str = '';
1184
+ for (const alias in xmlns) {
1190
1185
  if (alias === '' || alias === utils_1.TNS_PREFIX) {
1191
1186
  continue;
1192
1187
  }
1193
- var ns = xmlns[alias];
1188
+ const ns = xmlns[alias];
1194
1189
  switch (ns) {
1195
1190
  case 'http://xml.apache.org/xml-soap': // apachesoap
1196
1191
  case 'http://schemas.xmlsoap.org/wsdl/': // wsdl
@@ -1212,15 +1207,14 @@ var WSDL = /** @class */ (function () {
1212
1207
  str += ' xmlns:' + alias + '="' + ns + '"';
1213
1208
  }
1214
1209
  return str;
1215
- };
1216
- return WSDL;
1217
- }());
1210
+ }
1211
+ }
1218
1212
  exports.WSDL = WSDL;
1219
1213
  function open_wsdl_recursive(uri, p2, p3) {
1220
- var fromCache;
1221
- var WSDL_CACHE;
1222
- var options;
1223
- var callback;
1214
+ let fromCache;
1215
+ let WSDL_CACHE;
1216
+ let options;
1217
+ let callback;
1224
1218
  if (typeof p2 === 'function') {
1225
1219
  options = {};
1226
1220
  callback = p2;
@@ -1236,8 +1230,8 @@ function open_wsdl_recursive(uri, p2, p3) {
1236
1230
  return open_wsdl(uri, options, callback);
1237
1231
  }
1238
1232
  function open_wsdl(uri, p2, p3) {
1239
- var options;
1240
- var callback;
1233
+ let options;
1234
+ let callback;
1241
1235
  if (typeof p2 === 'function') {
1242
1236
  options = {};
1243
1237
  callback = p2;
@@ -1247,13 +1241,19 @@ function open_wsdl(uri, p2, p3) {
1247
1241
  callback = p3;
1248
1242
  }
1249
1243
  // initialize cache when calling open_wsdl directly
1250
- var WSDL_CACHE = options.WSDL_CACHE || {};
1251
- var request_headers = options.wsdl_headers;
1252
- var request_options = options.wsdl_options;
1253
- var wsdl;
1254
- if (!/^https?:/i.test(uri)) {
1244
+ const WSDL_CACHE = options.WSDL_CACHE || {};
1245
+ const request_headers = options.wsdl_headers;
1246
+ const request_options = options.wsdl_options;
1247
+ let wsdl;
1248
+ if (/^\<\?xml[^>]*?>/i.test(uri)) {
1249
+ wsdl = new WSDL(uri, uri, options);
1250
+ WSDL_CACHE[uri] = wsdl;
1251
+ wsdl.WSDL_CACHE = WSDL_CACHE;
1252
+ wsdl.onReady(callback);
1253
+ }
1254
+ else if (!/^https?:/i.test(uri)) {
1255
1255
  debug('Reading file: %s', uri);
1256
- fs.readFile(uri, 'utf8', function (err, definition) {
1256
+ fs.readFile(uri, 'utf8', (err, definition) => {
1257
1257
  if (err) {
1258
1258
  callback(err);
1259
1259
  }
@@ -1267,8 +1267,8 @@ function open_wsdl(uri, p2, p3) {
1267
1267
  }
1268
1268
  else {
1269
1269
  debug('Reading url: %s', uri);
1270
- var httpClient = options.httpClient || new http_1.HttpClient(options);
1271
- httpClient.request(uri, null /* options */, function (err, response, definition) {
1270
+ const httpClient = options.httpClient || new http_1.HttpClient(options);
1271
+ httpClient.request(uri, null /* options */, (err, response, definition) => {
1272
1272
  if (err) {
1273
1273
  callback(err);
1274
1274
  }