A data processing method, device, equipment and storage medium

By performing protocol conversion between HTTP/1.1 and HTTP/2 protocols, gRPC service requests are generated and sent to the server, which solves the application problem of gRPC under the HTTP/2 protocol and improves data processing efficiency and transmission efficiency.

CN113992641BActive Publication Date: 2024-09-20BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111182352.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-11
Publication Date
2024-09-20
Estimated Expiration
2041-10-11

AI Technical Summary

Technical Problem

How to apply gRPC business requests to the HTTP/2 protocol to improve data processing efficiency and solve the problems of low efficiency and long interaction time of the HTTP/1.1 protocol in the existing technology.

Method used

By receiving the client's HTTP business request, extracting the service identifier and data identifier, generating a gRPC business request containing these identifiers, converting it to the HTTP/2 protocol, and sending it to the server to achieve protocol conversion, it enriches the transmission mode of the business request.

Benefits of technology

It realizes sending business requests under different network protocols, improves the efficiency of data transmission and interaction time, and uses the multiplexing and other characteristics of the HTTP/2 protocol to improve the efficiency of data transmission between the client and the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113992641B
    Figure CN113992641B
Patent Text Reader

Abstract

The present disclosure relates to a data processing method, device, equipment and storage medium, and relates to the field of computer technology. A service request can be sent to a server under different network protocols, enriching the transmission mode of the service request. The data processing method includes: receiving a first service request sent by a client through a first network protocol; the first service request is used to request to obtain service data from a server; the first service request includes a service identifier and a data identifier; the service identifier is used to identify the server; the data identifier is used to identify the service data; generating a second service request including a data identifier and a service identifier; the second service request is used to obtain service data from the server based on a second network protocol; and sending the second service request to the server through the second network protocol.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, device, equipment and storage medium. Background Art

[0002] Remote Process Call (RPC) is a communication method between a client and a server. It is mainly manifested in that the client initiates a function call request to a remote server through the encapsulation of a Hyper Text Transfer Protocol (HTTP) request. It is a server application programming interface (API) design idea. gRPC is an open source RPC system released by Google.

[0003] Currently, gRPC business requests can be called based on HTTP / 1.1. The function name and passed parameters in the gRPC business request parsed by the server can be called through the interface call file established by the system to call the corresponding function, thereby realizing the call of gRPC business requests in browsers that support the HTTP / 1.1 protocol.

[0004] With the development of Internet technology, HTTP / 2 is gradually widely used. HTTP / 2 is the second version of the HTTP protocol. On the basis of being compatible with the previous HTTP / 1.1, it also has many new features. Compared with HTTP / 1.1, HTTP / 2 has the characteristics of high communication efficiency, short interaction time, and multiplexing.

[0005] Therefore, how to apply gRPC business requests to HTTP / 2 is a technical problem that needs to be solved urgently. Summary of the invention

[0006] The present disclosure provides a data processing method, device, equipment and storage medium, which can improve the efficiency of data processing.

[0007] The technical solution of the embodiment of the present disclosure is as follows:

[0008] According to a first aspect of an embodiment of the present disclosure, a data processing method is provided, which can be applied to an electronic device. The method may include: receiving a first service request sent by a client via a first network protocol; the first service request is used to request to obtain service data from a server; the first service request includes a service identifier and a data identifier; the service identifier is used to identify the server; the data identifier is used to identify the service data; generating a second service request including the data identifier and the service identifier; the second service request is used to obtain service data from the server based on a second network protocol; and sending the second service request to the server via the second network protocol.

[0009] Optionally, generating the second service request including the data identifier and the service identifier includes: extracting the service identifier and the data identifier from the first service request; and generating the second service request based on the second network protocol, the service identifier and the data identifier.

[0010] Optionally, extracting a service identifier and a data identifier from the first business request includes: parsing the first business request to obtain a description file for describing a server and business data; parsing the description file to obtain a first description field for describing the server and a second description field for describing the business data; determining the first description field as a service identifier, and determining the second description field as a data identifier.

[0011] Optionally, based on the second network protocol, the service identifier and the data identifier, a second business request is generated, including: based on the second network protocol, generating a business request for communicating with the server; based on the second network protocol, converting the data format of the service identifier and the data identifier into a data format for communicating with the server; adding the format-converted service identifier and data identifier to the business request for communicating with the server to obtain a second business request.

[0012] Optionally, the first network protocol is the Hypertext Transfer Protocol HTTP; the second network protocol is HTTP / 2; the first business request is an HTTP business request; and the second business request is a Google Remote Procedure Call gRPC business request.

[0013] Optionally, the data processing method also includes: receiving business data sent by the server in response to the second business request based on the second network protocol; generating a business response for communicating with the client based on the first network protocol; the business response includes the business data; and sending the business response to the client via the first network protocol.

[0014] According to the second aspect of the embodiment of the present disclosure, a data processing device is provided, which can be applied to an electronic device. The device may include: a receiving unit, a generating unit and a sending unit; the receiving unit is used to receive a first service request sent by a client through a first network protocol; the first service request is used to request to obtain service data from a server; the first service request includes a service identifier and a data identifier; the service identifier is used to identify the server; the data identifier is used to identify the service data; the generating unit is used to generate a second service request including a data identifier and a service identifier; the second service request is used to obtain service data from the server based on a second network protocol; the sending unit is used to send the second service request to the server through the second network protocol.

[0015] Optionally, the generating unit is specifically configured to: extract a service identifier and a data identifier from the first service request; and generate a second service request based on the second network protocol, the service identifier and the data identifier.

[0016] Optionally, the generating unit is specifically used to: parse the first business request to obtain a description file for describing the server and the business data; parse the description file to obtain a first description field for describing the server and a second description field for describing the business data; determine the first description field as a service identifier, and determine the second description field as a data identifier.

[0017] Optionally, the generating unit is specifically used to: generate a business request for communicating with a server based on a second network protocol; convert the data format of the service identifier and the data identifier into a data format for communicating with the server based on the second network protocol; and add the service identifier and the data identifier after the format conversion to the business request for communicating with the server to obtain a second business request.

[0018] Optionally, the first network protocol is the Hypertext Transfer Protocol HTTP; the second network protocol is HTTP / 2; the first business request is an HTTP business request; and the second business request is a Google Remote Procedure Call gRPC business request.

[0019] Optionally, the receiving unit is also used to receive business data sent by the server based on the second network protocol in response to the second business request; the generating unit is also used to generate a business response for communicating with the client based on the first network protocol; the business response includes the business data; the sending unit is also used to send the business response to the client via the first network protocol.

[0020] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, which may include: a processor and a memory for storing processor executable instructions; wherein the processor is configured to execute the instructions to implement any one of the optional data processing methods in the above-mentioned first aspect.

[0021] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform any one of the optional data processing methods in the first aspect above.

[0022] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the data processing method as described in any optional implementation of the first aspect.

[0023] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.

[0024] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0025] Based on any of the above aspects, in the present disclosure, after receiving a first service request sent by a client through a first network protocol, the electronic device can obtain a service identifier and a data identifier in the first service request, and generate a second service request including a data identifier and a service identifier. Subsequently, the electronic device sends a second service request to the server through a second network protocol. Since the second service request is used to obtain service data from the server based on the second network protocol, the service request after protocol conversion can send a service request to the server under different network protocols, enriching the transmission mode of the service request. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0027] Figure 1 A schematic diagram of a data processing method provided by an embodiment of the present disclosure is shown;

[0028] Figure 2 A flowchart of another data processing method provided by an embodiment of the present disclosure is shown;

[0029] Figure 3 A flowchart of another data processing method provided by an embodiment of the present disclosure is shown;

[0030] Figure 4 A flowchart of another data processing method provided by an embodiment of the present disclosure is shown;

[0031] Figure 5A flowchart of another data processing method provided by an embodiment of the present disclosure is shown;

[0032] Figure 6 A schematic diagram showing the structure of another data processing device provided by an embodiment of the present disclosure is shown;

[0033] Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown;

[0034] Figure 8 A schematic structural diagram of another electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0035] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0037] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.

[0038] The data involved in the present disclosure may be data authorized by the user or fully authorized by all parties.

[0039] As described in the background technology, with the development of Internet technology, HTTP / 2 has been widely used. HTTP / 2 is the second version of the HTTP protocol. On the basis of being compatible with the previous HTTP / 1.1, it also has many new features. Compared with HTTP / 1.1, HTTP / 2 has the characteristics of high communication efficiency, short interaction time, and multiplexing. Therefore, how to apply gRPC business requests to HTTP / 2 is a technical problem that needs to be solved urgently.

[0040] Based on this, an embodiment of the present application provides a data processing method, including: after receiving a first service request sent by a client through a first network protocol, the electronic device can obtain a service identifier and a data identifier in the first service request, and generate a second service request including a data identifier and a service identifier. Subsequently, the electronic device sends a second service request to the server through a second network protocol. Since the second service request is used to obtain service data from the server based on the second network protocol, the service request after protocol conversion can send the service request to the server under different network protocols, enriching the transmission mode of the service request.

[0041] The following is an exemplary description of the data processing method provided by the embodiment of the present disclosure:

[0042] The data processing method provided by the present disclosure can be applied to electronic devices.

[0043] In some embodiments, the electronic device may be a gateway in the process of data transmission between a server and a terminal, or may be other electronic devices for data processing, which is not limited in the present disclosure.

[0044] Among them, the gateway is also called the network connector and protocol converter. The gateway realizes network interconnection above the network layer. It is a complex network interconnection device and is only used for the interconnection of two networks with different high-level protocols. Gateways can be used for wide area network interconnection as well as local area network interconnection. A gateway is a computer system or device that performs the important task of conversion. It is used between two systems with different communication protocols, data formats or languages, or even completely different architectures. The gateway is a translator. Unlike a bridge that simply transmits information, a gateway repackages the received information to meet the needs of the destination system. Same layer - application layer.

[0045] The data processing method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0046] like Figure 1 As shown, when the data processing method is applied to an electronic device, the data processing method may include:

[0047] S101. An electronic device receives a first service request sent by a client via a first network protocol.

[0048] Specifically, the application installed on the client can provide various services for the user. When the user uses a certain service, the client can respond to the user's operation and send a first service request to the electronic device through the first network protocol. Correspondingly, the electronic device receives the first service request sent by the client through the first network protocol.

[0049] The first business request is used to request to obtain business data from the server; the first business request includes a service identifier and a data identifier; the service identifier is used to identify the server; and the data identifier is used to identify the business data.

[0050] Optionally, the first network protocol may be an HTTP protocol, and the first service request may be an HTTP service request.

[0051] For example, a user can purchase goods using a shopping application on a client. When paying transaction currency for the goods, the client needs to obtain transaction services from a transaction server. In this case, the client can send an HTTP service request to the electronic device through the HTTP protocol. The HTTP service request is used to request to obtain transaction services from the transaction server. The HTTP service request includes a data identifier for identifying the transaction service and a service identifier of the transaction server.

[0052] S102: The electronic device generates a second service request including a data identifier and a service identifier.

[0053] Specifically, after receiving the first service request sent by the client through the first network protocol, the electronic device may generate a second service request including a data identifier and a service identifier.

[0054] The second service request is used to obtain service data from the server based on the second network protocol.

[0055] Optionally, the second network protocol may be an HTTP / 2 protocol, and the second service request may be a gRPC service request.

[0056] In combination with the above example, after the client can send an HTTP business request to the electronic device through the HTTP protocol, since the HTTP business request includes a data identifier for identifying the transaction service and a service identifier of the transaction server, the electronic device can generate a gRPC business request including a data identifier for identifying the transaction service and a service identifier of the transaction server based on the HTTP / 2 protocol.

[0057] HTTP / 2 is the second version of the HTTP protocol. In addition to being compatible with the previous HTTP / 1.0 and HTTP / 1.1, it is also compatible with many new features, such as header field data compression based on the HPACK algorithm, server push, request pipelining, data multiplexing, etc. The biggest difference between HTTP / 2 and HTTP / 1.x is that HTTP / 2 divides the TCP connection into several streams, in each of which several messages can be transmitted, and each message consists of several minimum units of binary frames. In other words, the HTTP / 1.x protocol is a text protocol with very good readability, but it is not efficient.

[0058] First, HTTP / 1.x protocol parsing is difficult. For example, for a complete HTTP service request, you first need to correctly read the HTTP header. The fields in the HTTP header are separated by \r\n, and then separated from the body by \r\n\r\n. After parsing the header, you can get the body size from the content-length in the header and read the body.

[0059] Secondly, the interaction mode of HTTP / 1.x is that one connection can only have one question and one answer at a time, which means that after the client sends a request, it must wait for a reply before continuing to send the next request. HTTP / 2 is a binary protocol with zero readability, but it supports connection multiplexing, which improves the utilization rate of the connection; and multiple streams can be sent simultaneously in one connection; and in an HTTP service request, a lot of request metadata can be carried on the Header to describe the transmitted resources and its related attributes; while the HTTP / 1.1 protocol uses a plain text protocol, and uses "\r\n" to separate metadata. Once the data is too large, the header will be very large.

[0060] gRPC is a type of RPC that uses Protocol Buffer (Protobuf for short) as a serialization format. Protocol Buffer is a serialization framework from Google that is more portable and efficient than Json. It is also designed based on the HTTP / 2 standard, bringing features such as bidirectional streaming, flow control, header compression, and multiplexing requests on a single TCP connection. These features make it perform better on mobile devices, save power, and save space.

[0061] In gRPC, a client application can call methods directly on a server application on another computer as if it were a local object, making it easier to create distributed applications and services.

[0062] In this way, when the first network protocol is the HTTP protocol, the second network protocol is the HTTP / 2 protocol, the first business request is the HTTP business request, and the second business request is the gRPC business request, the present disclosure ensures that the HTTP business request can realize the conversion of the gRPC business request under different network protocols, so that when the client and the server transmit data, they can utilize the characteristics of HTTP / 2 communication efficiency, short interaction time, and multiplexing, thereby improving the efficiency of double-click transmission.

[0063] S103: The electronic device sends a second service request to the server via a second network protocol.

[0064] Specifically, after generating the second service request including the data identifier and the service identifier, the electronic device may send the second service request to the server through the second network protocol.

[0065] In combination with the above example, after generating a gRPC business request including a data identifier for identifying a transaction service and a service identifier of a transaction server based on the HTTP / 2 protocol, the electronic device can send a gRPC business request to the transaction server through the HTTP / 2 protocol to obtain the transaction service required by the client.

[0066] The technical solution provided by the above embodiment brings at least the following beneficial effects: As can be seen from S101-S103, after receiving the first service request sent by the client through the first network protocol, the electronic device can obtain the service identifier and data identifier in the first service request, and generate a second service request including the data identifier and the service identifier. Subsequently, the electronic device sends the second service request to the server through the second network protocol. Since the second service request is used to obtain service data from the server based on the second network protocol, the service request after the protocol conversion can send the service request to the server under different network protocols, enriching the transmission mode of the service request.

[0067] In one embodiment, in combination Figure 1 ,like Figure 2 As shown, in the above S102, the method in which the electronic device generates a second service request including a data identifier and a service identifier specifically includes:

[0068] S201. The electronic device extracts a service identifier and a data identifier from a first service request.

[0069] Specifically, when generating the second service request including the data identifier and the service identifier, in order to ensure that the second service request can obtain the service data required by the client from the server, the electronic device can extract the service identifier and the data identifier from the first service request.

[0070] Optionally, the service identifier and the data identifier may be pre-stored in a field of a file of the first service request. After receiving the first service request, the electronic device may extract the field from the file to obtain the service identifier and the data identifier.

[0071] S202: The electronic device generates a second service request based on the second network protocol, the service identifier and the data identifier.

[0072] Specifically, after extracting the service identifier and the data identifier from the first service request, in order to ensure that the electronic device can communicate with the server, the electronic device can generate a second service request based on the second network protocol, the service identifier and the data identifier.

[0073] Exemplarily, when the first business request is an HTTP business request and the second business request is a gRPC business request, the method field can be pre-defined. This field indicates which system and which interface the request needs to be routed to. For example, field A is used to identify that service A provided by the gRPC service of server A needs to be obtained.

[0074] The input parameter names in the HTTP interface document are in the form of underscores. Correspondingly, the input parameter names mapped to the proto file are also in the form of underscores. After the business is passed to the method, the electronic device can quickly locate the proto file of server A through field A, and obtain the interface name A of this service based on service A.

[0075] In this case, the electronic device can map the route to the rpc service of server A, and create the Method Descriptor method description object required by gRPC through the input and output parameter descriptors of gRPC to obtain a gRPC business request including a service identifier (used to identify server A) and a data identifier (used to identify the gRPC service obtained from server A, which provides service A).

[0076] The technical solution provided by the above embodiment brings at least the following beneficial effects: From S201-S202, it can be known that when the electronic device generates the second service request including the data identifier and the service identifier, in order to ensure that the second service request can obtain the service data required by the client from the server, the service identifier and the data identifier can be extracted from the first service request. Subsequently, the electronic device can generate the second service request based on the second network protocol, the service identifier and the data identifier, and a specific implementation method for generating the second service request is provided, which ensures that the service request after the protocol conversion can send the service request to the server under different network protocols, and enriches the transmission mode of the service request.

[0077] In one embodiment, in combination Figure 2 ,like Figure 3 As shown, in the above S201, the method for the electronic device to extract the service identifier and the data identifier from the first service request specifically includes:

[0078] S301: The electronic device parses a first service request to obtain a description file for describing a server and service data.

[0079] Specifically, the service identifier and the data identifier may be pre-stored in a description field of a description file of the first service request. After receiving the first service request, the electronic device may parse the first service request to obtain a description file for describing the server and service data.

[0080] Optionally, the description file can be a proto file.

[0081] S302: The electronic device parses the description file to obtain a first description field for describing the server and a second description field for describing the service data.

[0082] Specifically, after parsing the first service request to obtain a description file for describing the server and the service data, the electronic device may parse the description file to obtain a first description field for describing the server and a second description field for describing the service data.

[0083] Optionally, the first description field and the second description field may be method fields.

[0084] The two fields may be connected by an underscore or by other means, and this disclosure does not limit this.

[0085] S303: The electronic device determines the first description field as a service identifier, and determines the second description field as a data identifier.

[0086] Specifically, after parsing the description file to obtain a first description field for describing the server and a second description field for describing the service data, since the first description field is used to describe the server, the electronic device can determine the first description field as a service identifier. Correspondingly, since the second description field is used to describe the service data, the electronic device can determine the second description field as a data identifier.

[0087] The technical solution provided by the above embodiment brings at least the following beneficial effects: It can be seen from S301-S303 that the service identifier and the data identifier can be pre-stored in a description field of a description file of the first business request. After receiving the first business request, the electronic device can parse the first business request to obtain a description file for describing the server and the business data. Subsequently, the electronic device parses the description file to obtain a first description field for describing the server and a second description field for describing the business data, and determines the first description field as the service identifier, and determines the second description field as the data identifier, which provides a specific implementation method for extracting the service identifier and the data identifier from the first business request, ensuring that when the second business request is subsequently generated, the service identifier and the data identifier can be added to the second business request, so that the business request after the protocol conversion can send the business request required by the client to the server under different network protocols, enriching the transmission mode of the business request.

[0088] In one embodiment, in combination Figure 2 ,like Figure 4 As shown, in the above S202, the method in which the electronic device generates the second service request based on the second network protocol, the service identifier and the data identifier specifically includes:

[0089] S401. The electronic device generates a service request for communicating with a server based on a second network protocol.

[0090] Specifically, when generating the second business request based on the second network protocol, service identifier and data identifier, since the electronic device needs to communicate with the server based on the second network protocol, the electronic device can generate a business request for communicating with the server based on the second network protocol.

[0091] Exemplarily, the first service request received by the electronic device is an HTTP service request. When the service request sent by the electronic device to the server is a gRPC service request, the electronic device needs to send the gRPC service request to the server based on the network protocol of the gRPC service request (i.e., the second network protocol: HTTP / 2 protocol). In this case, the electronic device generates a service request for communicating with the server based on the HTTP / 2 protocol.

[0092] S402: The electronic device converts the data format of the service identifier and the data identifier into a data format for communication with the server based on the second network protocol.

[0093] Specifically, when a second business request is generated based on the second network protocol, the service identifier and the data identifier, since the electronic device needs to communicate with the server based on the second network protocol, the electronic device can convert the data format of the service identifier and the data identifier into a data format for communicating with the server based on the second network protocol.

[0094] Exemplarily, the first business request received by the electronic device is an HTTP business request. The data identifier and service identifier contained in the HTTP business request are description fields connected by underscores. When the business request sent by the electronic device to the server is a gRPC business request, the electronic device needs to convert the description fields connected by underscores (data identifiers and service identifiers in the HTTP business request) based on the network protocol of the gRPC business request (i.e., the second network protocol: HTTP / 2 protocol) into the data format under the HTTP / 2 protocol (for example, connecting the description fields with a plus sign) so that the server can identify the data identifier and service identifier based on the HTTP / 2 protocol.

[0095] S403: The electronic device adds the service identifier and data identifier after format conversion to the service request for communication with the server to obtain a second service request.

[0096] Specifically, after generating a business request for communicating with the server, and converting the data format of the service identifier and the data identifier into a data format for communicating with the server based on the second network protocol, the electronic device can add the format-converted service identifier and data identifier to the business request for communicating with the server to obtain a second business request.

[0097] The technical solution provided by the above embodiment brings at least the following beneficial effects: It can be seen from S401-S403 that when generating the second business request based on the second network protocol, the service identifier and the data identifier, since the electronic device needs to communicate with the server based on the second network protocol, the electronic device can generate a business request for communicating with the server based on the second network protocol. In addition, since the electronic device needs to communicate with the server based on the second network protocol, the electronic device can convert the data format of the service identifier and the data identifier into a data format for communicating with the server based on the second network protocol. Subsequently, the electronic device can add the format-converted service identifier and data identifier to the business request for communicating with the server to obtain the second business request, and provides a specific implementation method for generating the second business request based on the second network protocol, the service identifier and the data identifier, which ensures that the business request after the protocol conversion can send the business request to the server under different network protocols, enriching the transmission mode of the business request.

[0098] In one embodiment, the data processing method further includes:

[0099] S501. An electronic device receives service data sent by a server based on a second network protocol in response to a second service request.

[0100] Specifically, after the electronic device sends the second service request to the server via the second network protocol, the server may respond to the second service request and provide service data to the client. In this case, the electronic device receives the service data sent by the server based on the second network protocol in response to the second service request.

[0101] In combination with the above example, after generating a gRPC business request including a data identifier for identifying a transaction service and a service identifier of a transaction server based on the HTTP / 2 protocol, the electronic device can send a gRPC business request to the transaction server through the HTTP / 2 protocol to obtain the transaction service required by the client.

[0102] After receiving the gRPC service request, the transaction server can provide the client with the service data of the transaction service in response to the gRPC service request. In this case, the transaction server can send the service data of the transaction service to the electronic device based on the HTTP / 2 protocol.

[0103] S502: The electronic device generates a service response for communicating with the client based on the first network protocol.

[0104] Specifically, after receiving the business data sent by the server in response to the second business request based on the second network protocol, since the electronic device communicates with the client based on the first network protocol, the electronic device can generate a business response for communicating with the client based on the first network protocol.

[0105] The business response includes business data.

[0106] In combination with the above example, after receiving the business data of the transaction service sent by the transaction server based on the HTTP / 2 protocol, since the electronic device communicates with the client based on the HTTP protocol, the electronic device can generate a business response for communicating with the client based on the HTTP protocol. The business response includes the business data of the transaction service.

[0107] S503: The electronic device sends a service response to the client via the first network protocol.

[0108] Specifically, after generating a service response for communicating with the client based on the first network protocol, the electronic device sends the service response to the client through the first network protocol.

[0109] In combination with the above example, after generating a business response for communicating with a client based on the HTTP protocol, the electronic device sends a business response including business data of the transaction service to the client through the HTTP protocol.

[0110] The technical solution provided by the above embodiment brings at least the following beneficial effects: It can be seen from S501-S503 that after receiving the service data sent by the server in response to the second service request based on the second network protocol, since the electronic device communicates with the client based on the first network protocol, the electronic device can generate a service response for communicating with the client based on the first network protocol. Subsequently, the electronic device sends a service response including the service data to the client through the first network protocol. In this way, the electronic device can also return the service data corresponding to the service request to the client based on different network protocols, enriching the transmission mode of the service data.

[0111] It is understandable that, in actual implementation, the terminal / server described in the embodiment of the present disclosure may include one or more hardware structures and / or software modules for implementing the aforementioned corresponding data processing method, and these execution hardware structures and / or software modules may constitute an electronic device. It should be easily appreciated by those skilled in the art that, in combination with the algorithm steps of each example described in the embodiment disclosed herein, the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present disclosure.

[0112] Based on such understanding, the embodiments of the present disclosure also provide a data processing device that can be applied to electronic devices. Figure 6 FIG. 1 is a schematic diagram showing the structure of a data processing device provided by an embodiment of the present disclosure. Figure 6 As shown, the data processing device may include: a receiving unit 601, a generating unit 602 and a sending unit 603;

[0113] The receiving unit 601 is used to receive a first service request sent by a client through a first network protocol; the first service request is used to request to obtain service data from a server; the first service request includes a service identifier and a data identifier; the service identifier is used to identify the server; the data identifier is used to identify the service data;

[0114] A generating unit 602 is configured to generate a second service request including a data identifier and a service identifier; the second service request is used to obtain service data from a server based on a second network protocol;

[0115] The sending unit 603 is used to send a second service request to the server through a second network protocol.

[0116] Optionally, the generating unit 602 is specifically configured to:

[0117] Extracting a service identifier and a data identifier from the first business request;

[0118] A second service request is generated based on the second network protocol, the service identifier and the data identifier.

[0119] Optionally, the generating unit 602 is specifically configured to:

[0120] Parsing the first service request to obtain a description file for describing the server and service data;

[0121] Parsing the description file to obtain a first description field for describing the server and a second description field for describing the service data;

[0122] The first description field is determined as a service identifier, and the second description field is determined as a data identifier.

[0123] Optionally, the generating unit 602 is specifically configured to:

[0124] generating a service request for communicating with the server based on the second network protocol;

[0125] Based on the second network protocol, converting the data format of the service identifier and the data identifier into a data format for communication with the server;

[0126] The service identifier and the data identifier after the format conversion are added to the service request for communication with the server to obtain a second service request.

[0127] Optionally, the first network protocol is the Hypertext Transfer Protocol HTTP; the second network protocol is HTTP / 2; the first business request is an HTTP business request; and the second business request is a Google Remote Procedure Call gRPC business request.

[0128] Optionally, the receiving unit 601 is further configured to receive service data sent by the server based on the second network protocol in response to the second service request;

[0129] The generating unit 602 is further configured to generate a service response for communicating with the client based on the first network protocol; the service response includes service data;

[0130] The sending unit 603 is further configured to send a service response to the client via the first network protocol.

[0131] As described above, the embodiments of the present disclosure can divide the electronic device into functional modules according to the above method examples. Among them, the above integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, it should be noted that the division of modules in the embodiments of the present disclosure is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module.

[0132] Regarding the data processing device in the above embodiment, the specific manner in which each module performs operations and the beneficial effects possessed have been described in detail in the aforementioned method embodiment and will not be repeated here.

[0133] The embodiment of the present disclosure also provides an electronic device. Figure 7 The electronic device provided by the embodiment of the present disclosure is shown in the structural diagram. The electronic device may be a data processing device and may include at least one processor 61 , a communication bus 62 , a memory 63 and at least one communication interface 64 .

[0134] The processor 61 may be a processor (central processing unit, CPU), a microprocessor unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the disclosed solution. Figure 6 The function implemented by the generating unit 602 in the electronic device is similar to Figure 7 The functions implemented by the processor 61 in are the same.

[0135] The communication bus 62 may include a pathway for transmitting information between the above-mentioned components.

[0136] The communication interface 64 uses any transceiver-like device for communicating with other devices or communication networks, such as servers, Ethernet, radio access networks (RAN), wireless local area networks (WLAN), etc. As an example,

[0137] The memory 63 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit through a bus. The memory may also be integrated with the processing unit.

[0138] The memory 63 is used to store application code for executing the solution of the present disclosure, and the execution is controlled by the processor 61. The processor 61 is used to execute the application code stored in the memory 63, so as to realize the functions in the method of the present disclosure.

[0139] In a specific implementation, as an embodiment, the processor 61 may include one or more CPUs, such as Figure 7 CPU0 and CPU1 in.

[0140] In a specific implementation, as an embodiment, the electronic device may include multiple processors, such as Figure 7 61 and 65 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0141] In a specific implementation, as an embodiment, the electronic device may further include an input device 66 and an output device 67. The input device 66 communicates with the output device 67 and may receive user input in a variety of ways. For example, the input device 66 may be a mouse, a keyboard, a touch screen device, or a sensor device. The output device 67 communicates with the processor 61 and may display information in a variety of ways. For example, the output device 61 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, etc.

[0142] Those skilled in the art will understand that Figure 7 The structure shown in the figure does not constitute a limitation on the electronic device, and may include more or less components than shown in the figure, or combine certain components, or adopt a different component arrangement.

[0143] The embodiment of the present disclosure also provides an electronic device. Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure is shown. The electronic device may be a data processing device. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 71 and one or more memories 72. Among them, at least one instruction is stored in the memory 72, and at least one instruction is loaded and executed by the processor 71 to implement the data processing method provided by the above-mentioned various method embodiments. Of course, the electronic device may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The electronic device may also include other components for implementing the functions of the device, which will not be repeated here.

[0144] The present disclosure also provides a computer-readable storage medium including instructions, and the computer-readable storage medium stores instructions, and when the instructions in the computer-readable storage medium are executed by the processor of a computer device, the computer can execute the data processing method provided by the above-mentioned embodiment. For example, the computer-readable storage medium can be a memory 63 including instructions, and the above instructions can be executed by the processor 61 of the terminal to complete the above method. For another example, the computer-readable storage medium can be a memory 72 including instructions, and the above instructions can be executed by the processor 71 of the electronic device to complete the above method. Optionally, the computer-readable storage medium can be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium can be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.

[0145] The present disclosure also provides a computer program product, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the above Figure 1-Figure 5 The data processing method shown in any one of the accompanying drawings.

[0146] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0147] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A data processing method, It is characterized in that include: Receiving a first service request sent by a client through a first network protocol; The first service request is used to request to obtain service data from the server; The first business request includes a service identifier and a data identifier; The service identifier is used to identify the server; the data identifier is used to identify the service data; Extracting the service identifier and the data identifier from the first business request; generating a service request for communicating with the server based on a second network protocol, wherein the second network protocol is a network protocol used when communicating with the server; Based on the second network protocol, converting the data format of the service identifier and the data identifier into a data format for communication with the server; adding the format-converted service identifier and data identifier to a service request for communication with the server to obtain a second service request; the second service request is used to obtain the service data from the server based on the second network protocol; The transmission efficiency of the second service request is higher than the transmission efficiency of the first service request; Sending the second service request to the server through the second network protocol; Among them, the first network protocol is the Hypertext Transfer Protocol HTTP; the second network protocol is HTTP / 2; the first business request is an HTTP business request; and the second business request is a Google Remote Procedure Call gRPC business request.

2. The data processing method according to claim 1, It is characterized in that The extracting the service identifier and the data identifier from the first service request includes: parsing the first service request to obtain a description file for describing the server and the service data; Parsing the description file to obtain a first description field for describing the server and a second description field for describing the service data; The first description field is determined as the service identifier, and the second description field is determined as the data identifier.

3. The data processing method according to claim 1 or 2, It is characterized in that Also includes: receiving the service data sent by the server based on the second network protocol in response to the second service request; Based on the first network protocol, generating a service response for communicating with the client; the service response includes the service data; The service response is sent to the client through the first network protocol.

4. A data processing device, It is characterized in that include: A receiving unit, a generating unit and a sending unit; The receiving unit is used to receive a first service request sent by a client via a first network protocol; The first service request is used to request to obtain service data from the server; the first service request includes a service identifier and a data identifier; The service identifier is used to identify the server; the data identifier is used to identify the service data; The generating unit is used to extract the service identifier and the data identifier from the first service request; The generating unit is further configured to generate a service request for communicating with the server based on a second network protocol, where the second network protocol is a network protocol used when communicating with the server; The generating unit is further used to convert the data format of the service identifier and the data identifier into a data format for communication with the server; The generating unit is further used to add the format-converted service identifier and data identifier to the service request for communication with the server to obtain a second service request; the second service request is used to obtain the service data from the server based on the second network protocol; The transmission efficiency of the second service request is higher than the transmission efficiency of the first service request; The sending unit is used to send the second service request to the server through the second network protocol; Among them, the first network protocol is the Hypertext Transfer Protocol HTTP; the second network protocol is HTTP / 2; the first business request is an HTTP business request; and the second business request is a Google Remote Procedure Call gRPC business request.

5. The data processing device according to claim 4, It is characterized in that The generating unit is specifically used for: parsing the first service request to obtain a description file for describing the server and the service data; Parsing the description file to obtain a first description field for describing the server and a second description field for describing the service data; The first description field is determined as the service identifier, and the second description field is determined as the data identifier.

6. The data processing device according to claim 4 or 5, It is characterized in that The receiving unit is further configured to receive the service data sent by the server based on the second network protocol in response to the second service request; The generating unit is further configured to generate a service response for communicating with the client based on the first network protocol; the service response includes the service data; The sending unit is further configured to send the service response to the client via the first network protocol.

7. An electronic device, It is characterized in that The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data processing method according to any one of claims 1 to 3.

8. A computer-readable storage medium having instructions stored thereon, It is characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method according to any one of claims 1 to 3.