HTTP-services

Publications: HTTP-services in application solution
In addition to automatic REST interface in 1C:Enterprise platform, we have implemented the ability to create our own arbitrary HTTP-services.
You can generate a response to the request yourself using the script. In this case, you have convenient access to the body, headers and line of original request, as well as you can generate the code, body and headers of response on your own.
Compared with the existing platform SOAP web-services, HTTP-services have several advantages:

  • Easy to program the client of such services;
  • Potentially a smaller amount of transferred data;
  • Potentially lower computational load;
  • HTTP-services are focused on the «resources», while SOAP services are focused on the «actions».


First three factors are extremely important for the applications that operate on the mobile devices.

You may use HTTP-services as the «light» RPC-services that do not require the complicated preparation of XML-packets. The methods can be identified in URL, and the parameters can be passed in the request options or in its body. In the latter case. Such services are already coming close to SOAP, losing to it in the clarity of specification, but winning in flexibility.

According to its «construction execution», HTTP-services are very similar to web-services that exist in the platform. Similarly, there is a special configuration object HTTP service. Such objects are added to the branch General - HTTP-services:
Publications: HTTP-services in application solution

Each HTTP-service may contain one or more templates. For each template you can create on or more methods that perform data processing:
Publications: HTTP-services in application solution

Template specifies the path over which the HTTP-service can be addressed. In the template you can use a specific set of characters, including parameterized segments like {some text}.

For each method you specify, firstly, the handled HTTP method, as well as create the script procedure which will execute the data processing. As the HTTP method you can select on of the following: GET, POST, PUT, DELETE, PATCH, MERGE, CONNECT, OPTIONS, TRACE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK. Or specify Any. In this case, you can use any method of listed below.

When addressing to such HTTP-service, the platform will firstly try to compare URL to which the access was performed with one of existing templates and methods. If the comparison failed, the platform will produce the answer code 404 Not Found. If a suitable method will be found, the platform will start an execution of its handler, passing to it all the data existing in the request as a script object HTTPServiceRequest:
Publications: HTTP-services in application solution

From this object you can easily get, for example, the parameters contained in the original URL and use them to extract necessary data from the base.

You can return the obtained data in different formats. For example, they can be transformed in XML, as shown above, or even just in text string with delimiters.

The service response is generated by a special script object HTTPServiceResponse. In its body you can put the prepared data.

Publication of HTTP-services is performed similar to publication of web-services. Also similarly an authentication, the use of data separation and debug are performed for them.

[Total: 0    Average: 0/5]

Leave a Reply

Your email address will not be published. Required fields are marked *