E-Invoice Technical Document Details: Java Classes 1-Response
E-Invoice Technical Document Details: Java Classes 1-Response
Java Classes
1- Response
a. Use to Read Response from Zatca
b. ParseResponse Function used to read the response from Zatca and save that information in the
table.
2- ParseJson
a. Use to Parse each response from Zatca
b. Parse Function Use to get the Value from Response of Specific Json Column Type.
c. ParseJsonArray Function Use to get Array of Values from Response of Specific Array of Type.
d. ParseJsonObject Function Use to get the JsonObject from Response.
3- ConvertBase64
a. Use to Convert XML File into Base64 Format.
b. getXMLString Function Extract XML from Table and Convert into Base64 and Update Base64
Column in Table.
c. getInvoiceHash Function read CLOB Data and Return Base64Hash String.
d. getString Function Convert CLOB data into String.
e. Format Function Take String from getString Function and Serialize and Format in UTF-8.
f. parseXmlFile Function use to Parse XML in Proper Format
g. Convert Formatted String into Byte Array.
h. Convert Byte Array into Base64 String Using DatatypeConverter.printBase64Binary
2- Controllers
3- Application AM
2- We use some external Classes for signature, Hashing and Json Located at
$JAVA_TOP/org
Database Package
1- AEC_ZATCA_B2B_PKG
a. Crt_Inv_UBL_XML_Body Use to Generate Record for Invoice.
i. Generate Invoice Hash XML (HASH_XML_BODY_GENERATION).
ii. CRT_INV_UBL_XML_BODY (Generate XML Invoice).
iii. genrate_uuid (Generate UUID for XML).
iv. GET_XML_INFORMATION (Use to Get Previous Invoice Hash and Invoice Number
Reference in case of Credit Note).
v. Crt_Signature_Hash_Update (Use to Update Signature Hash in the Table and Original
XML).
Database Tables
1- AEC_ZATCA_B2B_UBL_SETUP
Use to Have All Information for Connection Certificate and its different Components.
2- AEC_ZATCA_B2B_UBL_XML_TEMP
Use to Have XML Template Structure to Be Joined and Updated when creating original XML and
Hash XML.
3- AEC_ZATCA_B2B_UBL_LK_VALUES
Use to Have Queries for Each Attribute Values in XML.
4- AEC_ZATCA_B2B_REQUESTS.
Use to Have Invoice Information, XML, Hash and Response from Zatca for each transactions.
Database Views
1- ZATCA_INVOICE_INFO_AEC
View Used in the Page to Show all invoice Results Processed or Errors.
Database Sequence
1- AEC_ZATCA_B2B_SEQ
Database Trigger
1- AEC_ZATCA_B2B_REQUESTS_TRG
Trigger on AEC_ZATCA_B2B_REQUESTS Table once Processed Flag is “Y” Means Zatca Response Cleared