/source/_SiteNote/XmlEditor/SvcHelper.js
JavaScript | 1221 lines | 1027 code | 179 blank | 15 comment | 255 complexity | ceb687b84a8211a7b3f5c6fdde220d29 MD5 | raw file
-
- function SvcHelper(xmlEditorPath, debugMode)
- {
- this.serviceUrl = xmlEditorPath + 'XmlEditor.asmx';
- this.debugMode = debugMode;
- this.xmlHttp = null;
- /**
- * @type WSClient
- */
- this.wsClient = null;
- }
-
- SvcHelper.prototype.Initialize = function ()
- {
- try
- {
- this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
- this.wsClient = new WSClient(this.serviceUrl, "POST", "http://tempuri.org/");
- this.wsClient.setSoapHeader("SessionIdHeader", {Id: SiteNote.Session.SessionId});
- //this.xmlHttp = new XMLHttpRequest();
- //alert('FireFox ou IE7');
- }
- catch(e)
- {
- try
- {
- this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
- //alert('IE6');
- }
- catch(ex)
- {
- err(ex);
- this.xmlHttp = null;
- }
- }
-
- return (this.xmlHttp != null);
- }
-
- SvcHelper.prototype.InitializeEdition = function (documentUri, schemaUri, bForceInitialization)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "documentUri=" + encodeURIComponent(documentUri) + "&schemaUri=" + encodeURIComponent(schemaUri) + "&bForceInitialization=" + bForceInitialization;
- //alert('ici');
- this.xmlHttp.Open("POST", this.serviceUrl + '/InitializeEdition', false);
- //alert(this.serviceUrl + '/InitializeEdition');
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
-
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/InitializeEdition');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/InitializeEdition');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.GetXmlDocument = function (documentId)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = "";
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "documentId=" + encodeURIComponent(documentId);
- this.xmlHttp.Open("POST", this.serviceUrl + '/GetXmlDocument', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/GetXmlDocument');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/GetXmlDocument');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.ReloadDocument = function (documentId)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = "";
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "documentId=" + encodeURIComponent(documentId);
- this.xmlHttp.Open("POST", this.serviceUrl + '/ReloadDocument', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/GetXmlDocument');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/GetXmlDocument');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.GetXsltDocument = function (uri)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = "";
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "uri=" + encodeURIComponent(uri);
- this.xmlHttp.Open("POST", this.serviceUrl + '/GetXsltDocument', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/GetXsltDocument');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/GetXsltDocument');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
-
- SvcHelper.prototype.GetXmlLabel = function (uri)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = "";
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "uri=" + encodeURIComponent(uri);
- this.xmlHttp.Open("POST", this.serviceUrl + '/GetXmlLabel', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/GetXmlLabel');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/GetXmlLabel');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.SaveText = function (documentId, object_id, text)
- {
- var post;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = false;
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("SaveText", {documentId: documentId, objectId: object_id, text: text});
- post = this.wsClient.requestBody;
-
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/SaveText');
- err(post);
- err(this.wsClient.getErrorReason());
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/SaveText');
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = true;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.GetActions = function(documentId, objectId)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "documentId=" + encodeURIComponent(documentId) + "&objectId=" + objectId;
- this.xmlHttp.Open("POST", this.serviceUrl + '/GetActions', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/GetActions');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/GetActions');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.GetEditionActions = function(documentId, objectId)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "documentId=" + encodeURIComponent(documentId) + "&objectId=" + objectId;
- this.xmlHttp.Open("POST", this.serviceUrl + '/GetEditionActions', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/GetEditionActions');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/GetEditionActions');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.CreateElement = function(documentId, objectId, position, elementName, elementType, schemaType)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("CreateElement", {documentId: documentId, objectId: objectId, position: position,
- elementName: elementName, elementType: elementType, schemaType: schemaType});
- post = this.wsClient.requestBody;
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/CreateElement');
- err(post);
- err(this.wsClient.getErrorReason());
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/CreateElement');
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.DeleteElement = function(documentId, objectId)
- {
- var post;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("DeleteElement", {documentId: documentId, objectId: objectId});
- post = this.wsClient.requestBody;
-
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/DeleteElement');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/DeleteElement');
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.SplitElement = function(documentId, objectId, position)
- {
- var post;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("SplitElement", {documentId: documentId, objectId: objectId, position: position})
- post = this.wsClient.requestBody;
-
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/SplitElement');
- err(post);
- err(this.wsClient.getErrorReason());
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/SplitElement');
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.MergeSiblings = function(documentId, objectId, siblingPosition)
- {
- var post;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("MergeSiblings", {documentId: documentId, objectId: objectId, siblingPosition: siblingPosition});
- post = this.wsClient.requestBody;
-
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + methodName);
- err(post);
- err(this.wsClient.getErrorReason());
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + methodName);
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.CopyElement = function(documentId, objectId)
- {
- var post;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = false;
-
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("CopyElement", {documentId: documentId, objectId: objectId});
- post = this.wsClient.requestBody;
-
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/CopyElement');
- err(post);
- err(this.wsClient.getErrorReason());
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/CopyElement');
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = true;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.PasteElement = function(documentId, objectId, position)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("PasteElement", {documentId: documentId, objectId: objectId, position: position});
- post = this.wsClient.requestBody;
-
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/PasteElement');
- err(post);
- err(this.wsClient.getErrorReason());
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/PasteElement');
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.PasteXml = function(documentId, objectId, position, xml)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "documentId=" + encodeURIComponent(documentId) + "&objectId=" + objectId + "&position=" + position + "&xml=" + encodeURIComponent(xml);
- this.xmlHttp.Open("POST", this.serviceUrl + '/PasteXml', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/PasteXml');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/PasteXml');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.DuplicateElement = function(documentId, sourceId, objectId, position, nbCopies)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.wsClient == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- response = this.wsClient.invoke("DuplicateElement", {documentId: documentId, sourceId: sourceId, objectId: objectId, position: position, nbCopies: nbCopies});
- post = this.wsClient.requestBody;
-
- if (this.wsClient.getErrorCode() != 0)
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/DuplicateElement');
- err(post);
- err(this.wsClient.getErrorReason());
- }
- }
- else
- {
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/DuplicateElement');
- err(post);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling.text;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.GetEnumeration = function(documentId, schemaType)
- {
- var post;
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- post = "documentId=" + encodeURIComponent(documentId) + "&schemaType=" + schemaType;
- this.xmlHttp.Open("POST", this.serviceUrl + '/GetEnumeration', false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(this.serviceUrl + '/GetEnumeration');
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(this.serviceUrl + '/GetEnumeration');
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling;
- }
- }
- }
-
- return result;
- }
-
- SvcHelper.prototype.ExecuteCall = function(url, post)
- {
- var document;
- var result;
- var response;
- var responseDocument;
- var status;
-
- result = null;
-
- if(this.xmlHttp == null)
- {
- if (!this.Initialize())
- {
- return result;
- }
- }
-
- //alert(url);
- //alert(post);
- this.xmlHttp.Open("POST", url, false);
- this.xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- this.xmlHttp.Send(post);
-
- document = this.xmlHttp.responseXML;
-
- if (document.parseError.errorCode != 0 || document.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve document");
- err(url);
- err(post);
- err(this.xmlHttp.responseText);
- }
- }
- else
- {
- response = document.documentElement.firstChild.text;
-
- //alert(response);
-
- /*response = response.replace(/<!\[ATADC\[/g, '<![CDATA[');
- response = response.replace(/\]ATADC\]>/g, ']]>');
- */
-
- responseDocument = new ActiveXObject("Msxml2.DOMDocument.6.0");;
-
- responseDocument.loadXML(response);
-
- //alert(response);
-
- if (responseDocument.parseError.errorCode != 0 || responseDocument.xml == '')
- {
- if (this.debugMode)
- {
- err("unable to retrieve read response");
- err(url);
- err(post);
- err(document.xml);
- err(response);
- }
- }
- else
- {
- status = responseDocument.documentElement.firstChild;
-
- if (status.text == 'succeed')
- {
- result = status.nextSibling;
- }
- }
- }
-
- return result;
- }