An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# peppol-bis-billing-validator
![Docker Image Version](https://img.shields.io/docker/v/easybill/peppol-bis-billing-validator)
[![Generic badge](https://img.shields.io/badge/License-MIT-blue.svg)]()

## 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.