view · edit · sidebar · attach · print · history

Index>

20170614-oddb-org-rack

Summary

  • Port oddb.org to use rack
  • install new version of sandoz.bbmb and sandoz.xmlconv on fastpower
  • Keep in Mind

Commits

Index

install new version of sandoz.bbmb and sandoz.xmlconv on fastpower

Redoing update sandoz.bbmb and sandoz.xmlconv as documented in yesterdays blog.

Testing it with the following calls

Verifiying it on http://sandoz.xmlconv.bbmb.ch/de/sbsm, where I see

33795	http://80.218.53.88	14.06.2017 12:04:08	file:/.../var/output/99_20170614120408037.txt	Bestellung via BBMB erfolgreich
33794	http://80.218.53.88	14.06.2017 12:03:54	file:/.../var/output/99_20170614120354052.txt	Fehler
33793	http://80.218.53.88	14.06.2017 12:02:35	file:/.../var/output/99_20170614120235030.txt	Bestellung via BBMB erfolgreich

We know that sending gard results in the error as seen in http://sandoz.xmlconv.bbmb.ch/de/sbsm/transaction/state_id/69811778238800/transaction_id/33794

RuntimeError
Bestellung OK, Eintrag in BBMB fehlgeschlagen:
RuntimeError
can't commit empty order

The transactions 33793 and 33795 showed no error. Verifying it via user 99 on http://sandoz.bbmb.ch/de/bbmb/orders/customer_id/99 we have

But we still have empty orders as seen by these lines

33797	http://194.158.242.196	14.06.2017 12:16:05	file:/.../sandoz.xmlconv.bbmb.ch/var/output	Leer
33796	http://85.7.226.134	14.06.2017 12:05:01	file:/.../sandoz.xmlconv.bbmb.ch/var/output	Leer
33792	http://46.14.254.205	14.06.2017 12:01:47	file:/.../sandoz.xmlconv.bbmb.ch/var/output	Leer

Added the lines for sending smtp_mails to etc/xmlconv.yml. Looking at post orders from 46.14.254.205 I find in log/2017/06/09/error_log the lines

[Fri Jun 09 17:00:53 2017] [notice] Received Request POST
[Fri Jun 09 17:00:53 2017] [notice] from 46.14.254.205
[Fri Jun 09 17:00:53 2017] [notice] content-length: 752

And in log/2017/06/09/access_log the line 46.14.254.205 - - [09/Jun/2017:17:00:53 +0200] "POST /pharmatic HTTP/1.1" 200 1664 "-" "-" This correspond to 33675 http://46.14.254.205:51153 09.06.2017 17:00:53 file:/.../var/output/4100602866_20170609170053026.txt Bestellung via BBMB erfolgreich Looking at I see that it was posted by communicationSoftwareId="Pharmatic NETReq.exe V1.20.0.4 (Requestdate: 09.06.2017 17:09)". Saving the xml file as test/data/4100602866.xml. Changing customer_id to 99 and testing it locally via curl -v http://sandoz.xmlconv.bbmb.ngiger.ch/pharmatic -d@test/data/4100602866.xml. Result was HTTP/1.1 200 OK and the returned xml was

<?xml version='1.0' encoding='UTF-8'?>
<customerOrderResponse xmlns='http://www.e-galexis.com/schemas/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.e-galexis.com/schemas/ http://www.e-galexis.com/schemas/POS/customerOrder/customerOrderResponse.xsd' version='1.0' roundUpForCondition='false' backLogDesired='false' language='de' productDescriptionDesired='false'>
  <clientResponse number='99-134'/>
  <orderHeaderResponse referenceNumber='108953'>
    <deliveryAddress/>
  </orderHeaderResponse>
  <orderLinesResponse>
    <productOrderLineResponse lineAccepted='true' backLogLine='false' roundUpForConditionDone='false' productReplaced='false'>
      <productOrderLine orderQuantity='1'>
        <pharmaCode id='4497405'/>
      </productOrderLine>
      <productResponse wholesalerProductCode='44020392' description='Pantoprazol Sandoz 20 mg Tbl 15'/>
      <availability status='yes'/>
    </productOrderLineResponse>
    <productOrderLineResponse lineAccepted='true' backLogLine='false' roundUpForConditionDone='false' productReplaced='false'>
      <productOrderLine orderQuantity='3'>
        <pharmaCode id='4995793'/>
      </productOrderLine>
      <productResponse wholesalerProductCode='44031882' description='Co-Candesartan Sandoz 8/12.5 mg Tbl 98'/>
      <availability status='yes'/>
    </productOrderLineResponse>
    <productOrderLineResponse lineAccepted='true' backLogLine='false' roundUpForConditionDone='false' productReplaced='false'>
      <productOrderLine orderQuantity='5'>
        <pharmaCode id='5404392'/>
      </productOrderLine>
      <productResponse wholesalerProductCode='44031890' description='RABEPRAZOL Sandoz 20mg Tbl 56'/>
      <availability status='yes'/>
    </productOrderLineResponse>
  </orderLinesResponse>
</customerOrderResponse>                                                                                                                                                                          

Will download and save the last 3 orders for all customers where we got an empty order. But first we will test with another injection tool from https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo.

Send two orders from two terminal session almost concurrently. Both arrived without problem, but with 2 seconds difference, because SBSM is not multi-threaded.

28371	http://192.168.0.70	14.06.2017 14:07:42	file:/.../var/output/99_20170614140742068.txt	Bestellung via BBMB erfolgreich
28370	http://192.168.0.70	14.06.2017 14:07:40	file:/.../var/output/99_20170614140739098.txt	Bestellung via BBMB erfolgreich

Sending via the Advanced REST Client to http://sandoz.xmlconv.bbmb.ngiger.ch/pharmatic worked fine, too. As result it shows 200 OK 1443.00ms It has helpful timing information

Start date: 6/14/2017
Time to connect: 0.6 ms
Send time: 11.36 ms
Wait time: 1429.1 ms
Receive time: 1.99 ms
Total: 1443.05 ms  

The request headers were

Content-Length: 156
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary1s0KwbfYfAMYpNB8

The response headers are

Content-Length: 404
Content-Type: text/html;charset=UTF-8
Date: Wed, 14 Jun 2017 11:50:22 GMT
Server: WEBrick/1.3.1 (Ruby/2.4.0/2016-12-24)
Set-Cookie: _session_id=10afa18a041bb85f8c607a9aead; path=/

But looking at the content of the returned XML

<?xml version="1.0" encoding="UTF-8"?>
<customerOrderResponse xmlns="http://www.e-galexis.com/schemas/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.e-galexis.com/schemas/ http://www.e-galexis.com/schemas/POS/customerOrder/customerOrderResponse.xsd" version="1.0" roundUpForCondition="false" backLogDesired="false" language="de" productDescriptionDesired="false"/>

we see that no order was placed. And the corresponding log entry confirms this 28369 http://192.168.0.70 14.06.2017 14:06:48 file:/.../sandoz.xmlconv.bbmb.ch/var/output Leer

Now I will compare it to the answer from the pre-rack on http://sandoz.xmlconv.bbmb.ch/pharmatic. It returned the following xml

<?xml version='1.0' encoding='UTF-8' ?>
<customerOrderResponse backLogDesired="false" language="de" productDescriptionDesired="false" roundUpForCondition="false" xsi:schemaLocation="http://www.e-galexis.com/schemas/ http://www.e-galexis.com/schemas/POS/customerOrder/customerOrderResponse.xsd" version="1.0" />

and the command is also marked as leer

33798 http://80.218.53.88:41244 14.06.2017 14:25:17 file:/.../sandoz.xmlconv.bbmb.ch/var/output Leer

http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/69948189687380/transaction_id/28372 shows

Input	Output
fileUpload [object Object]
Fehler

Did I configure the test request wrong, as I said that I want to load file. Should I enter the content directly?

Now breaking at sbsm/lib/sbsm/app.rb I get

[1] pry(#<XmlConv::Util::RackInterface>)> request
=> #<Rack::Request:0x0055b85eb0a2e0
 @env=
  {"CONTENT_LENGTH"=>"824",
   "CONTENT_TYPE"=>"application/x-www-form-urlencoded",
   "GATEWAY_INTERFACE"=>"CGI/1.1",
   "PATH_INFO"=>"/pharmatic",
   "QUERY_STRING"=>"",
   "REMOTE_ADDR"=>"::1",
   "REMOTE_HOST"=>"::1",
   "REQUEST_METHOD"=>"POST",
   "REQUEST_URI"=>"http://sandoz.xmlconv.bbmb.ngiger.ch/pharmatic",
   "SCRIPT_NAME"=>"",
   "SERVER_NAME"=>"sandoz.xmlconv.bbmb.ngiger.ch",
   "SERVER_PORT"=>"80",
   "SERVER_PROTOCOL"=>"HTTP/1.1",
   "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/2.4.0/2016-12-24)",
   "HTTP_HOST"=>"localhost:8011",
   "HTTP_USER_AGENT"=>"curl/7.38.0",
   "HTTP_ACCEPT"=>"*/*",
   "HTTP_X_FORWARDED_FOR"=>"192.168.0.70",
   "HTTP_X_FORWARDED_HOST"=>"sandoz.xmlconv.bbmb.ngiger.ch",
   "HTTP_X_FORWARDED_SERVER"=>"sandoz.xmlconv.bbmb.ngiger.ch",
   "HTTP_CONNECTION"=>"close",
   "rack.version"=>[1, 3],
   "rack.input"=>#<Rack::Lint::InputWrapper:0x0055b85eb0a330 @input=#<Rack::Lint::InputWrapper:0x0055b85eb159d8 @input=#<StringIO:0x0055b85eb20ce8>>>,
   "rack.errors"=>#<Rack::Lint::ErrorWrapper:0x0055b85eb0a308 @error=#<Rack::Lint::ErrorWrapper:0x0055b85eb15960 @error=#<IO:<STDERR>>>>,
   "rack.multithread"=>true,
   "rack.multiprocess"=>false,
   "rack.run_once"=>false,
   "rack.url_scheme"=>"http",
   "rack.hijack?"=>true,
   "rack.hijack"=>#<Proc:0x0055b85eb0a5d8@/var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:525>,
   "rack.hijack_io"=>nil,
   "HTTP_VERSION"=>"HTTP/1.1",
   "REQUEST_PATH"=>"/pharmatic",
   "rack.tempfiles"=>[]},
 @params=nil>

and in lib/xmlconv/util/transaction.rb @ line 29 I see the correct input

[2] pry(#<XmlConv::Util::Transaction>)> puts @input
<?xml version "1.0" encoding="utf-8"?><customerOrder     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0"     language="fr" productDescriptionDesired="true"     communicationSoftwareId="Pharmatic NETReq.exe V1.20.0.4     (Requestdate: 09.06.2017 17:09)"     xmlns="http://www.e-galexis.com/schemas/">  <client number="99" password="7601001319042" />  <orderHeader deliveryDate="2017-06-09" referenceNumber="108953"       />  <orderLines>    <productOrderLine orderQuantity="1">      <pharmaCode id="4497405" />    </productOrderLine>    <productOrderLine orderQuantity="3">      <pharmaCode id="4995793" />    </productOrderLine>    <productOrderLine orderQuantity="5">      <pharmaCode id="5404392" />    </productOrderLine>  </orderLines></customerOrder>
[3] pry(#<XmlConv::Util::Transaction>)> backtrace
--> #0  XmlConv::Util::Transaction.execute at /home/niklaus/git/xmlconv/lib/xmlconv/util/transaction.rb:29
    #1  XmlConv::Util::Application._execute(transaction#XmlConv::Util::Transaction) at /home/niklaus/git/xmlconv/lib/xmlconv/util/application.rb:43
    #2  XmlConv::Util::Application.execute(transaction#XmlConv::Util::Transaction) at /home/niklaus/git/xmlconv/lib/xmlconv/util/application.rb:36
    #3  XmlConvApp.execute_with_response(transaction#XmlConv::Util::Transaction) at /home/niklaus/git/xmlconv/lib/xmlconv/util/application.rb:140
    #4  XmlConv::State::Login.initialize(session#XmlConv::Util::Session, model#Class) at /home/niklaus/git/xmlconv/lib/xmlconv/state/login.rb:29
    &#881;-- #5  Class.new(*args) at /home/niklaus/git/sbsm/lib/sbsm/session.rb:389
    #6  SBSM::Session.logout at /home/niklaus/git/sbsm/lib/sbsm/session.rb:389
    #7  block in SBSM::Session.block in process_rack(rack_request#Rack::Request) at /home/niklaus/git/sbsm/lib/sbsm/session.rb:228
    &#881;-- #8  Thread::Mutex.synchronize at /home/niklaus/git/sbsm/lib/sbsm/session.rb:212
    #9  SBSM::Session.process_rack(rack_request#Rack::Request) at /home/niklaus/git/sbsm/lib/sbsm/session.rb:212
    #10 SBSM::RackInterface.call(env#Hash) at /home/niklaus/git/sbsm/lib/sbsm/app.rb:120
    #11 Rack::Lint._call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49
    #12 Rack::Lint.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37
    #13 Rack::ShowExceptions.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23
    #14 Rack::ContentLength.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15
    #15 Rack::Static.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149
    #16 Rack::CommonLogger.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33
    #17 Rack::TempfileReaper.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15
    #18 Rack::Lint._call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49
    #19 Rack::Lint.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37
    #20 Rack::ShowExceptions.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23
    #21 Rack::CommonLogger.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33
    #22 Rack::Chunked.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/chunked.rb:54
    #23 Rack::ContentLength.call(env#Hash) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15
    #24 Rack::Handler::WEBrick.service(req#WEBrick::HTTPRequest, res#WEBrick::HTTPResponse) at /var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86
    #25 WEBrick::HTTPServer.service(req#WEBrick::HTTPRequest, res#WEBrick::HTTPResponse) at /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140
    #26 WEBrick::HTTPServer.run(sock#TCPSocket) at /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96
    #27 block in WEBrick::GenericServer.block in start_thread(sock#TCPSocket, &block#NilClass) at /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290

Yesterday the encoding problem stemmed from the fact that this method execute was unable to decode the input and construct the model.

When posting via ARC the @input variable in the execute method is "fileUpload [object Object]". Whether I configure ARC to send a file or a raw content.

Maybe this is the root of the problem, that the new rack based SBSM does not handle correctly fileuploads. Debugging the ARC content gives me

[26] pry(#<XmlConv::Util::RackInterface>)> y = request.body.read
=> "------WebKitFormBoundaryA6RnRpIaoLvbfxyP\r\n" +
"Content-Disposition: form-data; name=\"fileUpload\"\r\n" +
"\r\n" +
"[object Object]\r\n" +
"------WebKitFormBoundaryA6RnRpIaoLvbfxyP\r\n" +
"Content-Disposition: form-data; name=\"<?xml version\"\r\n" +
"\r\n" +
"\"1.0\" encoding=\"utf-8\"?>\r\n" +
"<customerOrder\r\n" +
"     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\r\n" +
"     xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" version=\"1.0\"\r\n" +
"     language=\"fr\" productDescriptionDesired=\"true\"\r\n" +
"     communicationSoftwareId=\"Pharmatic NETReq.exe V1.20.0.4\r\n" +
"     (Requestdate: 09.06.2017 17:09)\"\r\n" +
"     xmlns=\"http://www.e-galexis.com/schemas/\">\r\n" +
"  <client number=\"99\" password=\"7601001319042\" />\r\n" +
"  <orderHeader deliveryDate=\"2017-06-09\" referenceNumber=\"108953\"\r\n" +
"       />\r\n" +
"  <orderLines>\r\n" +
"    <productOrderLine orderQuantity=\"1\">\r\n" +
"      <pharmaCode id=\"4497405\" />\r\n" +
"    </productOrderLine>\r\n" +
"    <productOrderLine orderQuantity=\"3\">\r\n" +
"      <pharmaCode id=\"4995793\" />\r\n" +
"    </productOrderLine>\r\n" +
"    <productOrderLine orderQuantity=\"5\">\r\n" +
"      <pharmaCode id=\"5404392\" />\r\n" +
"    </productOrderLine>\r\n" +
"  </orderLines>\r\n" +
"</customerOrder>\r\n" +
"------WebKitFormBoundaryA6RnRpIaoLvbfxyP--\r\n"
[31] pry(#<XmlConv::Util::RackInterface>)> request.media_type
=> "multipart/form-data"
[32] pry(#<XmlConv::Util::RackInterface>)> request.media_type_params
=> {"boundary"=>"----WebKitFormBoundaryA6RnRpIaoLvbfxyP"}

This problem is fixed with commit Find xml in any request paramater, not only the first

To ease debugging I also added a debug statement, where I see all the request.params in the app.log. This should help pinpoint errors for other tools which might format the POST request in another forms.

Testing with ARC, rest-client and curl works now. But displaying http://sandoz.xmlconv.bbmb.ngiger.ch/now fails with the error

NoMethodError at /
undefined method `navigation' for XmlConv::Util::KnownUser:Class

because I corrected the unknown user in SBSM.

Port oddb.org to use rack

Must add http:// before the remote_ip. Verified again that I cannot determine the remote port used pry

4] pry(#<XmlConv::Util::Session>)> rack_request
=> #<Rack::Request:0x0056015efbfb20
 @env=
  {"CONTENT_LENGTH"=>"629",
   "CONTENT_TYPE"=>"application/x-www-form-urlencoded",
   "GATEWAY_INTERFACE"=>"CGI/1.1",
   "PATH_INFO"=>"/propharma",
   "QUERY_STRING"=>"",
   "REMOTE_ADDR"=>"::1",
   "REMOTE_HOST"=>"::1",
   "REQUEST_METHOD"=>"POST",
   "REQUEST_URI"=>"http://sandoz.xmlconv.bbmb.ngiger.ch/propharma",
   "SCRIPT_NAME"=>"",
   "SERVER_NAME"=>"sandoz.xmlconv.bbmb.ngiger.ch",
   "SERVER_PORT"=>"80",
   "SERVER_PROTOCOL"=>"HTTP/1.1",
   "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/2.4.0/2016-12-24)",
   "HTTP_HOST"=>"localhost:8011",
   "HTTP_USER_AGENT"=>"curl/7.38.0",
   "HTTP_ACCEPT"=>"*/*",
   "HTTP_X_FORWARDED_FOR"=>"192.168.0.70",
   "HTTP_X_FORWARDED_HOST"=>"sandoz.xmlconv.bbmb.ngiger.ch",
   "HTTP_X_FORWARDED_SERVER"=>"sandoz.xmlconv.bbmb.ngiger.ch",
   "HTTP_CONNECTION"=>"close",
   "rack.version"=>[1, 3],
   "rack.input"=>#<Rack::Lint::InputWrapper:0x0056015efbfc10 @input=#<Rack::Lint::InputWrapper:0x0056015efcb358 @input=#<StringIO:0x0056015efda718>>>,
   "rack.errors"=>#<Rack::Lint::ErrorWrapper:0x0056015efbfb98 @error=#<Rack::Lint::ErrorWrapper:0x0056015efcb330 @error=#<IO:<STDERR>>>>,
   "rack.multithread"=>true,
   "rack.multiprocess"=>false,
   "rack.run_once"=>false,
   "rack.url_scheme"=>"http",
   "rack.hijack?"=>true,
   "rack.hijack"=>#<Proc:0x0056015efc8068@/var/www/sandoz.xmlconv.bbmb.ch/vendor/ruby240/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:525>,
   "rack.hijack_io"=>nil,
   "HTTP_VERSION"=>"HTTP/1.1",
   "REQUEST_PATH"=>"/propharma",
   "rack.tempfiles"=>[],
   "rack.request.cookie_hash"=>{},
   "rack.request.query_string"=>"",
   "rack.request.query_hash"=>{},
   "rack.request.form_hash"=>
    {"<?xml version"=>
      "\"1.0\" encoding=\"utf-8\"?><customerOrder xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" version=\"1.0\" language=\"fr\" productDescriptionDesired=\"true\" communicationSoftwareId=\"ywesee Test\" xmlns=\"http://www.e-galexis.com/schemas/\">  <client number=\"99\" password=\"\" />  <orderHeader deliveryDate=\"2016-07-15\" referenceNumber=\"99\"/>  <orderLines>    <productOrderLine orderQuantity=\"2\">      <pharmaCode id=\"2508375\" />    </productOrderLine>    <productOrderLine orderQuantity=\"2\">      <pharmaCode id=\"5195126\" />    </productOrderLine>  </orderLines></customerOrder>"},
   "rack.request.form_vars"=>
    "<?xml version=\"1.0\" encoding=\"utf-8\"?><customerOrder xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" version=\"1.0\" language=\"fr\" productDescriptionDesired=\"true\" communicationSoftwareId=\"ywesee Test\" xmlns=\"http://www.e-galexis.com/schemas/\">  <client number=\"99\" password=\"\" />  <orderHeader deliveryDate=\"2016-07-15\" referenceNumber=\"99\"/>  <orderLines>    <productOrderLine orderQuantity=\"2\">      <pharmaCode id=\"2508375\" />    </productOrderLine>    <productOrderLine orderQuantity=\"2\">      <pharmaCode id=\"5195126\" />    </productOrderLine>  </orderLines></customerOrder>",
   "rack.request.form_input"=>#<Rack::Lint::InputWrapper:0x0056015efbfc10 @input=#<Rack::Lint::InputWrapper:0x0056015efcb358 @input=#<StringIO:0x0056015efda718>>>},
 @params=
  {"<?xml version"=>
    "\"1.0\" encoding=\"utf-8\"?><customerOrder xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" version=\"1.0\" language=\"fr\" productDescriptionDesired=\"true\" communicationSoftwareId=\"ywesee Test\" xmlns=\"http://www.e-galexis.com/schemas/\">  <client number=\"99\" password=\"\" />  <orderHeader deliveryDate=\"2016-07-15\" referenceNumber=\"99\"/>  <orderLines>    <productOrderLine orderQuantity=\"2\">      <pharmaCode id=\"2508375\" />    </productOrderLine>    <productOrderLine orderQuantity=\"2\">      <pharmaCode id=\"5195126\" />    </productOrderLine>  </orderLines></customerOrder>"},
 @uri="/propharma">

Pushed commits

Testing it with the tool at https://www.hurl.it/. As answer I received Internal Server Error. But this is due to the fact, that my server is not open to the internet. Therefore I did not see anything in my log.

Installing http://www.fiddler2.com/fiddler2/ on my virtual windows machine.

Also installing https://github.com/wiztools/rest-client. With this tool I must use even another method to get the input

[23] pry(#<XmlConv::Util::RackInterface>)> request.body.rewind
=> nil
[24] pry(#<XmlConv::Util::RackInterface>)> puts request.body.read.to_s
<?xml version="1.0" encoding="utf-8"?>
<customerOrder
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0"
     language="fr" productDescriptionDesired="true"
     communicationSoftwareId="Pharmatic NETReq.exe V1.20.0.4
     (Requestdate: 09.06.2017 17:09)"
     xmlns="http://www.e-galexis.com/schemas/">
  <client number="99" password="7601001319042" />
  <orderHeader deliveryDate="2017-06-09" referenceNumber="108953"
       />
  <orderLines>
    <productOrderLine orderQuantity="1">
      <pharmaCode id="4497405" />
    </productOrderLine>
    <productOrderLine orderQuantity="3">
      <pharmaCode id="4995793" />
    </productOrderLine>
    <productOrderLine orderQuantity="5">
      <pharmaCode id="5404392" />
    </productOrderLine>
  </orderLines>
</customerOrder>

Under modruby the xml_src was read as xml_src = $stdin.read(content_length). This must be implemented differently under RACK. I will create in SBSM a read only variable post_content.

This was quite easy to fix and I think the rest-client is probably generating a request which forces me to use method which mimicks the old behaviour.

Pushed commits

Port oddb.org to use rack

Pushed yesterday work to new rack branch via commitInitial port to rack. localhost:8012 works

Must correct the rewrite rule in the apache config. to make URL like /de/gcc/search/zone/drugs/search_query/Aspirin/search_type/st_oddb work.

Added the following lines to the apache conf to debug my rewrite rules

  RewriteLog "/var/log/apache2/rewrite.log"
  RewriteLogLevel 3

Accessing http://localhost:8012/de/gcc/fachinfo/reg/59225 works. But not via Apache http://oddb-ci2.dyndns.org/de/gcc/fachinfo/reg/59225. Why?

After placing the new rewrite rule RewriteRule ^/(.*)$ http://localhost:8012/$1 [P] at the top of the rules, accessing the links in the fachinfo links work. Following the "SL Neuaufnahmen" gets the error

NoMethodError at /de/gcc/rss/channel/sl_introduction.rss
undefined method `passthru' for nil:NilClass
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:435:in `passthru'
        /var/www/oddb_rack.org/src/state/rss/passthru.rb:16:in `init'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:237:in `block in process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `synchronize'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/app.rb:119:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/chunked.rb:54:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'

The links "Analysen", "Apotheken", "Interaktionen", "Services", "Spital", "Zulassungen" work. "MiGel" does not work.

Searching for Aspirin via http://oddb-ci2.dyndns.org/de/gcc/search/zone/drugs/search_query/Aspirin/search_type/st_oddb?#best_result throws now

DRb::DRbConnError at /de/gcc/search/zone/drugs/search_query/Aspirin/search_type/st_oddb
druby://localhost:10999 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 10999>
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:745:in `rescue in block in open'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:739:in `block in open'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:738:in `each'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:738:in `open'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1248:in `initialize'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1228:in `new'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1228:in `open'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1141:in `block in method_missing'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1160:in `with_friend'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1140:in `method_missing'
        /var/www/oddb_rack.org/src/util/oddbapp.rb:793:in `get_currency_rate'
        /var/www/oddb_rack.org/src/util/oddbapp.rb:1571:in `method_missing'
        /var/www/oddb_rack.org/src/util/session.rb:157:in `get_currency_rate'
        /var/www/oddb_rack.org/src/view/dataformat.rb:196:in `convert_price'
        /var/www/oddb_rack.org/src/view/dataformat.rb:159:in `formatted_price'
        /var/www/oddb_rack.org/src/view/dataformat.rb:135:in `price_exfactory'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:67:in `block in compose_list'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `each_with_index'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `compose_list'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:323:in `block in compose_list'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:318:in `each'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:318:in `compose_list'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:54:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:129:in `init'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:254:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:76:in `new'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:76:in `create'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
        /var/www/oddb_rack.org/src/view/drugs/result.rb:126:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
        /var/www/oddb_rack.org/src/view/publictemplate.rb:71:in `new'
        /var/www/oddb_rack.org/src/view/publictemplate.rb:71:in `content'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
        /var/www/oddb_rack.org/src/view/publictemplate.rb:68:in `init'
        /var/www/oddb_rack.org/src/view/resulttemplate.rb:29:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:240:in `new'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:240:in `view'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:173:in `to_html'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:491:in `to_html'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:252:in `block in process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `synchronize'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/app.rb:119:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/chunked.rb:54:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
        ODDB::View::Drugs::ResultList::COMPONENTS[[8, 0]] in create(price_exfactory)
        ODDB::View::Drugs::ResultComposite::COMPONENTS[[0, 2]] in create(ODDB::View::Drugs::ResultList)
        ODDB::View::Drugs::Result::COMPONENTS[[0, 2]] in create(content)

This is now at least an error inside the rack app, where I can use pry. No. The problem was that the currency service was not started. Now a search via IKSNR works. A search via Asprin (price) and for Nolvadex via trademark take so much time, that I must stop the service. Done another trademark search for Nolvadex, waited till I got a ReadTimeout.

Net::ReadTimeout: Net::ReadTimeout
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/protocol.rb:176:in `rbuf_fill'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/protocol.rb:154:in `readuntil'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/protocol.rb:164:in `readline'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/http/response.rb:40:in `read_status_line'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/http/response.rb:29:in `read_new'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/http.rb:1446:in `block in transport_request'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/http.rb:1443:in `catch'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/http.rb:1443:in `transport_request'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/http.rb:1416:in `request'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:329:in `block in open_http'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/net/http.rb:877:in `start'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:323:in `open_http'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:741:in `buffer_open'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:212:in `block in open_loop'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:210:in `catch'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:210:in `open_loop'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:151:in `open_uri'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:721:in `open'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/open-uri.rb:35:in `open'
        /var/www/oddb_rack.org/src/view/tooltip.rb:18:in `set_tooltip'
        /var/www/oddb_rack.org/src/view/additional_information.rb:267:in `ikscat'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:67:in `block in compose_list'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `each_with_index'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `compose_list'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:323:in `block in compose_list'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:318:in `each'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:318:in `compose_list'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:54:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:129:in `init'
        /var/www/oddb_rack.org/src/view/drugs/resultlist.rb:254:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:76:in `new'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:76:in `create'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
        /var/www/oddb_rack.org/src/view/drugs/result.rb:126:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
        /var/www/oddb_rack.org/src/view/publictemplate.rb:71:in `new'
        /var/www/oddb_rack.org/src/view/publictemplate.rb:71:in `content'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
        /var/www/oddb_rack.org/src/view/publictemplate.rb:68:in `init'
        /var/www/oddb_rack.org/src/view/resulttemplate.rb:29:in `init'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:240:in `new'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:240:in `view'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:173:in `to_html'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:491:in `to_html'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:252:in `block in process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `synchronize'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:210:in `process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/app.rb:119:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/chunked.rb:54:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb_rack.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
        ODDB::View::Drugs::ResultList::COMPONENTS[[14, 0]] in create(ikscat)
        ODDB::View::Drugs::ResultComposite::COMPONENTS[[0, 2]] in create(ODDB::View::Drugs::ResultList)
        ODDB::View::Drugs::Result::COMPONENTS[[0, 2]] in create(content)

There must be a fundamental problem here. Are the indices not loaded/used correctly?

Starting import_daily to see how far we get here. The first error to fix is

/var/www/oddb_rack.org/src/util/oddbapp.rb:1541:in `initialize': unknown keyword: auxiliary (ArgumentError)
        from /var/www/oddb_rack.org/src/util/job.rb:40:in `new'
        from /var/www/oddb_rack.org/src/util/job.rb:40:in `run'
        from jobs/import_daily:12:in `<module:Util>'
        from jobs/import_daily:11:in `<module:ODDB>'
        from jobs/import_daily:10:in `<main>'

This was easily fixed via commit Fix starting ODDB::App for jobs

Now I have troubles sending a e-mail:

process: jobs/import_daily
init system
init system: 4.432897152
setup drb-delegation
2017-06-14 09:20:16 +0200: Latest saved (3407 bytes) as /var/www/oddb_rack.org/data/csv/evidentia_fi_link-2017.06.14.csv and /var/www/oddb_rack.org/data/csv/evidentia_fi_link-latest.csv
Delegating evidentia_search_links_hash=
Delegating odba_store
/var/www/oddb_rack.org/src/util/mail.rb: Configured email using /var/www/oddb_rack.org/etc/oddb.yml @cfg is now "smtp.gmail.com" 587 "ngiger@ywesee.com"
Util.log_and_deliver_mail to=["ngiger@ywesee.com"] subject ch.ODDB.org Report - Evidentia_FI_search_links - 06/2017 size 113 with 0 attachments. #<Mail::Body:0x0055ebf54154d8 @boundary=nil, @preamble=nil, @epilogue=nil, @charset="US-ASCII", @part_sort_order=["text/plain", "text/enriched", "text/html"], @parts=[], @raw_source="2017-06-14 09:20:16 +0200 Added 34 search_links from /var/www/oddb_rack.org/data/csv/evidentia_fi_link-latest.csv", @encoding="7bit">
Util.send_mail rescue: error is #<Net::SMTPAuthenticationError: 535-5.7.8 Username and Password not accepted. Learn more at
> recipients ["ngiger@ywesee.com"] /var/www/oddb_rack.org/src/util/mail.rb:91:in `send_mail'
/var/www/oddb_rack.org/src/util/log.rb:53:in `notify'
/var/www/oddb_rack.org/src/util/updater.rb:575:in `update_immediate_with_error_report'
/var/www/oddb_rack.org/src/util/updater.rb:397:in `update_evidentia_fi_search_links'
/var/www/oddb_rack.org/src/util/updater.rb:205:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb_rack.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

This error went away when using admin@ywesee.com as sender for the SMTP-Account.

Corrected an error with Fix auth method for sending stmp mails

Now looking again at the error when following the "SL Neuaufnahmen". Looks like mod_ruby had a method passthru which is not available for rack. Using pry to analyse the situation when we follow http://oddb-ci2.dyndns.org/de/gcc/rss/channel/sl_introduction.rss

From: /home/niklaus/git/sbsm/lib/sbsm/session.rb @ line 436 SBSM::Session#passthru:

    434:                def passthru(*args)
    435:       require 'pry'; binding.pry
 => 436:                        @request.passthru(*args)
    437:                end

[1] pry(#<ODDB::Session>)> args
=> ["/var/www/oddb_rack.org/data/rss/de/sl_introduction.rss", "inline"]

Before rack in sbsm the passthru was defined and used as follows in lib/sbsm/request.rb

    def passthru(path, disposition='attachment')
      # the variable @passthru is set by a trusted source
      @passthru    = path.untaint
      @disposition = disposition
      ''
    end
<..> drb_process
			cookie_input = @proxy.cookie_input
			# view.to_html can call passthru instead of sending data
			if(@passthru)
				unless(cookie_input.empty?)
					cookie = generate_cookie(cookie_input)
					@request.headers_out.add('Set-Cookie', cookie.to_s)
				end
        basename = File.basename(@passthru)
        fullpath = File.expand_path(
          @passthru,
          @request.server.document_root.untaint)
				subreq = @request.lookup_file(fullpath)
				@request.content_type = subreq.content_type
				@request.headers_out.add('Content-Disposition',
					"#@disposition; filename=#{basename}")
				@request.headers_out.add('Content-Length',
					File.size(fullpath).to_s)
				begin
					File.open(fullpath) { |fd| @request.send_fd(fd) }
        rescue Errno::ENOENT, IOError => err
          @request.log_reason(err.message, @passthru)
          return Apache::NOT_FOUND
        end

I had omitted these changes as they were not used by the other applications. Fixed this problem in sbsm.

In the import_daily got errors because the fi-parse daemon was not active. Must fix running sudo -u apache bundle-240 exec ruby-240 ext/fiparse/bin/fiparsed Got the success reports for

  • Evidentia_FI_search_links
  • recall.rss
  • hpc.rss

No find the root case of the search problem, I want make bin/admin work to be able to check which functions work fine and which not. Fixed starting bin/admin with commit Add start_service in ODDB::App.new

Now (at least some functions) of bin/admin work as seen by

sudo -u apache /usr/local/bin/bundle-240 exec ruby-240 bin/admin
ch.oddb> registrations.size
-> 11935
ch.oddb> registrations.first
-> ["65908", #<ODBA::Stub:47175066625040#34114601 @odba_class= @odba_container=47175078848120#22>]
ch.oddb> registration('62969')
-> #<ODDB::Registration:0x007f2bab36dc50>
ch.oddb> registration('62969').name_base
-> Relvar Ellipta 92/22 mcg

Looks like we have problem when searching the lib/sbsm/session.rb when process_rack_request calls to_html, where the error NoMethodError undefined method `size' for nil:NilClass is thrown.

Restarting import_daily before working on sandoz.xmlconv. Failed with

/usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:745:in `rescue in block in open': druby://localhost:10005 - #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 10005> (DRb::DRbConnError)
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:739:in `block in open'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:738:in `each'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:738:in `open'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1248:in `initialize'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1228:in `new'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1228:in `open'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1141:in `block in method_missing'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1160:in `with_friend'
        from /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1140:in `method_missing'
        from /var/www/oddb_rack.org/src/plugin/xls_export.rb:22:in `export_generics'
        from /var/www/oddb_rack.org/src/util/exporter.rb:157:in `export_generics_xls'
        from /var/www/oddb_rack.org/src/util/updater.rb:456:in `update_swissmedic_followers'
        from /var/www/oddb_rack.org/src/util/updater.rb:219:in `run'
        from jobs/import_daily:13:in `block in <module:Util>'
        from /var/www/oddb_rack.org/src/util/job.rb:40:in `run'
        from jobs/import_daily:12:in `<module:Util>'
        from jobs/import_daily:11:in `<module:ODDB>'
        from jobs/import_daily:10:in `<main>'

After runnning it a second time (with all ch.oddb* deamons, except crawler) started, I got

ODBA::Stub was unable to replace #13534582 from ODDB::Package:#234513
undefined method `empty?' for nil:NilClass
Something is wrong with @sequences of Registration (iksnr = 57061)
/var/www/oddb_rack.org/log/job.pid is deleted
view · edit · sidebar · attach · print · history
Page last modified on June 16, 2017, at 12:28 PM