Skip to content

Instantly share code, notes, and snippets.

@wibisono
Created May 14, 2018 10:11
Show Gist options
  • Select an option

  • Save wibisono/655488fecc6cd080765fff27acada65d to your computer and use it in GitHub Desktop.

Select an option

Save wibisono/655488fecc6cd080765fff27acada65d to your computer and use it in GitHub Desktop.
cat <<EOF > temp.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<soapenv:Header/>
<soapenv:Body>
<urn:checkVat>
<urn:countryCode>COUNTRY_CODE</urn:countryCode>
<urn:vatNumber>VAT_NUMBER</urn:vatNumber>
</urn:checkVat>
</soapenv:Body>
</soapenv:Envelope>
EOF
cat temp.xml | sed "s/COUNTRY_CODE/$1/g" | sed "s/VAT_NUMBER/$2/g" > payload.xml
echo "Request:"
cat payload.xml
echo "----------------------------"
echo "Response:"
http POST http://ec.europa.eu/taxation_customs/vies/services/checkVatService @payload.xml | xmllint --format -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment