Friday, 13 February 2009

NAV Web Services

So we have been doing some integration work between a custom piece of development and NAV2009. Our NAV Dev setup some code and exposed it as a series of web services. To test them a simple console app was written and everything was good.
Then they tried running the console app on a different machine to the NAV web service, all of a sudden nothing worked.
We went back over the config settings of the console app and confirmed that it was pointing to the correct URL for the web service, which it was, but for some reason when we ran it it kept trying to look for the service on the localhost. This turned out to be a setting in Visual Studio that by default embeds the URL of the web service when you register it, who knew..... well one of our .NET devs did thankfully. So by changing the GenerateDefaultValueInCode to False your solution will look to the Config file instead.














So after changing that and rebuilding the app we tried again. Still not working. After much testing with little joy we tried some simple tests on a different set of machines, on these we managed to get the following




Turned out that Windows firewall was blocking the port we were using, so after adding an exception to the firewall everything worked fine.
So next time we do some of this stuff we are going to make sure the server has the port unblocked and that we remember to tell Visual Studio not to imbed the web service URL (its default action) so we can control it with a config file.