Hi guys,
I have to get some data from a web service. So I have created a simple console application to test the server. That worked.
Then I have create a new class library project and built it in same way as my console application (added same WSDL manually, copy&pasted some code).
Then after adding the project to AX AOT and setting it up (deployment properties etc.), restarting AOS, generating CIL and all other "maintenance" tasks just to be sure, I have tried to call the code from X++ which is calling the web service to retrieve data. But as soon as the debugger gets to the line where the web service client object is created (which works fine in the console application) I get the exception:
"Could not find default endpoint element that references contract 'xxxxxx.xxxxx' 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"
I have found this post which describes the same problem that AX ignores the .NET configuration files since the Ax32serv.exe or Ax32.exe are "custom" executables.
http://community.dynamics.com/ax/f/33/t/83437.aspx
Similar problem is described here (is not AX related, but sounds similar):
http://stackoverflow.com/questions/3188965/could-not-find-endpoint-element-with-name
Before going this way (providing the parameters as C# objects and not XML) I checked with some guys and they say that they already have VS projects added and being used in X++ and the config file is used; otherwise their process wouldn't work.
I am not sure about it and weren't able to test it myself yet.
In general, as far as I know .NET runtime creates the config file in the same directory as the exe file and names it xxxx.exe.config.
If you look into the bin directory of the AOS, you will find such file: Ax32Serv.exe.config. But it is only for the standard services.
When you look into the \bin\VSAssemblies folder, you will see for every VS project there are two files:
MyCode.dll
MyCode.dll.config
So I expect when running the code AX should use this config. But I don't know if it happens.
I am quite sure my app.config is correct (at least it works in the console application).
And also the other two posts indicate that AX ignores the config files created and deployed from VS projects.
Have you guys had same problems? How would you approach this?