diff --git a/lib/savon/builder.rb b/lib/savon/builder.rb index 454c6f4f..13a17ef6 100644 --- a/lib/savon/builder.rb +++ b/lib/savon/builder.rb @@ -121,8 +121,9 @@ def namespaces if @wsdl&.document @wsdl.parser.namespaces.each do |identifier, path| - prefixed_identifier = identifier - prefixed_identifier = "xmlns:#{prefixed_identifier}" unless prefixed_identifier == 'xmlns' + next if identifier == 'xmlns' # Do not include xmlns namespace as this causes issues for some servers (https://github.com/savonrb/savon/issues/986) + + prefixed_identifier = "xmlns:#{identifier}" next if namespaces.key?(prefixed_identifier) diff --git a/spec/savon/softlayer_spec.rb b/spec/savon/softlayer_spec.rb index a438c6da..b61b4284 100644 --- a/spec/savon/softlayer_spec.rb +++ b/spec/savon/softlayer_spec.rb @@ -21,7 +21,6 @@ } expected_namespaces = { - 'xmlns' => "http://schemas.xmlsoap.org/wsdl/", 'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema", 'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance", 'xmlns:tns' => "http://api.service.softlayer.com/soap/v3/", @@ -34,7 +33,10 @@ locals = Savon::LocalOptions.new(message) builder = Savon::Builder.new(:create_object, wsdl, globals, locals) - envelope = Nokogiri::XML(builder.to_s).xpath('./env:Envelope').first + parsed_doc = Nokogiri::XML(builder.to_s) do |config| + config.norecover.strict + end + envelope = parsed_doc.xpath('./env:Envelope').first expect(envelope.namespaces).to match(expected_namespaces) end