ZATCA E-Invoice Fails with: XML does not comply with UBL 2.1 standards in line with ZATCA specifications
Chilkat users gets the following error:fatoora -validate -invoice signedXML_withQR.xml ********** Welcome to ZATCA E-Invoice Java SDK 3.1.6 ********************* This SDK uses Java to call the SDK (jar) passing it an invoice XML file. It can take a Standard or Simplified XML, Credit Note, or Debit Note. It returns if the validation is successful or shows errors where the XML validation fails. It checks for syntax and content as well. **************************************************************** 2022-12-09 00:42:57,787 [INFO] XsdValidator - Validate XSD for invoice : signedXML_withQR.xml 2022-12-09 00:42:58,221 [INFO] ValidationProcessorImpl - [XSD] validation result : FAILED 2022-12-09 00:42:58,221 [ERROR] ValidationProcessorImpl - xsd validation errors : 2022-12-09 00:42:58,222 [ERROR] ValidationProcessorImpl - CODE : SAXParseException, MESSAGE : Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications 2022-12-09 00:42:58,223 [INFO] InvoiceValidationService - *** GLOBAL VALIDATION RESULT = FAILEDThe problem is that the UBL 2.1 Schema requires the X509SerialNumber to be a valid value of the atomic type 'xs:integer' Your serial number is a valid integer, but it is very large.
<xades:IssuerSerial>
<ds:X509IssuerName>CN=****, DC=****, DC=gov, DC=local</ds:X509IssuerName>
<ds:X509SerialNumber>1279992876776561391517123451645660279462721123</ds:X509SerialNumber>
</xades:IssuerSerial>
See: https://stackoverflow.com/questions/29953032/large-number-failing-validation-as-type-xsinteger
The only solution is to use a certificate with an issuer cert that does not have a huge decimal serial number. (Or ZATCA needs to fix their schema validation..)