https://github.com/easybill/peppol-bis-billing-validator
A small service which allows to validate XML against PEPPOL BIS Billing schematron rules
https://github.com/easybill/peppol-bis-billing-validator
docker docker-compose e-invoice e-invoicing en16931 peppol peppol-bis schematron schematron-validation
Last synced: 5 months ago
JSON representation
A small service which allows to validate XML against PEPPOL BIS Billing schematron rules
- Host: GitHub
- URL: https://github.com/easybill/peppol-bis-billing-validator
- Owner: easybill
- License: mit
- Created: 2024-06-07T09:43:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-24T11:16:54.000Z (almost 2 years ago)
- Last Synced: 2024-08-24T12:28:45.195Z (almost 2 years ago)
- Topics: docker, docker-compose, e-invoice, e-invoicing, en16931, peppol, peppol-bis, schematron, schematron-validation
- Language: Java
- Homepage:
- Size: 101 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# peppol-bis-billing-validator

[]()
## Introduction
`peppol-bis-billing-validator` is a small service for validating XML against the official
Peppol BIS Billing 3.0 schematron rules. It exposes a validation endpoint which takes the
to be validated XML and returns the schematron report. The HTTP status code indicates if the
provided XML is valid (200) or has issues (400).
## Usage
This service was mainly designed with containerization in mind. So general idea is to use the following
docker image and make HTTP-Requests from the main application to the service for validation.
- modifying / creating docker-compose.yaml
> The service exposes a health endpoint which can be used to check if the service ready to be used
> You can find a OpenAPI documentation after you started the service at /swagger
```yaml
peppol-validator:
image: 'easybill/peppol-bis-billing-validator:latest'
ports:
- '8081:8080'
environment:
JAVA_TOOL_OPTIONS: -Xmx512m
healthcheck:
test: curl --fail http://localhost:8081/health || exit 0
interval: 10s
retries: 6
```
- starting docker compose
```
docker compose up --detach --wait --wait-timeout 30
```
- Example of using this service (PHP)
```PHP
request('POST', 'http://localhost:8081/validation', [
RequestOptions::HEADERS => [
'Content-Type' => 'application/xml',
],
RequestOptions::BODY => $xml,
RequestOptions::TIMEOUT => 10,
RequestOptions::CONNECT_TIMEOUT => 10,
RequestOptions::HTTP_ERRORS => false,
]);
return 200 === $response->getStatusCode();
}
}
```
- Example response in case the XML is invalid
> The `svrl:failed-assert` elements are relevant to be inspected. They contain the error message.
```xml
Business process MUST be in the format 'urn:fdc:peppol.eu:2017:poacc:billing:NN:1.0' where NN indicates the process number.
```
## Issues & Contribution
Feel free to create pull-requests or issues if you have trouble with this service or any related resources.