<< 20160720-non-flavor-url-sbsm-fix-encoding-error-sandoz-xmlconv-bbmb-ch | Index | 20160718-fix-search-filter-xmlconv-fix-encoding-issue-and-flavor-bbmb-ch >>
Xmlconv takes Inputs following interfaces:
I have to known this error why comes (and from where).
Error:/de/sbsm/transaction/state_id/47437178829060/transaction_id/29066
RuntimeError Bestellung OK, Eintrag in BBMB fehlgeschlagen: DRb::DRbConnError druby://localhost:12004 - # /usr/local/lib/ruby/2.3.0/drb/drb.rb:745:in `rescue in block in open' /usr/local/lib/ruby/2.3.0/drb/drb.rb:739:in `block in open' /usr/local/lib/ruby/2.3.0/drb/drb.rb:738:in `each' /usr/local/lib/ruby/2.3.0/drb/drb.rb:738:in `open' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1248:in `initialize' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1228:in `new' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1228:in `open' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1141:in `block in method_missing' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1160:in `with_friend' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1140:in `method_missing' ...
sandoz.xmlconv.bbmb.ch uses xmlconv with PopMission
(pop email).
Then I've setup stunnel same with production.
Links:
* http://www.stunnel.org/index.html
I'v emergeed stunnel 5.34-r1 with USE flag ssl and tcpd.
% eix stunnel [I] net-misc/stunnel Available versions: 5.24^t 5.30^t 5.34-r1^t {ipv6 libressl selinux ssl stunnel3 tcpd} Installed versions: 5.34-r1^t(10:32:36 AM 07/19/2016)(ssl tcpd -ipv6 -libressl -selinux -stunnel3) Homepage: http://www.stunnel.org/index.html Description: TLS/SSL - Port Wrapper
And start it manually, in foreground.
% sudo stunnel /etc/stunnel/gmail.conf 2016.07.19 10:41:32 LOG5[ui]: stunnel 5.34 on x86_64-pc-linux-gnu platform 2016.07.19 10:41:32 LOG5[ui]: Compiled/running with OpenSSL 1.0.2h 3 May 2016 2016.07.19 10:41:32 LOG5[ui]: Threading:PTHREAD Sockets:POLL,IPv4 TLS:ENGINE,OCSP,PSK,SNI Auth:LIBWRAP 2016.07.19 10:41:32 LOG5[ui]: Reading configuration from file /etc/stunnel/gmail.conf 2016.07.19 10:41:32 LOG5[ui]: UTF-8 byte order mark not detected 2016.07.19 10:41:32 LOG4[ui]: Service [gmail] needs authentication to prevent MITM attacks 2016.07.19 10:41:32 LOG5[ui]: Configuration successful
Stunnel setup (gmail.conf is below) is fine. It works.
But, PollingManager reports error :'(
# cat /etc/stunnel/gmail.conf foreground = yes client = yes pid = fips = no [gmail] delay = yes accept = localhost:10000 connect = pop.gmail.com:995
PollingManager
reports Connection reset by peer.
[2] 2.3.1-p112(#<XmlConv::Util::PollingManager>)> e => #<Errno::ECONNRESET: Connection reset by peer - SSL_connect> [3] 2.3.1-p112(#<XmlConv::Util::PollingManager>)> e.backtrace => ["/usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/pop.rb:553:in `connect'", "/usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/pop.rb:553:in `do_start'", "/usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/net/pop.rb:537:in `start'", ...
The openssl version in my local machine is 1.0.2h-r2:
% equery l -po openssl * Searching for openssl ... [-P-] [ ] dev-libs/openssl-0.9.8z_p8:0.9.8 [-P-] [ ] dev-libs/openssl-1.0.2g-r2:0 [-P-] [ ] dev-libs/openssl-1.0.2h:0 [-P-] [ ] dev-libs/openssl-1.0.2h-r1:0 [IP-] [ ] dev-libs/openssl-1.0.2h-r2:0
% equery u dev-libs/openssl [ Legend : U - final flag setting for installation] [ : I - package is installed with flag ] [ Colors : set, unset ] * Found these USE flags for dev-libs/openssl-1.0.2h-r2: U I - - abi_x86_32 : 32-bit (x86) libraries + + asm : Support assembly hand optimized crypto functions (i.e. faster run time) - - bindist : Disable EC algorithms (as they seem to be patented) -- note: changes the ABI - - gmp : Add support for dev-libs/gmp (GNU MP library) - - kerberos : Add kerberos support + + rfc3779 : Enable support for RFC 3779 (X.509 Extensions for IP Addresses and AS Identifiers) - - sctp : Support for Stream Control Transmission Protocol + + sslv2 : Support for the old/insecure SSLv2 protocol -- note: not required for TLS/https + + sslv3 : Support for the old/insecure SSLv3 protocol -- note: not required for TLS/https - - static-libs : Build static versions of dynamic libraries as well - - test : Workaround to pull in packages needed to run with FEATURES=test. ... anymore + + tls-heartbeat : Enable the Heartbeat Extension in TLS and DTLS - - vanilla : Do not add extra patches which change default behaviour; DO NOT USE THIS ... + + zlib : Add support for zlib (de)compression
% openssl s_client -connect localhost:10000 CONNECTED(00000003) 140284816983696:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:794: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 7 bytes and written 308 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE No ALPN negotiated SSL-Session: Protocol : TLSv1.2 Cipher : 0000 Session-ID: Session-ID-ctx: Master-Key: Key-Arg : None PSK identity: None PSK identity hint: None SRP username: None Start Time: 1468921427 Timeout : 300 (sec) Verify return code: 0 (ok) ---
The runtime error above comes as POST Request (not Email). # I've heared by Zeno.
So, I check this as next.
I've got internal error on my local:
It needs still some configurations.
% curl -v http://sandoz.xmlconv.bbmb.ch.on.klewenalp/propharma -H "Content-Type: text/xml" -d @./test.xml * Trying 127.0.0.1... * Connected to sandoz.xmlconv.bbmb.ch.on.klewenalp (127.0.0.1) port 80 (#0) > POST /propharma HTTP/1.1 > Host: sandoz.xmlconv.bbmb.ch.on.klewenalp > User-Agent: curl/7.49.0 > Accept: */* > Content-Type: text/xml > Content-Length: 828 > * upload completely sent off: 828 out of 828 bytes < HTTP/1.1 500 Internal Server Error < Date: Tue, 19 Jul 2016 10:58:07 GMT < Server: Apache < Content-Length: 0 < Connection: close < Content-Type: text/plain < * Closing connection 0
In production, I've tested using test xml.
% curl -H "Content-type: text/xml" -d @test.xml -v http://sandoz.xmlconv.bbmb.ch/propharma
[Tue Jul 19 13:24:35 2016] [notice] Received Request POST [Tue Jul 19 13:24:35 2016] [notice] from 212.51.146.241 [Tue Jul 19 13:24:35 2016] [notice] content-length: 817 [Tue Jul 19 13:24:35 2016] [error] NoMethodError [Tue Jul 19 13:24:35 2016] [error] undefined method `deliveries' for nil:NilClass [Tue Jul 19 13:24:35 2016] [error] (druby://localhost:12006) /var/www/sandoz.xmlconv.bbmb.ch/lib/conversion/sunstore_bdd.rb:43:in `respond'\n(druby://localhost:12006) /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.8/lib/xmlconv/util/transaction.rb:95:in `response'\n(druby://localhost:12006) /usr/local/lib/ruby/gems/2.3.0/gems/xmlconv-1.0.8/lib/xmlconv/util/application.rb:119:in `execute_with_response'\n(druby://localhost:12006) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block'\n(druby://localhost:12006) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform'\n(druby://localhost:12006) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop'\n(druby://localhost:12006) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in ...
In my local machine. (It seems that same space or load order issue occurs):
[Tue Jul 19 13:28:17 2016] [notice] Received Request POST [Tue Jul 19 13:28:17 2016] [notice] from 127.0.0.1 [Tue Jul 19 13:28:17 2016] [notice] content-length: 817 [Tue Jul 19 13:28:18 2016] [error] NameError [Tue Jul 19 13:28:18 2016] [error] uninitialized constant #<Module:0x7f3879cf6990>::XmlConv [Tue Jul 19 13:28:18 2016] [error] /var/www/sandoz.xmlconv.bbmb.ch/doc/propharma.rbx:29\n/path/to/ruby/1.8/apache/ruby-run.rb:53:in `load'\n/path/to/ruby/1.8/apache/ruby-run.rb:53:in `handler'
This mine error was caused by gem version.propharma.rbx
works on mod_ruby (compiled with Ruby 1.8.6) and it needs paths to some gems (Because it does not have rubygems support yet)
So, Finally, I was able to get same error in production.
[Tue Jul 19 13:44:41 2016] [notice] Received Request POST [Tue Jul 19 13:44:41 2016] [notice] from 127.0.0.1 [Tue Jul 19 13:44:41 2016] [notice] content-length: 817 [Tue Jul 19 13:44:46 2016] [error] NoMethodError [Tue Jul 19 13:44:46 2016] [error] undefined method `deliveries' for nil:NilClass [Tue Jul 19 13:44:46 2016] [error] (druby://localhost:12006) /var/www/sandoz.xmlconv.bbmb.ch/lib/conversion/sunstore_bdd.rb:43:in `respond'\n(druby://localhost:12006) /path/to/xmlconv/lib/xmlconv/util/transaction.rb:95:in `response'\n(druby://localhost:12006)
Where come from this error?
> https://github.com/zdavatz/sandoz.xmlconv.bbmb.ch/blob/2bb02b586d1242b082de6a70f1f6421050e22fe3/lib/conversion/sunstore_bdd.rb#L43
And this error rescuerd at here:
> https://github.com/zdavatz/xmlconv/blob/c194dc43ae960d7bc9e91b0fa4664963611d9af3/lib/xmlconv/util/application.rb#L33
At last, I've found error at this execution of Transaction.
[8] 2.3.1-p112(#<XmlConv::Util::Transaction>)> @input => "<?xml version=\"1.0\" encoding=\"utf-8\"?><customerOrderxmlns: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=\"99" /> <orderHeader deliveryDate=\"2016-07-15\" referenceNumber=\"99\"/> <orderLines> <productOrderLine orderQuantity=\"2\"> <pharmaCode id=\"2820109\" /> ... [9] 2.3.1-p112(#<XmlConv::Util::Transaction>)> reader_instance.parse(@input) REXML::ParseException: malformed XML: missing tag start Line: 1 Position: 838 Last 80 unconsumed characters: <customerOrderxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="htt from /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/rexml/parsers/baseparser.rb:375:in `pull_event'
And I've noticed that the reason of this error is LINE BREAK.
I've checked valid xml (without line break before/after tag attributes) work on my local and production.
test.xml:
99 is test user number (ywesee Test)
<?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="2820109" /> </productOrderLine> <productOrderLine orderQuantity="20"> <pharmaCode id="2991259" /> </productOrderLine> <productOrderLine orderQuantity="2"> <pharmaCode id="3458455" /> </productOrderLine> <productOrderLine orderQuantity="2"> <pharmaCode id="3938445" /> </productOrderLine> </orderLines> </customerOrder>
Finaly, I was able to reproduce following error in my local machine.
This error means BBMB (sandoz.bbmb.ch's bbmbd process) is down.
Error message says already so!!!Bestellung OK, Eintrag in BBMB fehlgeschlagen
RuntimeError Bestellung OK, Eintrag in BBMB fehlgeschlagen: DRb::DRbConnError druby://localhost:12004 - # /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:745:in `rescue in block in open' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:739:in `block in open' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:738:in `each' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:738:in `open' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:1248:in `initialize' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:1228:in `new' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:1228:in `open' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:1141:in `block in method_missing' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:1160:in `with_friend' /usr/local/share/rbenv/versions/2.3.1/lib/ruby/2.3.0/drb/drb.rb:1140:in `method_missing' /var/www/sandoz.xmlconv.bbmb.ch/lib/postprocess/bbmb2.rb:38:in `block in inject' ...
And, in addition. The same situation is also already documented at here:
http://dev.ywesee.com/Gag/Xmlconvchangelog
Links:
* http://dev.ywesee.com/wiki.php/XmlConv/Sandoz
ch.bbmb.xmlconv.sandoz> transaction(29096).class -> XmlConv::Util::Transaction
Check with which parameters, BBMB injection is called.
# xmlconv/lib/xmlconv/util/transaction.rb def postprocess if(@postprocs.respond_to?(:each)) @postprocs.each { |klass, *args| next if args.empty? args.push(self) $stderr.puts(args) PostProcess.const_get(klass).send(*args) } end end
inject druby://localhost:12004 customer_id #<XmlConv::Util::Transaction:0x0055b1e117f1e0>
`Bbmb` PostProcess is not used. Ues `Bbmb2`. And `inject` above is method name.
Then, How to re:inject to bbmbd (sandoz.bbmb.ch)
Boot bin/admin
% bundle exec xmlconv_admin config=/var/www/sandoz.xmlconv.bbmb.ch/etc/config.yml could not find htmlgrid.so, falling back to pure-ruby class ch.bbmb.xmlconv.sandoz>
And then pass Transaction by ID.
# bin/admin in sandoz.xmlconv.bbmb.ch (xmlconv) ch.bbmb.xmlconv.sandoz> XmlConv::PostProcess::Bbmb2.inject('druby://localhost:12004', 'customer_id', transaction(29096)) -> bbmb_ok
# process in sandoz.bbmb.ch (bbmb) Mail.sendmail smtp.gmail.com 25 localhost.localdomain smtp_user: yasaka@ywesee.com XXXXXXXXX XXXXX Mail.sendmail from yasaka@ywesee.com to yasaka@ywesee.com cc [] message: String /path/to/sandoz.bbmb.ch/.bundle/gems/ruby/2.3.0/gems/ydim-1.0.3/lib/ydim/smtp_tls.rb:10:in `do_start': \ Object#timeout is deprecated, use Timeout.timeout instead. -> "220 smtp.gmail.com ESMTP xxxxxxxxxxxx.3 - gsmtp\r\n" <- "EHLO localdomain\r\n" -> "250-smtp.gmail.com at your service, [xx.xx.xx.xx]\r\n" -> "250-SIZE 35882577\r\n" -> "250-8BITMIME\r\n" -> "250-STARTTLS\r\n" -> "250-ENHANCEDSTATUSCODES\r\n" -> "250-PIPELINING\r\n" -> "250-CHUNKING\r\n" -> "250 SMTPUTF8\r\n" <- "STARTTLS\r\n" -> "220 2.0.0 Ready to start TLS\r\n" <- "EHLO localdomain\r\n" -> "250-smtp.gmail.com at your service, [xx.xx.xx.xx]\r\n" -> "250-SIZE 35882577\r\n" -> "250-8BITMIME\r\n" -> "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n" -> "250-ENHANCEDSTATUSCODES\r\n" -> "250-PIPELINING\r\n" -> "250-CHUNKING\r\n" -> "250 SMTPUTF8\r\n" <- "AUTH PLAIN XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==\r\n" -> "235 2.7.0 Accepted\r\n" <- "MAIL FROM:<yasaka@ywesee.com>\r\n" -> "250 2.1.0 OK xxxxxxxxxxxx.3 - gsmtp\r\n" <- "RCPT TO:<yasaka@ywesee.com>\r\n" -> "250 2.1.5 OK xxxxxxxxxxxx.3 - gsmtp\r\n" <- "DATA\r\n" -> "354 Go ahead xxxxxxxxxxxxx.3 - gsmtp\r\n" writing message from String wrote 728 bytes -> "250 2.0.0 OK 1468936410 xxxxxxxxxxx.3 - gsmtp\r\n" <- "QUIT\r\n" -> "221 2.0.0 closing connection xxxxxxxxxxxx.3 - gsmtp\r\n"
And You will get a email such as following:
# this order file is created into FTP directory
Bbmb-Order 99-86 99,,19072016,86,2323983,7680553510121,00547865,1,7.03,99, 99,,19072016,86,3458484,7680573110080,44017529,1,57.16,99, 99,,19072016,86,3938468,7680568730286,44056961,1,35.54,99, 99,,19072016,86,4714179,7680604860182,44023132,2,60.18,99, 99,,19072016,86,4963020,7680561890512,44042139,2,10.60,99, 99,,19072016,86,4963037,7680561890529,44042140,1,14.80,99, 99,,19072016,86,5423366,7680559350103,44045689,2,61.52,99,
Finally, You have to cleanup error (RuntimeError) in Transaction
ch.bbmb.xmlconv.sandoz> transaction(29096).error -> RuntimeError ch.bbmb.xmlconv.sandoz> transaction(29096).error = nil -> ch.bbmb.xmlconv.sandoz> transaction(29096).odba_store -> #<XmlConv::Util::Transaction:0x00556666e41ed0>
And then, reboot xmlconvd (for remains caching value into memory).
See:
https://github.com/zdavatz/sandoz.xmlconv.bbmb.ch/pull/2