R_keeper 7 provides a large range of functions for working with both reference data on the reference server and with current orders at the cash server. Some of the functions are available at the manager station and at the cash station. This interface offers vast opportunities for integrating r_keeper 7 with external software. With some of the systems designed by r_keeper company (Delivery/Web Monitoring/RK-Oder/Reserving/etc.), the data is exchanged using this very interface.

Methods for Accessing XML Interface

Performing XML Requests Using RK7XML.DLL Library

Authentication/Authorization

To check the execution of the request to the XML interface set as the r_keeper 7 interface, you should use the XMLTEST.exe utility which is also available at FTP: ftp://FTP.ucs.ru/rk7/ForDealers/XMLInterface/. An example of the launch (when launched without parameters, the utility displays the information about the use):


xmltest.exe 127.0.0.1:1122 xmlquery.xml response.xml /pass:password

Parameters description:   

127.0.0.1:1122   IP address and the port to which the XML interface is set in r_keeper 7
xmlquery.xml     A file name with XML request
response.xml    A name of the file into which the response should be written
/pass:password   The password set in the r_keeper 7's  XML interface.

After the execution, the utility will save the response from r_keeper 7 XML interface into the response.xml file. You can use the following request to check the performance and correctness of the settings (you should save it in the xmlquery.xml file):   

<?xml version="1.0" encoding="UTF-8"?>
<RK7Query>
<RK7CMD CMD="GetSystemInfo"/>
</RK7Query>
XML

This utility comes with the TestXML.zip graphic interface for convenience.

Executing XML Requests Using HTTPs Interface (for version 7.05.03 and higher)

HTTPS Server Setup

Firstly, specify the value of the HTTP Data Port property (this is the port that will be listening to in the HTTPs interface). It is necessary to tick Use Free Listen Port box if the software needs to select another port in case the specified HTTP Data Port is busy. The port will be selected randomly.

The following two ports can be used to access the web interface:

  • The port specified in the HTTP Data Port property
  • The Port parameter value selected in the <b>TCPSOC</b> section of the corresponding INI file (this method is convenient as you can use a single port both for internal RK7 exchange and for the WEB interface), for example:
[TCPSOC]
Port        = "20002"

You can check if the settings are correct by opening the respective server's WEB interface.

Authentication/Authorization

An RK7 employee's name and password are used for authentication and authorization.

The WEB interface has the following limitations at the time this article is written:

There is an access right set for each of these items in the server properties:

After the right is set and the respective role is assigned, it is possible to check if the settings are correct by opening the respective pages in the WEB interface:

This is the most important address for ensuring the correct settings for the XML interface operation: if you see the server's response like the one shown on the screenshot above, the HTTP server's settings are correct for working with the XML interface.

Request execution example (javascript, XML interface test page)

To check the XML interface using the HTTPs interface, go to https://ip:port/webgui/iservxmltest.htm (for example, https://127.0.0.1:13665/webgui/iservxmltest.htm), enter the user name and password, and the text of the XML request to be executed. Then click Execute. The result should be similar to one in the figure below:


Request execution example (wget, command line)

An example of a request executed using the WGET utility:

wget.exe --secure-protocol=TLSv1 --no-check-certificate --header="Content-Type: text/xml" --http-user=9006 --http-password=9006 --post-file=requestData.xml https://127.0.0.1:20001/rk7api/v0/xmlinterface.xml

Parameters:
1. User: --http-user=9006
2. Password: --http-password=9006
3. Request file: --post-file=requestData.xml

After such a request is executed, its result will be saved in the xmlinterface.xml file.

Typical Interaction Algorithms

Working with Reference Data

Receiving or Saving Information on Data of Option Set Type (privileges/privileges for objects/rights/etc.)

Receive a list of all operations from the dictionary.
Note that the Undo Check operation code is 172, while that of the Line is 122. Take the Fright's property value as the code.
Then create a new, empty role. Add the same rights: Undo Check and Line
Receive the OpRIghts value as a result of ROLES request.

            <Item Ident="1000146" Name="TestRole" Code="9" Status="rsActive">
                <OpRights>
                    <Data BinaryCoding="Base64Text">AAAAAAAAAAAAAAAAAAAABAAAAAAAEAAAAAAAAAAAAAA=</Data>
                </OpRights>
            </Item>

Convert into bit stream.

00000000 00000000 00000000 00000000 00000000 00000000 
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000100 00000000 00000000
00000000 00000000 00000000 00010000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000

It turns out that the 126 and 172 bits have been set.
Use the following link to check the conversion: https://conv.darkbyte.ru/. The results are the same.

The problem is that the bit order is reversed. For example, two operations are active here:

  • 254: Main Cash Register App
  • 014: Keyboard code
  • The bits are calculated from junior to senior, i.e. 01000000 means that bit 7 is on, while 00000000 01000000 means that bit 14 is one (the first bit is the zero operation), and 00000000 00001000 means that bit 11 is on.
  • 00000000 01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 01000000