Public Repository

Last pushed: 3 months ago
Short Description
Base image for XML-based validation based on XML Schema and Schematron.
Full Description

Description

Image that serves as the basis for validation of XML documents using XML Schema and Schematron. This image is meant to be used as the basis of other images that specify the validation artefacts to use and the application's configuration.

To use this you would create an image where you would:

  1. Copy the XML Schema and Schematron files to use.
  2. Copy the application.properties file containing the application's configuration.
  3. Set the copied application.properties file as the source using the spring.config.location property.

The following Dockerfile acts an example assuming that

FROM isaitb/xml-validator:latest
ENV spring.config.location /validator/invoice/
COPY invoice /validator/invoice/

This assumes that folder invoice contains the validation artefacts and the application configuration.

Base image resources

The base image defines the following:

  1. A workdir folder /validator that contains the executable app (a Spring Boot application), and the logging output.
  2. Exposed port 8080 on which the embedded tomcat server listens on.

How to run

Assuming the image defined based on the xml-validator image is called my-validator, use the following command:

docker run -d -p 8000:8080 --name my-validator my-validator

This runs the image in daemon mmode and maps the internal port 8080 to the host's 8000 port.

Annex - full configuration file example

The following is a complete example of the application.properties configuration file to be provided in an inheriting image:

#
# Spring boot application properties
#
# Comma separated list of features to have enabled. Possible values are:
# - form: Web upload form.
# - email: Validation through email.
# - webservice: Validation through web service.
spring.profiles.active=form,webservice
# Maximum permitted size for uploaded files.
multipart.maxFileSize = -1
# The context path to register the application under.
server.context-path = /invoice
# Hide the Spring boot favicon.
spring.mvc.favicon.enabled=false
# Hide the Spring boot banner.
spring.main.banner-mode=off
#
# Custom application properties
#
# A comma-separated list of supported validation types. Values need to be reflected in properties validator.typeLabel, validator.schemaFile, validator.schematronFolder.
validator.type = ubl
# Label to display in the web form for a given validation type (added as a postfix of validator.typeLabel). Only displayed if there are multiple types.
validator.typeLabel.ubl = UBL invoice
# Title of the web page used for file upload.
validator.uploadTitle = UBL invoice validator
# The ID of the web service.
validator.webServiceId = UBLValidationService
# The description of the web service for element "xml".
validator.webServiceDescription.xml = The XML content representing the UBL invoice to validate
# The description of the web service for element "type". Only displayed if there are multiple types.
validator.webServiceDescription.type = The type of validation to perform (ubl).
# The rate at which the temp reports folder is polled for cleanup (in ms).
validator.cleanupPollingRate = 60000
# The rate at which the configured email address is polled for received input files (in ms).
validator.mailPollingRate = 60000
# The root folder from which validation resource paths are calculated (must always end with a '/').
validator.resourceRoot = /validator/resources/
# The schematron files loaded for a given validation type (added as a postfix). This can be a file or folder (must never start with a '/').
validator.schematronFile.ubl = ubl/xsls
# The XSD files loaded for a given validation type (added as a postfix). This can be a file or folder (must never start with a '/').
validator.schemaFile.ubl = ubl/xsds/maindoc/UBL-Invoice-2.1.xsd
# Report path.
validator.reportFolder = /validator/reports
# Prefix of input files in the report folder.
validator.inputFilePrefix = ITB-
# Time to keep XML input files in milliseconds (600000 = 10 minutes).
validator.minimumCachedInputFileAge = 600000
# Time to keep report files in milliseconds (600000 = 10 minutes).
validator.minimumCachedReportFileAge = 600000
# Prefix of report files in the report folder.
validator.reportFilePrefix = TAR-
# Accepted mime-types for validation.
validator.acceptedMimeTypes = application/xml, text/xml
# Properties related to email-based validation.
validator.mailFrom = Sample <sample@gmail.com>
validator.mailAuthEnable = true
validator.mailAuthUsername = sample@gmail.com
validator.mailAuthPassword = samplePass
validator.mailOutboundHost = smtp.gmail.com
validator.mailOutboundPort = 465
validator.mailOutboundSSLEnable = true
validator.mailInboundHost = imap.gmail.com
validator.mailInboundPort = 993
validator.mailInboundSSLEnable = true
validator.mailInboundFolder = INBOX
Docker Pull Command
Owner
isaitb

Comments (0)