.net vs C/AL, use of .net and webservices by Thomas Hejlsberg
He’ll do some coding from scratch from c# to call C/AL and vice versa.
Visual Studio : new project.
Add a service- or webservice reference. (VS 2005 is webservice, VS2008 can do both)
The URL needed for the service can be found in the documentation.
Of course we are in a demo, so something is not working….
After a restart of some services, all is …. not working.
This is a split session, so we go to the other session (Testing Dynamics NAV by Rusty Miller) while he is fixing it. See : http://mibuso.com/blogs/kriki/2009/04/03/testing-dynamics-nav-by-rusty-miller/
And back now. The problem was that the wireless network was not found. Disabling it fixed it.
In the code he creates a new systemservice, adds an URL and uses default credentials.
A command that gives all companies back from the service and a command that prints it.
In NAV he writes a new function in a codeunit to add to numbers and returns the sum as return-value.
In table 2000000076:”Web service” he adds an entry for the codeunit and gives it a service name and publishes it (the toggle).
In VS : he updates the webservices.
He adds some code to work in a certain company. Now he can use the codeunit (see the name in the table Web Service) and the name of the function.
It is also possible to expose pages. When he saves something in the pages, all the business logic is run.
Another VS example: he reads all customer and prints the No. and the name.
To change a customer:
Reads customer 10000 and changing his name.
Calls the Customer.Update-function and we see that in NAV the customer changed name.
Now the contrary. Some code in VS that is called by C/AL.
He makes a class library so it becomes a dll.
Properties must be set to let it become a com-object and it must be registered for COM interop.
The function is multiplying 2 integers.
In NAV, he creates a new codeunit, takes the automation variable. It will be shown in the list of automation because of the setup in VS.
Filed under: DirectionsEMEA2009, NAVISION, VisualStudio
[…] .net vs C/AL, use of .net and webservices by Thomas Hejlsberg […]