时间:2019-03-08 标签:c#SOAP VAT get validate

c# SOAP VAT get validate

在我的项目中,我添加了引用 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl,在我的代码中,我添加了:

   ServiceReferenceVAT.checkVatRequest check = new ServiceReferenceVAT.checkVatRequest();
       check.Body.vatNumber = "IT";
       check.Body.countryCode = "01983251678";

现在,我不知道如何调用方法来验证。当我检查时,此方法不会出现。 (...),如何验证我的增值税代码?

在此link作为问题的答案:https://blog.dotnetframework.org/2016/03/15/using-the-official-vies-api-in-c-for-vat-lookups/

var vat = new ServiceReferenceVAT.checkVatPortTypeClient();
           bool blnValid;
           string strName;
           string strAddress;
           string strCountryCode = "PT";
           string strVatNumber = "509358772";
       var t = vat.checkVat(ref strCountryCode, ref strVatNumber, out blnValid, out strName, out strAddress);