class ApiBanking::Soap11Client

Private Class Methods

add_soap_headers(options, soapAction) click to toggle source
# File lib/api_banking/soap/soap_client.rb, line 142
def self.add_soap_headers(options, soapAction)
  options[:headers] = {'Content-Type' => "text/xml;charset=UTF-8"}

  # SOAPAction header is mandatory for Soap11
  options[:headers][:SOAPAction] = soapAction
end
construct_envelope(&block) click to toggle source
# File lib/api_banking/soap/soap_client.rb, line 149
def self.construct_envelope(&block)
  Nokogiri::XML::Builder.new do |xml|
    xml.Envelope("xmlns:soap11" => "http://schemas.xmlsoap.org/soap/envelope/",
                 "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
                 "xmlns:xsd" => "http://www.w3.org/2001/XMLSchema") do
      xml.parent.namespace = xml.parent.namespace_definitions.first
      xml['soap11'].Header
      xml['soap11'].Body(&block)
    end
  end
end
parse_fault(reply) click to toggle source
# File lib/api_banking/soap/soap_client.rb, line 161
def self.parse_fault(reply)
  code   = nil # soap11 fault codes are meaningless
  reasonText   = content_at(reply.at_xpath('//soapenv11:Fault/faultstring', 'soapenv11' => 'http://schemas.xmlsoap.org/soap/envelope/'))

  code ||= 'ns:E500'  # in certain cases, a fault code isn't set by the server
  return Fault.new(code, nil, reasonText)
end