VEIS Webservice matchcode error
Something changed this week with the VEIS web service that provides validation of European tax registration numbers.
http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl
All of a sudden we get an error! The SOAP error on deserialization is:
'Invalid enum value '3' cannot be deserialized into type 'canford.checkVATWebservice.matchCode'
I regenerated the SOAP reference in Visual Studio, -still not working.
It seems the soap response is containing an invalid (according to the WSDL) value of 3 for the type match code that is returned.
I’ve emailed the address provided for support, no response yet, so to get us running again I’ve added in this as a valid enum, however I have no idea of what the value of 3 actually means!
To fix, edit the Reference.vb file generated after refreshing the reference, found under your service reference directory, (this example in VB.NET)
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
System.Runtime.Serialization.DataContractAttribute(Name:="matchCode", [Namespace]:="urn:ec.europa.eu:taxud:vies:services:checkVat:types")> _
Public Enum matchCode As Integer
<System.Runtime.Serialization.EnumMemberAttribute(Value:="1")> _
_1 = 0
<System.Runtime.Serialization.EnumMemberAttribute(Value:="2")> _
_2 = 1
End Enum
Adding
<System.Runtime.Serialization.EnumMemberAttribute(Value:="3")> _ _3 = 2
to give this
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
System.Runtime.Serialization.DataContractAttribute(Name:="matchCode", [Namespace]:="urn:ec.europa.eu:taxud:vies:services:checkVat:types")> _
Public Enum matchCode As Integer
<System.Runtime.Serialization.EnumMemberAttribute(Value:="1")> _
_1 = 0
<System.Runtime.Serialization.EnumMemberAttribute(Value:="2")> _
_2 = 1
<System.Runtime.Serialization.EnumMemberAttribute(Value:="3")> _
_3 = 2
End Enum
Now it will work again. I expect this will be fixed sometime after this post, but for those of you struggling with this issue at least you know what to do now!
update 9th Jan 2015
Refresh of references today brought in the “missing” enum – I guess it is fixed.
<xsd:enumeration value="3">
<xsd:annotation>
<xsd:documentation>NOT_PROCESSED</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>