How do I connect to a CRM IFD web service?

孤人 提交于 2019-12-25 01:52:34

问题


I have taken the code from the SDK and made just one modification to set the authentication type but when I try to connect I get an "Unauthorized" error.

My code is:

// Set up the CRM Service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 2;
token.OrganizationName = "TESTCRM";


CrmService service = new CrmService();
service.Url = "https://testcrm.ifdtestsystem.com/MSCrmServices/2007/CrmService.asmx";
service.CrmAuthenticationTokenValue = token;
//service.Credentials = System.Net.CredentialCache.DefaultCredentials;
service.Credentials = new NetworkCredential("Bill", "Password");


// Create an account entity and assign data to some attributes.
account newAccount = new account();
newAccount.name = "Greg Bike Store";
newAccount.accountnumber = "123456";
newAccount.address1_postalcode = "98052";
newAccount.address1_city = "Redmond";


// Call the Create method to create an account.
Guid accountId = service.Create(newAccount);

回答1:


When using SPLA (IFD) you need to also populate the token with a crmticket.The ticket can be retrieved by quering the CrmDiscoveryService.




回答2:


This document contains a reasonable sample how to use CrmDiscoveryService to obtain a ticket and set up CrmService.

Note that Credentials property for the service will no longer be required as all authentication information will be inside the ticket.

Hope this helps



来源:https://stackoverflow.com/questions/759500/how-do-i-connect-to-a-crm-ifd-web-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!