Цитата:
Сообщение от
a33ik
Может быть. Возня с сертификатами то еще удовольствие.
Цитата:
Сообщение от
probka
там тоже есть и логин и пароль
Вообще разрешать анонимный доступ к вебсервису (даже такой как CrmDiscoveryService) - это не очень хорошо.
Цитата:
Сообщение от
probka
Это Вы мне привели кусок не про авторизацию. Это параметры запроса, который передается в метод Execute веб сервиса. Внимательнее надо код читать. И так же можно было внимательнее почитать меня, я парой постов выше написала что значения параметров у меня есть.
Если мои слова Вас не убеждают, то, может быть, подскажете, как написать SOAP запрос к веб-сервису /MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx таким образом, чтобы он включал в себя и авторизацию на данном сервисе?
Чем Вас не устраивает ответ, помеченный как решение по ссылке выше?
CRM 4.0 Авторизация
X++:
1. Create an admin user in the active directory where the crm is install.
2. Add the user created in step 1 in the crm user.
3. Set the running user of the application as the created user in step 1.
4. Add the running user of the application pool of the crm service.
5. In the application, use the following code to connect to the discovery service (that give you a authentication ticket on crm) and use it to do the call:
CrmService service = new CrmService();
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = organization;
CrmDiscoveryService discoveryService = new CrmDiscoveryService();
discoveryService.UseDefaultCredentials = true;
discoveryService.Url = discoveryServiceUrl;
//Call the crm discovery service to get the related organisation of the user that execute the code (as created in step 2)
RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)discoveryService.Execute(orgRequest);
OrganizationDetail orgInfo = new OrganizationDetail();
foreach (OrganizationDetail orgDetail in orgResponse.OrganizationDetails)
{
if (orgDetail.OrganizationName == [your organisation name])
{
orgInfo = orgDetail;
var cred = ConfigurationData.GetUriCredentialSection("DiscoveryService/Credentials");
RetrieveCrmTicketRequest ticketRequest = new RetrieveCrmTicketRequest();
ticketRequest.OrganizationName = organization;
ticketRequest.UserId =[user name of the step 2 user]
ticketRequest.Password = [user password of the step 2 user]
RetrieveCrmTicketResponse ticketResponse = (RetrieveCrmTicketResponse)discoveryService.Execute(ticketRequest); //retrive the authentification
token.CrmTicket = ticketResponse.CrmTicket;
break;
}
}
service.CrmAuthenticationTokenValue = token;
service.Url = serviceUrl;
service.UseDefaultCredentials = true;
//Do your own call with service
6. Enjoy the crm service possibility!
Hope that could help somwone :)