Data transmission method, data processing gateway, system, and electronic device
The data transmission method optimizes web-based applications by preprocessing frontend code to construct a data model database, transforming server data into client-specific data, thereby enhancing efficiency and reducing response times and development workload.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2026-04-02
AI Technical Summary
Existing web-based applications face inefficiencies in data transmission due to redundant data transfer, requiring developers to customize models and manage multiple interfaces, leading to increased response times and development workload.
A data transmission method that involves preprocessing frontend code to construct a data model database, extracting API and data model IDs, and transforming server data into client-specific data using a data processing gateway, ensuring only necessary data is transmitted.
Improves data transmission efficiency, reduces costs, and shortens response times by eliminating redundant data transfer and minimizing the need for multiple interfaces.
Smart Images

Figure CN2024122397_02042026_PF_FP_ABST
Abstract
Description
DATA TRANSMISSION METHOD, DATA PROCESSING GATEWAY, SYSTEM, AND ELECTRONIC DEVICETECHNICAL FIELD
[0001] The present disclosure generally relates to the technical field of factory digitization, and more specifically, to a data transmission method, a data processing gateway, a system, and an electronic device.BACKGROUND
[0002] Web-based applications are styles popular and widely used in software applications. The Web-based applications offer accessibility to various devices connected through the Internet, allowing users to access services without installing applications locally.
[0003] Response time of software is an important indicator, especially in digitalized application within manufacturing industry. For a user, it would be better that a page is displayed in a short time after the user performs an operation (for example, clicking a link) , so that the user does not feel a delay. At least, the software applied to a factory is to improve daily work efficiency rather than impeding.
[0004] Extensive efforts have been done to reduce the response time from aspects of designing databases, optimizing services logic, deploying distributed services, and the like. For the response time, data transmission from a server to a client is crucial. The web-based applications are usually in a request-response mode, that is, the client transmits a request message for calling an API (Application Interface) to the server, and the server returns requested data.
[0005] A common situation is that data obtained from the server is redundant. It means that the data required by the client (for example, a page) is just a part of the data from the server. If the data transmitted by the server can be kept consistent with the page or the data required by the client, transmission time can be shortened. If the server is deployed on cloud, the data transmission cost can be reduced.
[0006] A method adopted at present is to customize a model in a backend by a developer. Apparently, this will bring additional work for the developer.
[0007] For example, two different pages require the data related to a device list, and then requests of these two pages can be processed by using the same API. However, the data actually required by these two pages are different.
[0008] This method has the following problems:
[0009] · To reduce a data volume, the developer at the backend needs to define a new model, and data is returned in a new interface.
[0010] · For a frontend, the developer further needs to pay attention to call two different interfaces.SUMMARY
[0011] A brief overview of the present disclosure is given below to provide a basic understanding of certain aspects of the present disclosure. It is to be understood that this summary is not an exhaustive overview of the present disclosure. This summary is not intended to determine key or important parts of the present disclosure, nor intended to limit the scope of the present disclosure. An objective of this summary is merely to present some concepts in a simplified form as a prelude to the more detailed description that is discussed later.
[0012] In view of this, the present disclosure provides a data transmission method for an application calling process.
[0013] According to an aspect of the present disclosure, a data transmission method is provided, including:
[0014] receiving an application calling request from a client, where the application calling request includes API information and ID information of a to-be-called application, and the ID information is used to identify a data model required by the client;
[0015] transmitting the application calling request to a server based on the API information;
[0016] receiving server data returned by the server according to the application calling request;
[0017] extracting the ID information from the application calling request, and querying a corresponding data model from a data model database according to the ID information;
[0018] transforming the received server data into client request data based on the queried data model; and
[0019] transmitting the client request data to the client.
[0020] In this way, for each request from the client, the data received by the client are kept consistent with the data model required by the client, all unnecessary data have been deleted before transmission, and only necessary data are transmitted. Therefore, the data transmission efficiency is improved, the data transmission cost is reduced, and the software response time is shortened.
[0021] Optionally, in an example in the foregoing aspect, before performing the step of receiving the application calling request from the client, the method includes a step of performing preprocessing on frontend code of the client, which may specifically include:
[0022] obtaining frontend code;
[0023] extracting an API and a required data model from the frontend code, and generating a corresponding ID for a data pair of the API and the data model;
[0024] storing the data pair of the API and the data model and the corresponding ID to construct the data model database; and
[0025] updating the frontend code with the ID.
[0026] In this way, a data model database can be constructed, and the frontend code can be updated, thereby extracting data model identification information representing a data style required by the client from the received application calling request.
[0027] Optionally, in an example in the foregoing aspect, the updating the frontend code with the ID includes:
[0028] adding the corresponding ID to a parameter in the frontend code.
[0029] Optionally, in an example in the foregoing aspect, the transforming the received server data into client request data based on the queried data model includes:
[0030] removing unnecessary data item from the server data and remaining necessary data item as the client request data according to the data model.
[0031] According to another aspect of the present disclosure, a data processing gateway is provided, including:
[0032] a calling request receiving unit, configured to receive an application calling request from a client, where the application calling request includes API information and ID information of a to-be-called application, and the ID information is used to identify a data model required by the client;
[0033] a calling request transmitting unit, configured to transmit the application calling request to a server based on the API information;
[0034] a server data receiving unit, configured to receive server data returned by the server according to the application calling request;
[0035] a data model query unit, configured to query a corresponding data model from a data model database according to the ID information;
[0036] a data transformation unit, configured to transform the received server data into client request data based on the queried data model; and
[0037] a client data transmitting unit, configured to transmit the client request data to the client.
[0038] According to another aspect of the present disclosure, a computing device is provided, including: at least one processor; and a memory coupled to the at least one processor, where the memory is configured to store instructions, and the instructions, when executed by the at least one processor, enable the processor to perform the method as described above.
[0039] According to another aspect of the present disclosure, a non-transient machine-readable medium is provided. The non-transient machine-readable medium stores executable instructions, and the instructions, when executed, enable a machine to perform the method as described above.
[0040] According to another aspect of the present disclosure, a computer program is provided, including computer-executable instructions. The computer-executable instructions, when executed, enable at least one processor to perform the method as described above.
[0041] According to another aspect of the present disclosure, a computer program product is provided. The computer program product is tangibly stored on a computer-readable medium and includes computer-executable instructions, and the computer-executable instructions, when executed, enable at least one processor to perform the method as described above.
[0042] According to the technical solutions in the embodiments of the present disclosure, the data transmission efficiency is improved, the data transmission cost is reduced, and the software response time is shortened. Moreover, the software development workload can be reduced. For a server, multiple corresponding interfaces do not need to be defined for different scenarios. For a client, data do not need to be transformed into a client model.BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Referring to descriptions of embodiments of the present disclosure in combination with accompanying drawings, the foregoing and other objectives, features, and advantages of the present disclosure may be more easily understood. Components in the accompanying drawings are merely used for demonstrating the principle of the present disclosure. In the accompanying drawings, the same or similar technical features or components may be represented by using the same or similar reference numerals. In the drawings:
[0044] FIG. 1 is a flowchart of an exemplary process of a data transmission method 100 according to an embodiment of the present disclosure;
[0045] FIG. 2 is a flowchart of an exemplary process of step S101;
[0046] FIG. 3 is a block diagram of an exemplary configuration of a data processing gateway 300 according to another embodiment of the present disclosure;
[0047] FIG. 4 is a block diagram of an exemplary configuration of a preprocessing unit 301 in FIG 3;
[0048] FIG. 5 is a block diagram of an exemplary configuration of an application calling system 500 according to another embodiment of the present disclosure; and
[0049] FIG. 6 is a block diagram of an electronic device 600 according to an embodiment of the present disclosure.
[0050] In the drawings: DETAILED DESCRIPTION
[0051] A subject described herein is discussed now with reference to exemplary embodiments. It is to be understood that, discussion of these embodiments is merely intended to make a person skilled in the art better understand and implement the subject described herein, and is not intended to limit the protection scope of the claims, the applicability, or examples. Changes may be made to the functions and arrangements of the discussed elements without departing from the protection scope of the content of the present disclosure. Various processes or components may be omitted, replaced, or added in each example according to requirements. For example, the described method may be performed according to a sequence different from the sequence described herein, and steps may be added, omitted, or combined. In addition, features described in some examples may alternatively be combined in other examples.
[0052] As used herein, the term "include" and variants thereof represent open terms, and means "include but is not limited to" . The term "based on" represents "at least partially based on" . The terms "one embodiment" and "an embodiment" represent "at least one embodiment" . The term "another embodiment" represents "at least one another embodiment" . The terms "first" , "second" , and the like may represent different objects or the same object. Other definitions may be included explicitly or implicitly in the following. Unless otherwise clearly specified, the definition of one term is consistent in the entire specification.
[0053] According to the technical solutions of the present disclosure, a data transmission method for a Web-based application is provided, which can intercept content required by a client from data returned from a server and then transmit the content to the client, thereby shortening the data transmission time and reducing the transmission cost.
[0054] Hereinafter, a page in a Web browser plays a role of a client. It can be understood that the method according to the present disclosure is applicable to a scenario of a microservice application.
[0055] Specific implementations of the embodiments of the present disclosure are further described below with reference to the accompanying drawings of the embodiments of the present disclosure.
[0056] FIG. 1 is a flowchart of an exemplary process of a data transmission method 100 according to an embodiment of the present disclosure.
[0057] In a technical solution according to an embodiment of the present disclosure, before performing step S102 of receiving an application calling request from a client, operation S101 of performing preprocessing on frontend code is performed first.
[0058] FIG. 2 is a flowchart of an exemplary process of step S101.
[0059] In step S1011, frontend code is obtained.
[0060] The frontend code is code deployed on a client to perform application calling. The frontend code may be modified after the frontend code is obtained. The frontend code may be manually uploaded by a user or automatically obtained. In a technical solution according to an embodiment of the present disclosure, a manner of obtaining the frontend code is not limited.
[0061] In step S1012, an API and a required data model are extracted from the frontend code, and a corresponding ID is generated for a data pair of the API and the data model.
[0062] Specifically, after the frontend code is obtained, all code is traversed to find all code parts related to API calling, the API (that is, a path for calling an application) and the required data model (that is, data content that is defined in the code and is required to be received) are extracted, and a corresponding ID or name is generated for a data pair of the API and the data model. The ID is uniformly used to describe hereinafter. Through this ID, information of the corresponding API and data model may be uniquely determined.
[0063] In step S1013, the data pair of the API and the data model and the corresponding ID are stored to construct a data model database.
[0064] In this step, triplet information related to calling each API is stored in the database to construct the data model database. The data model database includes the triplet information of the ID, the API, and the data model related to calling all APIs in the frontend code.
[0065] In step S1014, the frontend code is updated with the ID.
[0066] Specifically, an API calling part in the frontend code is changed, and a generated ID is added to each corresponding API calling parameter. Taking a piece of code used to export a device list as an example for describing. Left side code is initial code. It can be learned that an additional parameter, model_id: 4, is added to row "params" in right side code.
[0067] Operation S101 of performing preprocessing on the frontend code is performed to construct the data model database, and parameters that can uniquely determine information of the corresponding API and data model is added to the frontend code. It can be understood that the constructed data model database may be directly used in a process of performing a data transmission method for an application, and the frontend code does not need to be modified, that is, an operation in S101 does not need to be performed.
[0068] Next, a specific process of the data transmission method 100 is described in detail with reference to FIG. 1.
[0069] In step S102, an application calling request from a client is received.
[0070] According to a technical solution in an embodiment of the present disclosure, a gateway is provided between the client and a server, which can process an application calling request message from the client and a response message from the server.
[0071] The application calling request includes API information and ID information of a to-be-called application, and the ID information is used to identify a data model required by the client.
[0072] In step S104, the application calling request is transmitted to the server based on the API information.
[0073] In step S106, server data returned by the server according to the application calling request is received.
[0074] After receiving the application calling request, the server will return complete data as a response, which is referred to as server data herein.
[0075] In step S108, the ID information is extracted from the application calling request, and a corresponding data model is queried from a data model database according to the ID information.
[0076] As described above, a parameter "ID" is added to the frontend code on the client. Through this parameter, the to-be-called API and the required data model by the client may be determined through this parameter. This ID is extracted from the application calling request. Querying is performed in the data model database pre-constructed according to this ID.A data model corresponding to this ID can be queried, so as to determine content (or referred to as a data item) of the data required to be obtained in the calling request of the client.
[0077] Optionally, in an embodiment, ID information may alternatively be extracted and recorded from the application calling request first, a parameter "ID" is deleted from the application calling request, and then the application calling request is transmitted to the server.
[0078] In step S110, the received server data is transformed into client request data based on the queried data model.
[0079] In this step, unnecessary content is removed from the complete server data received in step S106 according to requirements of the data model, and only the data required by the client are retained, which are referred to as client request data herein.
[0080] In step S112, the client request data is transmitted to the client.
[0081] A specific example of the data transmission method 100 according to an embodiment of the present disclosure is given below.
[0082] For example, an application calling request received from a client is as follows:
[0083] http: / / 127.0.0.1: 8080 / mobility / api / v1 / devices? model_id=4
[0084] It can be learned that the request includes API information and ID information (model_id=4) of a to-be-called application.
[0085] Original output data from the server is as follows:
[0086] Assuming that the data model queried in the data model database according to the ID information model_id=4 defines that the client only needs to know a device_name field, unnecessary fields are removed from the foregoing data according to the data model, and the data finally provided for the client are as follows:
[0087] It can be learned that, by the data transmission method according to the embodiments of the present disclosure, the data transmitted to the client are consistent with the data required by the client, and a data size is significantly decreased.
[0088] The technical solution according to the embodiments of the present disclosure at least has one or more of the following advantages.
[0089] For each request from the client, the data received by the client are kept consistent with the data model required by the client, all unnecessary data have been deleted before transmission, and only necessary data are transmitted. Therefore, the data transmission efficiency is improved, the data transmission cost is reduced, and the software response time is shortened.
[0090] In addition, according to the technical solution in the embodiments of the present disclosure, the software development workload can be reduced. For a server, multiple corresponding interfaces do not need to be defined for different scenarios. For a client, data do not need to be transformed into a client model.
[0091] FIG. 3 is a block diagram of an exemplary configuration of a data processing gateway 300 according to another embodiment of the present disclosure. The data processing gateway 300 is configured to perform the data transmission method shown in FIG. 1.
[0092] As shown in FIG. 3, the data processing gateway 300 includes: a calling request receiving unit 302, a calling request transmitting unit 304, a server data receiving unit 306, a data model query unit 308, a data transformation unit 310, and a client data transmitting unit 312.
[0093] The calling request receiving unit 302 is configured to receive an application calling request from a client. The application calling request includes API information and ID information of a to-be-called application, and the ID information is used to identify a data model required by the client.
[0094] The calling request transmitting unit 304 is configured to transmit the application calling request to a server based on the API information.
[0095] The server data receiving unit 306 is configured to receive server data returned by the server according to the application calling request.
[0096] The data model query unit 308 is configured to query a corresponding data model from a data model database according to the ID information.
[0097] The data transformation unit 310 is configured to transform the received server data into client request data based on the queried data model.
[0098] The client data transmitting unit 312 is configured to transmit the client request data to the client.
[0099] In a specific embodiment, the data processing gateway 300 may further include a preprocessing unit 301.
[0100] FIG. 4 is a block diagram of an exemplary configuration of a preprocessing unit 301 in FIG 3.
[0101] As shown in FIG. 4, the preprocessing unit 301 includes: a frontend code obtaining subunit 3011, an information extraction subunit 3012, a data model database construction subunit 3013, and a frontend code updating subunit 3014.
[0102] The frontend code obtaining subunit 3011 is configured to obtain frontend code.
[0103] The information extraction subunit 3012 is configured to extract an API and a required data model from the frontend code, and generate a corresponding ID for a data pair of the API and the data model.
[0104] The data model database construction subunit 3013 is configured to store the data pair of the API and the data model and a corresponding ID to construct a data model database.
[0105] The frontend code updating subunit 3014 is configured to update the frontend code with the ID.
[0106] For example, details of operations and functions of various parts of the data processing gateway 300 may be the same as or similar to related parts of the embodiments of the data transmission method according to the embodiments of the present disclosure described with reference to FIG. 1. Detailed descriptions are not repeated here.
[0107] It is to be noted that, the data processing gateway 300 shown in FIG. 3 and structures of constituent units of the data processing gateway 300 are only exemplary. Those skilled in the art may modify a structural block diagram shown in FIG. 3 as required.
[0108] FIG. 5 is a block diagram of an exemplary configuration of an application calling system 500 according to another embodiment of the present disclosure. As shown in FIG. 5, the application calling system 500 includes a client 502, a server 504, and a data processing gateway 300 according to an embodiment of the present disclosure.
[0109] The client 502 transmits an application calling request to the data processing gateway 300. The application calling request includes a called API and an ID. The data processing gateway 300 transmits a request message for calling an API to the server 504. The server 504 returns complete server data according to the request message. The data processing gateway 300 may transform the server data into client request data according to a data model corresponding to the ID, and then transmit the client request data to the client 502.
[0110] For specific operations performed by the data processing gateway 300 in the application calling system 500, refer to operations and functions of the above data processing gateway 300 described with reference to FIG. 3 and FIG. 4. Detailed descriptions are not repeated here.
[0111] Referring to FIG. 1 to FIG. 5 as above, a method and an apparatus according to the embodiments of the present disclosure are described. Various units of the data processing gateway 300 described above may be implemented by hardware, or may be implemented by software or a combination of hardware and software.
[0112] FIG. 6 is a block diagram of an electronic device 600 according to an embodiment of the present disclosure. According to an embodiment, the electronic device 600 may include at least one processor 602. The processor 602 executes at least one computer-readable instruction stored or coded in a computer-readable storage medium (that is, a memory 604) .
[0113] It is to be understood that the computer-executable instructions stored in the memory 604, when executed, enable the at least one processor 602 to perform various operations and functions described in various embodiments of the present disclosure with reference to FIG. 1 to FIG. 5.
[0114] According to an embodiment, a non-transient machine-readable medium is provided. The non-transient machine-readable medium may have instructions (that is, the foregoing elements implemented in the form of software) , and the instructions, when executed by a machine, enable the machine to perform various operations and functions described in various embodiments of the present disclosure with reference to FIG. 1 to FIG. 5.
[0115] According to an embodiment, a computer program is provided, including computer-executable instructions. The computer-executable instructions, when executed, enable at least one processor to perform various operations and functions described in various embodiments of the present disclosure with reference to FIG. 1 to FIG. 5.
[0116] According to an embodiment, a computer program product is provided, including computer-executable instructions. The computer-executable instructions, when executed, enable at least one processor to perform various operations and functions described in various embodiments of the present disclosure with reference to FIG. 1 to FIG. 5.
[0117] Not all units in various foregoing structural diagrams are necessary, and some units may be omitted according to actual requirements. The apparatus structure described in various foregoing embodiments may be a physical structure or a logical structure. That is, some units may be implemented by the same physical entity, or some units may be separately implemented by multiple physical entities, or may be implemented by some components in multiple independent devices together.
[0118] The descriptions of the content of the present disclosure are provided to allow any person of ordinary skill in the art to implement or use the content of the present disclosure. For a person of ordinary skill in the art, various modifications on the content of the present disclosure are obvious. In addition, a general principle defined in this specification may be applied to other variants without departing from the protection scope of the content of the present disclosure. Therefore, the content of the present disclosure is not limited to the examples and designs described in this specification, but is consistent with the widest range conforming to the principle and novelty disclosed in this specification.
[0119] The foregoing descriptions are merely preferred embodiments of the present disclosure, but are not intended to limit the present disclosure. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present disclosure fall within the protection scope of the present disclosure.
[0120] Nouns and pronouns related to humans in this patent application are not limited to specific genders.
Claims
1.A data transmission method (100) , comprising:receiving an application calling request from a client, wherein the application calling request comprises API information and ID information of a to-be-called application, and the ID information is used to identify a data model required by the client (S102) ;transmitting the application calling request to a server based on the API information (S104) ;receiving server data returned by the server according to the application calling request (S106) ;extracting the ID information from the application calling request, and querying a corresponding data model from a data model database according to the ID information (S108) ;transforming the received server data into client request data based on the queried data model (S110) ; andtransmitting the client request data to the client (S122) .2.The method (100) according to claim 1, wherein before performing receiving the application calling request from the client, the method further comprises performing preprocessing on frontend code of the client (S101) , comprising:obtaining frontend code (S1011) ;extracting an API and a required data model from the frontend code, and generating a corresponding ID for a data pair of the API and the data model (S1012) ;storing the data pair of the API and the data model and the corresponding ID to construct the data model database (S1013) ; andupdating the frontend code with the ID (S1014) .3.The method (100) according to claim 2, wherein the updating the frontend code with the ID (S1014) comprises:adding the corresponding ID to a parameter in the frontend code.4.The method (100) according to any one of claims 1 to 3, wherein the transforming the received server data into client request data based on the queried data model (S110) comprises:removing unnecessary data item from the server data and remaining necessary data item as the client request data according to the data model.5.A data processing gateway (300) , comprising:a calling request receiving unit (302) , configured to receive an application calling request from a client, wherein the application calling request comprises API information and ID information of a to-be-called application, and the ID information is used to identify a data model required by the client;a calling request transmitting unit (304) , configured to transmit the application calling request to a server based on the API information;a server data receiving unit (306) , configured to receive server data returned by the server according to the application calling request;a data model query unit (308) , configured to query a corresponding data model from a data model database according to the ID information;a data transformation unit (310) , configured to transform the received server data into client request data based on the queried data model; anda client data transmitting unit (312) , configured to transmit the client request data to the client.6.The data processing gateway (300) according to claim 5, further comprising a preprocessing unit (301) , wherein the preprocessing unit (301) comprises:a frontend code obtaining subunit (3011) , configured to obtain frontend code;an information extraction subunit (3012) , configured to extract an API and a required data model from the frontend code, and generate a corresponding ID for a data pair of the API and the data model;a data model database construction subunit (3013) , configured to store the data pair of the API and the data model and the corresponding ID to construct the data model database; anda frontend code updating subunit (3014) , configured to update the frontend code with the ID.7.An application calling system (500) , comprising a client (502) , a server (504) , and a data processing gateway (300) according to claim 5 or 6, whereinthe client (502) transmits an application calling request to the data processing gateway (300) , and the calling request includes a called API and ID; andthe data processing gateway (300) transmits a request message to call the API to the server (504) , receives server data returned by the server (504) , transforms the server data into client request data according to a data model corresponding to the ID, and transmits the client request data to the client (502) .8.A computing device (600) , comprising:at least one processor (602) ; anda memory (604) coupled to the at least one processor (602) , wherein the memory is configured to store instructions, and the instructions, when executed by the at least one processor (602) , enable the at least one processor (602) to perform the method according to any one of claims 1 to 4.9.A non-transient machine-readable storage medium, storing executable instructions, wherein the instructions, when executed, enable a machine to perform the method according to any one of claims 1 to 4.10.A computer program product, wherein the computer program product is tangibly stored on a computer-readable medium and comprises computer-executable instructions, and the computer-executable instructions, when executed, enable at least one processor to perform the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Information interaction method and device
CN107231398A
Service request processing method, system and data gateway
CN113691615A
Runtime extensible application programming interface server
US11425221B1
Customizable graphical user interface for network management
US20150019991A1
Data query method and apparatus, server, and computer-readable storage medium
WO2023029752A1