To further highlight the benefits of writing coding decoupled from the user interface and the use of data contracts, we will create a service and use it in a C# project.
Writing services in AX is straightforward; for example, to create a service that returns "Hello world", we simply need to return the "Hello world" string. We do have to describe the service to the outside world, however, and this is done by a decoration at the method header.
Firstly, we need to tell the compiler that this is a web method, and the return type. In the case of the Hello world example, it is simply the following:
[AifCollectionTypeAttribute('return', Types::String), SysEntryPointAttribute(true)]