MS CRM Dynamics 4.0 のフォームの onSave イベントからスクリプトに AJAX 要求を行う必要があります。私が今持っているコードは
var http_request;
// Prepare the xmlHttpObject and send the request.
try{
http_request = new ActiveXObject("Msxm12.XMLHTTP");
}catch(e){
try{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
alert("Something went wrong..");
}
}
var poststr = "foo=bar";
http_request.open("POST", "/folder/index.html", false);
http_request.setRequestHeader("Content-Type","text/xml; charset=utf-8");
http_request.send(escape(poststr));
// Capture the result.
var resultXml = http_request.responseText;
alert(resultXml);
アラートに 404 タイプのエラーの内容が表示されるようになりました。ページがそこにあると確信しています。ブラウザから利用できます。
http_request.open("POST", "/folder/index.html", false);
をopen()に変更すると
http_request.open("POST", "localhost:5555/folder/index.html", false);
、「許可が拒否されました」と言って失敗します。
更新 (2009 年 12 月 7 日);
CRM の ISV フォルダーに仮想ディレクトリを作成し、ASP.NET アプリケーションをアップロードしました。ここで、crm.url.nl:5555/ISV/Default.aspx にアクセスすると、次のようになります。
「Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider、Microsoft.Crm.WebServices、Version=4.0.0.0、Culture=neutral、PublicKeyToken=31bf3856ad364e35」は存在しません。パラメーター名: Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider、Microsoft.Crm.WebServices、バージョン = 4.0.0.0、カルチャ = ニュートラル、PublicKeyToken = 31bf3856ad364e35
スタックトレース付き;
[ArgumentException: 'Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' doesn't exist.
Parameter name: Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]
Microsoft.Crm.Authentication.BaseAuthenticationSettings.CreateType(String typeName, Type requiredBaseType) +265
Microsoft.Crm.Authentication.BaseAuthenticationSettings.CreateProvider(String typeName, IDictionary`2 configuration) +28
Microsoft.Crm.Authentication.AuthenticationPipelineSettings.LoadPipeline() +262
Microsoft.Crm.Authentication.AuthenticationPipelineSettings.get_AuthenticationProvider() +16
Microsoft.Crm.Authentication.AuthenticationEngine.Execute(Object sender, EventArgs e) +524
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
誰にもアイデアはありますか?.NET アプリケーションは、Response に 1 つの単語を書き込むだけなので、特別なことは何もありません...