开发者

Using AIF webservices to connect to Microsoft Dynamics AX 2009

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.Fault开发者_C百科Exception: 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)


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 :-)


Try the following

        AX ax = new AX();//where AX=YourWebServiceClient

        ax.ChannelFactory.Credentials.UserName.UserName = @"domain\username";
        ax.ChannelFactory.Credentials.UserName.Password = @"password";

        CallContext context = new CallContext();
        context.Company = "YourCompany";

        Console.WriteLine(ax.YourServiceFunction(context));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜