VIES Check Vat: C# Client Example
1. Overview
You can verify the validity of a VAT number issued by any Member State by the European Information Exchange System (VIES) system for validation of VAT numbers. For more information on this service please visit VIES VAT number validation
The VIES has publicly exposed this service through the SOAP protocol. The service is called checkVatService and the WSDL document is located at the following address WSDL checkVatService.
This C# project implements a simple SOAP client to use the VIES services. You can found this project on VIESCheckVatService repository.
2. Project details
The project is divided into two sub-projects:
- VIESCheckVatService : Contains the SOAP proxy class and some interfaces and classes of boundary.
- VIESCheckVatServiceClient : It contains a simple Windows application that uses the service via the VIES SOAP client.
Figure 1 shows the classes and interfaces created to interact with the service. In detail:
- IVIESCheckVatService : Generically defines the interface for interaction with the services VIES.
- VIESCheckVatServicesSOAPImpl : Class that implements the interface defined above. This class is specific to interact via SOAP.
- VIESCheckServiceFactory : Factory class that returns the correct implementation of the client that interacts with the services VIES. The implementation is supported SOAP.
- VIESVatModel : This class represents the set of data returned by the service VIES.
Please find below an example of C # code that shows the use of the VIES service.
VIESCheckVatService.IVIESCheckVatService iCheckVatService =
VIESCheckVatService.VIESCheckServiceFactory.getService(ServiceType.SOAP);
VIESCheckVatService.VIESVatModel vatModel = iCheckVatService.getDetailVAT("IT", "01983251678");Console.Out.WriteLine("Valid: " + vatModel.Valid);
Console.Out.WriteLine("County Code: " + vatModel.CountryCode);
Console.Out.WriteLine("VAT Number: " + vatModel.VatNumber);
Console.Out.WriteLine("Request Date: " + vatModel.RequestDate);
Console.Out.WriteLine("Org. Name: " + vatModel.Name);
Console.Out.WriteLine("Org. Address: " + vatModel.Address);
Source Code 1. Example C# client code that use VIES service
The following figures show the windows application (available in the project) that interacts with the VIES service. FAILED for network problems The project was developed using the SharpDevelop tool (version 4.4). In addition, the project has been tested and run on the platform. NET 4.
3. Notes
To use the service you are invited to read the document Specific disclaimer for this service issued by the European Commission.
4. Resources
- Web Service Partite IVA Comunitarie from Antonio Musarra’s Blog
- Consumiamo i servizi dell’Agenzia delle Entrate: Partite IVA Comunitarie from Antonio Musarra’s Blog
- Example on how to build a SOAP client. NET via SharpDevelop Building a Client .NET for SugarCRM from Antonio Musarra’s Blog