?? webservice.htc
字號:
default:
ot = null;
}
return ot;
}
function parseType(oS, oschm, o, ssffx)
{
if (o == null)
return null;
switch(o.baseName)
{
case "complexType" :
return parseComplexType(oS, oschm, o, ssffx);
case "simpleType" :
return parseSimpleType(oS, oschm, o, ssffx);
}
return null;
}
function parseArrayType(at, sz)
{
var asa = sz.split("[");
if (asa.length <= 1)
{
asa = sz.split(",");
for (var i = 0; i < asa.length; i++)
{
var ii = parseInt(asa[i]);
at[at.length] = isNaN(ii) ? null : ii;
}
return;
}
for (var i=0; i < asa.length; i++)
parseArrayType(at, asa[i]);
}
function parseComplexType(oS, oschm, o, ssffx)
{
var ns = getQualifier(o.tagName);
if (!o.hasChildNodes())
return null;
var ot = null;
for (var j = 0; j < o.childNodes.length; j++)
{
var o1 = o.childNodes[j];
switch(o1.baseName)
{
case 'sequence' :
case 'all' :
var ao = o1.selectNodes(ns.length ? (ns+':any') : 'any');
if (ao.length != 0)
continue;
ao = o1.selectNodes(ns.length ? (ns+':element') : 'element');
if (ao.length == 0)
continue;
if (ot == null)
ot = new Array();
for (var i = 0; i < ao.length; i++)
{
var s = getAttrib(ao[i], "name");
if (s == null)
{
var s = getAttrib(ao[i], "ref");
if (s != null)
{
oS.refs[s] = ot;
}
}
else
ot[s] = parseElem(oS, oschm, ao[i], ssffx);
}
continue;
case 'complexContent' :
var o2 = o1.firstChild;
switch(o2.baseName)
{
case 'extension' :
var base = getAttrib(o2, "base");
if (base == null)
continue;
var ab = base.split(":");
var oBase = new Object();
oBase.nsuri = ab.length > 1 ? oS.ns[ab[0]] : oschm.uri;
oBase.base = ab.length > 1 ? ab[1] : ab[0];
ot = parseComplexType(oS, oschm, o2, ssffx);
oBase.type = getAttrib(o, "name");
oBase.derivedType = ot;
oBase.fExpanded = false;
if (oBase.type != null)
oS.exts[oBase.type] = oBase;
else
oS.exts[oS.exts.length] = oBase;
continue;
case 'restriction' :
return parseComplexType(oS, oschm, o2, ssffx);
case 'all' :
return parseComplexType(oS, oschm, o1, ssffx);
}
continue;
case 'attribute' :
var at=o1.attributes.getQualifiedItem("arrayType",oS.ns["wsdl"]);
if (at == null)
at=o1.attributes.getQualifiedItem("arrayType",oS.ns["soap"]);
if (at == null)
{
if (ot == null)
ot = new Array();
ot[getAttrib(o1, "name")] = parseAttrib(o1);
continue;
}
var tn = getBaseName(at.value);
if (ot != null)
{
var oe = get1stAryItem(ot);
oe.fArray = true;
oe.sizeArray = new Array();
parseArrayType(oe.sizeArray,
tn.substring(tn.indexOf("[")+1, tn.length));
continue;
}
var oe = new Object();
var a = tn.split("[");
if (a.length < 2)
continue;
oe.ns = getQualifier(at.value);
oe.ns = getUniqueNsq(oS, o1, oe.ns);
oe.name = a[0];
oe.fArray = true;
oe.type = a[0];
oe.sizeArray = new Array();
parseArrayType(oe.sizeArray,
tn.substring(tn.indexOf("[")+1, tn.length));
ot = new Array();
ot[a[0]] = oe;
continue;
default:
ot = null;
}
}
return ot;
}
function parseAttrib(o)
{
var attrib = new Object();
attrib.fAttrib = true;
var st = getAttrib(o, "type");
if (st != null)
{
var a = st.split(":");
attrib.type = a.length > 1 ? a[1] : a[0];
attrib.ns = a.length > 1 ? a[0] : null;
}
attrib.fixed = getAttrib(o, "fixed");
attrib.name = getAttrib(o, "name");
attrib.allowed = getAttrib(o, "use") != "prohibited";
return attrib;
}
function parseElem(oS, oschm, o, ssffx)
{
var oe = new Object();
oe.name = getAttrib(o, "name");
var st = getAttrib(o, "type");
if (st == null)
st = getAttrib(o, "xsi:type");
var minOccurs = getAttrib(o, "minOccurs");
var maxOccurs = getAttrib(o, "maxOccurs");
oe.fArray = (maxOccurs != null && maxOccurs != "1");
if (st != null)
{
oe.type = getBaseName(st);
oe.ns = getQualifier(st);
if (oe.ns == '')
oe.ns = oschm.qdef;
return oe;
}
if (typeof ssffx != 'undefined')
oe.type = ssffx + '_' + oe.name;
else
oe.type = oe.name;
var ct = parseType(oS, oschm, o.firstChild, ssffx);
oschm.types[oe.type] = ct;
return oe;
}
function parseSoapHeader(oS, o)
{
var hdrInfo = new Object();
hdrInfo.ns = getAttrib(o, "namespace");
hdrInfo.es = getAttrib(o, "encodingStyle");
var sUs = getAttrib(o, "use");
hdrInfo.fLiteral = (sUs != null && sUs.toLowerCase()=='literal');
var smsg = getAttrib(o, "message");
var amh = oS.msgs[getBaseName(smsg)];
var spart = getAttrib(o, "part");
hdrInfo.fRequired = getAttrib(o, "required") == "true";
hdrInfo.type = amh.args[getBaseName(spart)];
return hdrInfo;
}
function expBase(oS, a, t)
{
if (t.fExpanded)
return;
if (a[t.base] != null)
expBase(oS, a, a[t.base]);
t.fExpanded = true;
var oSchm = oS.schemas[t.nsuri];
var oSuper = oSchm.types[t.base];
if (oSuper == null)
return;
for (var x in oSuper)
if (t.derivedType[x] == null)
t.derivedType[x] = oSuper[x];
}
function parseSchemas(oS, nSchemas)
{
for (var j = 0; j < nSchemas.length; j ++)
{
var oSchm = new Object();
oSchm.uri = getAttrib(nSchemas[j], "targetNamespace");
oSchm.efd = getAttrib(nSchemas[j], "elementFormDefault");
oSchm.afd = getAttrib(nSchemas[j], "attributeFormDefault");
var nsdef = nSchemas[j].namespaceURI;
if (nsdef == null || nSchemas[j].prefix != '')
nsdef = oSchm.uri;
oSchm.qdef = oS.nsalias[nsdef];
if (oSchm.qdef == null)
{
oSchm.qdef = "";
oS.ns[oSchm.qdef] = nsdef;
oS.nsalias[nsdef] = oSchm.qdef;
}
oSchm.service = oS.url;
oSchm.elems = new Array();
oSchm.types = new Array();
oSchm.sTypes = new Array();
var nElements = nSchemas[j].childNodes;
for (var k = 0; k < nElements.length; k ++)
{
var sn = getAttrib(nElements[k], "name");
if (sn == null)
continue;
switch(nElements[k].baseName)
{
case 'element' :
oSchm.elems[sn] = parseElem(oS,oSchm,nElements[k],sn);
break;
case 'simpleType' :
case 'complexType' :
oSchm.types[sn] = parseType(oS, oSchm, nElements[k]);
break;
}
}
oS.schemas[oSchm.uri] = oSchm;
}
}
function parseSdl(oS, xmlSdl)
{
if (xmlSdl == null)
return false;
var nsq = getQualifier(xmlSdl.nodeName);
nsq = nsq.length == 0 ? "" : (nsq + ":");
var nMsgs = xmlSdl.selectNodes(nsq + "message");
var nPort = xmlSdl.selectNodes(nsq + "portType");
var nBinding = xmlSdl.selectNodes(nsq + "binding");
var nService = xmlSdl.selectNodes(nsq + "service");
var nTypes = xmlSdl.selectNodes(nsq + "types");
var aMsgs = new Array();
var aPort = new Array();
var aBinding = new Array();
oS.targetns = getAttrib(xmlSdl, "targetNamespace");
oS.ns["xsd"] = "http://www.w3.org/2001/XMLSchema";
oS.ns["soapenc"] = "http://schemas.xmlsoap.org/soap/encoding/";
oS.ns["wsdl"] = "http://schemas.xmlsoap.org/wsdl/";
oS.ns["soap"] = "http://schemas.xmlsoap.org/wsdl/soap/";
oS.ns["SOAP-ENV"] = 'http://schemas.xmlsoap.org/soap/envelope/';
oS.schemas = new Array();
oS.msgs = aMsgs;
oS.refs = new Array();
oS.exts = new Array();
for (var i = 0; i < xmlSdl.attributes.length; i++)
{
var oAtt = xmlSdl.attributes.item(i);
if (oAtt.name == "xmlns")
continue;
var ii = oAtt.name.indexOf("xmlns:");
if (ii != 0)
continue;
var nsn = oAtt.name.substring(6, oAtt.name.length);
if (oS.ns[nsn] != null)
continue;
oS.ns[nsn] = oAtt.value;
oS.nsalias[oAtt.value] = nsn;
}
if (oS.ns["xsi"] == null)
oS.ns["xsi"] = oS.ns["xsd"] == xsd99 ? xsi99 : xsi01;
for (var i = 0; i < nTypes.length; i ++)
parseSchemas(oS, nTypes[i].childNodes);
for (var x in oS.refs)
{
var q = getQualifier(x);
var nsUri = oS.ns[q];
var oschm = oS.schemas[nsUri];
if (oschm == null)
continue;
var ot = oschm.elems[getBaseName(x)];
oS.refs[x][ot.name] = ot;
}
for (var i in oS.exts)
expBase(oS, oS.exts, oS.exts[i]);
for (var i = 0; i < nMsgs.length; i++)
{
var sName = getAttrib(nMsgs[i], 'name');
aMsgs[sName] = new Object();
var ps = nMsgs[i].selectNodes(nsq + "part");
aMsgs[sName].args = new Array();
for (var j = 0; j < ps.length; j ++)
{
var ap = new Object();
ap.name = getAttrib(ps[j], "name");
ap.type = getAttrib(ps[j], "type");
ap.elem = getAttrib(ps[j], "element");
if (ap.elem != null)
{
ap.ns = getQualifier(ap.elem);
ap.elem = getBaseName(ap.elem);
}
if (ap.type != null)
{
ap.ns = getQualifier(ap.type);
ap.type = getBaseName(ap.type);
}
ap.ns = getUniqueNsq(oS, ps[j], ap.ns);
aMsgs[sName].args[ap.name] = ap;
}
aMsgs[sName].argl = ps.length;
}
for (var i = 0; i < nPort.length; i++)
{
var sName = getAttrib(nPort[i], "name");
aPort[sName] = new Object();
var nops = nPort[i].selectNodes(nsq + "operation");
var oops = new Array();
aPort[sName].ops = oops;
for (var j = 0; j < nops.length; j++)
{
var sOpName = getAttrib(nops[j], "name");
var nInputs = nops[j].selectNodes(nsq + "input");
var mInput = null;
if (nInputs.length > 0)
{
var s = getAttrib(nInputs[0], "message");
var sMsgName = getBaseName(s);
var sNS = getQualifier(s);
if (oops[sOpName] == null)
oops[sOpName] = new Array();
var sin = getAttrib(nInputs[0], "name");
if (sin != null)
oops[sOpName][sin] = aMsgs[sMsgName];
else
oops[sOpName][sOpName] = aMsgs[sMsgName];
if (aMsgs[sMsgName] == null)
break;
aMsgs[sMsgName].opname = sOpName;
mInput = aMsgs[sMsgName];
var firstArg = get1stAryItem(mInput.args);
if (sin != null)
sOpName = sin;
mInput.fWrapped = mInput.argl == 1 && firstArg != null
&& (firstArg.type == sOpName || firstArg.elem == sOpName);
}
var nOutputs = nops[j].selectNodes(nsq + "output");
if (nOutputs.length > 0)
{
var s = getAttrib(nOutputs[0], "message");
var sMsgName = getBaseName(s);
var sSoapName = aMsgs[sMsgName].soapName;
if (sSoapName == null)
aPort[sName].ops[sMsgName] = aMsgs[sMsgName];
else
{
aPort[sName].ops[sSoapName] = aMsgs[sMsgName];
aMsgs[sSoapName] = aMsgs[sMsgName];
}
if (mInput != null)
mInput.response = aMsgs[sMsgName];
}
mInput.fOneWay = nOutputs.length == 0;
}
}
for (var i = 0; i < nBinding.length; i++)
{
var osoapb = nBinding[i].selectNodes("soap:binding");
if (osoapb == null || osoapb.length == 0)
continue;
var sStyle= getAttrib(osoapb[0], "style");
var sName = getAttrib(nBinding[i], "name");
aBinding[sName] = new Object();
var stype = getBaseName(getAttrib(nBinding[i], "type"));
aBinding[sName].msgs = aPort[stype].ops;
var nops = nBinding[i].selectNodes(nsq + "operation");
for (var j = 0; j < nops.length; j++)
{
var sOpName = getAttrib(nops[j], "name");
var input = nops[j].selectSingleNode(nsq + "input");
if (input == null)
continue;
var sin = getAttrib(input, "name");
if (sin == null)
sin = sOpName;
var oM = aBinding[sName].msgs[sOpName][sin];
if (oM == null)
continue;
var nsoapops = nops[j].selectNodes("soap:operation");
if (nsoapops.length == 0)
continue;
var sOpStyle= getAttrib(nsoapops[0], "style");
oM.soapAction = getAttrib(nsoapops[0], "soapAction");
var nsoapbody = nops[j].selectNodes(nsq + "input/soap:body");
if (nsoapbody.length > 0)
{
oM.ns = getAttrib(nsoapbody[0], "namespace");
oM.es = getAttrib(nsoapbody[0], "encodingStyle");
var sUs = getAttrib(nsoapbody[0], "use");
oM.fLiteral = (sUs != null && sUs.toLowerCase() == 'literal');
}
var nheadIn = nops[j].selectNodes(nsq + "input/soap:header");
oM.hdrsIn = new Array();
for (var k = 0; k < nheadIn.length; k ++)
oM.hdrsIn[k] = parseSoapHeader(oS, nheadIn[k])
var nheadOut = nops[j].selectNodes(nsq + "output/soap:header");
oM.hdrsOut = new Array();
for (var k = 0; k < nheadOut.length; k ++)
oM.hdrsOut[k] = parseSoapHeader(oS, nheadOut[k])
if (sOpStyle != null)
oM.fRpc = sOpStyle.toLowerCase()=='rpc';
else
oM.fRpc=(sStyle !=null && sStyle.toLowerCase()=='rpc');
}
}
oS.soapPort = new Array();
oS.headers = new Array();
if (nService.length == 0)
{
oS.defPortName = "defaultPort";
var aPort = new Object();
oS.soapPort[oS.defPortName] = aPort;
aPort.location = null;
var firstBind = get1stAryItem(aBinding);
aPort.msgs = firstBind == null ? (new Array()) : firstBind.msgs;
return;
}
var nports = nService[0].selectNodes(nsq + "port");
for (var j = 0; j < nports.length; j++)
{
var oAddress = nports[j].selectNodes("soap:address");
if (oAddress.length == 0)
continue;
var oSOAPHdr = nports[j].selectNodes("soap:header");
for (var k = 0; k < oSOAPHdr.length; k ++)
oS.headers[k] = parseSoapHeader(oS, oSOAPHdr[k]);
oPort = new Object();
oPort.location = getAttrib(oAddress[0], "location");
var b = aBinding[getBaseName(getAttrib(nports[j], "binding"))];
if (b == null)
continue
oPort.msgs = b.msgs;
var szname = getAttrib(nports[j], "name");
oS.soapPort[szname] = oPort;
if (oS.defPortName == null)
oS.defPortName = szname;
}
}
function ensureXmlHttp(fAsync, oS)
{
var oXmlHttp = null;
var fCreate = fAsync ? oS.aXmlHttp == null : oS.sXmlHttp == null;
if (!fCreate && oS.fSeq)
{
oXmlHttp = fAsync ? oS.aXmlHttp : oS.sXmlHttp;
oXmlHttp.fFree = false;
return oXmlHttp;
}
for (var i = 0; i < _aXmlHttp.length; i++)
if (_aXmlHttp[i].fFree)
{
_aXmlHttp[i].fFree = false;
oXmlHttp = _aXmlHttp[i];
break;
}
if (oXmlHttp == null)
{
var xmlHttp;
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
return null;
}
var oXmlHttp = new Object();
oXmlHttp.fFree = false;
oXmlHttp.xmlHttp = xmlHttp;
_aXmlHttp[_aXmlHttp.length] = oXmlHttp;
}
if (!oS.fSeq)
return oXmlHttp;
if (fAsync)
oS.aXmlHttp = oXmlHttp;
else
oS.sXmlHttp = oXmlHttp;
return oXmlHttp;
}
function encodeHeader(oS, oM, oCall)
{
var co = oCall.co;
var sh = co.SOAPHeader == null ? oS.SOAPHeader : co.SOAPHeader;
if (sh == null)
return "";
var ht = (oM.hdrsIn == null) ? oS.headers : oM.hdrsIn;
var szHeader = "";
if (typeof sh == 'string')
szHeader = sh;
else if (typeof sh == 'object' && sh.xml != null)
szHeader = sh.xml;
else if (ht.length != 0)
{
oM1 = new Object();
oM1.opname = null;
oM1.ns = oM.ns;
oM1.fRpc = oM.fRpc;
oM1.fWrapped = false;
for (var i = 0; i < ht.length; i++)
{
if (sh[i] == null)
{
if (ht[i].fRequired)
return returnError(oCall, 9);
continue;
}
oM1.fLiteral = ht[i].fLiteral;
var ta = new Array();
ta[ht[i].type.name] = ht[i].type;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -