Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created January 9, 2015 03:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ayosec/18524d1489fe8282acd8 to your computer and use it in GitHub Desktop.
Save ayosec/18524d1489fe8282acd8 to your computer and use it in GitHub Desktop.
VAT validation using SOAP service
# Replace XXXXXXXXXXXXX with the VAT number
#
# The $valid attribute is in the path `soap:Body / checkVatResponse / valid`
#
# Example:
#
# <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
# <soap:Body>
# <checkVatResponse xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
#
# <countryCode>ES</countryCode>
# <vatNumber>....</vatNumber>
# <requestDate>2015-01-09+01:00</requestDate>
# <valid>true</valid>
# <name>---</name>
# <address>---</address>
# </checkVatResponse>
# </soap:Body>
# </soap:Envelope>
curl http://ec.europa.eu/taxation_customs/vies/services/checkVatService \
-i -w \\n \
-H 'SOAPAction: "checkVat"' \
-H "Content-Type: text/xml;charset=UTF-8" \
-d '<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ins0="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<env:Body>
<ins0:checkVat>
<ins0:countryCode>ES</ins0:countryCode>
<ins0:vatNumber>XXXXXXXXXXXXX</ins0:vatNumber>
</ins0:checkVat>
</env:Body>
</env:Envelope>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment