1

IE以外のブラウザからWebサービスを呼び出すときに、CRMjavascriptに問題があります。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");

ActiveXObjectを使用できるため、IEでは正しく実行されますが、Firefox/Chromeでは失敗します。Webサービスを呼び出す代わりの提案を探しています。誰か助けてもらえますか?ありがとう!

4

1 に答える 1

1

で試してみてください

var xHReq = new XMLHttpRequest();

IE7+でも機能します

于 2013-03-26T09:00:11.053 に答える