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

  • ~ Muheet Shariff, Dynamics AX Consultant

    muheet"I have found Amer a pleasant, generous person who is never afraid to take on a challenging task.Amer is an independent, self directed person who is able to communicate effectively and meet even the most demanding challenges. I am positive he will make outstanding contributions to Microsoft technologies. It was a great experience working with Amer during our implementation of Dynamics AX at  Al-Fahad and Al-Othaim companies. His support to Microsoft Dynamics AX is outstanding and very professional. Technically he sounds very strong. It was a great pleasure to be associated along with Amer performing some challenging tasks. I wish him to reach the desired success with his professionalism."

  • Read more testimonials »