lib/soap/winrm_service.rb in winrm-0.0.5 vs lib/soap/winrm_service.rb in winrm-0.0.6
- old
+ new
@@ -29,20 +29,21 @@
def initialize()
if $DEBUG
@debug = File.new('winrm_debug.out', 'w')
@debug.sync = true
end
-
end
def self.set_auth(user,pass)
@@user = user
@@pass = pass
+ true
end
def self.set_ca_trust_path(file_or_dir)
@@ca_trust_store = file_or_dir
+ true
end
# Turn off parsing and just return the soap response
def self.raw_soap!
@@raw_soap = true
@@ -104,12 +105,15 @@
req.set_trust_ca_file(@@ca_trust_store) if defined?(@@ca_trust_store)
#puts "SOAP DOCUMENT=\n#{req.body}"
end
def on_http_error(resp)
- puts "HTTP ERROR: #{resp.status}"
- puts "HEADERS=\n#{resp.headers}"
- puts "BODY=\n#{resp.body}"
+ case resp.status
+ when 401
+ raise WinRMAuthorizationError, "#{resp.headers}\n------\n#{resp.body}"
+ else
+ raise WinRMWebServiceError, "#{resp.headers}\n------\n#{resp.body}"
+ end
end
# ********** End Hooks **********