HTTP services for those who do not understand anything about the WEB. Web services (SOAP), HTTP services, oData (automatic REST service) New course 1c service parameters

If you don’t understand anything about WEB technologies and words like json, get, post and so on don’t mean anything to you and you’re just an avid 1C user to the core, but you need to make friends with 1C with third-party applications or a website. then this article is for you.

Let me start with the fact that I was once forced to deal with Web services on my own. Then somehow, little by little, I managed to master this matter and understand what and where to press for everything to work. Fortunately, the configuration with which I had to work was already stuffed with Web services and it was possible to peek and do it by analogy, and I also managed to find enough articles on this matter on the Internet. And so, using examples (for me this is the best way to study), I mastered this matter, and now they no longer scare me.

SO. The main task of any integration, be it CD, Web services or HTTP services, is to transfer something from somewhere, do something with it, and return a response. This is the format in which we will consider the new technology.

In the metadata tree, HTTP services are located in the General branch:

A new HTTP service is added in the same way as any other metadata object. Name and synonym as you wish. Here, only the “Root URL” is important - this, in fact, is the identifier of the HTTP service in this database, i.e. exactly what you write in this property, you will transfer to a third-party developer (or yourself) as a link to the service.

I don’t know if it’s possible to write here in Cyrillic, but so as not to be laughed at in the progressive world, write in Latin).

The Template property itself is important here:

Using a template, you can later refer to the data that was transferred to you. SO: all the data that you want to receive from the outside can be divided into 2 blocks - mandatory and optional.

We push the required data/parameters into the template, so if the person accessing the service does not fill them out, the service will a priori generate an error, and when developing the text of the handler module, you will be sure that this data is there. How this is done: in the line Pattern in curly brackets “()”, alternating with the “/” sign, we write the names of the variables. For example, we definitely need an article - then we write /(artikul). If we need to get the article, name and username, the template string will look like this: /(artikul)/(name)/(user), etc. Each of these parameters in the text of the handler module can be obtained like this: Request.ParametersURL["<имя параметра>"]. If there are no required ones, then the template looks like this: /*.

The optional data that we want to receive through the service is NOT described in the template. When building a link to access a service, they are described at the end of the link after the "?" sign, separated by the ampersand character "&" and have the structure<имя параметра>=<значение параметра>. In the text of the handler module, they can be accessed with the following construct: Request.RequestParameters.Get("<имя параметра>"). BUT: it is important to remember that since they are not required, they may not exist; accordingly, we check the value for Undefined.

Next, we add a new method for our template. The HTTP method property is important here. There are a huge number of them, BUT we will not go into all the details. To implement any of your tasks, you only need 2: GET and POST.

How to choose: If what we described in the previous two paragraphs is enough for your work, i.e. You can get all the data you need using the mandatory and optional parameters of the request itself, then we take GET. In this case, in any browser, if you enter the address bar correctly, you will see the result of your HTTP service - PROFIT! If suddenly for your service to work you need data in a more complex form (xml for example, or something else), something that cannot be stuffed into a simple address bar, then take POST. On the downside, such an easy check through the browser address bar, as with GET, will not work, but on the Internet you can easily find some sites where you can check services using the POST method (for example, the site https://www.hurl.it) . If the POST method is selected, then in addition to the URL (address), the request has a body into which you can stuff anything you want, and in the method handler access it through the Request.GetBodyAsString() construct. Any template can have both a GET and a POST method. They will have correspondingly different handlers, and 1C, depending on how the request was sent, will choose one method or another.

An HTTP service handler is a function that always returns a value of type HTTPServiceResponse, which is built by the constructor New HTTPServiceResponse(<КодСостояния>). <КодСостояния>- this is a number, so as not to have to worry about choosing what to write, we write: 200 - if everything is fine and you return some logical value, 400 - if there is an error and you return a description of the error. This type has various methods (you can read it in the syntax assistant, everything is clearly written there). Again, you can always return everything you need as a string - the SetBodyFromString() method. (one little trick: if you return html and want the browser to display it beautifully on the screen when you enter the address of your service in the address bar, in the response Headings property write: Answer.Headers.Insert("Content-Type","text/html; charset=utf-8") - thereby you indicate that this is not just a set of characters, but HTML and it must be shown accordingly)

After you've done everything, the HTTP service needs to be published. This is done on a computer with a web server installed (I won’t write about the settings, there are plenty of articles) through the menu:

Administration - Publishing on a web server.

There is a HTTP Services tab. Check the boxes and click "Publish"




I was faced with the need to obtain the current configuration state. You need to receive:

  • Number of documents with a certain selection;
  • The period of the last recorded price for the product;
  • The number of documents processed by user in the last 10 minutes.

Taking into account the experience of implementing a mobile application in projects, the thought first flashed through to write a configuration for Android. After weighing all the pros and cons, I came to the conclusion that this approach would not be suitable for solving my problem. Then the course was taken to use the http service. To do this, the http service “Statistics” was registered in the configuration, and the url template AnyURL was added, which had a get method added.


After generating the objects of the configuration tree, we begin to write an algorithm for generating a response. The method will return a response of type HTTPServiceResponse:

After writing the response code, we publish the http service from the configurator and access it from the browser. To access the http service, you need to contact the address as in the web client by adding “/hs/statistic/”. hs tells the platform that an http service is being accessed, and statistic is the name of our service.

In my opinion, http services can be useful in the following cases:
— Generating configuration statistics;
— Functionality for obtaining order status by its number;
— Preparing data for import into other systems.

A web service in 1C 8.3 and 8.2 is a metadata object that allows you to integrate the 1C platform with other information systems using service-oriented architecture (SOA).

Let's look at creating and configuring the example of a web service that allows two-way exchange between 1C 8 databases using SOAP.

First, let's look at the tab Other:

Get 267 video lessons on 1C for free:

  • In field Namespace URI describes the location of the resource identifier.
  • — a description of the types that the future web service will be able to work with.
  • Publication file name— name of the *.1CWS file that will be placed on the web server

Structure of the 1C web service

Let's look at the structure of the web service:

DataExchange is the web service itself. UnloadData, LoadData - operations, essentially, descriptions of functions that can be called via the SOAP protocol. ExchangePlanName, NodeCode, etc. — values ​​transmitted to the web service.

Web service module

The module contains the most interesting thing - a description of the functions of the future web service. In our case, we describe functionality that allows you to receive and send data using standard 1C exchange mechanisms. Because The exchange takes place between one platform - 1C, then they do not require data serialization.

Checking the operation of the 1C http service on a web server

Let me start with the fact that I was once forced to deal with Web services on my own. Then somehow, little by little, I managed to master this matter and understand what and where to press for everything to work. Fortunately, the configuration we had to work with was already full It was possible to look at it using Web services and do it by analogy, and on the Internet I was able to find enough articles on this matter. And so, using examples (for me this is the best way to study), I mastered this matter, and now they no longer scare me.

SO. The main task of any integration, be it CD, Web services or HTTP services, is to transfer something from somewhere, do something with it, and return a response. This is the format in which we will consider the new technology.

In the metadata tree, HTTP services are located in the General branch:

A new HTTP service is added in the same way as any other metadata object. Name and synonym as you wish. Only the “Root URL” is important here - this is, in fact, the identifier HTTP service in this database, i.e. exactly what you write in this property, you will transfer to a third-party developer (or yourself) as a link to the service.

I don’t know if it’s possible to write here in Cyrillic, but so as not to be laughed at in the progressive world, write in Latin).

The Template property itself is important here:

Using a template, you can later refer to the data that was transferred to you. SO: all the data that you want to receive from the outside can be divided into 2 blocks - mandatory and optional.

Required data/parameters we push it into the template, thus if the person accessing the service does not fill them out, then the service will a priori generate an error, and when developing the text of the handler module, you will be sure that this data is there. How this is done: in the line Pattern in curly brackets “()”, alternating with the “/” sign, we write the names of the variables. For example, we definitely need an article - then we write /(artikul). If we need to get the article, name and username, the template string will look like this: /(artikul) /(name)/(user), etc. Each of these parameters in the text of the handler module can be obtained like this: Request.ParametersURL["<имя параметра>"]. If there are no required ones, then the template looks like this: /*.

Optional data, which we want to receive through the service, are NOT described in the template. When building a link to access a service, they are described at the end of the link after the "?" sign, separated by the ampersand character "&" and have the structure<имя параметра>=<значение параметра>. In the text of the handler module, they can be accessed with the following construct: Request.RequestParameters.Get("<имя параметра>"). BUT: it is important to remember that since they are not required, they may not exist; accordingly, we check the value for Undefined.

Next, we add a new method for our template. The HTTP method property is important here. There are a huge number of them, BUT we will not go into all the details. To implement any of your tasks you only need 2: GET And POST.

How to choose: If what we described in the previous two paragraphs is enough for your work, i.e. You can get all the data you need using the mandatory and optional parameters of the request itself, then we take GET. In this case, in any browser, if you enter the address bar correctly, you will see the result of your HTTP service - PROFIT! If suddenly for your service to work you need data in a more complex form (xml for example, or something else), something that cannot be stuffed into a simple address bar, then take POST. On the downside, such an easy check through the browser address bar, as with GET, will not work, but on the Internet you can easily find some sites where you can check services using the POST method (for example, the site https://www.hurl.it) . If the method is selected POST, then the request besides URL (addresses) a body appears into which you can stuff anything, and in the method handler access it through the Request.GetBodyAsString() construct. Any template can have both a GET and a POST method. They will have correspondingly different handlers, and 1C, depending on how the request was sent, will choose one method or another.

An HTTP service handler is a function that always returns a value of type HTTPServiceResponse, which is built by the constructor New HTTPServiceResponse(<КодСостояния>). <КодСостояния>- this is a number, so as not to have to worry about choosing what to write, we write: 200 - if everything is fine and you return some logical value, 400 - if there is an error and you return a description of the error. This type has various methods (you can read it in the syntax assistant, everything is clearly written there). Again, you can always return everything you need as a string - the SetBodyFromString() method. (one little trick: if you return html and want the browser to display it beautifully on the screen when you enter the address of your service in the address bar, in the response Headings property write: Answer.Headers.Insert("Content-Type","text/html; charset=utf-8") - thereby you indicate that this is not just a set of characters, but HTML and it must be shown accordingly)

After you've done everything, the HTTP service needs to be published. This is done on a computer with a web server installed (I won’t write about the settings, there are plenty of articles) through the menu:

Administration - Publishing on a web server.

There is a HTTP Services tab. Check the boxes and click "Publish"

So, we received a ready-made HTTP service. HOW to contact him? If we use the GET method, then in the address bar of the browser we write: http://<имя веб сервера>/<имя базы>/hs/<корневой URL>/<обязательный параметр1>/<обязательный параметр2> <имя не обязательного параметра 1>=<значение не обязательного параметра 1>&<имя не обязательного параметра 2> =<значение не обязательного параметра 2> .

And finally, once again in pictures))):

Attention! Now the course is also held in the evening from 18:30 to 21:30 in an immersion format.

During the course you will gain practical skills in using the following mechanisms of the 1C:Enterprise 8 platform:

  • WEB services (SOAP protocol)
  • JSON format
  • oData interface (automatically REST service)
  • HTTP services

IMPORTANT!!! The course is designed for programmers who have skills in working with the XDTO mechanism, or have previously completed the course.

Description and program of the course:

The price of the WEB course includes:

  • 2 weeks of course, 2 webinars with a teacher
  • certificate of 1C Training Center No. 3 (subject to practical training)

The cost of the full-time immersion course includes:

  • 2 days from 10:00 to 17:00 or 4 pm from 18:30 to 21:30
  • notes, headphones
  • lunches, coffee breaks
  • access to updated video materials for 2 years after completing the course
  • certificate of 1C-Training center No. 3

Training formats

WEB training

What is this format:The proposed format combines many of the advantages of distance learning with a face-to-face component represented by video materials and online consultations.
The WEB course consists of videos, practical tasks and webinars with teachers. All course materials are available 24/7 via the Internet so you can study at a time that suits you. The course is divided into classes. During the lesson, materials on the current topic are studied, workshops are performed, and questions are asked to the teacher. At the end of each lesson, a webinar is held, during which the teacher examines all the questions received, typical errors, and explains the correct solution. Recordings of webinars are available in the portal. In this way, several classes are held one after another. At the end there is a final independent work and a final webinar.

Duration: 2 weeks

What is this format:


Duration:16 academic hours

What is this format:A full-time immersion course is a format that combines all the advantages of full-time training, distance learning and individual training. Classes are held in an equipped classroom, you independently study the course materials (step-by-step videos) and perform workshops. At the same time, there is a teacher in the audience who is ready at any time to answer questions and help with solving practical problems, as well as check the correctness of their implementation.
Advantages – individual consultations from the teacher on your questions, the pace of completing the material is suitable for you personally.
All this provides a more in-depth study of the course material.
This course can be taken from your workplace with the full effect of the presence of the teacher where the student is! If this opportunity interests you, give us a call!

Duration:16 academic hours