Consuming a custom service
Custom services are consumed in a way quite similar to any other Dynamics AX service. The difference is that each custom service can have a totally different set of operations, where the system or document services always expose the same list operations.
In this recipe, we will create a .NET console application to demonstrate how to consume a custom service. We will use the service created in the Creating a custom service recipe, which returns a description of the provided currency.
How to do it...
Carry out the following steps in order to complete this recipe:
1. In Visual Studio, create a new Visual C# Console Application project named
ConsumeBasicCustomService
.2. Add a new service reference named
CustomCurrencyServices
to the project.3. Copy the address from the WSDL URI field, from the Creating a custom service recipe, into the Address field:
4. Add the following code to the top section of the
Program.cs
file:using ConsumeBasicCustomService.CustomCurrencyServices...