Мне нужно сделать AJAX-запрос к какому-либо сценарию из события onSave формы в MS CRM Dynamics 4.0.
Код, который у меня сейчас есть,
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);
до
http_request.open("POST", "localhost:5555/folder/index.html", false);
open () завершается ошибкой, говоря: «Отказано в доступе».
ОБНОВЛЕНИЕ (7 декабря 2009 г.);
Я создал виртуальный каталог в папке ISV CRM и обновил приложение ASP.NET. Теперь, если я перейду к crm.url.nl:5555/ISV/Default.aspx, я получу;
Microsoft.Crm.WebServices.Crm2007.CookieAndSoapHeaderAuthenticationProvider, Microsoft.Crm.WebServices, версия = 4.0.0.0, культура = нейтральная, 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 только одно слово, поэтому в этом нет ничего особенного ...