如何用js读取WebService返回的XML结果
1个回答
展开全部
function b() {
var weburl = 'http://10.10.10.160:1000/CRM.asmx';
var context = Xrm.Page.context;
var id = context.getUserId();
var info;
info = '';
info = info + 'http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="'">http://schemas.xmlsoap.org/soap/envelope/">';
info = info + '';
info = info + '
'">http://tempuri.org/">';
info = info +
' ' + id +
'';
info = info + ' ';
info = info + ' ';
info = info + '';
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("GET", weburl, false);
alert(xmlhttp);
xmlhttp.SetRequestHeader("Content-Type", "text/xml;
charset=gb2312");
xmlhttp.Send(info);
var rst =
xmlhttp.responseXML.selectSingleNode('//GetLoginNameResponse//GetLoginNameResult').text;
winddow.document.getElementByIdx_x("new_mark").value=rst;
}
var weburl = 'http://10.10.10.160:1000/CRM.asmx';
var context = Xrm.Page.context;
var id = context.getUserId();
var info;
info = '';
info = info + 'http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="'">http://schemas.xmlsoap.org/soap/envelope/">';
info = info + '';
info = info + '
'">http://tempuri.org/">';
info = info +
' ' + id +
'';
info = info + ' ';
info = info + ' ';
info = info + '';
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("GET", weburl, false);
alert(xmlhttp);
xmlhttp.SetRequestHeader("Content-Type", "text/xml;
charset=gb2312");
xmlhttp.Send(info);
var rst =
xmlhttp.responseXML.selectSingleNode('//GetLoginNameResponse//GetLoginNameResult').text;
winddow.document.getElementByIdx_x("new_mark").value=rst;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询