Using AIF webservices to connect to Microsoft Dynamics AX 2009

Hadi Eskandari picture Hadi Eskandari · Jul 15, 2011 · Viewed 8k times · Source

I'm using AIF webservices to connect to Microsoft Dynamics AX 2009. Proxies are generated for the service in VS2010, but when I want to connect to the service using generate client class, it seems I am not authenticated in the system.

I even tried adding a domain user/pass and use windows authentication, like this:

var binding = new BasicHttpBinding();
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
var address = new EndpointAddress(new Uri("http://dynamicsserver/salesorderservice.svc"));
var client = new SalesOrderServiceClient(binding, address);
client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("admin", "pass", "domain);

Default binding is HttpBinding, and I'm trying to connect to the AIF using a console application that is running using the same account specified in NetworkCredential on the same machine.

I get the following error when application connects to the webservice:

System.ServiceModel.FaultException: You cannot log on to Microsoft Dynamics AX.. Error details: Unable to log on to Microsoft Dynamics AX.. Check the Web server event viewer for more information, or contact your Administrator.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

Answer

Jan B. Kjeldsen picture Jan B. Kjeldsen · Jul 21, 2011

You are unable to log on to Microsoft Dynamics AX. Check the Web server event viewer for more information, or contact your Administrator.

Maybe you do not have been created as an AX user?

Also check Administration\Setup\Security\System service accounts especially the "Business connector proxy".

If all fails, check the logs of your web server or contact your system administrator :-)