I had modified a function in a .NET Web Service while adding an additional function to it. The Web Service reference had been previously added to the AOT, so I only needed to refresh the reference, in order for my changes (the additional funtion) to be “seen” by the AX development environment.
After publishing my modified Web Service to the web server, I located my reference to it within the AOT, right-clicked it, and selected “Regenerate”. After getting the usual expected slew of errors, that ultimately reveal the need to restart the AOS so that the new assemblies can be loaded, I did just that. However that’s when things got strange. First, when I attempted to test my method in AX which calls the web service, I received the following error:
Type 'System.ServiceModel.Channels.ReceivedFault' in assembly 'System.ServiceModel, Version=220.127.116.11, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.I verified that the function was a set to run on the server (public static server [return type] [method name])
I then recompiled my method, and received a “… does not contain this function” error, pointing to the call to my modified web service function, that I had previously been successfully calling in AX. I also verified that the new function I had created was not being seen by AX either. This was strange, because, I verified the function was indeed part of the service, by accessing it directly via the web browser. After doing several “regenerates” and restarts on the AOS, all to no avail, left me scratching my head. So I decided to try one more thing.
I had been executing the “regenerate” option on the service reference, via my the AX client application on my local machine. So this final time, I remoted into the machine where the AOS was actually running, and loaded up the client from there. I then executed the “regenerate” option again, and restarted the AOS one more time. To my pleasant surprise, my mysteriously missing web service function (and the new function I created) were suddenly visible in AX, and I could then execute my method call without receiving the System.ServiceModel.Channels.ReceivedFault error.
The so the moral of the story seems to be the following:
When you want to refresh your web service reference in AX, do it from the client application running on the same machine as the AOS!