From 65379e7fc3a191ac9be26b827b81225168a896e8 Mon Sep 17 00:00:00 2001 From: Berislav Babic Date: Mon, 1 Nov 2021 12:59:07 +0100 Subject: [PATCH] Fix failed VIES calls since Oct 28th 2021 VIES calls started failing with this gem around October 28th. We traced the issue back to the SOAPAction key being included in the request header. Here is a quick fix to exclude the offending header. For search purposes, the error we got was: "Unknown error: (soap:Server) The given SOAPAction checkVat does not match an operation." --- lib/vat_check/requests.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vat_check/requests.rb b/lib/vat_check/requests.rb index 95edd8b..f54598a 100644 --- a/lib/vat_check/requests.rb +++ b/lib/vat_check/requests.rb @@ -6,7 +6,7 @@ def self.lookup(vat) client = Savon.client(wsdl: 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl', follow_redirects: true, log: false, log_level: :debug, pretty_print_xml: false) country_code, vat_number = VatCheck::Utility.split(vat) begin - response = client.call(:check_vat, message: {country_code: country_code, vat_number: vat_number}, message_tag: :checkVat) + response = client.call(:check_vat, message: {country_code: country_code, vat_number: vat_number}, message_tag: :checkVat, soap_action: nil) response.to_hash[:check_vat_response].reject { |key| key == :@xmlns } rescue Savon::SOAPFault => e if !!(e.message =~ /MS_UNAVAILABLE/)