Error when consuming AX 5.0 AIF Services from an external .NET client application: How to fix it!!


If you create an AIF Service from scratch (like creating an AX query and generating the WCF Service with the AIF wizard) and then you try to consume it from an external .NET client app, you'll get an error (at least with AX 5.0 CTP3 drop2). On the other hand, you are able to consume, with no problems, all the out-of-the-box AX 5.0 AIF services (like Customers, and so on).


So, the .NET error you get when consuming your own custom AIF Service is something like the following:


"Request Failed. See the Exception Log for details"

System.ServiceModel.FaultException was unhandled
  Message="Request Failed. See the Exception Log for details."
  Source="mscorlib"
  StackTrace:
    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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
       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)
       at WinAppClient.ExpenseRepService.BasicExpRepService.find(BasicExpRepServiceFindRequest request)
       at WinAppClient.ExpenseRepService.BasicExpRepServiceClient.WinAppClient.ExpenseRepService.BasicExpRepService.find(BasicExpRepServiceFindRequest request) in C:\Demos AX 5.0 and new MS techs\02 Demo Consuming AIF-WCF Services\Clients\WinAppClient\Service References\ExpenseRepService\Reference.cs:line 930
       at WinAppClient.ExpenseRepService.BasicExpRepServiceClient.find(QueryCriteria QueryCriteria) in C:\Demos AX 5.0 and new MS techs\02 Demo Consuming AIF-WCF Services\Clients\WinAppClient\Service References\ExpenseRepService\Reference.cs:line 936
       at WinAppClient.ExpenseReportForm.btnSubmitExpRep_Click(Object sender, EventArgs e) in C:\Demos AX 5.0 and new MS techs\02 Demo Consuming AIF-WCF Services\Clients\WinAppClient\ExpenseReportForm.cs:line 51
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at WinAppClient.Program.Main() in C:\Demos AX 5.0 and new MS techs\02 Demo Consuming AIF-WCF Services\Clients\WinAppClient\Program.cs:line 19
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

This is not a very descriptive error...


Anyway, it is very simple to fix it!!. What you gotta do is:


- Go to your AIF Service configuration properties (AOT), and add a SecurityKey. Then, you'll be able to consume your custom AIF-WCF Service with no errors/problems!!

Comments (1)

  1. rotemsapir says:

    Hi

    I was happy to see your post, since I though it would help me.

    Alas, I am already able to consume the WCF-AIF, but I get the same error when trying to call the ‘update’ method after changing data.

    If I call the update method without changing any data, it works fine, but if I do change anything (that I know I have permissions to change) I still get the error when calling ‘update’

    2 questions:

    1. Any idea on how this can be solved?
    2. Where is this ‘Exception Log ‘ they’re sending me to?

    BTW we’re using the AX 5.0 prerelease version.

Skip to main content