Must add the icon for text changes. Having problems that the link does not display correctly, only shows the description. Will fix the problem later.
Must test whether every thing works by doing a post request as documented under http://dev.ywesee.com/Yasu/20130616-sandoz-xmlconv-and-vetoquinol-bbmb#test-post-request-to-sandoz-xmlconv-bbmb-ch
% curl http://sandoz.xmlconv.bbmb.ch/propharma -X POST -H "Content-type: text/xml" -d "<test></test>" <?xml version='1.0' encoding='UTF-8'?> <customerOrderResponse backLogDesired='false' language='de' 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' productDescriptionDesired='false' roundUpForCondition='false' xmlns='http://www.e-galexis.com/schemas/'> </customerOrderResponse>
But first I must convert the database to UTF-8. This must be done in the project xmlconv by adding a file bin/migrate_xmlconv_to_utf_8. Starting with a copy of the ydim/bin/migrate_to_utf_8. First table to translate is XmlConv::Model::Address. But how do I have to create a user for the session? Using the YDIM::RootUser seems to work fine.
Fixing various problem while migrating 28243 bdds. This seem to take quite some time. Added some debug output. Migrating should use about 30 minutes here. Finally it took about 20 minutes. Dumped the database and verified that it contains the same tables but that the contents differ.
Pushed commit Added bin/migrate_xmlconv_to_utf_8
Adding a debug line at line 148 of the script did not work, because it did not count correctly the nrBdds. Therefore I was unable to estimate the progress made.
After adding the line 72 puts " #{__LINE__}: #{Time.now} Migrating #{obj.class} #{obj.to_s}" if obj.is_a?(XmlConv::Model::Bdd)
I was able to estimate the progress by counting the number of Bdd
in the migrate.log created when calling sudo -u bbmb /usr/local/bin/ruby231 bin/migrate_xmlconv_to_utf_8 /var/www/sandoz.xmlconv.bbmb.ch/etc/xmlconv.yml 2>&1 | tee migrate.log
Adding the following lines to /etc/apache2/vhosts.d/sandoz.bbmb.ch.conf
SetEnv ACCESS_DESTINATION '/var/www/sandoz.xmlconv.bbmb.ch/var/output/' SetEnv ACCESS_BBMB druby://localhost:12004 SetEnv WRITER BddCsv ScriptAlias /sunstore /var/www/sandoz.xmlconv.bbmb.ch/doc/sunstore.rbx ScriptAlias /propharma /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx ScriptAlias /pharmatic /var/www/sandoz.xmlconv.bbmb.ch/doc/pharmatic.rbx ScriptAlias /pharmasoft /var/www/sandoz.xmlconv.bbmb.ch/doc/sunstore.rbx ScriptAlias /unilog /var/www/sandoz.xmlconv.bbmb.ch/doc/unilog.rbx ScriptAlias /volksapotheke /var/www/sandoz.xmlconv.bbmb.ch/doc/volksapotheke.rbx
Copying the corresponding rbx files from fastpower.
By a request from zeno I removed on oddb-ci2 the directory /var/www/sandoz.xmlconv.bbmb.ch and cloned it from https://github.com/zdavatz/sandoz.xmlconv.bbmb.ch.git. Now starting /service/sandoz.xmlconv.bbmb.ch fails, because the missing /var/www/sandoz.xmlconv.bbmb.ch/etc/xmlconv.yml
. After copying it, starting failed, because lib/conversion/propharma_bdd.rb still references rockit. Removing these references. Now it does not start because of the missing /var/www/sandoz.xmlconv.bbmb.ch/etc/polling.yml
. Copied from fastpower and left only the entry for propharma.
Now sending the HTTP post results in the following error seen in /var/www/sandoz.bbmb.ch/log/error_log
[Mon Jun 13 13:52:41 2016] [error] mod_ruby: error in ruby [Mon Jun 13 13:52:41 2016] [error] mod_ruby: /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx:4:in `expand_path': Insecure operation - expand_path (SecurityError) [Mon Jun 13 13:52:41 2016] [error] mod_ruby: from /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx:4:in `<top (required)>' [Mon Jun 13 13:52:41 2016] [error] mod_ruby: from /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `load' [Mon Jun 13 13:52:41 2016] [error] mod_ruby: from /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `handler'
After uncommenting the line 4 I got
[Mon Jun 13 13:56:13 2016] [error] mod_ruby: error in ruby [Mon Jun 13 13:56:13 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `file?': Insecure operation - file? (SecurityError) [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block (2 levels) in contains_requirable_file?' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `each' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `any?' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:62:in `block in contains_requirable_file?' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `each' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `any?' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/basic_specification.rb:60:in `contains_requirable_file?' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:925:in `block in find_inactive_by_path' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `each' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:924:in `find_inactive_by_path' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:185:in `try_activate' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:132:in `rescue in require' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx:7:in `<top (required)>' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `load' [Mon Jun 13 13:56:13 2016] [error] mod_ruby: from /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `handler'
After uncommenting lines 7 and I see
tail: Fehler beim Lesen von „/var/www/sandoz.bbmb.ch/log“: Ist ein Verzeichnis tail: /var/www/sandoz.bbmb.ch/log: es ist nicht möglich, bis zum Ende dieses Dateityps vorgehen; kein weiterer Versuch für diesen Namen
Created directory /var/www/sandoz.xmlconv.bbmb.ch/log
.
Created a file post_test.data with the input as show under http://sandoz.xmlconv.bbmb.ch/de/transaction/state_id/70263318189560/transaction_id/28585
Now calling curl http://sandoz.xmlconv.bbmb.ngiger.ch/propharma -X POST -H "Content-type: text/xml" --data @post_test.data
completes with an exit code of 0. But looking at /var/www/sandoz.bbmb.ch/log/error_log shows the following error
[Mon Jun 13 14:13:45 2016] [notice] Received Request POST [Mon Jun 13 14:13:45 2016] [notice] from 172.25.1.75 [Mon Jun 13 14:13:45 2016] [notice] content-length: 1505 [Mon Jun 13 14:13:45 2016] [error] NameError [Mon Jun 13 14:13:45 2016] [error] uninitialized constant #<Module:0x00000001851640>::XmlConv [Mon Jun 13 14:13:45 2016] [error] /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx:33:in `<top (required)>'\n/usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `load'\n/usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `
Adding the xmlconv gem for ruby1.9.3 via sudo /usr/local/bin/gem193 install xmlconv
did not help. After adding to sandoz.xmlconv.bbmb.ch.conf
the lines
RubyAddPath /usr/local/lib64/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib RubyRequire 'xmlconv/util/destination' RubyRequire 'xmlconv/util/transaction'
I got the error
[Mon Jun 13 14:24:07 2016] [error] mod_ruby: failed to require xmlconv/util/transaction [Mon Jun 13 14:24:07 2016] [error] mod_ruby: failed to require xmlconv/util/transaction [Mon Jun 13 14:24:07 2016] [error] mod_ruby: failed to require xmlconv/util/transaction [Mon Jun 13 14:24:07 2016] [error] mod_ruby: error in ruby [Mon Jun 13 14:24:07 2016] [error] mod_ruby: error in ruby [Mon Jun 13 14:24:07 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- odba (LoadError) [Mon Jun 13 14:24:07 2016] [error] mod_ruby: error in ruby [Mon Jun 13 14:24:07 2016] [error] mod_ruby: /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- odba (LoadError) [Mon Jun 13 14:24:07 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' [Mon Jun 13 14:24:07 2016] [error] mod_ruby: from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
Added RubyAddPath /usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/
to sandoz.xmlconv.bbmb.ch.conf
Now the next error seen in /var/www/sandoz.xmlconv.bbmb.ngiger.ch/log/error_log
is
Mon Jun 13 14:31:33 2016] [notice] Received Request POST [Mon Jun 13 14:31:33 2016] [notice] from 172.25.1.75 [Mon Jun 13 14:31:33 2016] [notice] content-length: 1505 [Mon Jun 13 14:31:33 2016] [error] NoMethodError [Mon Jun 13 14:31:33 2016] [error] undefined method `execute_with_response' for BBMB::Persistence::ODBA:BBMB::Util::Server [Mon Jun 13 14:31:33 2016] [error] (druby://localhost:12004) /usr/local/lib/ruby/2.3.0/delegate.rb:87:in `method_missing' (druby://localhost:12004) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block' (druby://localhost:12004) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform' (druby://localhost:12004) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop' (druby://localhost:12004) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `loop' (druby://localhost:12004) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `block in main_loop' /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx:48:in `<top (required)>' /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `load' /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `handler'
Found in /var/www/sandoz.xmlconv.bbmb.ch/log/error_log
[Mon Jun 13 15:21:30 2016] [notice] Received Request POST [Mon Jun 13 15:21:30 2016] [notice] from 172.25.1.75 [Mon Jun 13 15:21:30 2016] [notice] content-length: 1505 [Mon Jun 13 15:21:30 2016] [error] NameError [Mon Jun 13 15:21:30 2016] [error] uninitialized constant #<Module:0x00000000ec4780>::XmlConv [Mon Jun 13 15:21:30 2016] [error] /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx:33:in `<top (required)>' /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `load' /usr/local/lib/ruby/1.9.1/apache/ruby-run.rb:53:in `
After reactivating the require/addpath in /etc/apache2/vhosts.d/sandoz.bbmb.ch.conf
I can post and see under http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm the following
Klicking on the first entry shows
Okay. The class CSV::Writer does no longer exist under Ruby 2.0. Must replace it by CSV.generate.
After fixing the problems I did see in the output of http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/225216580/transaction_id/28259 the following error /var/www/sandoz.xmlconv.bbmb.ch/var/output/4100612722_20160613160931005.txt
. This was easily fixed with sudo chown -R bbmb /var/www/sandoz.xmlconv.bbmb.ch/var/
Next error is
untimeError Bestellung OK, Eintrag in BBMB Fehlgeschlagen: NameError uninitialized constant XmlConv::PostProcess::Bbmb2::Iconv /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:96:in `iconv' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:87:in `info' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:31:in `block in inject' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:16:in `each' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:16:in `each_with_index' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:16:in `inject' /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/transaction.rb:85:in `block in postprocess' /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/transaction.rb:82:in `each' /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/transaction.rb:82:in `postprocess' /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/application.rb:39:in `_execute' /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/application.rb:31:in `execute' /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.2/lib/xmlconv/util/application.rb:115:in `execute_with_response' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `block in main_loop'
After replacing the iconv by encode('UTF-8') the http POST operation completes. The outputs looks good. Attach:sandox_xmlconv_xml.txt
From its output we can see that in concerns the client 4100612722. Navigating to http://sandoz.bbmb.ngiger.ch/de/sbsm/orders/customer_id/4100612722 shows the following images
Clicking on the first line shows the new invoice 36 in http://sandoz.bbmb.ngiger.ch/de/sbsm/order/order_id/4100612722-36 shows
Posting the same invoice to ensure that the total in http://sandoz.bbmb.ngiger.ch/de/sbsm/customer/customer_id/4100612722 (Sfr. 18465.88 -> Sfr. 18776.50) and the detail for the article Atedurex 100/25 mg Filmtbl 100
get increased (6 8 Atedurex 100/25 mg Filmtbl 100 26.39 211.12
-> 7 10 Atedurex 100/25 mg Filmtbl 100 26.39 263.90
). Both are okay.
Pushed my changes:
Creating a watir tests for the injection, which
Create the test first for propharma, then for volksapotheke (this one should fail first, because it requires some minor modifications in doc/volksapotheke.rbx. Pushed commit First watir tests fails
Collecting the turnover is okay, but posting via http fails. Will make it pass tomorrow.