📄 webservice.htc
字号:
case "portType" :
case "binding" :
case "service" :
xmlSdl.appendChild(oImp);
break;
default :
var nsq = getQualifier(xmlSdl.nodeName);
nsq = nsq.length == 0 ? "" : (nsq + ":");
var nt = oS._oXml.XMLDocument.createElement(nsq + "types");
xmlSdl.appendChild(nt);
nt.appendChild(oImp);
}
oS.imports[i].removeNode(true);
oS.imports[i] = null;
if (oS.cImporting == 0)
{
processService(oS);
return;
}
}
}
function loadImports(oS)
{
var xmlSdl = oS._oXml.documentElement;
if (xmlSdl == null)
return true;
var nsq = getQualifier(xmlSdl.nodeName);
nsq = nsq.length == 0 ? "" : (nsq + ":");
var nImp = xmlSdl.selectNodes(nsq + "import");
if (nImp.length == 0)
return true;
oS.imports = new Array();
oS.cImporting = 0;
for (var i = 0; i < nImp.length; i++)
{
var oImp = document.createElement("XML");
document.body.appendChild(oImp);
oImp.fPending = true;
oS.imports[i] = oImp;
oImp.onreadystatechange = function() {onImportLoaded(oS)};
var impUrl = getAttrib(nImp[i], "location");
if (impUrl == null)
continue;
oS.cImporting ++;
oImp.src = impUrl;
}
return false;
}
function invokeNext(svcName)
{
var oS = _sdl[svcName];
if (oS == null)
return;
var oC = oS.nextCall;
if (oC == null)
return null;
oS.nextCall = oC.next;
if (oS.nextCall == null)
oS.lastCall = null;
_invoke(oC);
}
function callNext(oS)
{
if (oS.fSeq)
setTimeout(element.uniqueID + '.invokeNext("' + oS.url + '")', 0);
}
function getAttrib(o, sAName)
{
if (o.attributes == null)
return null;
var a = o.attributes.getNamedItem(sAName);
if (a != null)
return a.value;
return null;
}
function getBaseName(str)
{
var a = str.split(":");
if (a.length > 1)
return a[1];
return str;
}
function getQualifier(str)
{
var a = str.split(":");
if (a.length > 1)
return a[0];
return '';
}
function getNextNsq(oS)
{
var nsq1;
do
{
nsq1 = "mswsb" + _nextNsQ;
_nextNsQ ++;
}
while (oS.ns[nsq1] != null)
return nsq1;
}
function getUniqueNsq(oS, o, litNsq)
{
if (litNsq == null)
return litNsq;
var nsuri = null;
if (litNsq == '')
nsuri = o.namespaceURI;
else
{
var o1 = o;
while (o1 != null)
{
nsuri = getAttrib(o1, 'xmlns:'+litNsq);
if (nsuri != null)
break;
o1 = o1.parentNode;
}
}
if (nsuri == null)
return litNsq;
var nsq1 = oS.nsalias[nsuri];
if (nsq1 != null)
return nsq1;
litNsq = getNextNsq(oS);
oS.ns[litNsq] = nsuri;
oS.nsalias[nsuri] = litNsq;
return litNsq;
}
function parseSimpleType(oS, oschm, o, ssffx)
{
var ns = getQualifier(o.tagName);
var o1 = o.firstChild;
if (o1 == null)
return null;
var sn = getAttrib(o, "name");
if (sn == null)
return null;
sn = getBaseName(sn);
var ot = new Object();
ot.name = sn;
switch(o1.baseName)
{
case 'restriction' :
var base = getAttrib(o1, "base");
if (base == null)
{
ot.ns = "xsd";
ot.type = "string";
}
else
{
ot.type = getBaseName(base);
ot.ns = getQualifier(base);
}
oschm.sTypes[sn] = ot;
break;
case 'list' :
case 'union' :
//
// treat union/list as string
//
ot.type = "string";
ot.ns = "xsd";
oschm.sTypes[sn] = ot;
break;
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 soapns = oS.ns[oS.qlt["soap"]];
var wsdlns = oS.ns[oS.qlt["wsdl"]];
var at=o1.attributes.getQualifiedItem("arrayType", wsdlns);
if (at == null)
at=o1.attributes.getQualifiedItem("arrayType", soapns);
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];
if (oe.type == "anyType" && oS.ns[oe.ns] == oS.ns["xsd"])
oe.type = "string";
oe.sizeArray = new Array();
parseArrayType(oe.sizeArray,
tn.substring(tn.indexOf("[")+1, tn.length));
ot = new Array();
ot[a[0]] = oe;
continue;
}
}
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;
if (oe.type == "anyType" && oS.ns[oe.ns] == oS.ns["xsd"])
oe.type = "string"; // note: only string is allowed for anyType
return oe;
}
oe.ns = oS.nsalias[oschm.uri];
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;
}
//
// expand base types
// a[in] : derived type array
// t[in] : derived type for which we want base types to be expanded
//
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 || t.derivedType == 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 schmUri = getAttrib(nSchemas[j], "targetNamespace");
if (oS.schemas[schmUri] == null)
{
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();
oS.schemas[oSchm.uri] = oSchm;
}
else
oSchm = oS.schemas[schmUri];
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;
}
}
}
}
//
// parse Wsdl from xml DOM object
// xmlSdl[in] : xml DOM object
// szService : service url
//
function parseWsdl(oS, xmlSdl)
{
if (xmlSdl == null)
return false;
var nsq = getQualifier(xmlSdl.nodeName);
nsq = nsq.length == 0 ? "" : (nsq + ":");
var nsqMsg = nsq;
var nsqPort = nsq;
var nsqBinding = nsq;
var nsqService = nsq;
var nsqTypes = nsq;
var nMsgs = xmlSdl.selectNodes(nsq + "message");
var nPort = xmlSdl.selectNodes(nsq + "portType");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -