Quantcast
Channel: It's all about Dynamics
Viewing all articles
Browse latest Browse all 2

Webservices and XMLPorts

$
0
0

To connect a system, like a web shop, to your back office you can use webservices in Dynamics NAV 2009.The easy way is to just publish the pages you need in your application, but this won’t always suffice. Sometimes you just have a different need, in this case you can use the XMLPorts to open up this information to the webservice. But how do you do this ?It’s very easy…First create a new XML port, in my case I’m going to create a simple customer list with ship-to addresses.After I created this I can go to my codeunits. I create a single new codeunit named “Webservice Functions”, and in this codeunit a create a new function called “getAllCustomers”.Because I want to be able to return all customers, or just a selection based on which customers are changed I add a parameter for the modified date. I also want to return only the customers with a valid webshop ID (this is a custom field), so I also create a parameters called WebshopID.The last parameter I created is the XML Port “CustomerList”, on this one I also check the “var” box, because I want to be able to return the customer list to the webservice.I also selected a return value of a Boolean to be able to show if there are any records at all in my dataset.If I create a little project in visual studio I can test it.And that’s all, now I created a custom dataset with customers that a can return to the webservice. I’m also able to filter this dataset based on webshopID and modified date.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images