<< | Index | >>
.... D, [2011-05-03T17:41:47.969975 #5159] DEBUG -- : HTTPI executes HTTP POST using the net_http adapter warning: peer certificate won't be verified in this SSL session "2359202" Getötet
Note
Note
Task
Updated files
def check_ean_pharma ret = '' result = nil @app.each_package do |pack| ean = pack.barcode.to_s result = nil SWISSINDEX_PHARMA_SERVER.session do |swissindex| result = swissindex.search(ean) end if (ean != nil) && (result != nil) && (result != ean) #ret << ean #ret << result break end end result
public def check_ean_pharma plug = SwissindexPlugin.new(@app) plug.check_ean_pharma end
#!/usr/bin/env ruby # SwissindexServer -- oddb.org -- 04.05.2011 -- mhatakeyama@ywesee.com $: << File.expand_path("../../../src", File.dirname(__FILE__)) $: << File.expand_path("../src", File.dirname(__FILE__)) require 'drb/drb' require 'swissindex_pharma' uri = 'druby://localhost:9485' DRb.start_service(uri, ODDB::Swissindex) DRb.thread.join
#!/usr/bin/ruby # encoding: utf-8 # Swissindex::SwissindexPharma -- 04.05.2011 -- mhatakeyama@ywesee.com require 'rubygems' require 'savon' require 'drb' module ODDB module Swissindex def Swissindex.session yield(SwissindexPharma.new) end class SwissindexPharma include DRb::DRbUndumped def initialize Savon.configure do |config| config.log = false # disable logging config.log_level = :info # changing the log level end end def search(eancode, lang = 'DE') client = Savon::Client.new do | wsdl, http | wsdl.document = "https://index.ws.e-mediat.net/Swissindex/Pharma/ws_Pharma_V101.asmx?WSDL" end try_time = 3 begin #response = @client.request :get_by_pharmacode do response = client.request :get_by_gtin do soap.xml = '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GTIN xmlns="http://swissindex.e-mediat.net/SwissindexPharma_out_V101">' + eancode + '</GTIN> <lang xmlns="http://swissindex.e-mediat.net/SwissindexPharma_out_V101">' + lang + '</lang> </soap:Body> </soap:Envelope>' end #if pharma = response.to_hash # return pharma #if response && pharma = response.to_hash[:pharma] && item = pharma[:item] if pharma = response.to_hash[:pharma] and item = pharma[:item] return uten[:gtin] else return nil end rescue StandardError => err if try_time > 0 sleep 10 retry try_time -= 1 else puts " - #{server} is not responding" puts e puts e.backtrace puts return nil end end end end end # Swissindex end # ODDB
Run
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> Updater.new(self).check_ean -> (druby://localhost:9485) /usr/lib64/ruby/1.8/net/http.rb:560:in `initialize': Connection timed out - connect(2)
failsafe rescued Errno::ETIMEDOUT < StandardError (druby://localhost:9485) /usr/lib64/ruby/1.8/net/http.rb:560:in `initialize': Connection timed out - connect(2) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1418:in `_admin' (druby://localhost:9485) /usr/lib64/ruby/1.8/net/http.rb:560:in `open' (druby://localhost:9485) /usr/lib64/ruby/1.8/net/http.rb:560:in `connect' (druby://localhost:9485) /usr/lib64/ruby/1.8/timeout.rb:53:in `timeout' (druby://localhost:9485) /usr/lib64/ruby/1.8/timeout.rb:93:in `timeout' (druby://localhost:9485) /usr/lib64/ruby/1.8/net/http.rb:560:in `connect' (druby://localhost:9485) /usr/lib64/ruby/1.8/net/http.rb:553:in `do_start' (druby://localhost:9485) /usr/lib64/ruby/1.8/net/http.rb:542:in `start' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/httpi-0.9.0/lib/httpi/adapter/net_http.rb:74:in `do_request' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/httpi-0.9.0/lib/httpi/adapter/net_http.rb:22:in `get' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/httpi-0.9.0/lib/httpi.rb:86:in `get' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/httpi-0.9.0/lib/httpi.rb:189:in `with_adapter' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/httpi-0.9.0/lib/httpi.rb:84:in `get' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/wsdl/request.rb:21:in `response' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/wsdl/request.rb:30:in `with_logging' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/wsdl/request.rb:21:in `response' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/wsdl/document.rb:93:in `http_request' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/wsdl/document.rb:77:in `document' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/wsdl/document.rb:105:in `parser' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/wsdl/document.rb:38:in `endpoint' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/client.rb:108:in `preconfigure' (druby://localhost:9485) /usr/lib64/ruby/gems/1.8/gems/savon-0.8.6/lib/savon/client.rb:74:in `request' (druby://localhost:9485) /home/masa/ywesee/oddb.org/ext/swissindex/src/swissindex_pharma.rb:31:in `search' (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/plugin/swissindex.rb:43:in `check_ean' (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `call' (druby://localhost:9485) /usr/lib64/ruby/1.8/drb/invokemethod.rb:10:in `block_yield' (druby://localhost:9485) /usr/lib64/ruby/1.8/drb/invokemethod.rb:17:in `perform_with_block' (druby://localhost:9485) /home/masa/ywesee/oddb.org/ext/swissindex/src/swissindex_pharma.rb:13:in `session' /home/masa/ywesee/oddb.org/src/plugin/swissindex.rb:42:in `check_ean' /home/masa/ywesee/oddb.org/src/model/sequence.rb:141:in `each' /home/masa/ywesee/oddb.org/src/model/sequence.rb:141:in `each_package' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `send' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `method_missing' /home/masa/ywesee/oddb.org/src/model/registration.rb:106:in `each_package' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `each_value' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `send' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `method_missing' /home/masa/ywesee/oddb.org/src/model/registration.rb:105:in `each_package' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `send' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `method_missing' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:605:in `each_package' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `each_value' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `send' /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `method_missing' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:604:in `each_package' /home/masa/ywesee/oddb.org/src/plugin/swissindex.rb:37:in `check_ean' /home/masa/ywesee/oddb.org/src/util/updater.rb:505:in `check_ean' /home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call' /home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1417:in `_admin' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1415:in `initialize' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1415:in `new' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1415:in `_admin' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `__send__' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `perform_without_block' /usr/lib64/ruby/1.8/drb/drb.rb:1515:in `perform' /usr/lib64/ruby/1.8/drb/drb.rb:1589:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1430:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1347:in `initialize' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `new' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `start_service' bin/oddbd:38