Module: Libis::Services::SoapClient
- Included in:
- CollectiveAccess::Connector, Digitool::DigitalEntityManager, Digitool::DigitoolConnector, Digitool::MetaDataManager, Rosetta::Client, Libis::Services::Sharepoint::Search
- Defined in:
- lib/libis/services/soap_client.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #configure(wsdl, options = {}) ⇒ Object
- #operations ⇒ Object
- #request(method, message = {}, call_options = {}, parse_options = {}) ⇒ Object
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
13 14 15 |
# File 'lib/libis/services/soap_client.rb', line 13 def client @client end |
Instance Method Details
#configure(wsdl, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/libis/services/soap_client.rb', line 15 def configure(wsdl, = {}) opts = { wsdl: wsdl, raise_errors: false, soap_version: 1, filters: [:password], pretty_print_xml: true, read_timeout: 30, open_timeout: 5, }.merge @client = Savon.client(opts) { yield if block_given? } end |
#operations ⇒ Object
29 30 31 |
# File 'lib/libis/services/soap_client.rb', line 29 def operations @client.operations end |
#request(method, message = {}, call_options = {}, parse_options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/libis/services/soap_client.rb', line 33 def request(method, = {}, = {}, = {}) response = client.call(method, message: ) do |locals| .each do |key, value| locals.send(key, value) end end return yield(response) if block_given? parse_result(response, ) rescue IOError, EOFError, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE => e debug "Exception: #{e.class.name} '#{e.message}'" unless (tries ||= 0) > 2; sleep(5 ** tries); tries += 1; retry; end raise Libis::Services::ServiceError, "Persistent network error: #{e.class.name} '#{e.message}'" rescue Net::ReadTimeout, Timeout::Error => e debug "Exception: #{e.class.name} '#{e.message}'" unless (tries ||= 0) > 1; sleep(5 ** tries); tries += 1; retry; end raise Libis::Services::ServiceError, "Network timeout error: #{e.class.name} '#{e.message}'" end |