You are on page 1of 6

Aplicación cliente para consumo de Servicio web en Microsoft Dynamics 365 for Finance and Operations

Creating a client application for web service consumption created in Microsoft Dynamics
365 FO

In previous publications it was emphasized that the consumption of web services is a very
different task to those performed in versions of AX 2012, therefore, it is necessary to update
our knowledge to face new challenges and problems that arise in Microsoft. Dynamics 365
FO.

The work of this publication is related to deliveries made in previous days, where the
following was published:

1. The Web Service created in Microsoft Dynamics 365 FO:


https://community.dynamics.com/ax/b/axaptatodoesposible/archive/2018/09/15/d
esaf-o-desarrollo-microsoft-dynamics-365-finance-and-operations
2. The registration of the application in Azure:
https://community.dynamics.com/ax/b/axaptatodoesposible/archive/2018/09/20/d
esaf-o-6-registrar-una-app-cliente-en-azure-para-consumo-servicio-soap
3. Installing packages for authentication in the ADD:
https://community.dynamics.com/ax/b/axaptatodoesposible/archive/2018/09/23/d
esaf-o-9-instalaci-n-paquetes-para-autenticaci-n-aad-y-dataentity-cliente

These publications cover the prerequisites for the next web service consumption client
application to work.

The Microsoft team has published some APIs that facilitate the development for
authentication, these resources are in the following link:
https://github.com/Microsoft/Dynamics-AX-Integration/blob/master/ServiceSamples/

Next, the steps to develop this application:

1. Create a new console application project in Visual Studio 2015 or 2017.

Autor: Ismael Utitiaj A.


Aplicación cliente para consumo de Servicio web en Microsoft Dynamics 365 for Finance and Operations

2. Add the reference to the Web Service.

The added web service is presented in the references section:

3. Add a new class (IwiaAutenticate) to handle the management logic in the


authentication to the Web Service

4. Add a new class (IwiaAuthenticationContract) for data contract management for


authentication

This class has the following structure:

Autor: Ismael Utitiaj A.


Aplicación cliente para consumo de Servicio web en Microsoft Dynamics 365 for Finance and Operations

5. Modify the IwiaAutenticate class and add the following 4 methods.

Autor: Ismael Utitiaj A.


Aplicación cliente para consumo de Servicio web en Microsoft Dynamics 365 for Finance and Operations

6. Create a new class (IwiaSoapUtil) to manage the binding, get the URI of the service
and the endpoint.

This class is inspired by the SoapHelper class, which is located at the following link:
Inspired by class: https://github.com/Microsoft/Dynamics-AX-
Integration/blob/master/ServiceSamples/SoapUtility/SoapHelper.cs

7. 7. Create a new class (CustomerUpdate) responsible for performing authentication,


call the web service and obtain the response of the operation.

With the following code:

Autor: Ismael Utitiaj A.


Aplicación cliente para consumo de Servicio web en Microsoft Dynamics 365 for Finance and Operations

8. Create a class for the application execution entry

Autor: Ismael Utitiaj A.


Aplicación cliente para consumo de Servicio web en Microsoft Dynamics 365 for Finance and Operations

9. The result is presented as follows.

Autor: Ismael Utitiaj A.

You might also like