Class: Savon::SOAP::XML

Inherits:
Object
  • Object
show all
Defined in:
lib/savon_patches.rb

Class Method Summary collapse

Class Method Details

.to_hash(xml) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/savon_patches.rb', line 2

def self.to_hash(xml)
  # Vindicia xml isn't _completely_ self-documenting. Ensure xsi header exists.
  if xml =~ /soap.vindicia.com/ and xml !~ /xmlns:xsi/
    xml = xml.sub(/soap:Envelope/, "soap:Envelope\n    xmlns:xsi=\"#{SchemaTypes["xmlns:xsi"]}\"")
  end
  (Crack::XML.parse(xml) rescue {}).find_soap_body
end