>local lValid as Boolean >local countryCode as string >local vatNumber as string >local cName as string >local cAddress as string >local ldDate as date > >lcUrl = "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl" >local o as MSSOAP.SoapClient30 >o = createobject("MSSOAP.SoapClient30") > >loException = null > >llError=.f. >try > o.MSSoapInit(lcUrl) >catch to loException > llError = .t. >endtry > >if llError > ? "Unable to load WSDL file from " + lcUrl > return >endif > >loException = null > >try > countryCode="PT" > vatNumber="502441240" > ldDate = date() > > loNL = o.CheckVat(@countryCode, @vatNumber) >catch to loException > llError = .t. >endtry > >*** Check for SOAP Error first - set even if Exception > >if (o.FaultCode != "") && Client or Server (usually Server) > wait window o.FaultString > return >endif > >*** If no SOAP Error check Exception >if !isnull(loException) > ? loException.message > ? loException.errorno > return >endif >>