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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 21.11.2016, 12:22   #1  
AnGor is offline
AnGor
Участник
Аватар для AnGor
 
97 / 46 (2) +++
Регистрация: 30.08.2007
Адрес: Ulm
Записей в блоге: 6
? AIF Web Service from C# (AX 2009)
Всем привет!
Пытаюсь разобраться с AIF, Web Service + C#.
Методичку https://msdn.microsoft.com/en-US/lib...(v=AX.50).aspx почитал.
Установил AIF Web services, AX добавил Web site, настроил сервис.
Отредактировал web.config
PHP код:
    <bindings>
      <
basicHttpBinding>
        <
binding name="basicHttpBindingWindowsAuth">
          <
security mode="TransportCredentialOnly">
            <
transport clientCredentialType="Basic" />
          </
security>
        </
binding>
      </
basicHttpBinding>
        <
wsHttpBinding>
            <
binding name="wsHttpWindowsAuthAif"
                     
closeTimeout="00:10:00"
                     
openTimeout="00:10:00"
                     
receiveTimeout="01:00:00"
                     
sendTimeout="01:00:00"
                     
maxReceivedMessageSize="2147483647" >
                <
readerQuotas maxArrayLength="10000000" />
                <
security mode="None"></security>
            </
binding>
        </
wsHttpBinding>
    </
bindings>
    
    <
services>
      <
service behaviorConfiguration="serviceBehaviorConfiguration" name="Microsoft.Dynamics.IntegrationFramework.Service.InventoryOnHandService">
        <
endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpWindowsAuthAif" bindingNamespace="http://schemas.microsoft.com/dynamics/2008/01/services" contract="Microsoft.Dynamics.IntegrationFramework.Service.InventoryOnHandService" />
      </
service>
    </
services
и в проекте app.config
PHP код:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpWindowsAuthAif"
             closeTimeout="00:10:00"
             openTimeout="00:10:00"
             receiveTimeout="01:00:00"
             sendTimeout="01:00:00"
             maxReceivedMessageSize="2147483647" >
          <readerQuotas maxArrayLength="10000000" />
          <security mode="None"></security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://zeus2.ealtd.com/MicrosoftDynamicsAXAif50/inventoryonhandservice.svc"
          binding="wsHttpBinding" bindingConfiguration="wsHttpWindowsAuthAif"
          contract="AIFInventOnHandRef.InventoryOnHandService" name="InventoryOnHandService"/>
    </client>
  </system.serviceModel>
</configuration>
написал коротенькую C#
PHP код:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AIFInventOnHand.AIFInventOnHandRef;
namespace 
AIFInventOnHand
{
    class 
Program
    
{
        static 
void Main(string[] args)
        {
            
InventoryOnHandServiceClient client = new InventoryOnHandServiceClient();

            
QueryCriteria qc = new QueryCriteria();
            
CriteriaElement[] qe = { new CriteriaElement()};

            
EntityKey[] entityKey = { new EntityKey() };

            
qe[0].DataSourceName "InventSum";
            
qe[0].FieldName "ItemId";
            
qe[0].Operator Operator.Equal;
            
qe[0].Value1 "1AUSLAUFRÄDER";

            
qc.CriteriaElement qe;

            
Console.WriteLine("start");

            
entityKey client.findKeys(qc);
            if (
null == entityKey)
            {
                
Console.WriteLine("Item was not found.");
            }
            else 
            {
                
Console.WriteLine(entityKey.First().KeyData[1].Field);
                
Console.WriteLine(entityKey.First().KeyData[1].Value);
            }
            
Console.ReadKey();
            
client.Close();
        }
    }

на строчке с entityKey = client.findKeys(qc); вылетает с сообщением:

The Application Integration Framework Web service cannot determine the Windows login of the user calling the Web service. Check the Web server Event Viewer for more information, or contact your Administrator.

Соответствующий Event:
The description for Event ID 0 from source Dynamics Application Integration Server cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

An error occurred while Web service request http://zeus2.ealtd.com/MicrosoftDyna...andservice.svc and action http://schemas.microsoft.com/dynamic...rvice/findKeys were being processed. Error details: The Application Integration Framework Web service cannot determine the Windows login of the user calling the Web service. Check the Web server Event Viewer for more information, or contact your Administrator.


The WCF service cannot determine the Windows identity of the caller. If using basicHttpBinding, please update the Web.config file as follows using the MS Service Configuration Editor (in binding configuration):
1- Set the Mode property to TransportCredentialOnly.
2- Set the TransportClientCredentialType property to anything other than None.
3- In IIS, set the directory security for the virtual directory to match the TransportClientCredentialType. For example, if the TransportClientCredentialType property is set to Windows then set the IIS authentication method to Integrated Windows authentication..

The specified resource type cannot be found in the image file

Чувствую, что я что-то должен поменять в web.config и/или app.config, а что не пойму.
Помогите пожалуйста
Старый 21.11.2016, 12:30   #2  
Pandasama is offline
Pandasama
Участник
 
449 / 133 (5) +++++
Регистрация: 11.08.2014
Адрес: Барнаул
В веб.конфиге попробуйте что-нибудь типа
Код:
<security mode="Transport">
<transport clientCredentialType="Windows"/>
</security>
За это сообщение автора поблагодарили: AnGor (1).
Старый 21.11.2016, 13:02   #3  
AnGor is offline
AnGor
Участник
Аватар для AnGor
 
97 / 46 (2) +++
Регистрация: 30.08.2007
Адрес: Ulm
Записей в блоге: 6
Цитата:
Сообщение от Pandasama Посмотреть сообщение
В веб.конфиге попробуйте что-нибудь типа
Код:
<security mode="Transport">
<transport clientCredentialType="Windows"/>
</security>
так тоже пробовал. При таких утановках сервис даже в браузере не открывается (http://localhost/MicrosoftDynamicsAX...andservice.svc)

вот что в ивентах:
WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/40550573
Exception: System.ServiceModel.ServiceActivationException: The service '/MicrosoftDynamicsAXAif50/inventoryonhandservice.svc' cannot be activated due to an exception during compilation. The exception message is: Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].. ---> System.InvalidOperationException: Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http].
at System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses)
at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress)
at System.ServiceModel.ServiceHostBase.ApplyConfiguration()
at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
--- End of inner exception stack trace ---
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
Process Name: w3wp
Process ID: 5528
Старый 21.11.2016, 15:24   #4  
AnGor is offline
AnGor
Участник
Аватар для AnGor
 
97 / 46 (2) +++
Регистрация: 30.08.2007
Адрес: Ulm
Записей в блоге: 6
Заработало!
переписал web.config:
PHP код:
  <system.serviceModel>
    <
bindings>
      <
basicHttpBinding>
        <
binding name="basicHttpBindingWindowsAuth">
          <
security mode="TransportCredentialOnly">
              <
transport clientCredentialType="Windows">
                  <
extendedProtectionPolicy policyEnforcement="Never" />
              </
transport>
          </
security>
        </
binding>
      </
basicHttpBinding>
    </
bindings>
    
    <
services>

      <
service behaviorConfiguration="serviceBehaviorConfiguration" name="Microsoft.Dynamics.IntegrationFramework.Service.InventoryOnHandService">
        <
endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingWindowsAuth" bindingNamespace="http://schemas.microsoft.com/dynamics/2008/01/services" contract="Microsoft.Dynamics.IntegrationFramework.Service.InventoryOnHandService" />
      </
service>
    </
services
и app.config:
PHP код:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_InventoryOnHandService" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://zeus2.ealtd.com/MicrosoftDynamicsAXAif50/inventoryonhandservice.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_InventoryOnHandService"
          contract="AIFInventOnHandRef.InventoryOnHandService" name="BasicHttpBinding_InventoryOnHandService" />
    </client>
  </system.serviceModel>
</configuration>
За это сообщение автора поблагодарили: gl00mie (2).
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
DynamicsAxSCM: Service products in Microsoft Dynamics AX 2012 Blog bot DAX Blogs 2 02.06.2011 13:36
dynamics-ax: Dynamics AX 2009: Hotfix 981339 for Consuming external WCF Web service Blog bot DAX Blogs 0 24.03.2011 01:14
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
semanticax: Dynamics AX 2009 Installation - Application Blog bot DAX Blogs 0 22.12.2010 08:11
gatesasbait: Dynamics AX 2009 SSRS and SSAS Integration Tips Blog bot DAX Blogs 3 09.07.2009 13:07
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

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