Trying to make the curl (POST) test work. Must adapt it to make it work with several destinations, which I found on fastpower via the following grep
/var/www/sandoz.xmlconv.bbmb.ch $ grep -w POST log/2017/*/*/a*log | cut -d ' ' -f 7 |sort|uniq / /de/sbsm /pharmasoft /pharmatic /propharma /unilog /volksapotheke/ ngiger@fastpower /var/www/sandoz.xmlconv.bbmb.ch $ grep -w POST log/2017/*/*/a*log | cut -d ' ' -f 7 |grep -c pharmasoft 917 ngiger@fastpower /var/www/sandoz.xmlconv.bbmb.ch $ grep -w POST log/2017/*/*/a*log | cut -d ' ' -f 7 |grep -c pharmatic 1087 ngiger@fastpower /var/www/sandoz.xmlconv.bbmb.ch $ grep -w POST log/2017/*/*/a*log | cut -d ' ' -f 7 |grep -c propharma 34 ngiger@fastpower /var/www/sandoz.xmlconv.bbmb.ch $ grep -w POST log/2017/*/*/a*log | cut -d ' ' -f 7 |grep -c volksapotheke 96
Remarked that in /etc/apache2/vhosts.d/sandoz.bbmb.ch.conf we have an entry @ScriptAlias /pharmasoft /var/www/sandoz.xmlconv.bbmb.ch/doc/sunstore.rbx
The difference between propharma.rbx, pharmatic.rbx, volksapotheke.rbx and sunstore.rbx are
request.content_type = 'text/xml;charset=utf-8'; print xmlconv.execute_with_response(transaction)
Can I see somewhere in the saved orders which partner was used? It does not look like. The partner id is only referenced in lib/postprocess/soap.rb where it is changed to customer.acc_id || customer.party_id
. Therefore I think it should be possible to handle all POST request the same way and set the transation.partner to the request_path, which would be all lowercase and not mixed case like for ProPharma.
Pushed the following commits
Posting still does not work, as in lib/conversion/sunstore_bdd.rb
the transaction.model is nil. Why?
In https://github.com/ngiger/xmlconv/blob/master/lib/xmlconv/util/transaction.rb#L31 the XML-source is not transformed correctly. There are two errors
<?xml version"
is the key. and the rest is the value. But we should have a valid XML-document.
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"
. Trying to fix this problem by changing the test/data/confuse.xml with replacing line-ending by spaces.
Now I am getting the following error when parsing the XML
[1] pry(#<XmlConv::Util::Transaction>)> input_model = reader_instance.parse(@input) => <UNDEFINED> ... </>
Why? Because the document does not contain a root element. This is no problem.
Added a to_html method in lib/xmlconv/view/login.rb
to return an empty answer for POST requests. Now the curl POST request answers with
* upload completely sent off: 629 out of 629 bytes < HTTP/1.1 200 OK < Date: Tue, 06 Jun 2017 10:18:43 GMT < Server: WEBrick/1.3.1 (Ruby/2.4.0/2016-12-24) < Content-Length: 0 < Content-Type: text/html;charset=UTF-8 < Set-Cookie: _session_id=bf502bd91d121915676d9ea0a; path=/ < * Curl_http_done: called premature == 0 * Connection #0 to host sandoz.xmlconv.bbmb.ngiger.ch left intact
Found no easy way to close the connection to host. After fixing the owner of var/output I can cat the newly generated file
cat /var/www/sandoz.xmlconv.bbmb.ch/var/output/99_20170606122302001.txt ,99,06062017,,2508375,,,2,,99,"" ,99,06062017,,5195126,,,2,,99,""
and it displays under http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/47435406056020/transaction_id/28320 the following content
Input Output <?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> ,99,06062017,,2508375,,,2,,99,"" ,99,06062017,,5195126,,,2,,99,"" Fehler ©ywesee.com 2017
Must make the bin/admin-interface work for sandoz.bbmb.ch.
Pushed commits
Checking virbac_admin to find why some users must have their password resetted. The admin-interface can be run via sudo -u bbmb /usr/local/bin/bundle-240 exec ruby-240 bin/virbac_admin
. But on fastpower it fails, because pry is not installed. After fixing this I get the following error
BBMB.config.load from /var/www/virbac.bbmb.ch/etc/config.yml Used version: sbsm 1.4.2, bbmb 2.2.9 virbac 092d5723262ba439902f726a0dcf1d1e0e145661 ch.bbmb.virbac> ODBA.cache.extent(BBMB::Model::Order).size -> DRb::DRbServerNotFound
On oddb-ci2 we listen on port 12099 on tcp AND tcp6, whereas on fastpower we listen only on tcp6.
giger@fastpower /var/www/virbac.bbmb.ch $ sudo netstat -lptu | grep 12002 tcp 0 0 fastpower:12002 *:* LISTEN 18828/Bbmb(Virbac)
The same is true for port 12003 virbac_yus. Why are two services for 12099 started for tcp4 AND tcp6 as on oddb-ci2, as seen by
tcp 0 0 oddb-ci2:12099 0.0.0.0:* LISTEN 307/Bbmb(Virbac) tcp6 0 0 oddb-ci2:12099 [::]:* LISTEN 1966/Bbmb(Virbac)
On oddb-ci2 the process with ID 307 on TPC4 port 12099 was launched by the bin/virbac_admin. If I change on oddb_ci2 the server_url in etc/config.xml to TCP6 by using the line server_url: druby://::1:12099
I get also the error DRb::DRbServerNotFound
Changing the server_port on oddb_ci2 from 12099 to the port 12002 as on fastpower. Calling sudo -u bbmb bundle exec rackup
opens a TCP6 port as seen by sudo netstat -ntlpu | grep 12002
which returns tcp6 0 0 ::1:12002 :::* LISTEN 20303/Bbmb(Virbac)
After changing the server_url to druby://127.0.0.1:12002
I get a TCP4 port tcp 0 0 127.0.0.1:12002 0.0.0.0:* LISTEN 20927/Bbmb(Virbac)
. And now I get again the error DRb::DRbServerNotFound. Therefore I must fix calling the service. After starting the virbac APP I can access the servic via BBMB.service. And the bin/virbac_admin begins to work.
E.g
ch.bbmb.virbac> ODBA.cache.retrieve_from_index('bbmb_model_customer_customer_id', '').last.customer_id -> 17538
Pushed commit Fix bin/virbac_admin Now on fastpower I get
ch.bbmb.virbac> ODBA.cache.retrieve_from_index('bbmb_model_customer_customer_id', '').last.customer_id -> 88611 ch.bbmb.virbac> ODBA.cache.retrieve_from_index('bbmb_model_customer_customer_id', '').last.address_lines -> ["KRONEN / VAS INTERNATIONAL", "", "DR. MED. VET.", "PETER KRONEN", "", "8400 WINTERTHUR"]
But via the HTTP admin web interface I am unable to find a customer 88611. But we can find a customer 88611 via vetoquinol. Therefore the config for the bin/virbac_admin is not yet correct. Looks like we use the DB bbmb_yus and not virbac_bbmb. These DBs are specified in the etc/yus.yml. Are they mixed up? Yes in bin/virbac_admin we first loaded the default config, whereas in the config.ru the etc/config.yml gets loaded first. Fixed with commit Ensure that bin/virbac_admin and config.ru read first etc/config.yml
After pulling these changes on fastpower bin/virbac_admin finally works fine and displays
ch.bbmb.virbac> BBMB::Model::Customer.find_by_customer_id('702329').address_lines -> ["Balcer", "", "& Colette Berner", "Weidstrasse 7", "8580 Amriswil"] ch.bbmb.virbac> BBMB::Model::Customer.find_by_customer_id('702329').email -> balber@bluewin.ch ch.bbmb.virbac> BBMB::Model::Customer.find_by_customer_id('702329').orders.size -> 1 ch.bbmb.virbac> BBMB::Model::Customer.find_by_customer_id('702329').orders.last -> #<BBMB::Model::Order:0x007f45c69c2698>