7. Message Files

This section contains the following topics:

7.1. Overview

Most common way of working with SIETS is sending and receiving XML requests and replies via HTTP API, which each contains a request and a reply of one SIETS command, respectively. However, there might be cases when it is more convenient to send a set of XML requests containing many SIETS commands for modifying contents of the SIETS storage directly to the SIETS server. For that reason the message files functionality has been included in the SIETS system.

The message files functionality implies that unlimited amount of XML requests can be stored in one or several files called message files and these message files can be uploaded to the SIETS server for execution using the siets-load command from the command promt.

The message files functionality can be used only from the same computer on which the SIETS server is installed.

7.2. Structure of Message Files

Message files have .msg extension and the following structure:

<msg code=”0” len=”N”> data N bytes of XML message </msg>

Each XML request must be enclosed in the mgs tags.

The code parameter always must be set to 0.

The len parameter denotes number of bytes an XML request text contains. It is also possible to set the len parameter to -1, in that case, the closing tag </msg> of the XML request is searched when performing the siets-load command.

Note: If a XML request contains a string </msg>, then the len parameter must not be set to -1, since in that case it would be considered as the message closing tag.

First character of XML request enclosed in the msg tags must follow immediately after the opening msg tag. There cannot be any space symbol or new line symbol between the last character of the opening msg tag and the first character of the XML request.

The following is an example of a message file:

<msg code=”0” len=”-1”><?xml version=”1.0” encoding=”US-ASCII”?>

<siets:request xmlns:siets=”www.siets.net”>

<siets:storage>My storage</siets:storage>

<siets:command>insert</siets:command>

<siets:requestid>101</siets:requestid>

<siets:appilcation>sample application</siets:application>

<siets:user>john_smith</siets:user>

<siets:passwd>qwerty</siets:passwd>

<siets:content>

<document>

<id> 56 </id>

<title> My document </title>

<rate> 10 </rate>

<text> The quick brown fox jumps over the lazy dog. </text>

</document>

</siets:content>

</siets_request>

</msg>

<msg code=”0” len=”356”><?xml version=”1.0” encoding=”US-ASCII”?>

<siets:request xmlns:siets=”www.siets.net”>

<siets:storage>My storage</siets:storage>

<siets:command>index</siets:command>

<siets:requestid>102</siets:requestid>

<siets:appilcation>sample application</siets:application>

<siets:user>john_smith</siets:user>

<siets:passwd>qwerty</siets:passwd>

</siets_request>

</msg>

7.3. Running siets-load

To run the siets-load command, proceed as follows:

  1. In the command promt, open the directory containing the message files you want to run.

  2. Run the siets-load executable file with the following parameters:

  3. Parameter

    Description

    -d

    Full path of the SIETS storage directory.

    By default, SIETS storage directories are located in /usr/local/siets/data/.

    -o

    If set, denotes if the siets-load command is performed once on message files of the current directory.

    If not set, the directory is being scanned all time and, each time a message file appears in it, the siets-load command is performed.

    By default, the siets-load executable file is installed in /usr/local/siets/bin/.

    Message files are being loaded to the SIETS server and renamed from *.msg to *.msg.ex, so that the siets-load command does not load the same message file once again.


PreviousTopNext