Exception: Handsoap::Fault
- Inherits:
-
StandardError
- Object
- StandardError
- Handsoap::Fault
- Defined in:
- lib/handsoap/service.rb
Overview
Wraps SOAP errors in a standard class.
Instance Attribute Summary (collapse)
-
- (Object) code
readonly
Returns the value of attribute code.
-
- (Object) details
readonly
Returns the value of attribute details.
-
- (Object) reason
readonly
Returns the value of attribute reason.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Fault) initialize(code, reason, details)
constructor
A new instance of Fault.
- - (Object) to_s
Constructor Details
- (Fault) initialize(code, reason, details)
A new instance of Fault
64 65 66 67 68 |
# File 'lib/handsoap/service.rb', line 64 def initialize(code, reason, details) @code = code @reason = reason @details = details end |
Instance Attribute Details
- (Object) code (readonly)
Returns the value of attribute code
62 63 64 |
# File 'lib/handsoap/service.rb', line 62 def code @code end |
- (Object) details (readonly)
Returns the value of attribute details
62 63 64 |
# File 'lib/handsoap/service.rb', line 62 def details @details end |
- (Object) reason (readonly)
Returns the value of attribute reason
62 63 64 |
# File 'lib/handsoap/service.rb', line 62 def reason @reason end |
Class Method Details
+ (Object) from_xml(node, options = { :namespace => nil })
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/handsoap/service.rb', line 74 def self.from_xml(node, = { :namespace => nil }) if not [:namespace] raise "Missing option :namespace" end ns = { 'env' => [: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) self.new(fault_code, reason, details) end |
Instance Method Details
- (Object) to_s
70 71 72 |
# File 'lib/handsoap/service.rb', line 70 def to_s "Handsoap::Fault { :code => '#{@code}', :reason => '#{@reason}' }" end |