view · edit · sidebar · attach · print · history


<< 20160722-debug-incoming-request-conversion-sandoz-xmlconv-bbmb-ch | Index | 20160719-fix-import-error-sandoz-xmlconv-ch-and-remove-flavor-bbmb-ch >>


  • Reviewed injection flow in xmlconv and bbmb
  • Debugged commit empty error on xmlconv
  • Add EAN-code as search target (in bbmb)
  • Improve test suite for (bundle exec rake test)
  • Removed ARGV violation from sbsm
  • Debugged conversion result status (Fixed Encoding::CompatibilityError)
  • Add sbsm to support non-flavored url (for bbmb products) => Next day

Commits / Patches / Pull Requests, Scripts


Review xmlconv bbmb order injection flow

z.B. propharma in

  1. New order request (xml) as POST Request comes indo *.rbx
  2. In '*.rbx' file, new Transaction is created, and holds xml as its content.
  3. xmlconvd parses transaction's xml and finds order request entries.
  4. xmlconvd saves this transaction in DB, even if bbmbd does not work (also, records error "RuntimeError Bestellung OK, Eintrag in BBMB fehlgeschlagen")
  5. (if bbmbd works fine) xmlconvd passes this transaction to bbmbd ( This is passed through via DRb.
  6. In bbmbd, 'BBMB::Util::Server#inject_order' is evaluated. Order object is saved.
  7. bbmbd sends a Notification as Email and creates (at 'BBMB::Util::Server#send_order') order file into chrooted directory (FTP)

Debug commit empty error bbmb

RuntimeError Bestellung OK, Eintrag in BBMB fehlgeschlagen: RuntimeError can't commit empty order
(druby://localhost:12004) /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.8/lib/bbmb/model/order.rb:99:in `commit!'
(druby://localhost:12004) /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.8/lib/bbmb/persistence/odba/model/order.rb:44:in `commit!' 
(druby://localhost:12004) /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.8/lib/bbmb/model/customer.rb:79:in `block in inject_order'
(druby://localhost:12004) /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.8/lib/bbmb/model/customer.rb:77:in `synchronize' 
(druby://localhost:12004) /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.8/lib/bbmb/model/customer.rb:77:in `inject_order' 
(druby://localhost:12004) /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.8/lib/bbmb/persistence/odba/model/customer.rb:32:in 
(druby://localhost:12004) /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.8/lib/bbmb/util/server.rb:57:in `inject_order' 
(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/ `block in inject'
 /var/www/ `each'
 /var/www/ `each_with_index'
 /var/www/ `inject'

I've reproduced in local, and then checked debugger console.

At BBMB::Util::Server#inject_order:

[1] 2.3.1-p112(#<BBMB::Util::Server>)> customer_id
=> "7601001029439"
[2] 2.3.1-p112(#<BBMB::Util::Server>)> products
=> [{:pcode=>"2820351", :quantity=>2}, {:pcode=>"1583564", :quantity=>1}, {:pcode=>"2358912", :quantity=>10}]
[3] 2.3.1-p112(#<BBMB::Util::Server>)> infos
=> {:reference=>"20.07.20162"}
[4] 2.3.1-p112(#<BBMB::Util::Server>)> opts
=> {:deliver=>true, :create_missing_customer=>"customer_id", :transaction=>"29120", :customer_name=>"Sion"}

Request format is fine. But, Products are not found in Artikle.txt (see pcode).
And this error occur, because order(BBMB::Model::Order)'s positions is empty.

This is expected behavior.

Add ean13 as search target

I've add EAN-Code also as search target.

* Add ean13 as search target

Improve bbmb unit test

SBSM ARGV violation issue

I've countered strange issue, if project use SBSM (SBSM::Session), rake command fails.

% bundle exec rake test                                                         
/usr/local/share/rbenv/versions/2.3.1/bin/ruby -I"lib:test" -I"/path/to/bbmb/.bundle/gems/ruby/2.3.0/gems/rake-11.2.2/lib"
/path/to/bbmb/.bundle/gems/ruby/2.3.0/gems/rake-11.2.2/lib/rake/rake_test_loader.rb:15:in \
`require': cannot load such file -- /path/to/bbmb (LoadError) \
  from /path/to/bbmb/.bundle/gems/ruby/2.3.0/gems/rake-11.2.2/lib/rake/rake_test_loader.rb:15:in `block in <main>'                                                   

It seems that this broken LOAD_PATH or ARG issue is caused by SBSM.

At here (SBSM::Session L53):

		ARGV.push('') # satisfy cgi-offline prompt      #=> this ARGV
		@@cgi ='html4')

This has possibility to brake other application.
Then I've removed this line.

Commit:Remove ARGV violation

Fix internal server error response by success order request

In Some order requests, Injection succeeds (to bbmb), but response is returend as 500 (Internal Server Error)
It seems that this error response is caused by encoding error.

[4] 2.3.1-p112(#<XmlConvApp>)> transaction.response
Encoding::CompatibilityError: incompatible encoding regexp match (UTF-8 regexp with ISO-8859-1 string)
from /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/rexml/text.rb:133:in `=~'

Input xml:

<?xml version="1.0" encoding="ISO-8859-1"?>                                     
<customerOrder xmlns:xsd="" \
xmlns:xsi="" \
compressionDesired="false" productDescriptionDesired="true" \
backLogDesired="true" language="fr" roundUpForCondition="true" version="1.0">
  <client number="xxxxxx" password="xxxxx" />                               
  <orderHeader deliveryDate="2016-07-19"                                        
    referenceNumber="190720161" mannerOfTransport="tour"                        
    phoneCallDesired="false" urgent="false">                                    
    <deliveryAddress line1="Rue du Stade" line4="Pharmacie DU                   
      STADE" line5PostalCode="1965" line5City="Savièse">                       
      <addressLine2And3Text line2="Savièse" line3="DU STADE" />                
    <productOrderLine orderQuantity="2"                                         
      roundUpForCondition="true" backLogDesired="true">                         
      <pharmaCode id="5552537" />                                               
    <productOrderLine orderQuantity="1"                                         
      roundUpForCondition="true" backLogDesired="true">                         
      <pharmaCode id="3938445" />                                               
    <productOrderLine orderQuantity="1"                                         
      roundUpForCondition="true" backLogDesired="true">                         
      <pharmaCode id="4782459" />                                               
    <productOrderLine orderQuantity="2"                                         
      roundUpForCondition="true" backLogDesired="true">                         
      <pharmaCode id="2991153" />                                               
    <productOrderLine orderQuantity="2"                                         
      roundUpForCondition="true" backLogDesired="true">                         
      <pharmaCode id="4008903" />                                               
    <productOrderLine orderQuantity="2"                                         
      roundUpForCondition="true" backLogDesired="true">                         
      <pharmaCode id="5423366" />                                               
    <productOrderLine orderQuantity="1"                                         
      roundUpForCondition="true" backLogDesired="true">                         
      <pharmaCode id="3446104" />                                               

This $stdin is Apache::Request object. It does not have set_encoding method...
This is caused in Ruyb 1.8.6, So I could not use encode incoming request at propharma.rbx file....


Encoding::CompatibilityError is caused by creation with some different encodings (z.B. UTF-8 and ISO-8859-1)

So, I've removed encoding conversion to (ISO-8859-1), and force UTF-8.
# Why _utf8 method convert to ISO-8859-1... ?

On Web UI, Result XML has still strange character, But HTTP Response will be 200 by this change.

Commit:Fix Encoding::CompatibilityError at conversion


Next day, fix this warning in SBSM.
Above change producet this warning.

/path/to/ warning: regexp match /.../n against to UTF-8 string

Fix BBMB Sort order

Next day

view · edit · sidebar · attach · print · history
Page last modified on July 20, 2016, at 07:14 PM