profoundjs 7.4.0 → 7.6.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.
- package/LICENSE.txt +27 -25
- package/htdocs/jszip/FileSaver.min.js +2 -2
- package/htdocs/profoundui/proddata/css/atrium.css +201 -201
- package/htdocs/profoundui/proddata/css/designer_respeditor.css +91 -91
- package/htdocs/profoundui/proddata/css/ipademulator.css +38 -38
- package/htdocs/profoundui/proddata/css/iphoneemulator.css +29 -29
- package/htdocs/profoundui/proddata/css/jumpstart.css +442 -442
- package/htdocs/profoundui/proddata/css/key_management.css +122 -122
- package/htdocs/profoundui/proddata/css/logic.css +1669 -1665
- package/htdocs/profoundui/proddata/css/markdown.css +754 -754
- package/htdocs/profoundui/proddata/css/profoundai.css +42 -0
- package/htdocs/profoundui/proddata/css/puisplash.css +186 -186
- package/htdocs/profoundui/proddata/css/qtips.css +32 -32
- package/htdocs/profoundui/proddata/html/genieframe.html +25 -25
- package/htdocs/profoundui/proddata/js/designer.js +4022 -4002
- package/htdocs/profoundui/proddata/js/key_management.js +34 -34
- package/htdocs/profoundui/proddata/js/profoundai.js +26 -0
- package/htdocs/profoundui/proddata/js/rich-display-react-component.js +45 -45
- package/htdocs/profoundui/proddata/js/rich-display-vue-component.js +28 -28
- package/htdocs/profoundui/proddata/js/runtime.js +1373 -1369
- package/htdocs/profoundui/proddata/js/soapclient.js +419 -419
- package/htdocs/profoundui/proddata/typings/profoundjs.d.ts +881 -881
- package/htdocs/profoundui/proddata/typings/profoundui.d.ts +388 -388
- package/htdocs/profoundui/userdata/atrium themes/css/xtheme-gray.css +414 -414
- package/htdocs/profoundui/userdata/atrium themes/css/xtheme-olive.css +623 -623
- package/htdocs/profoundui/userdata/atrium themes/css/xtheme-slate.css +672 -672
- package/htdocs/profoundui/userdata/atrium themes/css/xtheme-steel.css +10437 -10437
- package/htdocs/profoundui/userdata/css/atrium_banner.css +13 -13
- package/htdocs/profoundui/userdata/css/atrium_home.css +37 -37
- package/htdocs/profoundui/userdata/custom/themes/enhanced.js +104 -104
- package/htdocs/profoundui/userdata/custom/themes/hybrid.js +109 -109
- package/htdocs/profoundui/userdata/custom/themes/standard.js +68 -68
- package/htdocs/profoundui/userdata/custom/widgets/googlemaps.js +139 -139
- package/htdocs/profoundui/userdata/custom/widgets/listbox.js +37 -37
- package/htdocs/profoundui/userdata/custom/widgets/panel.js +74 -74
- package/htdocs/profoundui/userdata/custom/widgets/styled_button.js +71 -71
- package/htdocs/profoundui/userdata/custom/widgets/tabpanel.js +61 -61
- package/htdocs/profoundui/userdata/genie skins/Classic/Classic.css +562 -562
- package/htdocs/profoundui/userdata/genie skins/Classic/custom.js +3 -3
- package/htdocs/profoundui/userdata/genie skins/Gradient/Gradient.css +616 -616
- package/htdocs/profoundui/userdata/genie skins/Gradient/adjusted columns custom.js +83 -83
- package/htdocs/profoundui/userdata/genie skins/Gradient/custom.js +83 -83
- package/htdocs/profoundui/userdata/genie skins/Hybrid/Hybrid.css +616 -616
- package/htdocs/profoundui/userdata/genie skins/Hybrid/custom.js +330 -330
- package/htdocs/profoundui/userdata/genie skins/Plain/Plain.css +546 -546
- package/htdocs/profoundui/userdata/genie skins/Plain/custom.js +6 -6
- package/htdocs/profoundui/userdata/genie skins/Skyline/Skyline.css +753 -753
- package/htdocs/profoundui/userdata/genie skins/Skyline/adjusted columns custom.js +97 -97
- package/htdocs/profoundui/userdata/genie skins/Skyline/custom.js +97 -97
- package/htdocs/profoundui/userdata/genie skins/Tablet/Tablet.css +743 -743
- package/htdocs/profoundui/userdata/genie skins/Tablet/custom.js +153 -153
- package/htdocs/profoundui/userdata/samples/ordentry/OrdEntry.js +92 -92
- package/package.json +3 -2
- package/profound.jse +1 -1
- package/setup/pjsdist.savf +0 -0
|
@@ -1,419 +1,419 @@
|
|
|
1
|
-
/** ***************************************************************************\
|
|
2
|
-
|
|
3
|
-
Javascript "SOAP Client" library
|
|
4
|
-
|
|
5
|
-
@version: 2.4 - 2007.12.21
|
|
6
|
-
@author: Matteo Casati - http://www.guru4.net/
|
|
7
|
-
|
|
8
|
-
\*****************************************************************************/
|
|
9
|
-
|
|
10
|
-
function SOAPClientParameters() {
|
|
11
|
-
var _pl = [];
|
|
12
|
-
this.add = function(name, value) {
|
|
13
|
-
_pl[name] = value;
|
|
14
|
-
return this;
|
|
15
|
-
};
|
|
16
|
-
this.toXml = function() {
|
|
17
|
-
var xml = "";
|
|
18
|
-
for (var p in _pl) {
|
|
19
|
-
switch (typeof (_pl[p])) {
|
|
20
|
-
case "string":
|
|
21
|
-
case "number":
|
|
22
|
-
case "boolean":
|
|
23
|
-
case "object":
|
|
24
|
-
xml += "<" + p + ">" + SOAPClientParameters._serialize(_pl[p]) + "</" + p + ">";
|
|
25
|
-
break;
|
|
26
|
-
default:
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return xml;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
SOAPClientParameters._serialize = function(o) {
|
|
34
|
-
var s = "";
|
|
35
|
-
var p;
|
|
36
|
-
switch (typeof (o)) {
|
|
37
|
-
case "string":
|
|
38
|
-
s += o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
39
|
-
break;
|
|
40
|
-
case "number":
|
|
41
|
-
case "boolean":
|
|
42
|
-
s += o.toString();
|
|
43
|
-
break;
|
|
44
|
-
case "object":
|
|
45
|
-
// Date
|
|
46
|
-
if (o.constructor.toString().indexOf("function Date()") > -1) {
|
|
47
|
-
var year = o.getFullYear().toString();
|
|
48
|
-
var month = (o.getMonth() + 1).toString();
|
|
49
|
-
month = (month.length == 1) ? "0" + month : month;
|
|
50
|
-
var date = o.getDate().toString();
|
|
51
|
-
date = (date.length == 1) ? "0" + date : date;
|
|
52
|
-
var hours = o.getHours().toString();
|
|
53
|
-
hours = (hours.length == 1) ? "0" + hours : hours;
|
|
54
|
-
var minutes = o.getMinutes().toString();
|
|
55
|
-
minutes = (minutes.length == 1) ? "0" + minutes : minutes;
|
|
56
|
-
var seconds = o.getSeconds().toString();
|
|
57
|
-
seconds = (seconds.length == 1) ? "0" + seconds : seconds;
|
|
58
|
-
var milliseconds = o.getMilliseconds().toString();
|
|
59
|
-
var tzminutes = Math.abs(o.getTimezoneOffset());
|
|
60
|
-
var tzhours = 0;
|
|
61
|
-
while (tzminutes >= 60) {
|
|
62
|
-
tzhours++;
|
|
63
|
-
tzminutes -= 60;
|
|
64
|
-
}
|
|
65
|
-
tzminutes = (tzminutes.toString().length == 1) ? "0" + tzminutes.toString() : tzminutes.toString();
|
|
66
|
-
tzhours = (tzhours.toString().length == 1) ? "0" + tzhours.toString() : tzhours.toString();
|
|
67
|
-
var timezone = ((o.getTimezoneOffset() < 0) ? "+" : "-") + tzhours + ":" + tzminutes;
|
|
68
|
-
s += year + "-" + month + "-" + date + "T" + hours + ":" + minutes + ":" + seconds + "." + milliseconds + timezone;
|
|
69
|
-
}
|
|
70
|
-
// Array
|
|
71
|
-
else if (o.constructor.toString().indexOf("function Array()") > -1) {
|
|
72
|
-
for (p in o) {
|
|
73
|
-
if (!isNaN(p)) {
|
|
74
|
-
// linear array
|
|
75
|
-
(/function\s+(\w*)\s*\(/ig).exec(o[p].constructor.toString());
|
|
76
|
-
var type = RegExp.$1;
|
|
77
|
-
switch (type) {
|
|
78
|
-
case "":
|
|
79
|
-
type = typeof (o[p]);
|
|
80
|
-
break;
|
|
81
|
-
case "String":
|
|
82
|
-
type = "string";
|
|
83
|
-
break;
|
|
84
|
-
case "Number":
|
|
85
|
-
type = "int";
|
|
86
|
-
break;
|
|
87
|
-
case "Boolean":
|
|
88
|
-
type = "bool";
|
|
89
|
-
break;
|
|
90
|
-
case "Date":
|
|
91
|
-
type = "DateTime";
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
s += "<" + type + ">" + SOAPClientParameters._serialize(o[p]) + "</" + type + ">";
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
// associative array
|
|
98
|
-
s += "<" + p + ">" + SOAPClientParameters._serialize(o[p]) + "</" + p + ">";
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// Object or custom function
|
|
103
|
-
else {
|
|
104
|
-
for (p in o) {
|
|
105
|
-
s += "<" + p + ">" + SOAPClientParameters._serialize(o[p]) + "</" + p + ">";
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
break;
|
|
109
|
-
default:
|
|
110
|
-
break; // throw new Error(500, "SOAPClientParameters: type '" + typeof(o) + "' is not supported");
|
|
111
|
-
}
|
|
112
|
-
return s;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
function SOAPClient() {}
|
|
116
|
-
|
|
117
|
-
SOAPClient.username = null;
|
|
118
|
-
SOAPClient.password = null;
|
|
119
|
-
|
|
120
|
-
SOAPClient.invoke = function(url, method, parameters, async, callback) {
|
|
121
|
-
if (async) {
|
|
122
|
-
SOAPClient._loadWsdl(url, method, parameters, async, callback);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
return SOAPClient._loadWsdl(url, method, parameters, async, callback);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
// private: wsdl cache
|
|
130
|
-
SOAPClient_cacheWsdl = [];
|
|
131
|
-
|
|
132
|
-
// private: invoke async
|
|
133
|
-
SOAPClient._loadWsdl = function(url, method, parameters, async, callback) {
|
|
134
|
-
// load from cache?
|
|
135
|
-
var wsdl = SOAPClient_cacheWsdl[url];
|
|
136
|
-
if (wsdl + "" != "" && wsdl + "" != "undefined") {
|
|
137
|
-
return SOAPClient._sendSoapRequest(url, method, parameters, async, callback, wsdl);
|
|
138
|
-
}
|
|
139
|
-
// get wsdl
|
|
140
|
-
var xmlHttp = SOAPClient._getXmlHttp();
|
|
141
|
-
|
|
142
|
-
if (SOAPClient.username && SOAPClient.password) {
|
|
143
|
-
xmlHttp.open("GET", url + "?wsdl", async, SOAPClient.username, SOAPClient.password);
|
|
144
|
-
// Some WS implementations (i.e. BEA WebLogic Server 10.0 JAX-WS) don't support Challenge/Response HTTP BASIC, so we send authorization headers in the first request
|
|
145
|
-
xmlHttp.setRequestHeader("Authorization", "Basic " + SOAPClient._toBase64(SOAPClient.username + ":" + SOAPClient.password));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// xmlHttp.open("GET", url + "?wsdl", async);
|
|
149
|
-
if (async) {
|
|
150
|
-
xmlHttp.onreadystatechange = function() {
|
|
151
|
-
if (xmlHttp.readyState == 4) {
|
|
152
|
-
SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
xmlHttp.send(null);
|
|
158
|
-
if (!async) {
|
|
159
|
-
return SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
SOAPClient._onLoadWsdl = function(url, method, parameters, async, callback, req) {
|
|
163
|
-
var wsdl = req.responseXML;
|
|
164
|
-
SOAPClient_cacheWsdl[url] = wsdl; // save a copy in cache
|
|
165
|
-
return SOAPClient._sendSoapRequest(url, method, parameters, async, callback, wsdl);
|
|
166
|
-
};
|
|
167
|
-
SOAPClient._sendSoapRequest = function(url, method, parameters, async, callback, wsdl) {
|
|
168
|
-
// get namespace
|
|
169
|
-
var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value;
|
|
170
|
-
|
|
171
|
-
// build SOAP request
|
|
172
|
-
var sr =
|
|
173
|
-
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
174
|
-
"<soap:Envelope " +
|
|
175
|
-
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
|
|
176
|
-
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
|
|
177
|
-
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
|
|
178
|
-
"<soap:Body>" +
|
|
179
|
-
"<" + method + " xmlns=\"" + ns + "\">" +
|
|
180
|
-
parameters.toXml() +
|
|
181
|
-
"</" + method + "></soap:Body></soap:Envelope>";
|
|
182
|
-
// send request
|
|
183
|
-
|
|
184
|
-
var xmlHttp = SOAPClient._getXmlHttp();
|
|
185
|
-
|
|
186
|
-
if (SOAPClient.username && SOAPClient.password) {
|
|
187
|
-
xmlHttp.open("POST", url, async, SOAPClient.username, SOAPClient.password);
|
|
188
|
-
// Some WS implementations (i.e. BEA WebLogic Server 10.0 JAX-WS) don't support Challenge/Response HTTP BASIC, so we send authorization headers in the first request
|
|
189
|
-
xmlHttp.setRequestHeader("Authorization", "Basic " + SOAPClient._toBase64(SOAPClient.username + ":" + SOAPClient.password));
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
xmlHttp.open("POST", url, async);
|
|
193
|
-
}
|
|
194
|
-
var soapaction = ((ns.lastIndexOf("/") != ns.length - 1) ? ns + "/" : ns) + method;
|
|
195
|
-
xmlHttp.setRequestHeader("SOAPAction", soapaction);
|
|
196
|
-
xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
|
197
|
-
if (async) {
|
|
198
|
-
xmlHttp.onreadystatechange = function() {
|
|
199
|
-
if (xmlHttp.readyState == 4) {
|
|
200
|
-
SOAPClient._onSendSoapRequest(method, async, callback, wsdl, xmlHttp);
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
xmlHttp.send(sr);
|
|
205
|
-
if (!async) {
|
|
206
|
-
return SOAPClient._onSendSoapRequest(method, async, callback, wsdl, xmlHttp);
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
SOAPClient._onSendSoapRequest = function(method, async, callback, wsdl, req) {
|
|
211
|
-
var o = null;
|
|
212
|
-
var nd = SOAPClient._getElementsByTagName(req.responseXML, method + "Result");
|
|
213
|
-
if (nd.length == 0) {
|
|
214
|
-
nd = SOAPClient._getElementsByTagName(req.responseXML, "return");
|
|
215
|
-
} // PHP web Service?
|
|
216
|
-
if (nd.length == 0) {
|
|
217
|
-
if (req.responseXML.getElementsByTagName("faultcode").length > 0) {
|
|
218
|
-
if (async || callback) {
|
|
219
|
-
o = new Error(500, req.responseXML.getElementsByTagName("faultstring")[0].childNodes[0].nodeValue);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
throw new Error(500, req.responseXML.getElementsByTagName("faultstring")[0].childNodes[0].nodeValue);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
o = SOAPClient._soapresult2object(nd[0], wsdl);
|
|
228
|
-
}
|
|
229
|
-
if (callback) {
|
|
230
|
-
callback(o, req.responseXML);
|
|
231
|
-
}
|
|
232
|
-
if (!async) {
|
|
233
|
-
return o;
|
|
234
|
-
}
|
|
235
|
-
};
|
|
236
|
-
SOAPClient._soapresult2object = function(node, wsdl) {
|
|
237
|
-
var wsdlTypes = SOAPClient._getTypesFromWsdl(wsdl);
|
|
238
|
-
return SOAPClient._node2object(node, wsdlTypes);
|
|
239
|
-
};
|
|
240
|
-
SOAPClient._node2object = function(node, wsdlTypes) {
|
|
241
|
-
var i;
|
|
242
|
-
// null node
|
|
243
|
-
if (node == null) {
|
|
244
|
-
return null;
|
|
245
|
-
}
|
|
246
|
-
// text node
|
|
247
|
-
if (node.nodeType == 3 || node.nodeType == 4) {
|
|
248
|
-
return SOAPClient._extractValue(node, wsdlTypes);
|
|
249
|
-
}
|
|
250
|
-
// leaf node
|
|
251
|
-
if (node.childNodes.length == 1 && (node.childNodes[0].nodeType == 3 || node.childNodes[0].nodeType == 4)) {
|
|
252
|
-
return SOAPClient._node2object(node.childNodes[0], wsdlTypes);
|
|
253
|
-
}
|
|
254
|
-
var isarray = SOAPClient._getTypeFromWsdl(node.nodeName, wsdlTypes).toLowerCase().indexOf("arrayof") != -1;
|
|
255
|
-
// object node
|
|
256
|
-
if (!isarray) {
|
|
257
|
-
var obj = null;
|
|
258
|
-
if (node.hasChildNodes()) {
|
|
259
|
-
obj = {};
|
|
260
|
-
}
|
|
261
|
-
for (i = 0; i < node.childNodes.length; i++) {
|
|
262
|
-
var p = SOAPClient._node2object(node.childNodes[i], wsdlTypes);
|
|
263
|
-
obj[node.childNodes[i].nodeName] = p;
|
|
264
|
-
}
|
|
265
|
-
return obj;
|
|
266
|
-
}
|
|
267
|
-
// list node
|
|
268
|
-
else {
|
|
269
|
-
// create node ref
|
|
270
|
-
var l = [];
|
|
271
|
-
for (i = 0; i < node.childNodes.length; i++) {
|
|
272
|
-
l[l.length] = SOAPClient._node2object(node.childNodes[i], wsdlTypes);
|
|
273
|
-
}
|
|
274
|
-
return l;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
SOAPClient._extractValue = function(node, wsdlTypes) {
|
|
278
|
-
var value = node.nodeValue;
|
|
279
|
-
switch (SOAPClient._getTypeFromWsdl(node.parentNode.nodeName, wsdlTypes).toLowerCase()) {
|
|
280
|
-
case "s:boolean":
|
|
281
|
-
return value + "" == "true";
|
|
282
|
-
case "s:int":
|
|
283
|
-
case "s:long":
|
|
284
|
-
return (value != null) ? parseInt(value + "", 10) : 0;
|
|
285
|
-
case "s:double":
|
|
286
|
-
return (value != null) ? parseFloat(value + "") : 0;
|
|
287
|
-
case "s:datetime":
|
|
288
|
-
if (value == null) {
|
|
289
|
-
return null;
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
value = value + "";
|
|
293
|
-
value = value.substring(0, (value.lastIndexOf(".") == -1 ? value.length : value.lastIndexOf(".")));
|
|
294
|
-
value = value.replace(/T/gi, " ");
|
|
295
|
-
value = value.replace(/-/gi, "/");
|
|
296
|
-
var d = new Date();
|
|
297
|
-
d.setTime(Date.parse(value));
|
|
298
|
-
return d;
|
|
299
|
-
}
|
|
300
|
-
case "s:string":
|
|
301
|
-
default:
|
|
302
|
-
return (value != null) ? value + "" : "";
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
SOAPClient._getTypesFromWsdl = function(wsdl) {
|
|
306
|
-
var wsdlTypes = [];
|
|
307
|
-
// IE
|
|
308
|
-
var ell = wsdl.getElementsByTagName("s:element");
|
|
309
|
-
var useNamedItem = true;
|
|
310
|
-
// MOZ
|
|
311
|
-
if (ell.length == 0) {
|
|
312
|
-
ell = wsdl.getElementsByTagName("element");
|
|
313
|
-
useNamedItem = false;
|
|
314
|
-
}
|
|
315
|
-
for (var i = 0; i < ell.length; i++) {
|
|
316
|
-
if (useNamedItem) {
|
|
317
|
-
if (ell[i].attributes.getNamedItem("name") != null && ell[i].attributes.getNamedItem("type") != null) {
|
|
318
|
-
wsdlTypes[ell[i].attributes.getNamedItem("name").nodeValue] = ell[i].attributes.getNamedItem("type").nodeValue;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
if (ell[i].attributes["name"] != null && ell[i].attributes["type"] != null) {
|
|
323
|
-
wsdlTypes[ell[i].attributes["name"].value] = ell[i].attributes["type"].value;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return wsdlTypes;
|
|
328
|
-
};
|
|
329
|
-
SOAPClient._getTypeFromWsdl = function(elementname, wsdlTypes) {
|
|
330
|
-
var type = wsdlTypes[elementname] + "";
|
|
331
|
-
return (type == "undefined") ? "" : type;
|
|
332
|
-
};
|
|
333
|
-
// private: utils
|
|
334
|
-
SOAPClient._getElementsByTagName = function(document, tagName) {
|
|
335
|
-
try {
|
|
336
|
-
// trying to get node omitting any namespaces (latest versions of MSXML.XMLDocument)
|
|
337
|
-
return document.selectNodes(".//*[local-name()=\"" + tagName + "\"]");
|
|
338
|
-
}
|
|
339
|
-
catch (ex) {
|
|
340
|
-
}
|
|
341
|
-
// old XML parser support
|
|
342
|
-
return document.getElementsByTagName(tagName);
|
|
343
|
-
};
|
|
344
|
-
// private: xmlhttp factory
|
|
345
|
-
SOAPClient._getXmlHttp = function() {
|
|
346
|
-
try {
|
|
347
|
-
if (window.XMLHttpRequest) {
|
|
348
|
-
var req = new XMLHttpRequest();
|
|
349
|
-
// some versions of Moz do not support the readyState property and the onreadystate event so we patch it!
|
|
350
|
-
if (req.readyState == null) {
|
|
351
|
-
req.readyState = 1;
|
|
352
|
-
req.addEventListener("load",
|
|
353
|
-
function() {
|
|
354
|
-
req.readyState = 4;
|
|
355
|
-
if (typeof req.onreadystatechange == "function") {
|
|
356
|
-
req.onreadystatechange();
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
false);
|
|
360
|
-
}
|
|
361
|
-
return req;
|
|
362
|
-
}
|
|
363
|
-
if (window.ActiveXObject) {
|
|
364
|
-
return new ActiveXObject(SOAPClient._getXmlHttpProgID());
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
catch (ex) {
|
|
368
|
-
}
|
|
369
|
-
throw new Error("Your browser does not support XmlHttp objects");
|
|
370
|
-
};
|
|
371
|
-
SOAPClient._getXmlHttpProgID = function() {
|
|
372
|
-
if (SOAPClient._getXmlHttpProgID.progid) {
|
|
373
|
-
return SOAPClient._getXmlHttpProgID.progid;
|
|
374
|
-
}
|
|
375
|
-
var progids = ["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
|
|
376
|
-
var o;
|
|
377
|
-
for (var i = 0; i < progids.length; i++) {
|
|
378
|
-
try {
|
|
379
|
-
/* eslint no-unused-vars: 0 */
|
|
380
|
-
o = new ActiveXObject(progids[i]);
|
|
381
|
-
return (SOAPClient._getXmlHttpProgID.progid = progids[i]);
|
|
382
|
-
}
|
|
383
|
-
catch (ex) {
|
|
384
|
-
}
|
|
385
|
-
;
|
|
386
|
-
}
|
|
387
|
-
throw new Error("Could not find an installed XML parser");
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
SOAPClient._toBase64 = function(input) {
|
|
391
|
-
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
392
|
-
var output = "";
|
|
393
|
-
var chr1, chr2, chr3;
|
|
394
|
-
var enc1, enc2, enc3, enc4;
|
|
395
|
-
var i = 0;
|
|
396
|
-
|
|
397
|
-
do {
|
|
398
|
-
chr1 = input.charCodeAt(i++);
|
|
399
|
-
chr2 = input.charCodeAt(i++);
|
|
400
|
-
chr3 = input.charCodeAt(i++);
|
|
401
|
-
|
|
402
|
-
enc1 = chr1 >> 2;
|
|
403
|
-
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
404
|
-
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
405
|
-
enc4 = chr3 & 63;
|
|
406
|
-
|
|
407
|
-
if (isNaN(chr2)) {
|
|
408
|
-
enc3 = enc4 = 64;
|
|
409
|
-
}
|
|
410
|
-
else if (isNaN(chr3)) {
|
|
411
|
-
enc4 = 64;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
|
|
415
|
-
keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
|
416
|
-
} while (i < input.length);
|
|
417
|
-
|
|
418
|
-
return output;
|
|
419
|
-
};
|
|
1
|
+
/** ***************************************************************************\
|
|
2
|
+
|
|
3
|
+
Javascript "SOAP Client" library
|
|
4
|
+
|
|
5
|
+
@version: 2.4 - 2007.12.21
|
|
6
|
+
@author: Matteo Casati - http://www.guru4.net/
|
|
7
|
+
|
|
8
|
+
\*****************************************************************************/
|
|
9
|
+
|
|
10
|
+
function SOAPClientParameters() {
|
|
11
|
+
var _pl = [];
|
|
12
|
+
this.add = function(name, value) {
|
|
13
|
+
_pl[name] = value;
|
|
14
|
+
return this;
|
|
15
|
+
};
|
|
16
|
+
this.toXml = function() {
|
|
17
|
+
var xml = "";
|
|
18
|
+
for (var p in _pl) {
|
|
19
|
+
switch (typeof (_pl[p])) {
|
|
20
|
+
case "string":
|
|
21
|
+
case "number":
|
|
22
|
+
case "boolean":
|
|
23
|
+
case "object":
|
|
24
|
+
xml += "<" + p + ">" + SOAPClientParameters._serialize(_pl[p]) + "</" + p + ">";
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return xml;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
SOAPClientParameters._serialize = function(o) {
|
|
34
|
+
var s = "";
|
|
35
|
+
var p;
|
|
36
|
+
switch (typeof (o)) {
|
|
37
|
+
case "string":
|
|
38
|
+
s += o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
39
|
+
break;
|
|
40
|
+
case "number":
|
|
41
|
+
case "boolean":
|
|
42
|
+
s += o.toString();
|
|
43
|
+
break;
|
|
44
|
+
case "object":
|
|
45
|
+
// Date
|
|
46
|
+
if (o.constructor.toString().indexOf("function Date()") > -1) {
|
|
47
|
+
var year = o.getFullYear().toString();
|
|
48
|
+
var month = (o.getMonth() + 1).toString();
|
|
49
|
+
month = (month.length == 1) ? "0" + month : month;
|
|
50
|
+
var date = o.getDate().toString();
|
|
51
|
+
date = (date.length == 1) ? "0" + date : date;
|
|
52
|
+
var hours = o.getHours().toString();
|
|
53
|
+
hours = (hours.length == 1) ? "0" + hours : hours;
|
|
54
|
+
var minutes = o.getMinutes().toString();
|
|
55
|
+
minutes = (minutes.length == 1) ? "0" + minutes : minutes;
|
|
56
|
+
var seconds = o.getSeconds().toString();
|
|
57
|
+
seconds = (seconds.length == 1) ? "0" + seconds : seconds;
|
|
58
|
+
var milliseconds = o.getMilliseconds().toString();
|
|
59
|
+
var tzminutes = Math.abs(o.getTimezoneOffset());
|
|
60
|
+
var tzhours = 0;
|
|
61
|
+
while (tzminutes >= 60) {
|
|
62
|
+
tzhours++;
|
|
63
|
+
tzminutes -= 60;
|
|
64
|
+
}
|
|
65
|
+
tzminutes = (tzminutes.toString().length == 1) ? "0" + tzminutes.toString() : tzminutes.toString();
|
|
66
|
+
tzhours = (tzhours.toString().length == 1) ? "0" + tzhours.toString() : tzhours.toString();
|
|
67
|
+
var timezone = ((o.getTimezoneOffset() < 0) ? "+" : "-") + tzhours + ":" + tzminutes;
|
|
68
|
+
s += year + "-" + month + "-" + date + "T" + hours + ":" + minutes + ":" + seconds + "." + milliseconds + timezone;
|
|
69
|
+
}
|
|
70
|
+
// Array
|
|
71
|
+
else if (o.constructor.toString().indexOf("function Array()") > -1) {
|
|
72
|
+
for (p in o) {
|
|
73
|
+
if (!isNaN(p)) {
|
|
74
|
+
// linear array
|
|
75
|
+
(/function\s+(\w*)\s*\(/ig).exec(o[p].constructor.toString());
|
|
76
|
+
var type = RegExp.$1;
|
|
77
|
+
switch (type) {
|
|
78
|
+
case "":
|
|
79
|
+
type = typeof (o[p]);
|
|
80
|
+
break;
|
|
81
|
+
case "String":
|
|
82
|
+
type = "string";
|
|
83
|
+
break;
|
|
84
|
+
case "Number":
|
|
85
|
+
type = "int";
|
|
86
|
+
break;
|
|
87
|
+
case "Boolean":
|
|
88
|
+
type = "bool";
|
|
89
|
+
break;
|
|
90
|
+
case "Date":
|
|
91
|
+
type = "DateTime";
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
s += "<" + type + ">" + SOAPClientParameters._serialize(o[p]) + "</" + type + ">";
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// associative array
|
|
98
|
+
s += "<" + p + ">" + SOAPClientParameters._serialize(o[p]) + "</" + p + ">";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Object or custom function
|
|
103
|
+
else {
|
|
104
|
+
for (p in o) {
|
|
105
|
+
s += "<" + p + ">" + SOAPClientParameters._serialize(o[p]) + "</" + p + ">";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
break; // throw new Error(500, "SOAPClientParameters: type '" + typeof(o) + "' is not supported");
|
|
111
|
+
}
|
|
112
|
+
return s;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
function SOAPClient() {}
|
|
116
|
+
|
|
117
|
+
SOAPClient.username = null;
|
|
118
|
+
SOAPClient.password = null;
|
|
119
|
+
|
|
120
|
+
SOAPClient.invoke = function(url, method, parameters, async, callback) {
|
|
121
|
+
if (async) {
|
|
122
|
+
SOAPClient._loadWsdl(url, method, parameters, async, callback);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return SOAPClient._loadWsdl(url, method, parameters, async, callback);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// private: wsdl cache
|
|
130
|
+
SOAPClient_cacheWsdl = [];
|
|
131
|
+
|
|
132
|
+
// private: invoke async
|
|
133
|
+
SOAPClient._loadWsdl = function(url, method, parameters, async, callback) {
|
|
134
|
+
// load from cache?
|
|
135
|
+
var wsdl = SOAPClient_cacheWsdl[url];
|
|
136
|
+
if (wsdl + "" != "" && wsdl + "" != "undefined") {
|
|
137
|
+
return SOAPClient._sendSoapRequest(url, method, parameters, async, callback, wsdl);
|
|
138
|
+
}
|
|
139
|
+
// get wsdl
|
|
140
|
+
var xmlHttp = SOAPClient._getXmlHttp();
|
|
141
|
+
|
|
142
|
+
if (SOAPClient.username && SOAPClient.password) {
|
|
143
|
+
xmlHttp.open("GET", url + "?wsdl", async, SOAPClient.username, SOAPClient.password);
|
|
144
|
+
// Some WS implementations (i.e. BEA WebLogic Server 10.0 JAX-WS) don't support Challenge/Response HTTP BASIC, so we send authorization headers in the first request
|
|
145
|
+
xmlHttp.setRequestHeader("Authorization", "Basic " + SOAPClient._toBase64(SOAPClient.username + ":" + SOAPClient.password));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// xmlHttp.open("GET", url + "?wsdl", async);
|
|
149
|
+
if (async) {
|
|
150
|
+
xmlHttp.onreadystatechange = function() {
|
|
151
|
+
if (xmlHttp.readyState == 4) {
|
|
152
|
+
SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
xmlHttp.send(null);
|
|
158
|
+
if (!async) {
|
|
159
|
+
return SOAPClient._onLoadWsdl(url, method, parameters, async, callback, xmlHttp);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
SOAPClient._onLoadWsdl = function(url, method, parameters, async, callback, req) {
|
|
163
|
+
var wsdl = req.responseXML;
|
|
164
|
+
SOAPClient_cacheWsdl[url] = wsdl; // save a copy in cache
|
|
165
|
+
return SOAPClient._sendSoapRequest(url, method, parameters, async, callback, wsdl);
|
|
166
|
+
};
|
|
167
|
+
SOAPClient._sendSoapRequest = function(url, method, parameters, async, callback, wsdl) {
|
|
168
|
+
// get namespace
|
|
169
|
+
var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value;
|
|
170
|
+
|
|
171
|
+
// build SOAP request
|
|
172
|
+
var sr =
|
|
173
|
+
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
174
|
+
"<soap:Envelope " +
|
|
175
|
+
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
|
|
176
|
+
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
|
|
177
|
+
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
|
|
178
|
+
"<soap:Body>" +
|
|
179
|
+
"<" + method + " xmlns=\"" + ns + "\">" +
|
|
180
|
+
parameters.toXml() +
|
|
181
|
+
"</" + method + "></soap:Body></soap:Envelope>";
|
|
182
|
+
// send request
|
|
183
|
+
|
|
184
|
+
var xmlHttp = SOAPClient._getXmlHttp();
|
|
185
|
+
|
|
186
|
+
if (SOAPClient.username && SOAPClient.password) {
|
|
187
|
+
xmlHttp.open("POST", url, async, SOAPClient.username, SOAPClient.password);
|
|
188
|
+
// Some WS implementations (i.e. BEA WebLogic Server 10.0 JAX-WS) don't support Challenge/Response HTTP BASIC, so we send authorization headers in the first request
|
|
189
|
+
xmlHttp.setRequestHeader("Authorization", "Basic " + SOAPClient._toBase64(SOAPClient.username + ":" + SOAPClient.password));
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
xmlHttp.open("POST", url, async);
|
|
193
|
+
}
|
|
194
|
+
var soapaction = ((ns.lastIndexOf("/") != ns.length - 1) ? ns + "/" : ns) + method;
|
|
195
|
+
xmlHttp.setRequestHeader("SOAPAction", soapaction);
|
|
196
|
+
xmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
|
|
197
|
+
if (async) {
|
|
198
|
+
xmlHttp.onreadystatechange = function() {
|
|
199
|
+
if (xmlHttp.readyState == 4) {
|
|
200
|
+
SOAPClient._onSendSoapRequest(method, async, callback, wsdl, xmlHttp);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
xmlHttp.send(sr);
|
|
205
|
+
if (!async) {
|
|
206
|
+
return SOAPClient._onSendSoapRequest(method, async, callback, wsdl, xmlHttp);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
SOAPClient._onSendSoapRequest = function(method, async, callback, wsdl, req) {
|
|
211
|
+
var o = null;
|
|
212
|
+
var nd = SOAPClient._getElementsByTagName(req.responseXML, method + "Result");
|
|
213
|
+
if (nd.length == 0) {
|
|
214
|
+
nd = SOAPClient._getElementsByTagName(req.responseXML, "return");
|
|
215
|
+
} // PHP web Service?
|
|
216
|
+
if (nd.length == 0) {
|
|
217
|
+
if (req.responseXML.getElementsByTagName("faultcode").length > 0) {
|
|
218
|
+
if (async || callback) {
|
|
219
|
+
o = new Error(500, req.responseXML.getElementsByTagName("faultstring")[0].childNodes[0].nodeValue);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
throw new Error(500, req.responseXML.getElementsByTagName("faultstring")[0].childNodes[0].nodeValue);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
o = SOAPClient._soapresult2object(nd[0], wsdl);
|
|
228
|
+
}
|
|
229
|
+
if (callback) {
|
|
230
|
+
callback(o, req.responseXML);
|
|
231
|
+
}
|
|
232
|
+
if (!async) {
|
|
233
|
+
return o;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
SOAPClient._soapresult2object = function(node, wsdl) {
|
|
237
|
+
var wsdlTypes = SOAPClient._getTypesFromWsdl(wsdl);
|
|
238
|
+
return SOAPClient._node2object(node, wsdlTypes);
|
|
239
|
+
};
|
|
240
|
+
SOAPClient._node2object = function(node, wsdlTypes) {
|
|
241
|
+
var i;
|
|
242
|
+
// null node
|
|
243
|
+
if (node == null) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
// text node
|
|
247
|
+
if (node.nodeType == 3 || node.nodeType == 4) {
|
|
248
|
+
return SOAPClient._extractValue(node, wsdlTypes);
|
|
249
|
+
}
|
|
250
|
+
// leaf node
|
|
251
|
+
if (node.childNodes.length == 1 && (node.childNodes[0].nodeType == 3 || node.childNodes[0].nodeType == 4)) {
|
|
252
|
+
return SOAPClient._node2object(node.childNodes[0], wsdlTypes);
|
|
253
|
+
}
|
|
254
|
+
var isarray = SOAPClient._getTypeFromWsdl(node.nodeName, wsdlTypes).toLowerCase().indexOf("arrayof") != -1;
|
|
255
|
+
// object node
|
|
256
|
+
if (!isarray) {
|
|
257
|
+
var obj = null;
|
|
258
|
+
if (node.hasChildNodes()) {
|
|
259
|
+
obj = {};
|
|
260
|
+
}
|
|
261
|
+
for (i = 0; i < node.childNodes.length; i++) {
|
|
262
|
+
var p = SOAPClient._node2object(node.childNodes[i], wsdlTypes);
|
|
263
|
+
obj[node.childNodes[i].nodeName] = p;
|
|
264
|
+
}
|
|
265
|
+
return obj;
|
|
266
|
+
}
|
|
267
|
+
// list node
|
|
268
|
+
else {
|
|
269
|
+
// create node ref
|
|
270
|
+
var l = [];
|
|
271
|
+
for (i = 0; i < node.childNodes.length; i++) {
|
|
272
|
+
l[l.length] = SOAPClient._node2object(node.childNodes[i], wsdlTypes);
|
|
273
|
+
}
|
|
274
|
+
return l;
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
SOAPClient._extractValue = function(node, wsdlTypes) {
|
|
278
|
+
var value = node.nodeValue;
|
|
279
|
+
switch (SOAPClient._getTypeFromWsdl(node.parentNode.nodeName, wsdlTypes).toLowerCase()) {
|
|
280
|
+
case "s:boolean":
|
|
281
|
+
return value + "" == "true";
|
|
282
|
+
case "s:int":
|
|
283
|
+
case "s:long":
|
|
284
|
+
return (value != null) ? parseInt(value + "", 10) : 0;
|
|
285
|
+
case "s:double":
|
|
286
|
+
return (value != null) ? parseFloat(value + "") : 0;
|
|
287
|
+
case "s:datetime":
|
|
288
|
+
if (value == null) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
value = value + "";
|
|
293
|
+
value = value.substring(0, (value.lastIndexOf(".") == -1 ? value.length : value.lastIndexOf(".")));
|
|
294
|
+
value = value.replace(/T/gi, " ");
|
|
295
|
+
value = value.replace(/-/gi, "/");
|
|
296
|
+
var d = new Date();
|
|
297
|
+
d.setTime(Date.parse(value));
|
|
298
|
+
return d;
|
|
299
|
+
}
|
|
300
|
+
case "s:string":
|
|
301
|
+
default:
|
|
302
|
+
return (value != null) ? value + "" : "";
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
SOAPClient._getTypesFromWsdl = function(wsdl) {
|
|
306
|
+
var wsdlTypes = [];
|
|
307
|
+
// IE
|
|
308
|
+
var ell = wsdl.getElementsByTagName("s:element");
|
|
309
|
+
var useNamedItem = true;
|
|
310
|
+
// MOZ
|
|
311
|
+
if (ell.length == 0) {
|
|
312
|
+
ell = wsdl.getElementsByTagName("element");
|
|
313
|
+
useNamedItem = false;
|
|
314
|
+
}
|
|
315
|
+
for (var i = 0; i < ell.length; i++) {
|
|
316
|
+
if (useNamedItem) {
|
|
317
|
+
if (ell[i].attributes.getNamedItem("name") != null && ell[i].attributes.getNamedItem("type") != null) {
|
|
318
|
+
wsdlTypes[ell[i].attributes.getNamedItem("name").nodeValue] = ell[i].attributes.getNamedItem("type").nodeValue;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
if (ell[i].attributes["name"] != null && ell[i].attributes["type"] != null) {
|
|
323
|
+
wsdlTypes[ell[i].attributes["name"].value] = ell[i].attributes["type"].value;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return wsdlTypes;
|
|
328
|
+
};
|
|
329
|
+
SOAPClient._getTypeFromWsdl = function(elementname, wsdlTypes) {
|
|
330
|
+
var type = wsdlTypes[elementname] + "";
|
|
331
|
+
return (type == "undefined") ? "" : type;
|
|
332
|
+
};
|
|
333
|
+
// private: utils
|
|
334
|
+
SOAPClient._getElementsByTagName = function(document, tagName) {
|
|
335
|
+
try {
|
|
336
|
+
// trying to get node omitting any namespaces (latest versions of MSXML.XMLDocument)
|
|
337
|
+
return document.selectNodes(".//*[local-name()=\"" + tagName + "\"]");
|
|
338
|
+
}
|
|
339
|
+
catch (ex) {
|
|
340
|
+
}
|
|
341
|
+
// old XML parser support
|
|
342
|
+
return document.getElementsByTagName(tagName);
|
|
343
|
+
};
|
|
344
|
+
// private: xmlhttp factory
|
|
345
|
+
SOAPClient._getXmlHttp = function() {
|
|
346
|
+
try {
|
|
347
|
+
if (window.XMLHttpRequest) {
|
|
348
|
+
var req = new XMLHttpRequest();
|
|
349
|
+
// some versions of Moz do not support the readyState property and the onreadystate event so we patch it!
|
|
350
|
+
if (req.readyState == null) {
|
|
351
|
+
req.readyState = 1;
|
|
352
|
+
req.addEventListener("load",
|
|
353
|
+
function() {
|
|
354
|
+
req.readyState = 4;
|
|
355
|
+
if (typeof req.onreadystatechange == "function") {
|
|
356
|
+
req.onreadystatechange();
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
false);
|
|
360
|
+
}
|
|
361
|
+
return req;
|
|
362
|
+
}
|
|
363
|
+
if (window.ActiveXObject) {
|
|
364
|
+
return new ActiveXObject(SOAPClient._getXmlHttpProgID());
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
catch (ex) {
|
|
368
|
+
}
|
|
369
|
+
throw new Error("Your browser does not support XmlHttp objects");
|
|
370
|
+
};
|
|
371
|
+
SOAPClient._getXmlHttpProgID = function() {
|
|
372
|
+
if (SOAPClient._getXmlHttpProgID.progid) {
|
|
373
|
+
return SOAPClient._getXmlHttpProgID.progid;
|
|
374
|
+
}
|
|
375
|
+
var progids = ["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
|
|
376
|
+
var o;
|
|
377
|
+
for (var i = 0; i < progids.length; i++) {
|
|
378
|
+
try {
|
|
379
|
+
/* eslint no-unused-vars: 0 */
|
|
380
|
+
o = new ActiveXObject(progids[i]);
|
|
381
|
+
return (SOAPClient._getXmlHttpProgID.progid = progids[i]);
|
|
382
|
+
}
|
|
383
|
+
catch (ex) {
|
|
384
|
+
}
|
|
385
|
+
;
|
|
386
|
+
}
|
|
387
|
+
throw new Error("Could not find an installed XML parser");
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
SOAPClient._toBase64 = function(input) {
|
|
391
|
+
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
392
|
+
var output = "";
|
|
393
|
+
var chr1, chr2, chr3;
|
|
394
|
+
var enc1, enc2, enc3, enc4;
|
|
395
|
+
var i = 0;
|
|
396
|
+
|
|
397
|
+
do {
|
|
398
|
+
chr1 = input.charCodeAt(i++);
|
|
399
|
+
chr2 = input.charCodeAt(i++);
|
|
400
|
+
chr3 = input.charCodeAt(i++);
|
|
401
|
+
|
|
402
|
+
enc1 = chr1 >> 2;
|
|
403
|
+
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
|
|
404
|
+
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
|
|
405
|
+
enc4 = chr3 & 63;
|
|
406
|
+
|
|
407
|
+
if (isNaN(chr2)) {
|
|
408
|
+
enc3 = enc4 = 64;
|
|
409
|
+
}
|
|
410
|
+
else if (isNaN(chr3)) {
|
|
411
|
+
enc4 = 64;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) +
|
|
415
|
+
keyStr.charAt(enc3) + keyStr.charAt(enc4);
|
|
416
|
+
} while (i < input.length);
|
|
417
|
+
|
|
418
|
+
return output;
|
|
419
|
+
};
|