我正在使用JQuery调用SharePoint Web服务(Webs.asmx)以获取所有子站点的列表:
$(document).ready(function() {
var hrefParts = window.location.href.split('/');
var wsURL = "";
for (i = 0; i < (hrefParts.length - 2); i++) {
if (i > 0)
wsURL += "/";
wsURL += hrefParts[i];
}
wsURL += "/_vti_bin/Webs.asmx";
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetAllSubWebCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
</GetAllSubWebCollection > \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: wsURL,beforeSend: function (xhr) {
xhr.setRequestHeader("SOAPAction","http://schemas.microsoft.com/sharepoint/soap/GetAllSubWebCollection");
},type: "POST",dataType: "xml",data: soapEnv,complete: processResult,error:function(xhr,err){
alert("readyState: "+xhr.readyState+"\nstatus: "+xhr.status);
alert("responseText: "+xhr.responseText);
},contentType: "text/xml; charset=\"utf-8\""
});
});
function processResult(xData,status) {
...
}
但是,由于beforeSend调用,我总是遇到登录问题.如果我将其注释掉,则会从SharePoint收到“访问被拒绝”错误页面.
我具有对该站点和所有子站点的“完全控制”访问权限.调用其他Web服务(例如,从list.asmx调用GetListCollection)成功.
这可能是什么问题?
最佳答案
原文链接:/jquery/530968.html