It is great that you can create web services in NAV, but you should be able to use them in outside applications. This recipe will show you how to create a basic program to use these web services.
Create a new codeunit from Object Designer.
Add a function named
GetCustomer
.The function should take in the following parameter:
Name
DataType
Length
CustNo
Code
20
Add the following local variable to the function:
Name
DataType
SubType
Customer
Record
Customer
The function should return a text variable of length 50.
Add the following code to the function:
IF Customer.GET(CustNo) THEN EXIT(Customer.Name) ELSE EXIT('Not Found!');
Save and close the codeunit.
Add the codeunit as a web service as described in the Creating a web service recipe.
Create a new Console Application project in Visual Studio.
Right-click the References link and click on Add Web Reference.
Enter
http://localhost:7047/DynamicsNAV/WS/Cronus_International_Ltd/Services
(this may be different...