6.2.2. Using web services


<< Prev   Next >>

To get the client application distribution package using web service you need to publish a special web service that return this distribution package. This web service is described below in more detail.

6.2.2.1. Overview

Thin client (1cv8c) can attempt to install the required thin client version if the version matches 1C:Enterprise server cluster version or web server extension version. For this, the following three mechanisms are used (in order of use):

  1. Search for the distribution package in the local network – using the parameters of configuration files (1cestart.cfg and 1cescmn.cfg) DistributiveLocation.
  2. Getting the client application distribution package at the URL specified in the default.vrd (attribute of the point element, see article default.vrd) or conf.cfg configuration files (PublishDistributiveLocation * parameters, see article conf.cfg). The priority value is the value specified in the default.vrd file.
  3. Get the file using the web service for obtaining the client application distribution package. The web service address must be specified in the 1cestart.cfg configuration file (parameters InternetService or WebDistributiveLocation, see article 1cestart.cfg for details) or in the launch window settings dialog box, see article Startup window settings for details.

    The thin client analyzes the result of the request to the web service. If the web service returns 0 in the Size parameter, then it is considered that the required client application distribution package does not exist, and the error is generated that the versions of the client application and the server do not match. Otherwise, the user is prompted to download and install the client application, and the size of the distribution package received is shown. If the answer is positive, the new version is downloaded and installed. Then the necessary version of the client application is restarted. When you import the distribution package file, the timeout for the operation is 600 seconds. When executing distribution package import, redirect on the web server side is not supported.

6.2.2.2. Web service description

Web service name: WebDistributiveLocation. The timeout for execution of any web service method is 3 seconds.

The web service methods are listed below.

GetDistributiveInfo

Description:

This method is used by the thin client (1cv8c) to get the required version of the client application distribution package in the following cases:

  • When connecting via a web server in client/server mode, the version of the client application does not match the server version.
  • When connecting via a web server in file mode, the version of the client application does not match the web server extension version.

Parameters:

DistributiveType input

String. The type of operating system for which you need to get the client application distribution package.

Values: Linux, LinuxDEB, LinuxRPM, MacOS, and Windows.

Arch input

String. The architecture of operating system for which you need to get the client application distribution package.

Values: x86, x86_64.

Version input

String. The version number of the client application for which you need to get the client application distribution package.

Size output

Number. The size of the client application distribution package (in bytes). If the requested distribution package is missing, you must return the value 0.

URL output

String. URL for downloading the client application distribution package. When generating the URL, remember that the distribution package file must be accessible to the web server. In addition, the user getting the distribution package must also have rights to download this file.

The client application distribution package is a zip archive of distribution files. For more information about the contents of the zip archive, see article <point> (root element).

Returns:

Arbitrary type, the value is ignored.

6.2.2.3. Implementation example

Let us consider an example of web service to get the client application distribution package.

A simple configuration is used as the web service. It implements the web service only and does not contain any other configuration objects. The client application distribution packages are located in a special directory to which the web server should have access. In this configuration the WebDistributiveLocation web service must be created, for which: the operation GetDistributiveInfo is defined, the Return value type property is set to string, the Possibly empty value check box is selected. The remaining properties are set to default values.

Text of the web service operations:

Function GetDistributiveInfo(OS, Arch, Version, Size, URL)

DistributiveDirectory = "C:\inetpub\Distribs\";
DistributiveURL = "http://host/site/distribs/";
// generate the zip file name
FileName = "tc-" + Lower(OS) + "-" + Arch + "-" + Version + ".zip";
Archive = New File(DistributiveDirectory + FileName);
If Archive.Exists() Then
Size = Archive.Size();
URL = DistributiveURL + FileName;
Else
Size = 0;
URL = "";
EndIf;
Return "";
EndFunction

You need to specify the correct values in the DistributionPackageDirectory and DistributionPackageURL variables that correspond to the real name of the distribution package directory of the client application (when accessing it from the Web service, the DistributionPackageDirectory variable and when accessing it through the web service, the DistributionPackageURL variable).

The name of the file with the distribution package should be tc-windows-x86-8.3.3.100.zip or similar (depending on the OS type and the requested client application architecture). The name of the archive file is determined by the program code of the demonstration web service shown above.

After creating the configuration, the web service should be published to the web server (see article Web service support settings). Then the address of published web services should be stored. Suppose the web service is published at http://localhost/getdistrhttp://localhost/getdistr.

In the startup window setup form (see article Startup window settings), add a web service with the address displayed above and specify the ws suffix: http://localhost/listservicehttp://localhost/getdistr/ws. Now, to get the distribution package, this web service is requested. If the DistributionDirectory directory (on the computer with the web service) contains the zip archive with correct distribution package, this file is transferred to the computer that requested the distribution package.

<< Prev   Next >>

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002