Blog

Microsoft Dynamics AX Blog

2

I had a case where I tried to call a Dynamics AX 2009 AIF Web service from an XML Web Service (.asmx). But the new thing in this case is that the AIF Web Service call is actually inside a dll referenced in this new asmx web service.
When you reference that dll into a web service/asp.net project in the Visual Studio .NET, and then call the function inside that dll which calls the Dynamics AX AIF Web Service… you will have the following error:

System.InvalidOperationException: Could not find default endpoint element that references contract 'AXGLServiceRef.GeneralJournalService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef() at System.ServiceModel.ClientBase`1..ctor()
at AXWCFClassLibrary.AXGLServiceRef.GeneralJournalServiceClient..ctor()
at AXWCFClassLibrary.Class1.checkme() at Service.HelloWorld(String name, String accval) in d:WebSite1App_CodeService.cs:line 21

This error is actually due to that the end point that this dll is trying to reach is unidentified to this web application. What you have to do is:

  1. Go to the class library project where you created that dll
  2. Go to app.config
  3. Copy the whole ServiceModel part
  4. Go to the web.config in your new web application
  5. Paste the ServiceModel part inside the Configuration part

By this, you will be able to execute without getting that endpoint error

Dynamics AX 2012 Event

Recent Posts

Tags

Archives

Random Testimonial

  • ~ Ahmad Al-Shanshoury, Senior Dynamics AX Consultant at Al-Fanar IT

    ahmed el shanshoury"I am pleased to be able to write this recommendation for Mr. Amer Atiyah, I was lucky to work with Amer during our implementation of Dynamics AX at AlOthaim company. Since the day one, I know him as an energetic and goal-oriented person Amer demonstrated a strong work ethic and a dedication to success. His efforts have produced high quality results time and time again.His extraordinary ability to analyze problems and outline necessary courses of action was invaluable, simply I can see Amer innovative, creative, intelligent and ambitious, in addition of his powerful Technical background. Seldom have I been able to recommend someone without reservation. It is a pleasure to do so in the case of Amer"

  • Read more testimonials »