We have reviewed general concepts use of the mechanism « Web-services". Let's refresh some knowledge.
Web services are used to exchange data between a server and a client; XML format used to “package” data for the purpose of mutual understanding between both participants in communication.
CHAPTERI
EXAMPLE OF IMPLEMENTATIONWEB- SERVICE IN THE 1C:ENTERPRISE SYSTEM
TASK: It is necessary to create a web service, by accessing which clients can determine all the necessary information on their applications.
The task is a demonstration and serves only as an example for understanding and teaching the mechanismweb-services.
SOLUTION:
Step 1. Let's create a new one information base without configuration to develop a new configuration.
Step 2. Let's add several new objects to the configuration
Directory "Clients";
Document "Application";
Enumeration "Request Statuses".
Step 3. Let's create a new XDTO package.
Why and for what purpose are we creating an XDTO package? More information about using the XDTO mechanism can be found in “Chapter 16. Developer’s Guide” and .
Let us briefly note that the XDTO mechanism is a universal way of presenting data for interaction with various external data sources and software systems.
In our case, an XDTO package is created to describe the return value of the web service.
Let’s expand the “General” branch → “XDTO packages” → Add…
Let's specify the name of the XDTO package " DocumentsData" and its namespace http://localhost/request or http://192.168.1.76/request (to facilitate understanding and learning process, we indicate local IP address computer where the web server is installed (supported web servers: IIS or Apache)). Each Web service can be uniquely identified by its name and the URI of the namespace to which it belongs.
Our package contains two types of XDTO objects:
1) Сustomer- to transfer data from the “Clients” directory element.
- Name ;
2) Document- to transfer data from the “Application” document
This XDTO object type will contain the following properties:
- Сustomer- Customer type from the namespace http://192.168.1.76/request ; represents a reference to the XDTO object we defined above;
- Status- string type from the namespace http://www.w3.org/2001/XMLSchema ;
- Numder- string type from the namespace http://www.w3.org/2001/XMLSchema.
Step 4. Let's add a new Web service to the configuration
Let’s expand the branch “General” → “Web services” → Add…
For the Web service, we specify the following property values:
Name - DocumentsData
Namespace URI - http://192.168.1.76/request
XDTO Packages - DocumentsDataorhttp://192.168.1.76/request
Publication file name - request.1cws
Step 5. For the created Web service we will define the operation “ GetData»
Operation property values:
Return type - Document (http://192.168.1.76/request)
Possibly empty value - True
Procedure name - GetData.
Step 6. At the operation GetData Let's define the Customer parameter with the following property values:
Value type - type string from the namespace http://www.w3.org/2001/XMLSchema;
Transmission direction - input.
Step 7 Let's open the module of the created Web service and place in it the Get() function, which will be executed when this Web service is called.
Function GetData(Customer) // Get the types of XDTO objects ClientType = FactoryXDTO.Type("http://192.168.1.76/request", "Customer"); RequestType = FactoryXDTO.Type("http://192.168.1.76/request", "Document"); // Get the client ClientLink = Directories.Clients.FindByName(Customer); If Not ValueFilled(ClientRef) Then Return Undefined; endIf; Request = New Request; Request.Text = "SELECT TOP 1 | Application.Link, | REPRESENTATION(Application.Status) AS Status, | Application.Number |FROM | Document.Request AS Application |WHERE | Application.Client = &Client"; Request.SetParameter("Client", ClientLink); RequestResult = Request.Execute(); If QueryResult.Empty() Then Return Undefined; endIf; Selection = QueryResult.Select(); Selection.Next(); Document = Selection.Link.GetObject(); // Create an XDTO object of an order Order = FactoryXDTO.Create(OrderType); Application.Numder = Sample.Number; Client = FactoryXDTO.Create(ClientType); Client.Name = ClientLink.Name; Application.Customer = Client; Application.Status = Selection.Status; // Return the request Return Application; EndFunction
Step 8 Let's publish the created Web service on the web server.
Menu item Configurator: “Administration” → “Publishing on a Web server”.
On the “Web Services” tab, set the “Publish Web Services” checkbox and also check the box next to our new Web service.
CHAPTERII
EXAMPLE OF APPEAL TOWEB-TO THE 1C:ENTERPRISE SYSTEM SERVICE FROM A THIRD-PARTY APPLICATION
The main purpose of the Web services mechanism in the 1C:Enterprise system is to transfer the necessary data to third-party applications.
Let's consider an example of developing an application in Delphi calling our web service from the first section of this article.
Step 1. Let's create a new project and place several controls on the form
Text field - used to display information received from the web service;
Two buttons - clearing the text field and accessing the web service;
An input field is a parameter passed to the web service.
Step 2. Importing a WSDL file
As a result, we get a new module request(we defined this name directly in 1C). This module has everything necessary information by web service.
Step 3. Let's write a web service call handler
The DocumentDataPortType variable is already defined in the module request
Step 4. Launch the application and run the test.
CHAPTERIII
EXAMPLE OF APPEAL TOWEB-SERVICE IN THE 1C:ENTERPRISE SYSTEM
Step 1. Let's create a new external processing with the name "WEB_Service"
Step 2. For processing we define new uniform
Step 3. We will indicate several details on the form
Client - type "String"
ClientReturn - type "String"
NumberReturn - type "String"
StatusReturn - type “String”.
We will display the details on the form.
Step 4. Let's add a form command " To get data»
Let's specify the command handler
&OnClient Procedure GetData(Command) GetDataOnServer(Client); End of Procedure Procedure GetDataOnServer(Client) // Create a WS proxy based on the link and perform the Get() operation Definition = New WSDefinitions("http://192.168.1.76/WEB_Service/ws/request.1cws?wsdl"); Proxy = New WSProxy(Definition, "http://192.168.1.76/request", "DocumentsData", "DocumentsDataSoap"); Application Data = Proxy.GetData(Client); If Application Data = Undefined Then ClientReturn = "Undefined"; StatusReturn = "Undefined"; ReturnNumber = "Undefined"; Return; endIf; CustomerReturn = Application Data.Customer.Name; StatusReturn = Application Data.Status; Return Number = Application Data.Numder; End of Procedure
The 1C:Enterprise system can use web services provided by other providers in two ways:
By using static links created in the configuration tree;
"plus": high speed;
"minus": re-importing the WSDL description using the configurator and saving the changed configuration.
By using dynamic links, created by means built-in language
(correspondingly, the “cons” of static ones for dynamic ones are “pros”)
CHAPTERIV
DEBUGGING WEB SERVICES IN THE 1C:ENTERPRISE SYSTEM
For a local web service you need:
Step 1. Place the file on the client where the 1C system runs webservicecfg.xml with the following content
Step 2. To file default. vrd publish configuration add line
Step 3. In the configurator, select the menu item
"Debugging" → "Connection" → " Automatic connection» → “Web services on the server”
Step 4. Click on the “OK” button
For the server option, you also need to run the 1c server in debugging mode with the key /debug
We have selected the 10 best web services, reviews of which were published in Lifehacker last year. These tools help us effectively organize time and work in a team, manage our business, acquire new knowledge and develop our abilities, and get more pleasure from relaxation and entertainment. Try them in the new year and let your life become brighter and more comfortable!
The ingenious ifttt mashup allows you to establish a cause-and-effect relationship between events in various web services according to the “If This happened in one service, then That will happen on another service.” More than 20 services, social networks and technologies are supported: Gmail and any other mail, RSS, Facebook, Twitter, Evernote, Dropbox, Google Reader, Google Talk, Foursquare, Flickr, Instapaper, ReadItLater, LinkedIn, YouTube and others. In addition, events include SMS, phone calls, changes in stock prices, and even changes in weather in a given region. Examples of automated processes created using ifttt: “if a post is marked with an asterisk in Google Reader, it is saved in Evernote”, “if it starts to rain in New York, then a notification about this is sent via SMS.” Now imagine the possibilities of ifttt in the future “Internet of Things”, when different electronic devices will be able to communicate with each other! ;) I first learned about this service from a Lifehacker friend, Viktor Zakharchenko. He later also talked about his experience using ifttt in a solo episode of the 42 podcast, dedicated to productivity and startup management.
Bookmate - your personal digital library, books from which can be read on a computer and mobile devices(iPhone, iPad, Android, Symbian). At the same time, data is synchronized between the devices you use - once you start reading on your computer, you can continue it on your smartphone or tablet from where you left off. The Bookmate fund stores several thousand free books, many books are available by subscription costing only 99 rubles per month. If you do not find the book you need among them, you can upload it to the library yourself. The service allows you to share recommendations with friends, see their reading lists, and borrow books from their bookshelves. For reading lovers, I can also recommend the wonderful social network of book lovers Goodreads, which I have been using myself for almost a year and which we talked about in the 40th episode of the “42” podcast together with Pyotr Didenko and Viktor Zakharchenko.
Modern companies must use new technologies to increase competitiveness and stimulate their development. Many accounting and business management tasks can be outsourced, and in many cases it is convenient for an individual entrepreneur or LLC to use such cloud services, as "My business." This service is a profitable replacement for conventional outsourcing. With its help, you can semi-automatically maintain accounting records, calculate taxes, submit reports to government agencies in in electronic format via the Internet, receive expert advice, in 15 minutes create a package of documents necessary for registering an individual entrepreneur (and soon it will be possible to prepare documents for registering an LLC). Please also pay attention to a similar service from the SKB Kontur company - electronic accountant "Elba". If you are interested in the topic of cloud technologies for business, then listen to the 54th episode of the podcast “42” with the participation of Peter Didenko and Nina Gorbunova.
Another important category of cloud services is project management systems. One of the best (and free) is TeamLab, a worthy competitor to Basecamp and other popular systems. TeamLab comes in three solutions - as SaaS for use in the browser immediately after registering an account; in the form of an open source code, which you can independently modify to suit your needs and tastes, and then deploy the system on your servers; and in the form virtual machine with a pre-installed TeamLab portal on Amazon servers. TeamLab includes modules for project management, collaboration, document management, calendar, CRM system (customer relationship management system). TeamLab Marketing Manager Nina Gorbunova presented this system in the 54th episode of the podcast “42” about cloud technologies for business.
The new fashionable service Pinterest allows you to create beautiful virtual boards with images of various objects, buildings, places, interiors, dishes - everything that you love and want to show others. New objects are added to boards very simply - using a bookmarklet for browsers or manually through the web interface. On Pinterest, you can follow the updates of your friends' virtual boards, looking at interesting pictures in search of ideas, inspiration and just a good mood. As an example, I’ll give you my “42 Podcast Guests” board with photos of all the wonderful guests, information about their activities and links to podcast episodes with their participation.
Using the Yast time tracking service, you can track time spent on various projects and individual tasks, find weak points in your work schedule and optimize them. The service is intended for both individual users and small teams. The task timer starts and stops with one click, and later you get detailed reports in different sections. Time trackers are very useful time management tools - just as important as task managers and calendars. From my own experience, I know that personal effectiveness can be radically improved by deeply studying your work schedule and devoting a little time to optimizing it.
Moredays is an online organizer, stylized as paper planners and somewhat reminiscent of the legendary Moleskines. Its main advantage is its amazing beauty. The designers did their best and made one of the most beautiful organizers in the world. At the same time, Moredays has quite rich functionality: you can manage tasks, plan time in a calendar, store notes, contacts, share individual organizer pages with other people via Twitter, Facebook and Google+, synchronize data with Evernote and Google Apps, and soon there will be clients for mobile devices.
If you are one of the founders of Facebook, then any of your projects instantly becomes famous. This is what happened with the Asana project management system of Dustin Moskowitz, co-founder of the world's largest social network. However, Asana deserves attention not only because of Dustin’s personality - the developers have created a simple and convenient service with a pleasant, but strict interface. Asana is suitable for individual use and for working in a small team. The functionality of the system can hardly be called rich, but perhaps this is precisely one of its main advantages for those who do not require project management tools overloaded with functions. Asana synchronizes with Google Calendar, Apple iCal and Microsoft Outlook, integrates with mail, and has clients for smartphones and tablets.
BO.LT provides a simple yet amazing opportunity to edit any web page to your liking. It is enough to indicate its address and you can very easily, without knowledge of HTML and other web development technologies, make any changes to the text and design of the copy of this web page, and then send other people a shortened link to the result. Friends or colleagues you invite to view can also edit this web page. The service is indispensable when you need to clearly present appearance website after various modifications, brainstorm new design ideas, or show your friends the web page with your explanatory comments. You can switch to HTML code editing mode to gain even more freedom of action.
Dear readers, what web services did you like in 2011? Which ones can you recommend to us for reviews in Lifehacker?
Web service is software, which provides platform-independent access to your data to others software products over the Internet, using XML and standards such as SOAP, WSDL and UDDI.
What can Web services be used for in practice? Imagine a stock exchange whose servers have full information on current quotes of all securities traded on this exchange. This is very important information, online access to which can be very valuable and useful for remote software systems. Or another closer one to the common man example: a weather office server may contain information about weather conditions in a certain region or on the entire planet. This information may also be used by third party applications.
Many people have often seen weather site informers, but this is not the most convenient method of obtaining real information for corporate applications, since it limits the ability to operate with the information received. You can only do two things with such an informer: “hang” it on your website or remove it from the website if it is already posted there. But what about applications that need to receive raw data from the Met Office server and process it to perform some complex operations (for example, graphically model maps with the corresponding temperature plotted on regions)?
To solve such problems, a stock exchange or weather office server can become a provider (supplier) of Web services, and applications that receive data from them via the Internet can become consumers of this data. In this way, a client-server architecture is formed, where the data provider is the server and the consumer is the client, while the server and client software do not have to be compatible, the main condition is support for Web services.
The exchange between the server and the client is carried out using standard Internet protocols, such as HTTP. The web service describes itself and defines an API for interacting with it. in this case, the elements of this API are automatically converted into language constructs for the programming language that the client application uses. Web services are described according to the WSDL (Web Services Description Language) specification. The data itself is transferred from the server to the client in SOAP format (Simple Object Access Protocol).
In other words, the client application accesses the WSDL file by its URL, i.e. using the usual GET method. At the same time, it receives a description of the Web service methods and can then use them as its own (that is, without writing additional code on the client side - the Web service becomes, as it were, a remote continuation of the client program).
Web services are one of the platform mechanisms used for integration with other information systems. It is a means of supporting SOA (Service-Oriented Architecture), a service-oriented architecture that is a modern standard for integrating applications and information systems.
A significant advantage of service-oriented architecture is that it allows you to develop the enterprise infrastructure in a uniform way, without destroying the existing existing solutions. Its use allows you to minimize costs by integrating heterogeneous and legacy systems into the modern enterprise landscape. It allows you to implement loosely coupled software components in order to maximize their reuse.
Service-oriented architecture is being intensively developed and supported by major vendors. It is built on the basis of services, autonomous or managed externally. The preferred way to implement them is through web services. They are platform independent, standalone, and supported everywhere.
Application solution 1C:Enterprise 8 can be both a provider of web services and a consumer of web services published by other providers.
Systems using arbitrary hardware and software platforms. Web services technology is platform independent.
Technical implementation of web services
If the application solution is a web service provider, then in both the file and client-server modes of operation the interaction between application solution and consumers of the web service is carried out through the web server, using the web server extension module.
In this case, when a consumer accesses the web service of an application solution, the web service module is executed. This module is contained in the configuration and contains procedures that are executed when calling certain web service operations.
In the case of a client-server version of work, this module will be executed in a cluster. In the case of the file version of work - in the web server extension module.
If the application solution is a consumer of a third-party web service provider, then the interaction between the application solution and the web service provider is carried out by the client application. It calls certain web service operations and processes the received data.
The 1C:Enterprise platform, acting as a web service consumer, supports optimized transmission of binary data via the MTOM protocol. Enabling the MTOM mode in 1C:Enterprise occurs automatically.
The topic title is really a question, because... I myself don’t know what it is and for the first time I will try to work with it within the framework of this article. The only thing I can guarantee is that the code presented below will work, but my phrases will only be assumptions and guesses about how I myself understand all this. So, let's go...
Introduction
We need to start with why the concept of web services was created. By the time this concept appeared in the world, technologies already existed that allowed applications to interact at a distance, where one program could call some method in another program, which could be launched on a computer located in another city or even country. All this is abbreviated as RPC (Remote Procedure Calling). Examples include CORBA technologies, and for Java - RMI (Remote Method Invoking). And everything seems to be good in them, especially in CORBA, because... You can work with it in any programming language, but something was still missing. I believe that the disadvantage of CORBA is that it works through some of its own network protocols instead of simple HTTP, which will get through any firewall. The idea of the web service was to create an RPC that would be inserted into HTTP packets. Thus began the development of the standard. What are the basic concepts of this standard:- SOAP. Before calling a remote procedure, you need to describe this call in XML file e SOAP format. SOAP is simply one of the many XML markups that are used in web services. Everything we want to send somewhere via HTTP is first converted into an XML SOAP description, then stuffed into an HTTP packet and sent to another computer on the network via TCP/IP.
- WSDL. There is a web service, i.e. a program whose methods can be called remotely. But the standard requires that this program be accompanied by a description that says that “yes, you’re right - this is really a web service and you can call such and such methods from it.” This description is represented by another XML file, which has a different format, namely WSDL. Those. WSDL is just an XML file describing a web service and nothing more.
General approach
In web services there is always a client and a server. The server is our web service and is sometimes called the endpoint (as in, the end point where SOAP messages from the client reach). We need to do the following:- Describe the interface of our web service
- Implement this interface
- Launch our web service
- Write a client and remotely call the desired web service method