从IE以外的浏览器调用Web服务时,我在CRM javascript上遇到问题。有关Web服务调用实现,请参见下面的代码。
function RetrieveMultipleEntity(targetEntity, conditionAttributeName, conditionAttributeValue, targetId, targetAttribute)
{
// Prepare variables to retrieve the contacts.
var authenticationHeader = GenerateAuthenticationHeader();
// Prepare the SOAP message.
// var xml = (the SOAP message)
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);
// Capture the result.
var resultXml = xHReq.responseXML;
return resultXml;
}
这条线上有一个问题:
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
它可以在IE上正确运行,因为它可以使用ActiveXObject,但不幸的是,它在Firefox / Chrome上无法运行。我正在寻找有关替代Web服务的建议。谁能帮我?谢谢!
最佳答案
尝试
var xHReq = new XMLHttpRequest();
它也适用于IE7 +
关于javascript - 使用ActiveX调用XRM Javascript调用Web服务的替代方法,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15632821/