Today for me was historic. For the past few years building mobile line of business solutions with Microsoft NAV meant hard graft. Mimicking functionality in .Net that NAV had built in, second guessing how functions inside NAV work and writing data straight into SQL bypassing all of NAV's validation. We'll things for me changed today in that I was finally able to get a glimmer of things to come. Using the Virtual PC image that provides a preview of NAV 2009 I was able to call directly into NAV using its new inbuilt web-services functionality.
So here's how you do it.
First get the Virtual PC 2007 image at Partner Source. You'll need to be a MBS partner to get this.
One done follow the instructions to get the Virtual Server up and running. The instructions explain all this better than I could. Finally logon as administrator.
Ok, over to my instructions. First we need to start the web-services server. You should find the start web-services icon on the desktop -
Ok, next we need to expose something in NAV that we want to use. Lets go for broke and use the Item card. On the start menu, launch the SQL NAV program.
When NAV starts up open the object designer and navigate to the 'Web Services' table as follows -
Run the Web Services table, I've added a single row with a service name of test, publishing object ID 30, which is the item card. My resultant record looks like this -
Ok, that's about it from the NAV side.
The final thing you need to-do is establish the IP address of the virtual server. I did this by running ipconfig in a DOS box.
OK, now over to .Net I built a sample mobile application and added a web-reference to in my case -
http://10.2.62.18:85/dynamicsnav/ws/CRONUS_International_Ltd/services
I'm going to skip over a few of the details here, but here is a snippet of my code to produce a list of items
nav2009.test_Binding ourws = Elements.WS_binding(); // < get a reference to our web-service setting the credentials and the URL
nav2009.test_Filter[] filters = new test_Filter[1]; // < setup a dummy array of filters, to get all items
filters[0] = new NAV2009Mobile.nav2009.test_Filter();
filters[0].Field = test_Fields.Description;
filters[0].Criteria = "";
this.dataGrid1.DataSource = ourws.Find(filters, "", 14); // < go get first few items
Final result is a very easy to accomplish list of items, aka THE MONEY SHOT -