From 549c556d4a9db4053704d997139500b05f317008 Mon Sep 17 00:00:00 2001 From: Bohdan Viter Date: Tue, 24 Sep 2013 16:06:49 +0000 Subject: [PATCH] Fix private method called for # '#{@code}', :reason => '#{@reason}' }" end - + def self.from_xml(node, options = { :namespace => nil }) if not options[:namespace] raise "Missing option :namespace" end - + ns = { 'env' => options[:namespace] } - + # tries to find SOAP1.2 fault code fault_code = node.xpath("./env:Code/env:Value", ns).to_s - + # if no SOAP1.2 fault code was found, try the SOAP1.1 way unless fault_code fault_code = node.xpath('./faultcode', ns).to_s - + # if fault_code is blank, add the namespace and try again unless fault_code fault_code = node.xpath("//env:faultcode", ns).to_s end end - + # tries to find SOAP1.2 reason reason = node.xpath("./env:Reason/env:Text[1]", ns).to_s - + # if no SOAP1.2 faultstring was found, try the SOAP1.1 way unless reason reason = node.xpath('./faultstring', ns).to_s - + # if reason is blank, add the namespace and try again unless reason reason = node.xpath("//env:faultstring", ns).to_s end end - - details = node.xpath('./detail/*', ns) + + details = node.xpath('./detail/*', ns) self.new(fault_code, reason, details) end end @@ -228,7 +228,7 @@ def invoke(action, options = { :soap_action => :auto, :http_options => nil }, &b if options[:soap_header] iterate_hash_array(header, options[:soap_header]) end - + if options[:soap_body] action_hash = { action => options[:soap_body] } iterate_hash_array(body, action_hash) @@ -391,7 +391,7 @@ def on_missing_document(response) def debug(message = nil) #:nodoc: if @@logger if message - @@logger.puts(message) + @@logger.info(message) end if block_given? yield @@logger @@ -408,13 +408,13 @@ def make_http_request(uri, post_body, headers, http_options=nil) request.set_client_cert_files(http_options[:client_cert_file], http_options[:client_cert_key_file]) if http_options[:client_cert_file] && http_options[:client_cert_key_file] request.set_ssl_verify_mode(http_options[:ssl_verify_mode]) if http_options[:ssl_verify_mode] end - + headers.each do |key, value| request.add_header(key, value) end request.body = post_body debug do |logger| - logger.puts request.inspect + logger.info request.inspect end on_after_create_http_request(request) request @@ -424,7 +424,7 @@ def make_http_request(uri, post_body, headers, http_options=nil) # There are various stages and hooks for each, so that you can override those in your service classes. def parse_http_response(response) debug do |logger| - logger.puts(response.inspect do |body| + logger.info(response.inspect do |body| Handsoap.pretty_format_envelope(body).chomp end) end