ZUGFeRD / mustangproject

Open Source Java e-Invoicing library, validator and tool (Factur-X/ZUGFeRD, UNCEFACT/CII XRechnung)
http://www.mustangproject.org
Apache License 2.0
231 stars 130 forks source link

Run as server #242

Open nd1012 opened 3 years ago

nd1012 commented 3 years ago

Hi,

I'm using your software for validating ZUGFeRD PDF files. It works very good, but it takes ages to validate a single file.

For XRechnung I've been using https://github.com/itplr-kosit/validator-configuration-xrechnung so far, which I can run as local http daemon, too. This tool has a similar processing time when I run it from the command line. But when I use the daemon mode, the validation runs pretty fast.

For this reason I'd like to suggest to support a daemon mode similar to the KoSIT validator for ZUGFeRD actions. I'd be very happy to use it!

Greetings, nd

jstaerk commented 3 years ago

There is a (deamon) Rest API you could pilot-user, so far we never did any serious benchmarking on it.

And I have some hopes that rewriting the schematron processing from ph-schematron to saxon and xpath does not only allow a reader based approach (i.e. no more need for temp-files) but also XRechnung/UBL and hopefully a speedup (because the XSLT processor instance can be reused).

I assume you did already find the batch validation mode, i.e. being able to recursively validate directories using the validateExpectValid action?

nd1012 commented 3 years ago

There is a (deamon) Rest API you could pilot-user

Yes, please :)

I assume you did already find the batch validation mode

I'd like to run a multi-threaded ZUGFeRD validator micro service (for a cloud environment). For this szenario I fear the batch mode doesn't fit well. However, it's a good feature to be able to run multiple validations in one rush.

jstaerk commented 3 years ago

Hi

There is a (deamon) Rest API you could pilot-user

Yes, please :)

Just please drop me a short mail to jstaerk at usegroup.de so I can send you the link.

kind regards Jochen

nd1012 commented 3 years ago

To update this ticket, I've just done some tests with the ZUGFeRD validator REST webservice (thank you, Jochen, you made my day!):

02.06.2021 04:09.40     XRechnung: 0,11878800392151
02.06.2021 04:09.46     ZUGFeRD: 5,0083250999451
02.06.2021 04:10.09     XRechnung: 0,093724012374878
02.06.2021 04:10.15     ZUGFeRD: 5,3283050060272
02.06.2021 04:10.30     XRechnung: 0,079795122146606
02.06.2021 04:10.36     ZUGFeRD: 4,6100389957428
02.06.2021 04:10.46     XRechnung: 0,085416793823242
02.06.2021 04:10.52     ZUGFeRD: 4,6864018440247
02.06.2021 04:11.02     XRechnung: 0,089216947555542
02.06.2021 04:11.08     ZUGFeRD: 4,5003991127014
02.06.2021 04:11.23     XRechnung: 0,087321996688843
02.06.2021 04:11.29     ZUGFeRD: 4,4306631088257
02.06.2021 04:11.47     XRechnung: 0,085178852081299
02.06.2021 04:11.53     ZUGFeRD: 4,4059791564941

The result of a test is the duration in seconds for the validation http request, processing the validation, receiving the response and parsing the XML validation report. XRechnung validates only the XML data, while ZUGFeRD validates the PDF/A-3B and ZUGFeRD environment, too (and in addition, it needs to extract the XML data from the PDF catalog).

With the CLI I've got an average duration of about 9-10 seconds per PDF validation. So an average duration of 4,5s now, using the REST webservice, is a huge improvement (~50%) of processing speed already!

Btw. I've used the same XML and PDF for all tests to get compareable results. All tests did run on a productive server, that may process something else even at the night time. That may be the reason why the duration of the first tests differs a lot from the following tests.

mxsxs2 commented 2 years ago

@nd1012 Hi, I am wondering if you created the REST service yourself or it is built into the project? I am planning to build the validation into CI/CD for one of my projects. Would be easier to call a REST service running in docker than calling a command line app.

nd1012 commented 2 years ago

@jstaerk gave me a REST server in these days, but he asked me not to provide it to anyone - maybe he'd give it to you, too?

mxsxs2 commented 2 years ago

Do you know if it is a pre release software or do they have Saas plans for it?

nd1012 commented 2 years ago

I think what I've got could be pre-release. At the time I've got the download, it was still unclear if it'll be open source, finally, or not. I don't know anything about SaaS plans, but it's pretty simple to run the server as a microservice in your own environment.

mxsxs2 commented 2 years ago

Okay. Ill see what I can do. Thanks!

nd1012 commented 2 years ago

There's a GitHub project which has a commit from March, 10. It's outdated - but better read it by yourself:

https://github.com/ZUGFeRD/mustangserver

jstaerk commented 2 years ago

Unfortunately nobody ever contributed so we abandoned the dropwizard based open-source version but continued with a complete rewrite in Spring Boot. Which is alive and well and available via https://www.mustangproject.org/server/