Skip to main content

Integration with KING (on premise)

Written by Jèsel Broekema
Updated this week

Introduction

This guide describes the steps required to connect Zenvoices to a local KING ERP installation.

To realise the integration, the following components must be installed on the customer’s KING ERP database server:

  • King Webservices: This is a software component of KING ERP, used by the Zenvoices King webservice to write data into KING ERP. See the KING Software page for more information, download links, and manuals. King Webservices is hosted in Internet Information Services (IIS).

  • Zenvoices King webservice: This is a Zenvoices software component. The Zenvoices platform communicates with this webservice via the internet, which in turn communicates with KING ERP via King Webservices (writing data) and ODBC (reading data). The Zenvoices King webservice is hosted in IIS.

The diagram below shows the relationship between the components:

Want to learn more about how the integration is secured and which data is exchanged? Read this article for more information.

Questions, comments, or suggestions? Contact us via chat, support@zenvoices.com or +31 (0)85 3038853.

Preparation

Installation requirements

Verify in advance that the following requirements are met:

  • Verify if the customer uses KING ERP 5.57 or higher.

  • Verify if the customer has a KING ERP monthly subscription.

  • Verify if the customer has a KING ERP client-server installation (required for King Webservices).

  • Verify if the customer has a fixed WAN IP address or hostname.

  • Verify if the system administrator can open a WAN TCP port in the firewall/router for a range of IP addresses.

  • Verify if the system administrator can provide access to the KING ERP database server (via TeamViewer, AnyDesk, or similar) to perform the installation remotely (optional).

Preparation by system administrator

See Preparation by system administrator for KING ERP on-premise.

Installation

Log in to the customer’s KING ERP database server and follow the steps below.

please note: King Webservices must be installed on the same server as the KING ERP database server. This is a requirement of King Webservices.

Requirements

  • From the system administrator:

    • WAN IP or hostname

    • Forwarded port (if different from default 8900)

    • Access to the KING ERP database server

  • From the customer:

    • KING ERP login credentials of a user with full rights

    • List of administrations and journals to connect

    • Access to the Zenvoices environment

King Webservices installation

Zenvoices King webservice installation

  1. Download the latest version here. please note: If the customer uses a KING ERP version older than 5.57a1, download version 1.17 of the Zenvoices King webservice here.

  2. Extract the files into a directory (e.g. C:\Zenvoices\King webservice).

  3. Create a new application pool “Zenvoices King webservice” with .NET CLR version v4.0.30319. Set “Enable 32-bit Applications” to True.

  4. Create a new IIS website named “Zenvoices King webservice” and link it to the directory.

  5. Install a valid SSL certificate and create an HTTPS binding with this certificate. If the customer does not have an SSL certificate, a Zenvoices certificate can be used. Contact support to request this certificate. View the manual for installing an SSL certificate here.

  6. Open web.config and update and change a neccecerry information:

    a. King webservice URL (King.Host.Url): local URL of King Webservices

    b. Secret token (Zenvoices.SecretToken): generate (length 32, letters and numbers only)

  7. Verify the IIS website returns a 403 error in a browser (confirms security is active).

Connecting administrations

Follow these steps for each administration to be connected.

Configuration in KING ERP

  1. Enable the following in KING ERP (Help → About King → Administration tab → Change license):

    a. King Data Digger

    b. Webservices Financial

    c. Webservices NAW

    d. Webservices Orders

    e. Digital archive (NAW documents) (optional)

    f. Process archive documents (optional)

  2. Go to Miscellaneous -> Webservices master data, set a fixed access code for the following webservices and save/remember the access code:

  • ArchiveDocument_Add

  • BookingFlow_Close

  • BookingFlow_JournalEntry_JournalLine_Add

  • BookingFlow_JournalEntry_Add

  • BookingFlow_JournalEntry_Delete

  • BookingFlow_Add

  • Creditor_BankAccount_Add

  • Creditor_BankAccount_Delete

  • Creditor_AddUpdate

  • Debtor_BankAccount_Add

  • Debtor_BankAccount_Delete

  • Debtor_AddUpdate

  • PurchaseInvoice_* (if using Purchase to Pay)

  • OpenItem_Update

  • Webservice_Test

** Only required if you use the Zenvoices module Purchase to pay.
3. Check if a digital archive in KING ERP is desired whether the correct digital archive types exist in KING ERP. When a new digital archive type is created, use at least the following settings:

  • Processing: Enter journal entries

  • Journal: the journal for which the digital archive type is used

  • File storage: configure a location (for example <document path>\Purchase). This location is used by Zenvoices for storing archive documents. This directory must be accessible for Zenvoices King webservice.

  • Set at Organisation / Master data digital archive a sequence number with leading zeros, for example 0000001. This prevents a known problem in King Webservices (dated 28-1-2020).

Activate ODBC connection in KING ERP

  1. Open KING ERP on the server on which Zenvoices King webservice is installed.

  2. Go to General | Administration | Modify administration | Choose the administration | External access.

  3. Enter a username and access code, save this and click on ‘Create’.

  4. Click on ‘Activate ODBC connection for this machine’. Now an ODBC datasource has been created.

Create accounting integration in Zenvoices

Please note: Per King administration an accounting integration is created in Zenvoices.

  1. Go to: Manage → Environment → Accounting integrations → New integration → KING ERP

  2. Fill in the requested data:

    a. API url: the URL on which Zenvoices King webservice can be reached via the internet. For example: https://customeripaddress:8900/

    b. Secret token: the web.config installed token.

    c. Connection string: enter this as follows,
    Dsn=KingDataDigger_AdminCode;Uid=Username;Pwd=Password;

    i. Replace Administration code with the administration code of the KING ERP administration.

    ii. Replace Username with the ODBC username (set during the ODBC activation).

    iii. Replace Password with the ODBC access code (set during the ODBC activation).

    d. Administration code: fill this with the administration code of the KING ERP administration.

    e. Administration access code: fill this with the webservice access code set in KING ERP.

  3. Click Next to test the integration. If the integration works, then a list with administrations is shown. This always shows one administration. Does an error occur? Then consult the error message here.

  4. Does the customer work with a digital archive in KING ERP?

    a. No: disable uploading of booking documents in the administration settings in Zenvoices (via Manage / Environment / Administrations / Modify administration / tab KING ERP).

    b. Yes: check if the correct digital archive types are set in the administration settings in Zenvoices (via Manage / Environment / Administrations / Modify administration / tab KING ERP).

  5. Set the default administration data in Zenvoices: currency and country (optional).

  6. Test the intergation by doing the following actions:

    a. Read in a test invoice.

    b. Create an account from the booking screen in Zenvoices.

    c. Save the booking so that this is exported to KING ERP. Does an error occur? Then consult the error message here.

    d. Check the result in KING ERP: check if the booking and the archive document can be consulted. Delete the data afterwards.

Keep KING ERP administration permanently active (optional)

King Webservices can only connect to administrations in which a user is logged in, or if the administration is started when the database server starts. To make the administrations permanently reachable, you can start them when the database server is started. It is important that Qsysteem is also reachable for King Webservices, so that it can be determined whether an administration is accessible or blocked.

You set administrations to remain permanently active by adjusting DB-Parameters.ini from the data map of KING ERP. The QSysteem database and administration databases that must be started when the database starts up must be added to this.

Example:

C:\Quadrant\King\Data\qsysteem.db
C:\Quadrant\King\Data\Demofin.db

When KING ERP is updated, DB-Parameters.ini is not overwritten.

Consult the documentation of King Webservice for more information about this.

Automatically create ledger accounts (optional)

It is possible to have Zenvoices automatically create general ledger accounts in KING ERP for cost centres and cost units. This option can be enabled per administration and is disabled by default. If this option is enabled, then when exporting a booking it is checked whether all general ledger account, cost centre and cost unit combinations exist as general ledger accounts in KING ERP. If this is not the case, then the combination is created by generating an XML file and calling KingJob.exe to import it into KING ERP.

To configure this, the following additional installation actions are required:

  1. Check if Jobs is available in the KING ERP license and is activated in the relevant administrations.

  2. Check if Jobs is available in the KING ERP license and is activated in the relevant administrations.

    a. KingJob executable path (King.KingJob.ExecutableFilePath): the path of KingJob.exe. Example: “C:\Program Files (x86)\King\KingJob.exe”.

    b. KingJob general ledger account import directory (King.KingJob.GrootboekrekeningImportDirectory): the directory to which XML files for creating general ledger accounts in KING ERP via Jobs are written. This directory must be accessible and writable for the IIS worker process. Example: “C:\Zenvoices\King Jobs\”.

    c. KingJob job number for importing general ledger accounts (King.KingJob.GrootboekrekeningImportJobNummer): job number of the job used for creating general ledger accounts in KING ERP. please note that this number must be the same for all administrations. Example: “900”.

  3. Set “Load User Profile” to True in the application pool settings in IIS (this setting is required to be able to start KingJob.exe successfully from the IIS worker process):

    a. Go to Application Pools in IIS manager and click “Advanced settings” for the application pool used by Zenvoices King webservice.

    b. Change the “Load User Profile” setting to “True”:

  4. In the relevant KING ERP administrations, create a job for importing general ledger accounts:

    a. In KING ERP, go to Miscellaneous / Jobs and click Add.

    b. Enter the “Number” field and make sure that this value corresponds to the King.KingJob.GrootboekrekeningImportJobNummer setting from the web.config file of Zenvoices King webservice.

    c. Enter the “Description” field as desired, for example “Import general ledger accounts Zenvoices”.

    d. On the “Lines” tab, click “Add” and change type to “Import”.

    e. Change “Import type” to “General ledger accounts”.

    f. At “Import layout”, click the “i” button and create a new import layout.

    g. Enter “Layout number” and “Description” as desired.

    h. Enter “File name” with the directory that you configured with the King.KingJob.GrootboekrekeningImportDirectory setting in web.config of Zenvoices King webservice and add “ImportGrootboekrekening.xml” after it. Example: “C:\Zenvoices\King Jobs\ImportGrootboekrekening.xml”.

    i. Change “Delete file” to “Yes”.

    j. Click “Close”.

    k. Select the created import layout in the “Job data” window and click “Close”.

  5. Open “Modify administration” for the relevant administrations in the Zenvoices portal, go to the KING ERP tab and enable the option “Automatically create non-existing cost centre/cost unit general ledger accounts when exporting bookings”. If this option is not visible, then the option “Use separate fields for cost centre and cost unit” must first be enabled.

N.B. in some situations it is necessary to change the identity of the IIS app pool to LocalSystem.

Document the installation

Document the data of the installation and any special details. For this, use for example this template. Also provide this documentation to the customer’s system administrator.

After the installation

Points of attention when updating KING ERP

If an update of KING ERP is installed, then King Webservices must also be updated to the corresponding version. You can assume that Zenvoices is compatible with updates of KING ERP. New versions are tested by us and if necessary we adapt our software.

Updating Zenvoices King webservice

New versions of the Zenvoices King webservice may become available. If it is a necessary update, then we will inform the customer or our installation partner about this.

Follow the procedure below for installing an update:

  1. Stop the IIS website of Zenvoices King Webservice

  2. Overwrite all files except web.config

  3. Start the IIS website

  4. Test from Zenvoices whether the integration works

Documentation

Explanation digital archive (since 1-11-2021)

By default, Zenvoices uses for storing archive documents the file location and file name that are set in KING ERP for digital archive types. The variables available in KING ERP are supported, however <volgnummer> does not contain the archive document sequence number but the unique booking number of Zenvoices.

please note: it is important that the file location set in KING ERP is accessible to Zenvoices King webservice.

Explanation digital archive (up to 1-11-2021)

Up to 1-11-2021, the digital archive type settings of KING ERP were not used by Zenvoices and it was necessary to configure an archive directory in Zenvoices King webservice.

Do you want the digital archive type settings to be used by Zenvoices? Then update Zenvoices King webservice to version 1.16 or higher and in Zenvoices enable the option “Use digital archive file storage settings from KING ERP” at Manage / Environment / Accounting package integrations / Modify.

Archive documents are stored in the directory set in the web.config file of the Zenvoices King webservice. For this, the following file name structure is used:

{configured archive directory}{administration code}{journal code}{account code}{invoice number}-{unique code}.{file extension}

The (file) location set in KING ERP for a digital archive type is not used.

In the administration settings in Zenvoices, it can be set which digital archive type must be used for purchase and sales bookings respectively.

Set a different archive directory per administration

Since Zenvoices King webservice version 1.4, it is possible to set a different archive directory per administration. For this, go in Zenvoices to Manage / Environment / Accounting systems and click Modify for the desired accounting system. On the KING ERP tab you will find the setting ‘Digital archive directory’, with which you can set the archive directory that must be used for this administration. If this field is set, then the following file name structure is used:

{configured archive directory of the administration}{journal code}{account code}{invoice number}-{unique code}.{file extension}

List of known error messages when connecting/testing an accounting system

  • “Invalid secret token (403 response)”: the entered secret token is incorrect.

  • “Server response: Format of the initialization string does not conform to specification starting at index 0.”: the connection string is incorrect.

  • “[…] An error occurred while sending the request. –> Unable to connect to the remote server –> A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond […]”:

    • Check whether the API URL was entered correctly.

    • Check whether Zenvoices King webservice has been started.

    • Check whether the port forwarding is configured correctly in the firewall/router.

    • Check whether there is an active firewall blocking the connection (for example Windows Firewall).

  • “[…] No connection could be made because the target machine actively refused it […]”:

    • Check whether the API URL was entered correctly.

    • Check whether Zenvoices King webservice has been started.

    • Check whether the port forwarding is configured correctly in the firewall/router.

    • Check whether there is an active firewall blocking the connection (for example Windows Firewall).

  • “[…] The underlying connection was closed: An unexpected error occurred on a send. –> The handshake failed due to an unexpected packet format.”: check whether the API url was entered correctly. Possibly http is used instead of https, or vice versa.

  • “Request to http://…DemoFin2/Webservice_Test failed. An error occurred while sending the request.”:

    • Check whether King Webservices is installed and active.

    • Check whether the King Webservices URL is configured correctly in the web.config file of Zenvoices King webservice.

  • “Webservice heeft geen toegangscode, toegangscode is niet meegegeven of toegangscodes komen niet overeen!”:

    • Check whether Administration access code was entered correctly.

    • Check whether the webservices access codes are configured correctly in KING ERP.

  • “[…] Database already in use”: check whether ODBC access is activated in KING ERP.

  • “Unexpected character encountered while parsing […]”: check whether the API url points to Zenvoices King webservice.

  • “Creating database connection with system database ‘QSYSTEEM’ failed […]”: check whether the KING ERP databases are permanently active. If this is not the case, then the King administration must be active (that is, opened by at least one user) when it is called by Zenvoices.

  • “The type initializer for ‘Sap.Data.SQLAnywhere.SAConnectionStringBuilder’ threw an exception”: 1. After the first installation and configuration of the King Webservices, the IIS service must be restarted. You do this by running the command “iisreset” in a command prompt with administrator rights. This may solve the problem. 2. check whether the correct version of King Webservices is installed (32-bit or 64-bit, see installation manual of King Webservices) and/or whether the “Enable 32-bit applications” setting in IIS is configured correctly.

List of known error messages when exporting a booking

  • “(20668) Invalid or no archive type supplied”: check whether the digital archive type set in the Zenvoices administration exists in King and is correct.

  • “Unexpected character encountered while parsing […]” or “[…]Archiefstuk_Toevoegen failed with status code 500 (Internal Server Error)“:

    • Try exporting a test booking with an attachment of max. 10 KB and view the error message. Solving this error message will probably solve the problem.

    • View in the Windows event log of the server which error occurs.

    • This message can also occur because the sequence number in digital archive needs to be restored. By entering a 5-digit starting number in the “sequence number” field (for example 00001), this is usually resolved. See image:

  • “Creating database connection with system database ‘QSYSTEEM’ failed […]”: check whether the KING ERP databases are permanently active. If this is not the case, then the King administration must be active (that is, opened by at least one user) when it is called by Zenvoices.

  • “Access to the path ‘…’ is denied”:

    • Check whether a UNC path is configured.

    • Check whether King Webservices has write permissions in the configured directory (see preparations by system administrator).

  • King is too slow in processing the booking to be received. After two minutes, the booking is retrieved back by Zenvoices with the assumption that the booking failed and the webservice returns the error message above. The booking may possibly still be processed later in King; the advice is then to delete the booking in King and perform the export again in Zenvoices to prevent the following error message from being shown: Invoice number already exists for the account in King

List of known error messages when calling King Webservices

  • “HTTP Error 500.19 – Internal Server Error […] 0x800700c1”:

    • Check whether the Dynamic and Static compression modules are configured correctly or disable them.

    • Check whether the bitness of the IIS app pool matches the installed version of King Webservices (32-bit or 64-bit).

Link to test file (attachment <10kb) for getting a detailed error message.

Release notes Zenvoices King webservice

Current version HD Services: 1.20.3 (last updated 7-2-2025)

Version 1.22.1 (31-10-2025)

  • Changed: .NET Framework version update to 4.8

Version 1.21.4 (25-9-2025)

  • Resolved: Warehouse receipts created after Zenvoices was taken into use were no longer retrieved.

Version 1.21.3 (14-7-2025)

  • Changed: Fully processed warehouse receipts that were processed before Zenvoices was taken into use are no longer retrieved.

Version 1.20.3 (22-5-2024)

  • Changed: do not retrieve projects with status ‘Concept’ or ‘Closed’.

Version 1.20.2 (27-4-2024)

  • Changed: project retrieval has been extended with the project id field.

Version 1.20.1 (19-4-2024)

  • Resolved: project code is retrieved incorrectly.

Version 1.20 (17-4-2024)

  • New: support for projects (requires KING Webservices 5.68a1 or higher).

  • New: delete purchase invoice if an error occurs during creation (requires KING Webservices 5.68a1 or higher).

Version 1.19.1 (27-1-2023)

  • New: speed optimisation for retrieving orders and warehouse receipts.'

  • Resolved: the batch number of warehouse receipt lines is not copied to created purchase invoice lines.

Version 1.18 (8-6-2022), requires KING ERP 5.67a1 or higher

  • New: support for processing purchase invoices (requires KING ERP and KING Webservices version 5.67a1 or higher).

  • New: support for linking warehouse receipt lines to purchase invoice lines (requires KING ERP and KING Webservices version 5.67a1 or higher).

Version 1.17 (13-1-2022)

  • New: support for retrieving warehouse receipt cost price information.

Version 1.16 (1-11-2021)

  • New: support for retrieving warehouse receipts.

  • New: support for retrieving digital archive settings.

Version 1.15 (20-10-2021)

  • Resolved: when rounding net prices of order lines, no account is taken of the number of decimals of an item.

Version 1.14 (9-9-2021)

  • New: support added for filling the following archive document fields: note, document date, external code

  • Resolved: if creating a purchase invoice fails, a bookkeeping document already created is not deleted.

  • Resolved: retrieving administration data does not always return a result.

Version 1.13 (27-1-2021)

  • Resolved: leading zeros of cost unit and cost centre codes are not copied.

Version 1.12 (14-12-2020)

  • Resolved: error message “KingJob.exe returned an error …: 1” appears when creating a general ledger account for a general ledger account/cost centre/cost unit combination fails because the combined description is longer than 40 characters. General ledger account descriptions are from now on shortened to 40 characters.

  • Changed: maximum duration for creating general ledger accounts for general ledger account/cost centre/cost unit combinations increased from 15 seconds to 30 seconds.

Version 1.11 (4-12-2020)

  • Resolved: error message “(20701) Invalid combination: HulpRekeningBtwCode is not allowed in combination with HulpRekeningSoort GEEN” appears when exporting financial bookings in combination with King Webservices 5.63a1

  • New: support added for booking quantities in booking lines (requires King Webservices 5.63a1 or higher)

Version 1.10 (20-11-2020)

New: support for automatically creating general ledger accounts for non-existing general ledger account, cost centre and/or cost unit combinations.

Version 1.9 (13-11-2020)

Resolved: the VAT code of order lines without a VAT code is returned incorrectly.

Version 1.8 (6-11-2020)

New: support for copying warehouse slip reference numbers to purchase invoice line reference numbers.

Version 1.7 (23-7-2020)

New: link archive documents to purchase invoices (requires King 5.62a1 and King Webservices 5.62a1 or newer). please note: setting an access code for webservice Inkoopfactuur_Archiefstuk_Toevoegen in King is required.

Version 1.6 (6-3-2020)

Resolved: an incorrect bookkeeping document number is returned after creating a booking.

Version 1.5 (13-2-2020)

Resolved: an empty booking flow arises in King if an error occurs when creating a journal entry.

Version 1.4 (31-1-2020)

Support added for different archive directories per administration.

Version 1.3 (13-1-2020)

Payment condition field “Invoice type” added.

Version 1.2 (9-12-2019)

Support added for the new module ‘Matching orders and invoices’:

  • Retrieving orders from King

  • Retrieving items, rates and text blocks from King

  • Retrieving warehouses from King

  • Booking purchase invoices in King

Version 1.1.9 (11-9-2019)

Resolved: unclear error messages are shown in Zenvoices if exporting a booking fails because of a validation error of King Webservices.

Version 1.1.8 (29-4-2019)

Support added for filling the payment reference field.

Version 1.1.7 (11-4-2019)

  • Resolved: since version 1.1.6 it is no longer possible to create or modify accounts without IBAN.

  • Resolved: archive documents are created again in King after creating a booking in King fails. From now on, archive documents already created are reused, causing archive documents to be created only once in King.

Version 1.1.6 (9-4-2019)

  1. IBANs are from now on normalised when creating/modifying a bank account in King (among other things, spaces are removed).

  2. When an IBAN is modified, from now on a new default bank account is created for the account in King. Deleting bank accounts no longer takes place.

  3. When creating a bank account in King, the NAW data of the account are copied as the account holder data.

Version 1.1.5 (18-7-2018)

Support added for retrieving cost centres and cost units.

Version 1.1.4 (12-2-2018)

Support added for creating accounts with their own code

Version 1.1.3 (17-1-2018)

Resolved: order of accounts and general ledger accounts is not always stable.

Version 1.1.2 (19-9-2017)

Check added when creating journal entries to see whether a booking already exists

for an account.

Version 1.1.1 (16-9-2017)

Resolved: archive document numbers with leading zeros are not linked correctly to

bookings.

Did this answer your question?