Exception: Handsoap::Fault

Inherits:
Exception
  • Object
show all
Defined in:
lib/handsoap/service.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, reason, details) ⇒ Fault

Returns a new instance of Fault.



52
53
54
55
56
# File 'lib/handsoap/service.rb', line 52

def initialize(code, reason, details)
  @code = code
  @reason = reason
  @details = details
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



51
52
53
# File 'lib/handsoap/service.rb', line 51

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



51
52
53
# File 'lib/handsoap/service.rb', line 51

def details
  @details
end

#reasonObject (readonly)

Returns the value of attribute reason.



51
52
53
# File 'lib/handsoap/service.rb', line 51

def reason
  @reason
end

Class Method Details

.from_xml(node, options = { :namespace => nil }) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/handsoap/service.rb', line 60

def self.from_xml(node, options = { :namespace => nil })
  if not options[:namespace]
    raise "Missing option :namespace"
  end
  ns = { 'env' => options[:namespace] }
  fault_code = node.xpath('./env:Code/env:Value/text()', ns).to_s
  if fault_code == ""
    fault_code = node.xpath('./faultcode/text()', ns).to_s
  end
  reason = node.xpath('./env:Reason/env:Text[1]/text()', ns).to_s
  if reason == ""
    reason = node.xpath('./faultstring/text()', ns).to_s
  end
  details = node.xpath('./detail/*', ns)
  self.new(fault_code, reason, details)
end

Instance Method Details

#to_sObject



57
58
59
# File 'lib/handsoap/service.rb', line 57

def to_s
  "Handsoap::Fault { :code => '#{@code}', :reason => '#{@reason}' }"
end