views:

36

answers:

2

Hi I am trying to use http://ec.europa.eu/taxation_customs/vies/vieshome.do?selectedLanguage=EN in c# to check if it's ok

[ClassInterface(ClassInterfaceType.AutoDual)]
[ProgId("DotNetCOM.VerificareCIF")]
public class VerificareCIF
{
    public string tara = "RO";
    public bool valid = false;
    public DateTime data;
    public String firma = String.Empty;
    public String adresa = String.Empty;


    public bool VerifCIF(string CIF)
    {
        eu.europa.ec.checkVatService service = new eu.europa.ec.checkVatService();
        data = service.checkVat(ref tara, ref CIF, out valid, out firma, out adresa);
        return valid;
    }
}

it crashes when i add the web reference

Please help!

A: 

psu - check your output value (out valid) before returning as it could be undefined if there's an error in the service call.

jim

jim
i tried that, i defined it ... maybe this solution is wrong . any ideas
psu
A: 

I you don't want to depend on VIES's website, you can use these regular expressions, hashed by the first two letters of the country :

http://pastie.org/1120493

Clément