libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 11ca15404680694c5d18f7f6300b504a881f20d3
parent 87974b488382fabd262c63c0523aa2f26fbe557f
Author: Florian Dold <florian.dold@gmail.com>
Date:   Tue,  8 Oct 2019 12:28:59 +0530

fix XML schema validation

Java libraries need some extra logic to handle includes properly.  Also,
one of the EBICS schema files was broken.

Diffstat:
A.idea/$PRODUCT_WORKSPACE_FILE$ | 20++++++++++++++++++++
A.idea/modules.xml | 9+++++++++
A.idea/modules/libeufin.iml | 10++++++++++
Msrc/main/kotlin/tech/libeufin/Main.kt | 5-----
Msrc/main/kotlin/tech/libeufin/XML.kt | 75+++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Asrc/main/resources/ebics_H004.xsd | 11+++++++++++
Asrc/main/resources/ebics_keymgmt_response_H004.xsd | 137+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/main/resources/ebics_orders_H004.xsd | 4++--
Asrc/main/resources/ebics_request_H004.xsd | 355+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/main/resources/ebics_response_H004.xsd | 166+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/main/resources/ebics_types_H004.xsd | 4++--
Msrc/test/kotlin/XmlTest.kt | 2--
Msrc/test/resources/ebics_ini_request_sample.xml | 4++--
13 files changed, 763 insertions(+), 39 deletions(-)

diff --git a/.idea/$PRODUCT_WORKSPACE_FILE$ b/.idea/$PRODUCT_WORKSPACE_FILE$ @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="masterDetails"> + <states> + <state key="ProjectJDKs.UI"> + <settings> + <last-edited>12</last-edited> + <splitter-proportions> + <option name="proportions"> + <list> + <option value="0.2" /> + </list> + </option> + </splitter-proportions> + </settings> + </state> + </states> + </component> +</project> +\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="ProjectModuleManager"> + <modules> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/libeufin.iml" filepath="$PROJECT_DIR$/.idea/modules/libeufin.iml" /> + </modules> + </component> +</project> +\ No newline at end of file diff --git a/.idea/modules/libeufin.iml b/.idea/modules/libeufin.iml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/../.." /> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> +\ No newline at end of file diff --git a/src/main/kotlin/tech/libeufin/Main.kt b/src/main/kotlin/tech/libeufin/Main.kt @@ -46,11 +46,6 @@ fun main() { val logger = getLogger() val xmlProcess = XML() - if (xmlProcess.isNull()) { - logger.error("Could not load the XML processor, aborting") - return - } - dbCreateTables() val server = embeddedServer(Netty, port = 5000) { diff --git a/src/main/kotlin/tech/libeufin/XML.kt b/src/main/kotlin/tech/libeufin/XML.kt @@ -19,9 +19,14 @@ package tech.libeufin; +import com.sun.org.apache.xerces.internal.dom.DOMInputImpl import org.w3c.dom.Document +import org.w3c.dom.ls.LSInput +import org.w3c.dom.ls.LSResourceResolver +import org.xml.sax.ErrorHandler import org.xml.sax.InputSource import org.xml.sax.SAXException +import org.xml.sax.SAXParseException import java.io.ByteArrayInputStream import java.io.IOException import java.io.InputStream @@ -42,43 +47,61 @@ import javax.xml.transform.stream.StreamResult import javax.xml.transform.stream.StreamSource import javax.xml.validation.SchemaFactory + /** * This class takes care of importing XSDs and validate * XMLs against those. */ class XML { - /** - * Bundle of all the XSDs loaded in memory, from disk. + * Validator for EBICS messages. */ - private val bundle = { + private val validator = try { val classLoader = ClassLoader.getSystemClassLoader() - val schemas = arrayOf( - StreamSource(classLoader.getResourceAsStream("ebics_hev.xsd")), - StreamSource(classLoader.getResourceAsStream("xmldsig-core-schema.xsd")), - StreamSource(classLoader.getResourceAsStream("ebics_types_H004.xsd")), - StreamSource(classLoader.getResourceAsStream("ebics_signature_S002.xsd")), - StreamSource(classLoader.getResourceAsStream("ebics_orders_H004.xsd")), - StreamSource(classLoader.getResourceAsStream("ebics_keymgmt_request_H004.xsd")) - ) - - try { - val sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI) - sf.newSchema(schemas) - } catch (e: SAXException) { - e.printStackTrace() - null + val sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI) + sf.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "file") + sf.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "") + sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true) + sf.errorHandler = object : ErrorHandler { + override fun warning(p0: SAXParseException?) { + println("Warning: $p0") + } + + override fun error(p0: SAXParseException?) { + println("Error: $p0") + } + + override fun fatalError(p0: SAXParseException?) { + println("Fatal error: $p0") + } } - }() - private val validator = bundle?.newValidator() - - /** - * True if the object didn't initialize - */ - fun isNull(): Boolean { - return (validator == null) || (bundle == null) + sf.resourceResolver = object : LSResourceResolver { + override fun resolveResource( + type: String?, + namespaceURI: String?, + publicId: String?, + systemId: String?, + baseUri: String? + ): LSInput? { + if (type != "http://www.w3.org/2001/XMLSchema") { + return null + } + val res = classLoader.getResourceAsStream(systemId) ?: return null + return DOMInputImpl(publicId, systemId, baseUri, res, "UTF-8") + } + } + val schemaInputs = arrayOf( + StreamSource(classLoader.getResourceAsStream("ebics_H004.xsd"), "/ebics_H004.xsd"), + StreamSource(classLoader.getResourceAsStream("ebics_hev.xsd"), "/ebics_hev.xsd") + ) + val bundle = sf.newSchema(schemaInputs) + bundle.newValidator() + } catch (e: SAXException) { + e.printStackTrace() + throw e } + /** * Parse string into XML DOM. * @param xmlString the string to parse. diff --git a/src/main/resources/ebics_H004.xsd b/src/main/resources/ebics_H004.xsd @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> + <annotation> + <documentation xml:lang="de">ebics_H004.xsd inkludiert alle Schemadateien des EBICS-Protokolls, um die Eindeutigkeit von Element- und Typnamen im EBCIS Namespace zu erzwingen.</documentation> + <documentation xml:lang="en">ebics_H004.xsd includes all schema files for the EBICS protocol in order to enforce unique element and type names in the EBICS namespace.</documentation> + </annotation> + <include schemaLocation="ebics_request_H004.xsd"/> + <include schemaLocation="ebics_response_H004.xsd"/> + <include schemaLocation="ebics_keymgmt_request_H004.xsd"/> + <include schemaLocation="ebics_keymgmt_response_H004.xsd"/> +</schema> diff --git a/src/main/resources/ebics_keymgmt_response_H004.xsd b/src/main/resources/ebics_keymgmt_response_H004.xsd @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Mit XMLSpy v2008 rel. 2 sp2 (http://www.altova.com) von benutzerservice benutzerservice (SIZ GmbH) bearbeitet --> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> + <annotation> + <documentation xml:lang="de">ebics_keymgmt_response_H004.xsd ist das EBICS-Protokollschema für Schlüsselmanagement-Antwortnachrichten (HIA, HPB, HSA, INI).</documentation> + </annotation> + <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"> + <annotation> + <documentation xml:lang="de">XML-Signature.</documentation> + </annotation> + </import> + <include schemaLocation="ebics_types_H004.xsd"/> + <include schemaLocation="ebics_orders_H004.xsd"/> + <element name="ebicsKeyManagementResponse"> + <annotation> + <documentation xml:lang="de">Electronic Banking Internet Communication Standard des Zentralen Kreditausschusses (ZKA): Multibankfähige Schnittstelle zur internetbasierten Kommunikation.</documentation> + </annotation> + <complexType> + <sequence> + <element name="header"> + <annotation> + <documentation xml:lang="de">enthält die technischen Transaktionsdaten.</documentation> + </annotation> + <complexType> + <sequence> + <element name="static"> + <annotation> + <documentation xml:lang="de">enhält alle festen Headereinträge.</documentation> + </annotation> + <complexType> + <sequence/> + </complexType> + </element> + <element name="mutable" type="ebics:KeyMgmntResponseMutableHeaderType"> + <annotation> + <documentation xml:lang="de">enthält alle variablen Headereinträge.</documentation> + </annotation> + </element> + </sequence> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </complexType> + </element> + <element name="body"> + <annotation> + <documentation xml:lang="de">enthält die Auftragsdaten und den fachlichen ReturnCode.</documentation> + </annotation> + <complexType> + <sequence> + <element name="DataTransfer" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Transfer von Auftragsdaten; nur bei Download anzugeben (HPB).</documentation> + </annotation> + <complexType> + <sequence> + <element name="DataEncryptionInfo"> + <annotation> + <documentation xml:lang="de">Informationen zur Verschlüsselung der Auftragsdaten</documentation> + </annotation> + <complexType> + <complexContent> + <extension base="ebics:DataEncryptionInfoType"> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </extension> + </complexContent> + </complexType> + </element> + <element name="OrderData"> + <annotation> + <documentation xml:lang="de">enthält Auftragsdaten.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:OrderDataType"> + <anyAttribute namespace="##targetNamespace" processContents="lax"/> + </extension> + </simpleContent> + </complexType> + </element> + <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> + <element name="ReturnCode"> + <annotation> + <documentation xml:lang="de">Antwortcode für den vorangegangenen Transfer.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:ReturnCodeType"> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </extension> + </simpleContent> + </complexType> + </element> + <element name="TimestampBankParameter" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Zeitstempel der letzten Aktualisierung der Bankparameter; nur in der Initialisierungsphase anzugeben.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:TimestampType"> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </extension> + </simpleContent> + </complexType> + </element> + </sequence> + </complexType> + </element> + </sequence> + <attributeGroup ref="ebics:VersionAttrGroup"/> + </complexType> + </element> + <complexType name="KeyMgmntResponseMutableHeaderType"> + <annotation> + <documentation xml:lang="de">Datentyp für den variablen EBICS-Header.</documentation> + </annotation> + <sequence> + <element name="OrderID" type="ebics:OrderIDType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Auftragsnummer von Sendeaufträgen gemäß DFÜ-Abkommen (used for all key management order types except download order type HPB).</documentation> + </annotation> + </element> + <element name="ReturnCode" type="ebics:ReturnCodeType"> + <annotation> + <documentation xml:lang="de">Rückmeldung des Ausführungsstatus mit einer eindeutigen Fehlernummer.</documentation> + </annotation> + </element> + <element name="ReportText" type="ebics:ReportTextType"> + <annotation> + <documentation xml:lang="de">Klartext der Rückmeldung des Ausführungsstatus.</documentation> + </annotation> + </element> + <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + </complexType> +</schema> diff --git a/src/main/resources/ebics_orders_H004.xsd b/src/main/resources/ebics_orders_H004.xsd @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Mit XMLSpy v2008 rel. 2 (http://www.altova.com) von Sabine Wenzel (SIZ Bonn) bearbeitet --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:esig="http://www.ebics.org/S001" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:esig="http://www.ebics.org/S002" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> <annotation> <documentation xml:lang="de">ebics_orders_H004.xsd enthält auftragsbezogene Referenzelemente und auftragsbezogene Typdefinitionen für EBICS.</documentation> <documentation xml:lang="en">ebics_orders_H004.xsd contains order-based reference elements and order-based type definitions for EBICS.</documentation> </annotation> - <import namespace="http://www.ebics.org/S001" schemaLocation="ebics_signature_S002.xsd"/> + <import namespace="http://www.ebics.org/S002" schemaLocation="ebics_signature_S002.xsd"/> <include schemaLocation="ebics_types_H004.xsd"/> <!--Es folgen die Elementdefinitionen für neue EBICS-Auftragsarten (Hxx). Die XML-Klartext-Struktur wird im EBICS-Auftragsdatenkontext binär interpretiert.--> <element name="EBICSOrderData" abstract="true"> diff --git a/src/main/resources/ebics_request_H004.xsd b/src/main/resources/ebics_request_H004.xsd @@ -0,0 +1,355 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!-- Mit XMLSpy v2008 rel. 2 (http://www.altova.com) von Sabine Wenzel (SIZ Bonn) bearbeitet --> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> +<annotation> + <documentation xml:lang="de">ebics_request_H004.xsd ist das EBICS-Protokollschema für Anfragen.</documentation> + <documentation xml:lang="en">ebics_request_H004.xsd is the appropriate EBICS protocol schema for standard requests.</documentation> +</annotation> +<include schemaLocation="ebics_types_H004.xsd"/> +<include schemaLocation="ebics_orders_H004.xsd"/> +<import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/> +<element name="ebicsRequest"> + <annotation> + <documentation xml:lang="de">Electronic Banking Internet Communication Standard of the EBICS SCRL: Multibankfähige Schnittstelle zur internetbasierten Kommunikation.</documentation> + <documentation xml:lang="en">Electronic Banking Internet Communication Standard der EBICS SCRL: multi-bank capable interface for internet-based communication.</documentation> + </annotation> + <complexType> + <sequence> + <element name="header"> + <annotation> + <documentation xml:lang="de">enthält die technischen Transaktionsdaten.</documentation> + <documentation xml:lang="en">contains the transaction-driven data.</documentation> + </annotation> + <complexType> + <sequence> + <element name="static" type="ebics:StaticHeaderType"> + <annotation> + <documentation xml:lang="de">enhält alle festen Headereinträge.</documentation> + <documentation xml:lang="en">contains the static header entries.</documentation> + </annotation> + </element> + <element name="mutable" type="ebics:MutableHeaderType"> + <annotation> + <documentation xml:lang="de">enthält alle variablen Headereinträge.</documentation> + <documentation xml:lang="en">contains the mutable header entries.</documentation> + </annotation> + </element> + </sequence> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </complexType> + </element> + <element ref="ebics:AuthSignature"/> + <element name="body"> + <annotation> + <documentation xml:lang="de">enthält die Auftragsdaten, EU(s) und weitere Nutzdaten.</documentation> + <documentation xml:lang="en">contains order data, order signature(s) and further data referring to the current order.</documentation> + </annotation> + <complexType> + <sequence> + <annotation> + <documentation xml:lang="de"/> + </annotation> + <element ref="ds:X509Data" minOccurs="0" maxOccurs="0"> + <annotation> + <documentation xml:lang="de">X.509-Daten des Teilnehmers.</documentation> + <documentation xml:lang="en">X.509 data of the user.</documentation> + </annotation> + </element> + <choice> + <annotation> + <documentation xml:lang="de">Welche Transaktionsphase?</documentation> + <documentation xml:lang="en">Which transaction phase?</documentation> + </annotation> + <sequence> + <annotation> + <documentation xml:lang="de">Initialisierungs- und Transferphase.</documentation> + <documentation xml:lang="en">Initialisation or transfer phase.</documentation> + </annotation> + <element name="PreValidation" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Daten zur Vorabprüfung; nur anzugeben in der Initialisierungsphase bei Uploads mit Auftragsattribut OZH (EUs + Auftragsdaten).</documentation> + <documentation xml:lang="en">Data sent for pre-validation; mandatory for initialisation phase during uploads using order attribute OZH (order signature(s) + order data).</documentation> + </annotation> + <complexType> + <complexContent> + <extension base="ebics:PreValidationRequestType"> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </extension> + </complexContent> + </complexType> + </element> + <element name="DataTransfer" type="ebics:DataTransferRequestType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Transfer von Signatur- bzw. Auftragsdaten; nur bei Upload anzugeben.</documentation> + <documentation xml:lang="en">Transfer of signature or order data; mandatory for uploads only.</documentation> + </annotation> + </element> + </sequence> + <sequence> + <annotation> + <documentation xml:lang="de">Quittierungsphase nach Download.</documentation> + <documentation xml:lang="en">Receipt phase after download.</documentation> + </annotation> + <element name="TransferReceipt"> + <annotation> + <documentation xml:lang="de">Quittierung des Transfers.</documentation> + <documentation xml:lang="en">Receipt of transfer.</documentation> + </annotation> + <complexType> + <complexContent> + <extension base="ebics:TransferReceiptRequestType"> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </extension> + </complexContent> + </complexType> + </element> + </sequence> + </choice> + </sequence> + </complexType> + </element> + </sequence> + <attributeGroup ref="ebics:VersionAttrGroup"/> + <anyAttribute namespace="##targetNamespace" processContents="strict"/> + </complexType> +</element> +<complexType name="StaticHeaderType"> + <annotation> + <documentation xml:lang="de">Datentyp für den statischen EBICS-Header.</documentation> + <documentation xml:lang="en">Data type for the static EBICS header.</documentation> + </annotation> + <sequence> + <element name="HostID" type="ebics:HostIDType"> + <annotation> + <documentation xml:lang="de">Hostname des Banksystems.</documentation> + </annotation> + </element> + <choice> + <annotation> + <documentation xml:lang="de">Transaktionsphase?</documentation> + <documentation xml:lang="en">Transaction phase?</documentation> + </annotation> + <sequence> + <annotation> + <documentation xml:lang="de">Initialisierungsphase.</documentation> + <documentation xml:lang="en">Initialisation phase.</documentation> + </annotation> + <element name="Nonce" type="ebics:NonceType"> + <annotation> + <documentation xml:lang="de">Zufallswert; damit wird die Initialisierungsnachricht des Clients einzigartig.</documentation> + <documentation xml:lang="en">Random value, ensures the uniqueness of the client's message during initialisation phase.</documentation> + </annotation> + </element> + <element name="Timestamp" type="ebics:TimestampType"> + <annotation> + <documentation xml:lang="de">aktueller Zeitstempel zur Begrenzung der serverseitigen Nonce-Speicherung.</documentation> + <documentation xml:lang="en">current timestamp, used to limit storage space for nonces on the server.</documentation> + </annotation> + </element> + <element name="PartnerID" type="ebics:PartnerIDType"> + <annotation> + <documentation xml:lang="de">Kunden-ID des serverseitig administrierten Kunden.</documentation> + <documentation xml:lang="en">ID of the partner = customer, administered on the server.</documentation> + </annotation> + </element> + <element name="UserID" type="ebics:UserIDType"> + <annotation> + <documentation xml:lang="de">Teilnehmer-ID des serverseitig zu diesem Kunden administrierten Teilnehmers.</documentation> + <documentation xml:lang="en">ID of the user that is assigned to the given customer, administered on the server.</documentation> + </annotation> + </element> + <element name="SystemID" type="ebics:UserIDType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">technische User-ID für Multi-User-Systeme.</documentation> + <documentation xml:lang="en">ID of the system for multi-user systems.</documentation> + </annotation> + </element> + <element name="Product" nillable="true" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Kennung des Kundenprodukts bzw. Herstellerkennung oder Name.</documentation> + <documentation xml:lang="en">software ID / manufacturer ID / manufacturer's name of the customer's software package.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:ProductType"> + <attribute name="Language" type="ebics:LanguageType" use="required"> + <annotation> + <documentation xml:lang="de">Sprachkennzeichen der Kundenproduktversion (gemäß ISO 639).</documentation> + <documentation xml:lang="en">Language code of the customer's software package according to ISO 639.</documentation> + </annotation> + </attribute> + <attribute name="InstituteID" type="ebics:InstituteIDType" use="optional"> + <annotation> + <documentation xml:lang="de">Kennung des Herausgebers des Kundenprodukts bzw. des betreuenden Kreditinstituts.</documentation> + <documentation xml:lang="en">ID of the manufacturer / financial institute providing support for the customer's software package.</documentation> + </annotation> + </attribute> + </extension> + </simpleContent> + </complexType> + </element> + <element name="OrderDetails" type="ebics:StaticHeaderOrderDetailsType"> + <annotation> + <documentation xml:lang="de">Auftragsdetails.</documentation> + <documentation xml:lang="en">order details.</documentation> + </annotation> + </element> + <element name="BankPubKeyDigests"> + <annotation> + <documentation xml:lang="de">Hashwerte der erwarteten öffentlichen Schlüssel (Verschlüsselung, Signatur, Authentifikation) des Kreditinstituts.</documentation> + <documentation xml:lang="en">Digest values of the expected public keys (authentication, encryption, signature) owned by the financial institute.</documentation> + </annotation> + <complexType> + <sequence> + <element name="Authentication"> + <annotation> + <documentation xml:lang="de">Hashwert des Authentifikationsschlüssels.</documentation> + <documentation xml:lang="en">Digest value of the public authentication key.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:PubKeyDigestType"> + <attribute name="Version" type="ebics:AuthenticationVersionType" use="required"> + <annotation> + <documentation xml:lang="de">Version des Authentifikationsverfahrens.</documentation> + <documentation xml:lang="en">Version of the algorithm used for authentication.</documentation> + </annotation> + </attribute> + </extension> + </simpleContent> + </complexType> + </element> + <element name="Encryption"> + <annotation> + <documentation xml:lang="de">Hashwert des Verschlüsselungsschlüssels.</documentation> + <documentation xml:lang="en">Digest value of the public encryption key.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:PubKeyDigestType"> + <attribute name="Version" type="ebics:EncryptionVersionType" use="required"> + <annotation> + <documentation xml:lang="de">Version des Verschlüsselungsverfahrens.</documentation> + <documentation xml:lang="en">Version of the algorithm used for encryption.</documentation> + </annotation> + </attribute> + </extension> + </simpleContent> + </complexType> + </element> + <element name="Signature" minOccurs="0" maxOccurs="0"> + <annotation> + <documentation xml:lang="de">Hashwert des Signaturschlüssels.</documentation> + <documentation xml:lang="en">Digest value of the public signature key.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:PubKeyDigestType"> + <attribute name="Version" type="ebics:SignatureVersionType" use="required"> + <annotation> + <documentation xml:lang="de">Version des Signaturverfahrens.</documentation> + <documentation xml:lang="en">Version of the algorithm used for signature creation.</documentation> + </annotation> + </attribute> + </extension> + </simpleContent> + </complexType> + </element> + </sequence> + </complexType> + </element> + <element name="SecurityMedium" type="ebics:SecurityMediumType"> + <annotation> + <documentation xml:lang="de">Angabe des Sicherheitsmediums, das der Kunde verwendet.</documentation> + <documentation xml:lang="en">Classification of the security medium used by the customer.</documentation> + </annotation> + </element> + <element name="NumSegments" type="ebics:NumSegmentsType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Gesamtsegmentanzahl für diese Transaktion; nur bei Uploads anzugeben.</documentation> + <documentation xml:lang="en">Total number of segments for this transaction; mandatory for uploads only.</documentation> + </annotation> + </element> + <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + <sequence> + <annotation> + <documentation xml:lang="de">Transfer- und Quittierungsphase.</documentation> + <documentation xml:lang="en">Transfer or receipt phase.</documentation> + </annotation> + <element name="TransactionID" type="ebics:TransactionIDType"> + <annotation> + <documentation xml:lang="de">eindeutige, technische Transaktions-ID; wird vom Server vergeben.</documentation> + <documentation xml:lang="en">unique transaction ID, provided by the server.</documentation> + </annotation> + </element> + </sequence> + </choice> + </sequence> +</complexType> +<complexType name="MutableHeaderType"> + <annotation> + <documentation xml:lang="de">Datentyp für den variablen EBICS-Header.</documentation> + <documentation xml:lang="en">Data type for the mutable EBICS header.</documentation> + </annotation> + <sequence> + <element name="TransactionPhase" type="ebics:TransactionPhaseType"> + <annotation> + <documentation xml:lang="de">Phase, in der sich die Transaktion gerade befindet; wird bei jedem Transaktionsschritt vom Client gesetzt und vom Server übernommen.</documentation> + <documentation xml:lang="en">Current phase of the transaction; this information is provided by the client for each step of the transaction, and the server adopts the setting.</documentation> + </annotation> + </element> + <element name="SegmentNumber" nillable="true" minOccurs="0"> + <annotation> + <documentation xml:lang="de">enthält die Nummer des aktuellen Segments, welches gerade übertragen oder angefordert wird; nur anzugeben bei TransactionPhase=Transfer.</documentation> + <documentation xml:lang="en">contains the number of the segment which is currently being transmitted or requested; mandatory for transaction phase 'Transfer' only.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:SegmentNumberType"> + <attribute name="lastSegment" type="boolean" use="required"> + <annotation> + <documentation xml:lang="de">Ist dies das letzte Segment der Übertragung?</documentation> + <documentation xml:lang="en">Is this segment meant to be the last one regarding this transmission?</documentation> + </annotation> + </attribute> + </extension> + </simpleContent> + </complexType> + </element> + <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </sequence> +</complexType> +<complexType name="StaticHeaderOrderDetailsType"> + <annotation> + <documentation xml:lang="de">Datentyp für Auftragsdetails im statischen EBICS-Header.</documentation> + <documentation xml:lang="en">Data type for order details stored in the static EBICS header.</documentation> + </annotation> + <sequence> + <element name="OrderType"> + <annotation> + <documentation xml:lang="de">Auftragsart.</documentation> + <documentation xml:lang="en">type code of the order.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:OrderTBaseType"/> + </simpleContent> + </complexType> + </element> + <element name="OrderID" type="ebics:OrderIDType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Auftragsnummer für Sendeaufträge gemäß DFÜ-Abkommen.</documentation> + <documentation xml:lang="en">ID of the (upload) order, formatted in accordance with the document "DFÜ-Abkommen".</documentation> + </annotation> + </element> + <element name="OrderAttribute" type="ebics:OrderAttributeType"> + <annotation> + <documentation xml:lang="de">Auftragsattribut.</documentation> + <documentation xml:lang="en">attribute describing the order contents.</documentation> + </annotation> + </element> + <element ref="ebics:OrderParams"/> + </sequence> +</complexType> +</schema> diff --git a/src/main/resources/ebics_response_H004.xsd b/src/main/resources/ebics_response_H004.xsd @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="UTF-8"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> + <annotation> + <documentation xml:lang="de">ebics_response_H004.xsd ist das EBICS-Protokollschema für Antwortnachrichten.</documentation> + <documentation xml:lang="en">ebics_response_H004.xsd is the appropriate EBICS protocol schema for standard responses.</documentation> + </annotation> + <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"> + <annotation> + <documentation xml:lang="de">XML-Signature.</documentation> + </annotation> + </import> + <include schemaLocation="ebics_types_H004.xsd"/> + <include schemaLocation="ebics_orders_H004.xsd"/> + <element name="ebicsResponse"> + <annotation> + <documentation xml:lang="de">Electronic Banking Internet Communication Standard des Zentralen Kreditausschusses (ZKA): Multibankfähige Schnittstelle zur internetbasierten Kommunikation.</documentation> + <documentation xml:lang="en">Electronic Banking Internet Communication Standard of the "Zentraler Kreditausschuss (ZKA)": multi-bank capable interface for internet-based communication.</documentation> + </annotation> + <complexType> + <sequence> + <element name="header"> + <annotation> + <documentation xml:lang="de">enthält die technischen Transaktionsdaten.</documentation> + <documentation xml:lang="en">contains the transaction-driven data.</documentation> + </annotation> + <complexType> + <sequence> + <element name="static" type="ebics:ResponseStaticHeaderType"> + <annotation> + <documentation xml:lang="de">enhält alle festen Headereinträge.</documentation> + <documentation xml:lang="en">contains the static header entries.</documentation> + </annotation> + </element> + <element name="mutable" type="ebics:ResponseMutableHeaderType"> + <annotation> + <documentation xml:lang="de">enthält alle variablen Headereinträge.</documentation> + <documentation xml:lang="en">contains the mutable header entries.</documentation> + </annotation> + </element> + </sequence> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </complexType> + </element> + <element ref="ebics:AuthSignature"> + <annotation> + <documentation xml:lang="de">Authentifikationssignatur.</documentation> + <documentation xml:lang="en">Authentication signature.</documentation> + </annotation> + </element> + <element name="body"> + <annotation> + <documentation xml:lang="de">enthält die Auftragsdaten, EU(s) und weitere Nutzdaten.</documentation> + <documentation xml:lang="en">contains order data, order signature(s) and further data referring to the current order.</documentation> + </annotation> + <complexType> + <sequence> + <element name="DataTransfer" type="ebics:DataTransferResponseType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Transfer von Auftragsdaten; nur bei Download anzugeben.</documentation> + <documentation xml:lang="en">Transfer of signature or order data; mandatory for downloads only.</documentation> + </annotation> + </element> + <element name="ReturnCode"> + <annotation> + <documentation xml:lang="de">fachlicher Antwortcode für den vorangegangenen Request.</documentation> + <documentation xml:lang="en">order-related return code of the previous request.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:ReturnCodeType"> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </extension> + </simpleContent> + </complexType> + </element> + <element name="TimestampBankParameter" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Zeitstempel der letzten Aktualisierung der Bankparameter; nur in der Initialisierungsphase anzugeben.</documentation> + <documentation xml:lang="en">timestamp indicating the latest update of the bank parameters; may be set during initialisation phase only.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:TimestampType"> + <attributeGroup ref="ebics:AuthenticationMarker"/> + </extension> + </simpleContent> + </complexType> + </element> + </sequence> + </complexType> + </element> + </sequence> + <attributeGroup ref="ebics:VersionAttrGroup"/> + <anyAttribute namespace="##targetNamespace" processContents="strict"/> + </complexType> + </element> + <complexType name="ResponseStaticHeaderType"> + <annotation> + <documentation xml:lang="de">Datentyp für den statischen EBICS-Header.</documentation> + <documentation xml:lang="en">Data type for the static EBICS header.</documentation> + </annotation> + <sequence> + <element name="TransactionID" type="ebics:TransactionIDType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">eindeutige, technische Transaktions-ID; wird vom Server vergeben, falls OrderAttribute entweder gleich "OZHNN" oder gleich "DZHNN" ist und falls tatsächlich eine Transaktion erzeugt wurde.</documentation> + <documentation xml:lang="en">unique transaction ID, provided by the server if and only if the order attribute is set to either "OZHNN" or "DZHNN" and if a transaction has been established actually.</documentation> + </annotation> + </element> + <element name="NumSegments" type="ebics:SegmentNumberType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Gesamtsegmentanzahl für diese Transaktion; nur bei Downloads in der Initialisierungsphase anzugeben.</documentation> + <documentation xml:lang="en">Total number of segments for this transaction; mandatory for downloads in initialisation phase only.</documentation> + </annotation> + </element> + </sequence> + </complexType> + <complexType name="ResponseMutableHeaderType"> + <annotation> + <documentation xml:lang="de">Datentyp für den variablen EBICS-Header.</documentation> + <documentation xml:lang="en">Data type for the mutable EBICS header.</documentation> + </annotation> + <sequence> + <element name="TransactionPhase" type="ebics:TransactionPhaseType"> + <annotation> + <documentation xml:lang="de">Phase, in der sich die Transaktion gerade befindet; wird bei jedem Transaktionsschritt vom Client gesetzt und vom Server übernommen.</documentation> + <documentation xml:lang="en">Current phase of the transaction; this information is provided by the client for each step of the transaction, and the server adopts the setting.</documentation> + </annotation> + </element> + <element name="SegmentNumber" minOccurs="0"> + <annotation> + <documentation xml:lang="de">enthält die Nummer des aktuellen Segments, welches gerade übertragen oder angefordert wird; nur anzugeben bei TransactionPhase=Transfer und (bei Download) TransactionPhase=Initialisation.</documentation> + <documentation xml:lang="en">contains the number of the segment which is currently being transmitted or requested; mandatory for transaction phases 'Transfer' and (for downloads) 'Initialisation' only.</documentation> + </annotation> + <complexType> + <simpleContent> + <extension base="ebics:SegmentNumberType"> + <attribute name="lastSegment" type="boolean" use="required"> + <annotation> + <documentation xml:lang="de">Ist dies das letzte Segment der Übertragung?</documentation> + </annotation> + </attribute> + </extension> + </simpleContent> + </complexType> + </element> + <element name="OrderID" type="ebics:OrderIDType" minOccurs="0"> + <annotation> + <documentation xml:lang="de">Auftragsnummer von Sendeaufträgen gemäß DFÜ-Abkommen.</documentation> + </annotation> + </element> + <element name="ReturnCode" type="ebics:ReturnCodeType"> + <annotation> + <documentation xml:lang="de">Rückmeldung des technischen Status mit einer eindeutigen Fehlernummer.</documentation> + <documentation xml:lang="en">Return code indicating the technical status.</documentation> + </annotation> + </element> + <element name="ReportText" type="ebics:ReportTextType"> + <annotation> + <documentation xml:lang="de">Klartext der Rückmeldung des technischen Status.</documentation> + <documentation xml:lang="en">Textual interpretation of the returned technical status code.</documentation> + </annotation> + </element> + <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> + </sequence> + </complexType> +</schema> diff --git a/src/main/resources/ebics_types_H004.xsd b/src/main/resources/ebics_types_H004.xsd @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Mit XMLSpy v2008 rel. 2 (http://www.altova.com) von Sabine Wenzel (SIZ Bonn) bearbeitet --> -<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:esig="http://www.ebics.org/S001" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> - <import namespace="http://www.ebics.org/S001" schemaLocation="ebics_signature_S002.xsd"/> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:esig="http://www.ebics.org/S002" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ebics="urn:org:ebics:H004" targetNamespace="urn:org:ebics:H004" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> + <import namespace="http://www.ebics.org/S002" schemaLocation="ebics_signature_S002.xsd"/> <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/> <annotation> <documentation xml:lang="de">ebics_types_H004.xsd enthält einfache Typdefinitionen für EBICS.</documentation> diff --git a/src/test/kotlin/XmlTest.kt b/src/test/kotlin/XmlTest.kt @@ -13,7 +13,6 @@ class XmlTest { @Test fun hevValidation(){ - val classLoader = ClassLoader.getSystemClassLoader() val hev = classLoader.getResourceAsStream("ebics_hev.xml") assertTrue(processor.validate(StreamSource(hev))) @@ -21,7 +20,6 @@ class XmlTest { @Test fun iniValidation(){ - val classLoader = ClassLoader.getSystemClassLoader() val ini = classLoader.getResourceAsStream("ebics_ini_request_sample.xml") assertTrue(processor.validate(StreamSource(ini))) diff --git a/src/test/resources/ebics_ini_request_sample.xml b/src/test/resources/ebics_ini_request_sample.xml @@ -3,8 +3,8 @@ <header authenticate="true"> <static> <HostID>foo</HostID> - <PartnerID>flo-kid</PartnerID> - <UserID>flo-uid</UserID> + <PartnerID>flokid</PartnerID> + <UserID>flouid</UserID> <OrderDetails> <OrderType>INI</OrderType> <OrderAttribute>DZNNN</OrderAttribute>