AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX: Программирование
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.12.2016, 15:33   #1  
Pandasama is offline
Pandasama
Участник
 
449 / 133 (5) +++++
Регистрация: 11.08.2014
Адрес: Барнаул
Consume external web-service through proxy
Коллеги,
ситуация такая:
ax2012r3
есть внешний сервис
в VS стандартным образом создан прокси-класс (с Service Reference на внешний сервис)
из аксапты идет обращение к нему с попыткой отправить туда данные

в ответ получаем ошибку 407 - нужна аутентификация на прокси

вопрос:
1) как в аксапте (или в прокси-классе, его конфиге или параметра Service Reference) задать сервис-клиенту параметры прокси-сервера?
2) как получить из системы стандартные параметры прокси?
Старый 16.12.2016, 08:56   #2  
Pandasama is offline
Pandasama
Участник
 
449 / 133 (5) +++++
Регистрация: 11.08.2014
Адрес: Барнаул
Собственно, первый вопрос решился примерно вот таким образом. А второй не столь актуален для меня.
X++:
MyNamespace.MyServiceType                                               _client;
ClrObject                                                               clientType;
System.ServiceModel.Description.ServiceEndpoint                         endPoint;
System.ServiceModel.BasicHttpBinding                                    binding;
System.ServiceModel.BasicHttpSecurity                                   security;
System.ServiceModel.BasicHttpSecurityMode                               securityMode;
System.ServiceModel.HttpTransportSecurity                               httpTransportSecurity;
System.ServiceModel.HttpProxyCredentialType                             httpProxyCredType;
System.Uri                                                              proxyUri;

...

clientType = CLRInterop::getType("MyNamespace.MyServiceType");
_client = AifUtil::CreateServiceClient(clientType);

endPoint = _client.get_Endpoint();

binding = endPoint.get_Binding();

binding.set_UseDefaultWebProxy(false);

proxyUri = new System.Uri("http://proxy.site.ru:8080");
binding.set_ProxyAddress(proxyUri);

security = binding.get_Security();
httpTransportSecurity = security.get_Transport();
httpProxyCredType = System.ServiceModel.HttpProxyCredentialType::Windows;
httpTransportSecurity.set_ProxyCredentialType(httpProxyCredType);

security.set_Transport(httpTransportSecurity);
binding.set_Security(security);
endPoint.set_Binding(binding);
За это сообщение автора поблагодарили: Maxim Gorbunov (2).
Теги
ax2012, proxy, web-service

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: Calling AX 2012 Business Logic from SSIS Using a Script Task and Custom Web Service Blog bot DAX Blogs 0 12.11.2015 03:48
atinkerersnotebook: Using Service Management to Track Service Orders Blog bot DAX Blogs 1 25.08.2013 19:16
AIF: Microsoft Dynamics AX Services and Windows Azure Service Bus Blog bot DAX Blogs 0 24.07.2013 03:13
emeadaxsupport: AX for Retail 2012 R2: Installing the Real-time Service Blog bot DAX Blogs 0 19.12.2012 11:11
Pokluda: Outbound web service (AIF) Blog bot DAX Blogs 0 28.10.2006 17:43

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 15:38.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.