Skip to content

Commit

Permalink
Fix #986 do not include xmlns namespace from WSDL (#989)
Browse files Browse the repository at this point in the history
Co-authored-by: Nathan Samson <nathan.samson@beeple.eu>
  • Loading branch information
nathansamson and Nathan Samson committed Dec 15, 2022
1 parent 1a660b3 commit fc54703
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/savon/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 4 additions & 2 deletions spec/savon/softlayer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand All @@ -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
Expand Down

0 comments on commit fc54703

Please sign in to comment.