Показать сообщение отдельно
Старый 17.10.2008, 12:13   #1  
sergeyjb is offline
sergeyjb
Участник
Аватар для sergeyjb
 
68 / 12 (1) ++
Регистрация: 01.10.2008
Обращение к CrmService
Стандартный код выдает ошибку

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.IO;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using CrmSdk;
using CrmSdk.Discovery;
public partial class UpdateActivity : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.ContentType = "text/xml";

CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = "Samarasoft";

CrmService crmService = new CrmService();
crmService.CrmAuthenticationTokenValue = token;
crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
AppSettingsReader appSettings = new AppSettingsReader();
crmService.Url = appSettings.GetValue("CrmSdk.CrmService", Type.GetType("System.String")).ToString();

task my_task = new task();
my_task.subject = "my_task_1";
Guid t_guid = new Guid("A64664F4-E699-DD11-B4E0-00A0C5B316E9");
Owner t_owner = new Owner();
t_owner.Value = t_guid;
t_owner.type = EntityName.systemuser.ToString();
my_task.ownerid = t_owner;
Guid accountId = crmService.Create(my_task);
}
}

Ошибка идет на шаге Guid accountId = crmService.Create(my_task); такая:

Exception information:
Exception type: SoapException
Exception message: System.Web.Services.Protocols.SoapException: Сервер не распознал значение заголовка HTTP SOAPAction: http://schemas.microsoft.com/crm/200...ervices/Create.
в System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
в System.Web.Services.Protocols.SoapServerProtocol.Initialize()
в System.Web.Services.Protocols.ServerProtocol.SetContext(Type type, HttpContext context, HttpRequest request, HttpResponse response)
в System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

Request information:
Request URL: http://crm:1001/UpdateActivity.aspx?...Mode=Completed
Request path: /UpdateActivity.aspx
User host address: 192.168.100.62
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Что то я уже всю голову сломал в чем дело - стандартная конструкция не работает
Подскажите в чем может быть дело...
__________________
Сергей Осипов, MCTS:SQL Server 2005, ООО "Программные технологии", Самара