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

  • ~ Mohammad A-Awami, Dynamics AX Specialist at WorleyParsons

    AlAwami"I worked with Amer for WorleyParsons. I found him very cooperative. He is able to help me in a lot of issues that related to ax. His ability to solve the problems is fascinating me. It is so fast and done on the best practice. His ability on business analysis and implantation are done on the best methods."

  • Read more testimonials »