Documentation/Integration

For administrators

Documents from devices

The structure of XML documents in inbox and how to import them into the accounting system.

PalmOrder Server writes documents from the mobile application to inbox as XML files. The accounting system imports these files on its own schedule.

File structure

The user attribute of the <post> root element contains the device's syncName. The <docs> element contains one or more <doc> documents of the same type.

<?xml version="1.0" encoding="utf-8"?>
<post user="sales-kyiv-1" connType="remote">
  <docs name="order">
    <doc>
      <head>
        <field name="number" value="ЗК-1"/>
        <field name="customer_code" value="C-001"/>
      </head>
      <table>
        <row>
          <field name="code" value="P-001"/>
          <field name="count" value="2"/>
          <field name="price" value="42.5"/>
          <field name="sum" value="85"/>
        </row>
      </table>
    </doc>
  </docs>
</post>
ElementPurpose
<post user="…">Identifies the syncName of the device that sent the data.
<docs name="…">Specifies the document type, such as order, invoice or storecheck.
<doc>One document in the batch.
<head>Contains the document header fields.
<table>Contains the table section rows; it can be absent.
<row>One row of the table section.

The fields are defined by the corresponding <document> description in exchange.xml. Do not assume that every file has the same fields: the integration must use the fields defined by your exchange configuration.

Import without duplicates

Process all documents in the XML file:

  1. open the file and check the document type and syncName;
  2. check whether each <doc> has already been imported;
  3. import new documents and record each document's processing result in your database;
  4. move the XML file to an archive or delete it only after all documents have been processed successfully.

The integrator must define a stable document key and configure its transfer in exchange.xml. The accounting system uses this key to recognize a document that has already been imported, even if it arrives again in a different file. The XML file name does not replace the document key; a document number can be used only if the integration rules guarantee its uniqueness.

Creating a document in the accounting system and recording its import result must complete together. If an import is interrupted, the next run must skip documents that have already been imported and continue processing the rest.

If a document does not appear

First check the event log by the exchange time and syncName. Then check the inbox directory configured for this device and the server's write permissions for it.