⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webservice2.js

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 JS
📖 第 1 页 / 共 5 页
字号:
/* * Bindows 1.5 * http://www.bindows.net/ * Copyright (c) 2003-2005 MB Technologies * * Bindows(tm) belongs to MB Technologies (Georgia, USA). All rights reserved. * You are not allowed to copy or modify this code. Commercial use requires * license. */function BiXmlDefinitionsDocument()
{if(_biInPrototype)return;BiEventTarget.call(this);this._loaded=false;this._httpRequest=new BiXmlHttp();}
_p=_biExtend(BiXmlDefinitionsDocument,BiEventTarget,"BiXmlDefinitionsDocument");BiXmlDefinitionsDocument.prototype.dispose=function()
{this._httpRequest=null;for(var lIdx=0;lIdx<this._imports.length;lIdx++)
{this._imports[lIdx].getImportedDefinitionsDocument().dispose();this._imports[lIdx]=null;}
BiEventTarget.prototype.dispose.call(this);}
BiXmlDefinitionsDocument.prototype.setSource=function(aSource,aBaseUrl)
{this._source=aSource;this._baseLocation=aBaseUrl;}
BiXmlDefinitionsDocument.prototype.load=function(aAsync)
{if(typeof(this._source)=="string")
{this._loadFromUrl(this._source,aAsync);}else {this._processReceivedDocument(this._source,aAsync);}}
BiXmlDefinitionsDocument.prototype._loadFromUrl=function(aUrl,aAsync)
{if(aAsync)
{var lThis=this;this._httpRequest.onreadystatechange=function(){if(lThis._httpRequest.readyState==4)
{if(lThis._httpRequest.status<200||lThis._httpRequest.status>299)
{lThis._reportLoadError(aAsync,new BiWebServiceError("Could not receive XML: "+lThis._httpRequest.status));return;}
lThis._processReceivedDocument(lThis._httpRequest.responseXML.documentElement,aAsync);}};}
this._baseLocation=aUrl;try
{this._httpRequest.open("GET",aUrl,aAsync);this._httpRequest.send(null);}catch(e)
{this._reportLoadError(aAsync,new BiWebServiceError("Could not load definitions document: "+e.toString()));return;}
if(!aAsync)
{if(this._httpRequest.status<200||this._httpRequest.status>299)
{this._reportLoadError(aAsync,new BiWebServiceError("Could not receive XML: "+this._httpRequest.status));return;}
this._processReceivedDocument(this._httpRequest.responseXML.documentElement,aAsync);}}
BiXmlDefinitionsDocument.prototype._reportLoadError=function(aAsync,aErr)
{var lErrObj;if(typeof aErr=="string")
{lErrObj=new BiWebServiceError(aErr);}else {lErrObj=aErr;}
if(aAsync)
{var lEvt=new BiEvent("loaded");lEvt.err=lErrObj;this.dispatchEvent(lEvt);}else {throw lErrObj;}}
BiXmlDefinitionsDocument.prototype._processReceivedDocument=function(aRootElement,aAsync)
{this._xmlSource=aRootElement;try
{this._initiallyProcessDocument();this._imports=this._getImports();this._resolveImportsAndFinishLoading(aAsync);}catch(e)
{this._reportLoadError(aAsync,e);}}
BiXmlDefinitionsDocument.prototype._resolveImportsAndFinishLoading=function(aAsync)
{this._pendingImportCount=this._imports.length;if(!this._pendingImportCount)
{this._processLocalDefinitions();this._notifyDocumentLoaded();}
for(var lImportIdx=0;lImportIdx<this._imports.length;lImportIdx++)
{var lImport=this._imports[lImportIdx].getImportedDefinitionsDocument();if(aAsync)
{lPendingImports=true;lImport.addEventListener("loaded",this._createLoadedEventHandler(this,this._imports[lImportIdx]));}
lImport.load(aAsync);if(!aAsync)
{this._handleReceivedImport(lImport,this._imports[lImportIdx]);}}}
BiXmlDefinitionsDocument.prototype._createLoadedEventHandler=function(aImporter,aImport)
{return function(aEvt)
{if(aEvt.err)
{aImporter._reportLoadError(true,aEvt.err);}else {try
{aImporter._handleReceivedImport(aEvt.getTarget(),aImport);}catch(e)
{aImporter._reportLoadError(true,e);}}};}
BiXmlDefinitionsDocument.prototype._handleReceivedImport=function(aImportedDoc,aImportDesc)
{this._processImport(aImportedDoc,aImportDesc);this._pendingImportCount--;if(!this._pendingImportCount)
{this._processLocalDefinitions();this._notifyDocumentLoaded();}}
BiXmlDefinitionsDocument.prototype.getXml=function()
{return this._xmlSource;}
BiXmlDefinitionsDocument.prototype._notifyDocumentLoaded=function()
{this._loaded=true;this.dispatchEvent(new BiEvent("loaded"));}
BiXmlDefinitionsDocument.prototype._initiallyProcessDocument=function()
{throw new BiWebServiceError("_initiallyProcessDocument must be overriden by BiXmlDefinitionsDocument derivatives.");}
BiXmlDefinitionsDocument.prototype._getImports=function(aDocument)
{throw new BiWebServiceError("_getImports must be overriden by BiXmlDefinitionsDocument derivatives.");}
BiXmlDefinitionsDocument.prototype._processImport=function(aImportedDoc,aImportDesc)
{throw new BiWebServiceError("_processImport must be overriden by BiXmlDefinitionsDocument derivatives.");}
BiXmlDefinitionsDocument.prototype._processLocalDefinitions=function()
{throw new BiWebServiceError("_processLocalDefintions must be overriden by BiXmlDefinitionsDocument derivatives.");}
BiXmlDefinitionsDocument.getURIFromNode=function(aPrefix,aContext)
{var lRes="";var lSought="xmlns";if(aPrefix)
{lSought=lSought+":"+aPrefix;}
while(aContext&&(!lRes||lRes==""))
{if(aContext.nodeType==1)
{lRes=aContext.getAttribute(lSought);}
aContext=aContext.parentNode;}
return lRes;}
BiXmlDefinitionsDocument.expandQname=function(aQname,aContext)
{var lParts=aQname.split(":");var lPrefix=lParts.length>1?lParts[0]:"";var lLocalPart=lParts.length>1?lParts[1]:lParts[0];var lRet="["+BiXmlDefinitionsDocument.getURIFromNode(lPrefix,aContext)+"]"+lLocalPart;return lRet;};BiXmlDefinitionsDocument.parseExpandedQname=function(aExpandedQname)
{var lRet=new Object();var lRexp= /\[([^\]]*)\](.*)/;var lParts=lRexp.exec(aExpandedQname);if(!lParts||lParts.length!=3)
{throw new BiWebServiceError(aExpandedQname+" is not a valid Expanded-QName");}
lRet.ns=lParts[1];lRet.localName=lParts[2];return lRet;}
function BiXmlDefinitionsDocumentImportDesc(aDoc)
{if(_biInPrototype)return;this._importedDoc=aDoc;}
_p=_biExtend(BiXmlDefinitionsDocumentImportDesc,Object,"BiXmlDefinitionsDocumentImportDesc");BiXmlDefinitionsDocumentImportDesc.prototype.getImportedDefinitionsDocument=function()
{return this._importedDoc;}
BiWsdlDefinitionDictionary=function(aPrimarySource,aObjectsPath,aKeyPath,aObFactory)
{this._obPath=aObjectsPath;this._keyPath=aKeyPath;this._obFactory=aObFactory;this._loadedObjects={};this._loadedObjectNames=[];this._primarySource=aPrimarySource;this._imports=[];}
_p=_biExtend(BiWsdlDefinitionDictionary,Object,"BiWsdlDefinitionDictionary");BiWsdlDefinitionDictionary.prototype.dispose=function()
{for(var lIdx=0;lIdx<this._loadedObjectNames.length;lIdx++)
{var lDispObj=this._loadedObjectNames[lIdx];if(typeof(lDispObj["dispose"])=="function")
{lDispObj.dispose();}}}
BiWsdlDefinitionDictionary.prototype.loadDefinitions=function()
{var lDefNodes=this._primarySource.getXml().selectNodes(this._obPath);for(var lIdx=0;lIdx<lDefNodes.length;lIdx++)
{var lDefNode=lDefNodes[lIdx];var lDefLocalName=lDefNode.selectSingleNode(this._keyPath).nodeValue;var lDefName="["+this._primarySource.getTargetNamespace()+"]"+lDefLocalName;if(!this._loadedObjects[lDefName])
{this._loadedObjectNames.push(lDefName);this._loadedObjects[lDefName]=this._obFactory(lDefNode,this._primarySource);if(this._loadedObjects[lDefName]["finishLoad"])
{this._loadedObjects[lDefName].finishLoad();}}}}
BiWsdlDefinitionDictionary.prototype.addImport=function(aDefinitionDictionary)
{this._imports.push(aDefinitionDictionary);}
BiWsdlDefinitionDictionary.prototype.getCount=function()
{return this._enumKeys(null);}
BiWsdlDefinitionDictionary.prototype.getKeys=function()
{var lRes=[];this._enumKeys(lRes);return lRes;}
BiWsdlDefinitionDictionary.prototype.getItem=function(aItemKey)
{var lRes=this._loadedObjects[aItemKey];if(!lRes)
{var lSoughtName=BiXmlDefinitionsDocument.parseExpandedQname(aItemKey);if(lSoughtName.ns==this._primarySource.getTargetNamespace())
{var lDefNode=this._primarySource.getXml().selectSingleNode(this._obPath+"["+this._keyPath+"='"+lSoughtName.localName+"']");if(lDefNode)
{this._loadedObjectNames.push(aItemKey);lRes=this._loadedObjects[aItemKey]=this._obFactory(lDefNode,this._primarySource);if(lRes["finishLoad"])
{lRes.finishLoad();}}}}
var lIdx=0;while(!lRes&&lIdx<this._imports.length)
{lRes=this._imports[lIdx].getItem(aItemKey);lIdx++;}
return lRes;}
BiWsdlDefinitionDictionary.prototype._enumKeys=function(aWhereTo)
{var lCount=this._loadedObjectNames.length;if(aWhereTo)
{for(var lIdx=0;lIdx<this._loadedObjectNames.length;lIdx++)
{aWhereTo.push(this._loadedObjectNames[lIdx]);}}
for(var lIdx2=0;lIdx2<this._imports.length;lIdx2++)
{lCount+=this._imports[lIdx2]._enumKeys(aWhereTo);}
return lCount;}
function BiSchemaError(aMessage)
{if(_biInPrototype)return;Error.call(this,aMessage);this.errMessage=aMessage;}
_p=_biExtend(BiSchemaError,Error,"BiSchemaError");BiSchemaError.prototype.toString=function()
{return this.errMessage;}
function BiSchemaType(aName)
{if(_biInPrototype)return;this._name=aName;}
_p=_biExtend(BiSchemaType,Object,"BiSchemaType");BiSchemaType.prototype.getName=function()
{return this._name;}
function BiSchemaSimpleContentType(aName)
{if(_biInPrototype)return;BiSchemaType.call(this,aName);}
_p=_biExtend(BiSchemaSimpleContentType,BiSchemaType,"BiSchemaSimpleContentType");BiSchemaSimpleContentType.prototype.encodeJsValue=function(aValueToEncode)
{throw new BiSchemaError("BiSchemaSimpleContentType derivatives must implement encodeJsValue.");}
BiSchemaSimpleContentType.prototype.decodeJsValue=function(aValueToDecode)
{throw new BiSchemaError("BiSchemaSimpleContentType derivatives must implement decodeJsValue.");}
function BiSchemaPrimitiveType(aName)
{if(_biInPrototype)return;BiSchemaSimpleContentType.call(this,aName);}
_p=_biExtend(BiSchemaPrimitiveType,BiSchemaSimpleContentType,"BiSchemaPrimitiveType");function BiSchemaStringPrimitiveType(aName)
{if(_biInPrototype)return;BiSchemaPrimitiveType.call(this,aName);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -