A remote calling method, device and system

By determining the configuration parameter set in RPC to support multiple serialization protocols and network protocols, the problem of high coupling between serialization protocols and network protocols in existing RPC solutions is solved, and the flexibility and adaptability of RPC is improved.

CN113407366BActive Publication Date: 2024-12-10DOUYIN VISION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110803025.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-15
Publication Date
2024-12-10
Estimated Expiration
2041-07-15

AI Technical Summary

Technical Problem

The existing remote procedure call (RPC) implementation scheme only supports one serialization protocol, which leads to high coupling between the serialization protocol and the network protocol, and the inability to free replacement of the serialization protocol, resulting in more flexibility in the RPC implementation scheme. Low, cannot be used effectively in multiple scenarios.

Method used

By determining the configuration parameter set in the remote call request, including multiple serialization protocols, network protocols and call models, the corresponding serialization request data is generated, and deserialized on the server side, the serialization protocol and network protocol are realized. Decoupling, supports multiple serialization protocols, network protocols and calling models.

Benefits of technology

It improves the flexibility of the RPC solution, enables it to be used in multiple scenarios, supports multiple serialization protocols and network protocols, and enhances the adaptability and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113407366B_ABST
    Figure CN113407366B_ABST
Patent Text Reader

Abstract

The present disclosure provides a remote calling method and device, which determines a configuration parameter set that matches a remote calling request through a target calling method, and then uses the protocol and calling model indicated in the configuration parameter set to perform a remote call, so as to decouple the serialization protocol and the network protocol, support multiple serialization protocols, network protocols and calling models in a set of RPC implementation solutions, and improve the flexibility of the RPC solution.
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 remote calling method and device. Background Art

[0002] Remote Procedure Call (RPC) is a way of calling each other between services. The client can call an application or function on the server by sending a call request to the server. The call request usually carries the request data required to call the function or application. Communication between the client and the server requires the support of the network protocol, and the communication content needs to be serialized before it can be successfully transmitted.

[0003] The usual RPC implementation only supports one serialization protocol, and the serialization protocol is highly coupled to the network protocol, making it impossible to freely replace the serialization protocol. This results in low flexibility of the RPC implementation and is not suitable for use in a variety of scenarios. Summary of the invention

[0004] The embodiments of the present disclosure at least provide a remote calling method and device.

[0005] In a first aspect, an embodiment of the present disclosure provides a remote calling method, which is applied to a client and includes:

[0006] In response to a remote call request, determining a configuration parameter set matching the remote call request based on a target call method indicated by the remote call request; the configuration parameter set includes a target serialization protocol, a target network protocol, and a target call model selected from a plurality of serialization protocols, a plurality of network protocols, and a plurality of call models;

[0007] Based on the configuration parameter set, generate serialized request data corresponding to the remote call request, and send the serialized request data to the server;

[0008] Receiving a first remote call result after serialization fed back by the server based on the serialization request data;

[0009] The first remote call result is deserialized based on the configuration parameter set to obtain a second remote call result.

[0010] In an optional implementation, generating serialized request data corresponding to the remote call request based on the configuration parameter set, and sending the serialized request data to the server includes:

[0011] Obtaining instances corresponding to the target serialization protocol, target network protocol, and target call model indicated by the configuration parameter set;

[0012] Preprocessing the request data carried by the remote call request based on the instance corresponding to the target call model to obtain preprocessed request data;

[0013] Based on the instance corresponding to the target serialization protocol, serialize the preprocessed request data to obtain serialized request data;

[0014] Based on the instance corresponding to the target network protocol, the serialization request data is sent to the server.

[0015] In an optional implementation, the deserializing the first remote call result based on the configuration parameter set to obtain the second remote call result includes:

[0016] Based on the instance corresponding to the target serialization protocol, the first remote call result is deserialized to obtain the second remote call result.

[0017] In an optional implementation manner, after obtaining the second remote call result, the method further includes:

[0018] Based on the instance corresponding to the target call model, the second remote call result is restored to obtain a third remote call result.

[0019] In a second aspect, the embodiment of the present disclosure also provides another remote calling method, which is applied to a server, including:

[0020] Receive serialized request data sent by the client;

[0021] Based on the serialization request data, determining a configuration parameter set corresponding to the serialization request data; the configuration parameter set includes a target serialization protocol and a target call model selected from a plurality of serialization protocols and a plurality of call models;

[0022] Based on the configuration parameter set, deserialize the serialized request data to obtain deserialized request data;

[0023] Calling the target program based on the deserialized request data to obtain a second remote call result;

[0024] The second remote call result is serialized based on the configuration parameter set to generate a first remote call result, and the first remote call result is sent to the client.

[0025] In an optional implementation, the deserializing the serialized request data based on the configuration parameter set to obtain the deserialized request data includes:

[0026] Obtaining the instance corresponding to the target serialization protocol and the target call model indicated by the configuration parameter set;

[0027] Deserialize the serialization request data based on the instance corresponding to the target serialization protocol to obtain deserialized initial request data;

[0028] The initial request data is restored based on the instance corresponding to the target call model to obtain the deserialized request data.

[0029] In an optional implementation, the serializing the second remote call result based on the configuration parameter set to generate the first remote call result includes:

[0030] Preprocessing the second remote call result based on the instance corresponding to the target call model to obtain a preprocessed second remote call result;

[0031] The preprocessed remote call result is serialized based on an instance corresponding to the target serialization protocol to obtain the first remote call result.

[0032] In a third aspect, the embodiment of the present disclosure further provides a remote calling device, which is used for a client, comprising:

[0033] A first determination module is used to determine, in response to a remote call request, a configuration parameter set matching the remote call request based on a target call method indicated by the remote call request; the configuration parameter set includes a target serialization protocol, a target network protocol, and a target call model selected from a plurality of serialization protocols, a plurality of network protocols, and a plurality of call models;

[0034] A first calling module, configured to generate serialized request data corresponding to the remote calling request based on the configuration parameter set, and send the serialized request data to the server;

[0035] A first receiving module, configured to receive a first remote call result after serialization fed back by the server based on the serialization request data;

[0036] The first processing module is used to deserialize the first remote call result based on the configuration parameter set to obtain a second remote call result.

[0037] In an optional implementation manner, the first calling module is specifically used to:

[0038] Obtaining instances corresponding to the target serialization protocol, target network protocol, and target call model indicated by the configuration parameter set;

[0039] Preprocessing the request data carried by the remote call request based on the instance corresponding to the target call model to obtain preprocessed request data;

[0040] Based on the instance corresponding to the target serialization protocol, serialize the preprocessed request data to obtain serialized request data;

[0041] Based on the instance corresponding to the target network protocol, the serialization request data is sent to the server.

[0042] In an optional implementation manner, the first processing module is specifically configured to:

[0043] Based on the instance corresponding to the target serialization protocol, the first remote call result is deserialized to obtain the second remote call result.

[0044] In an optional implementation manner, after obtaining the second remote call result, the first processing module is further configured to:

[0045] Based on the instance corresponding to the target call model, the second remote call result is restored to obtain a third remote call result.

[0046] In a fourth aspect, the embodiment of the present disclosure also provides another remote calling device for a server, comprising:

[0047] The second receiving module is used to receive serialization request data sent by the client;

[0048] A second determination module is used to determine a configuration parameter set corresponding to the serialization request data based on the serialization request data; the configuration parameter set includes a target serialization protocol and a target call model selected from multiple serialization protocols and multiple call models;

[0049] A second processing module, configured to perform deserialization processing on the serialized request data based on the configuration parameter set to obtain deserialized request data;

[0050] A second calling module, used to call the target program based on the deserialized request data to obtain a second remote calling result;

[0051] The third processing module is used to serialize the second remote call result based on the configuration parameter set, generate a first remote call result, and send the first remote call result to the client.

[0052] In an optional implementation manner, the second processing module is specifically configured to:

[0053] Obtaining the instance corresponding to the target serialization protocol and the target call model indicated by the configuration parameter set;

[0054] Deserialize the serialization request data based on the instance corresponding to the target serialization protocol to obtain deserialized initial request data;

[0055] The initial request data is restored based on the instance corresponding to the target call model to obtain the deserialized request data.

[0056] In an optional implementation, when the third processing module serializes the second remote call result based on the configuration parameter set to generate the first remote call result, it is used to:

[0057] Preprocessing the second remote call result based on the instance corresponding to the target call model to obtain a preprocessed second remote call result;

[0058] The preprocessed remote call result is serialized based on an instance corresponding to the target serialization protocol to obtain the first remote call result.

[0059] In a fifth aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, steps in the above-mentioned first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect are performed.

[0060] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect, any possible implementation of the first aspect, the second aspect, or any possible implementation of the second aspect are executed.

[0061] The remote call method and device provided by the embodiments of the present disclosure first respond to a remote call request, and determine a configuration parameter set that matches the remote call request based on the target call method indicated by the remote call request; the configuration parameter set includes a target serialization protocol, a target network protocol, and a target call model selected from multiple serialization protocols, multiple network protocols, and multiple call models; then, based on the configuration parameter set, serialization request data corresponding to the remote call request is generated, and the serialization request data is sent to a server; thereafter, a first remote call result after serialization fed back by the server based on the serialization request data is received; finally, the first remote call result is deserialized based on the configuration parameter set to obtain a second remote call result.

[0062] The disclosed embodiment determines the configuration parameter set that matches the remote call request through a target call method, and then uses the protocol and call model indicated in the configuration parameter set to perform the remote call, so as to decouple the serialization protocol and the network protocol, support multiple serialization protocols, network protocols and call models in a set of RPC implementation solutions, and improve the flexibility of the RPC solution.

[0063] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.

[0065] Figure 1 A flowchart of a remote calling method provided by an embodiment of the present disclosure is shown;

[0066] Figure 2 A flowchart of another remote calling method provided by an embodiment of the present disclosure is shown;

[0067] Figure 3 A flowchart of another remote calling method provided by an embodiment of the present disclosure is shown;

[0068] Figure 4 A schematic diagram of a remote calling device provided by an embodiment of the present disclosure is shown;

[0069] Figure 5 A schematic diagram showing another remote calling device provided by an embodiment of the present disclosure;

[0070] Figure 6 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown;

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

[0072] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.

[0073] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0074] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.

[0075] Research has found that the usual RPC implementation solution only supports one serialization protocol, and the degree of coupling between the serialization protocol and the network protocol is strong, and the serialization protocol cannot be freely replaced, resulting in low flexibility of the RPC implementation solution and cannot be used in multiple scenarios.

[0076] Based on the above research, the present disclosure provides a remote calling method and device, which determines the configuration parameter set that matches the remote calling request through the target calling method, and then uses the protocol and calling model indicated in the configuration parameter set to perform the remote call, so as to decouple the serialization protocol and the network protocol, support multiple serialization protocols, network protocols and calling models in a set of RPC implementation solutions, and improve the flexibility of the RPC solution.

[0077] To facilitate understanding of this embodiment, a remote calling system disclosed in the embodiment of the present disclosure is first introduced in detail. The remote calling system provided in the embodiment of the present disclosure includes a client, namely a server, and the client can remotely call a program or function on the server.

[0078] See also Figure 1 As shown, it is a flowchart of the remote calling method provided by the embodiment of the present disclosure, and the method can be applied to the client in the above remote calling system, including steps S101 to S104, wherein:

[0079] S101. In response to a remote call request, determine a configuration parameter set that matches the remote call request based on a target call method indicated by the remote call request; the configuration parameter set includes a target serialization protocol, a target network protocol, and a target call model selected from a plurality of serialization protocols, a plurality of network protocols, and a plurality of call models.

[0080] After the client detects the remote call request, it can read the target call method indicated by the remote call request. The target call method can be a string that records a configuration parameter set. The configuration parameter set includes a target serialization protocol, a target network protocol, and a target call mode. The above target serialization protocol, target network protocol, and target call mode are selected from a variety of serialization protocols, a variety of network protocols, and a variety of call models.

[0081] Among them, the serialization protocol converts data of one structure into a specific exchange format of another structure, such as JSON, Thrift, and Protobuf; the network protocol is the communication protocol used when the server and the client call each other, such as TCP, HTTP, and HTTP2; the call model is the interaction model used when the service and the client call each other, such as ping-pong, oneway, and streaming. The call model may include one or more middleware to process the communication data.

[0082] Here, the selection of the target protocol and the target calling model can be determined by the user according to specific needs.

[0083] S102: Generate serialization request data corresponding to the remote call request based on the configuration parameter set, and send the serialization request data to the server.

[0084] In this step, the target serialization protocol, target network protocol and target call model indicated by the configuration parameter set can be determined, and then the corresponding instances can be obtained. The obtained instances are used to process the request data carried by the remote call request to obtain serialized request data, and the serialized request data is sent to the server using the instance corresponding to the target network protocol, so that the server calls the target program based on the serialized request data.

[0085] Specifically, S102 may include the following steps:

[0086] Obtaining instances corresponding to the target serialization protocol, target network protocol, and target call model indicated by the configuration parameter set;

[0087] Preprocessing the request data carried by the remote call request based on the instance corresponding to the target call model to obtain preprocessed request data;

[0088] Based on the instance corresponding to the target serialization protocol, serialize the preprocessed request data to obtain serialized request data;

[0089] Based on the instance corresponding to the target network protocol, the serialization request data is sent to the server.

[0090] Among them, the target serialization protocol can be generated by the serialization protocol producer, and the serialization protocol producer can obtain the instance corresponding to the target serialization protocol; the target network protocol can be provided by the network protocol producer, and the network protocol producer can also obtain the instance corresponding to the target network protocol; in the target call model, the specific execution between the middleware, the target serialization protocol and the target network protocol can be described.

[0091] In this way, different types of target serialization protocols can be obtained through network protocol producers and serialization protocol producers, and different network protocols and serialization protocols can be obtained and called, thereby building an RPC architecture in which serialization protocols and network protocols are independent of each other, so that the strong coupling relationship between the network protocol and the serialization protocol in the RPC solution is decoupled, thereby improving the flexibility of the RPC solution.

[0092] Specifically, a call context can be established in memory, the obtained instance and request data can be stored in the call context, and then the preprocessing, serialization and sending steps can be performed in sequence. Before performing serialization, the configuration data corresponding to the remote call request can also be obtained from the configuration center, and the network protocol, serialization protocol, call model and other configuration parameters can be configured.

[0093] In the preprocessing step, the middleware in the target call model can be executed once in a preset order, and the request data can be processed step by step to obtain the preprocessed request data. Then, according to the requirements of the target serialization protocol, the preprocessed request data is converted into serialized request data. Here, the serialized request data can be binary data. Then, the serialized request data can be written to the real connection through an instance of the target network protocol, and finally passed to the server through the real connection.

[0094] Exemplarily, in the process of sending serialized request data to the server, a call request for the target program can be generated. The call request can carry the identification information of the target program and the above-mentioned serialized request data, and then the above-mentioned call request is sent to the server through a real connection. The target program can be a function, and the call request is used to call the function on the server. For example, the call request can be used to request a user list. In this case, the target program can be a list query function, and the serialized request data can include parameters such as user identification information and verification information. For another example, the call request can also be used to request detailed information on a product. In this case, the target program can be a product information query function, and the serialized request data can include product identification information, etc.

[0095] S103: Receive a first remote call result after serialization fed back by the server based on the serialization request data.

[0096] In this step, the server can deserialize the serialized request data, and use the deserialized request data to call the target application or target function to obtain a remote call result, then serialize it to obtain a first remote call result, and send the first remote call result to the client.

[0097] S104: Deserialize the first remote call result based on the configuration parameter set to obtain a second remote call result.

[0098] In this step, since the first remote call result received by the client is a serialized call result, it needs to be deserialized. Through the instance corresponding to the target serialization protocol, it can be deserialized to obtain the second remote call result.

[0099] After obtaining the second remote call result, since the second remote call process has been preprocessed by the middleware of the target call model, it also needs to be restored. Through the instance corresponding to the target call model, the preprocessing can be reversed to achieve restoration and obtain the second remote call result.

[0100] See also Figure 2FIG. 2 is a flowchart of another remote calling method provided by an embodiment of the present disclosure. The method can be applied to the server in the above remote calling system, and includes steps S201 to S205, wherein:

[0101] S201. Receive serialization request data sent by the client.

[0102] The above serialization request data is the serialization request data generated and sent through step S101 to step S102, and adopts the target serialization protocol, target network protocol and target calling model.

[0103] S202. Determine a configuration parameter set corresponding to the serialization request data based on the serialization request data; the configuration parameter set includes a target serialization protocol and a target calling model selected from a plurality of serialization protocols and a plurality of calling models.

[0104] In this step, the corresponding target serialization protocol or target call model can be determined according to the characteristics of the serialization request data, and the corresponding target network protocol can be determined according to the actual connection used when receiving the serialization request data.

[0105] S203: Based on the configuration parameter set, deserialize the serialized request data to obtain deserialized request data.

[0106] Similar to the client method, the server can obtain the instance corresponding to the target serialization protocol and target call model indicated by the configuration parameter set, store it and the serialized request data in the call context in the memory for subsequent use, use the target serialization protocol to deserialize the serialized request data, obtain the deserialized initial request data, and then use the corresponding instance of the target call model to perform reverse execution of the preprocessing to restore the initial request data to the request data.

[0107] S204: Call the target program based on the deserialized request data to obtain a second remote call result.

[0108] In this step, the obtained request data can be used as a parameter to call the corresponding target program and obtain the calling result fed back by the target program.

[0109] S205: Serialize the second remote call result based on the configuration parameter set to generate a first remote call result, and send the first remote call result to the client.

[0110] In this step, similar means as the client can be used. After obtaining the second remote call result, the second remote call result can be preprocessed using the instance corresponding to the target call model, and then the preprocessed second remote call result can be serialized using the instance of the target serialization protocol to obtain the first remote call result. Afterwards, the real connection corresponding to the reception of the serialized request data can be used to send it to the client in accordance with the requirements of the target network protocol to implement the remote call.

[0111] The disclosed embodiment determines the configuration parameter set that matches the remote call request through a target call method, and then uses the protocol and call model indicated in the configuration parameter set to perform the remote call, so as to decouple the serialization protocol and the network protocol, support multiple serialization protocols, network protocols and call models in a set of RPC implementation solutions, and improve the flexibility of the RPC solution.

[0112] See also Figure 3 As shown, it is a flowchart of another remote calling method provided by an embodiment of the present disclosure, including steps 1 to 19, wherein:

[0113] 1.Send ping data: The caller prepares the request data (ping data) and sends it to the client.

[0114] 2. Call ping method: Call the target calling method (RPC method) to obtain the configuration parameter set, and pass the configuration parameter set to the calling process.

[0115] 3.Create client context: Build the RPC call context in the client's memory.

[0116] 3a.Inject protocol: Get the target serialization protocol Protocol from the client's serialization protocol producer ProtocolProvider and inject the target serialization protocol into the calling context.

[0117] 3b.Inject connection: Get the target network protocol from the network protocol producer ConnectionProvider, and inject the target network protocol Connection into the calling context Context.

[0118] 3c.Inject handle: Inject the target call model Handle into the Context.

[0119] 3d.Inject remote config: Get configuration data from the configuration center ConfigCenter and inject it into Context.

[0120] 4.Execute middleware(out): Execute the middleware in Handle in sequence to pre-process the request data.

[0121] 5.Serialization: Serialize request data.

[0122] 5a.Encode memory data: Serialize the preprocessed request data into binary data through the target serialization protocol instance Protocol.encode().

[0123] 5b.Write binary data: Write the serialized binary data to the real connection through the target network protocol instance Connection.write().

[0124] 6.Send binary data: The real connection transmits binary data to the network protocol producer (ConnectionProvider) of the corresponding server through the network.

[0125] 7.Emit connection event: ConnectionProvider detects the receive event, generates an instance of Connection of the target network protocol and triggers the connection event.

[0126] 8.Create server context: Build the RPC call context in the server's memory.

[0127] 8a.Inject connection: Inject the Connection instance of the target network protocol obtained from the ConnectionProvider into the Context.

[0128] 8b.Inject protocol: Get and inject the target serialization protocol instance Protocol from the serialization protocol producer ProtocolProvider.

[0129] 8c.Inject handle: Inject the target calling model Handle into the Context.

[0130] 8d.Inject remote config: Get and inject configuration data from the configuration center ConfigCenter.

[0131] 9.Deserialization: Deserialize the serialized request data.

[0132] 9a.Read binary data: Get binary data from the real connection through the target network protocol instance Connection.read().

[0133] 9b.Decode binary data: Convert binary data into request data through Protocol.decode(), an instance of the target serialization protocol.

[0134] 10.Execute middleware(in): Execute the Middleware in Handle in sequence to restore the request data.

[0135] 11.Receive ping data: The callee (target program) receives the request data.

[0136] 12.Send pong data: The callee returns the response data (second call result).

[0137] 13.Execute middleware(out): Execute the Middleware in Handle in sequence for preprocessing.

[0138] 14.Serialization: Serialize the preprocessed response data (first call result).

[0139] 14a.Encode memory data: Serialize the processed response data into binary data through Protocol.encode

[0140] 14b.Write binary data: Write the serialized binary data to the real connection through the target network protocol instance Connection.write. After writing is completed, the Context of the RPC call can be asynchronously recycled.

[0141] 15.Send binary data: The real connection transmits the binary data (the first remote call result) to the corresponding client through the network.

[0142] 16.Deserialization: Deserialize the response data to obtain the second remote call result.

[0143] 16a.Read binary data: Get binary data from the real connection through Connection.read (the result of the first remote call).

[0144] 16b.Decode binary data: Convert the binary data into response data (second remote call result) through Protocol.decode.

[0145] 17.Execute middleware(in): Execute the Middleware in Handle in sequence to perform restoration processing.

[0146] 18.Release client context: Reclaim the Context of the RPC call.

[0147] 19.Receive pong data: The caller receives the response data.

[0148] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0149] Based on the same inventive concept, a remote calling device corresponding to the remote calling method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned remote calling method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0150] Reference Figure 4 FIG. 1 is a schematic diagram of a remote calling device provided by an embodiment of the present disclosure, wherein the device includes:

[0151] A first determination module 410 is used to determine, in response to a remote call request, a configuration parameter set matching the remote call request based on a target call method indicated by the remote call request; the configuration parameter set includes a target serialization protocol, a target network protocol, and a target call model selected from a plurality of serialization protocols, a plurality of network protocols, and a plurality of call models;

[0152] A first calling module 420, configured to generate serialized request data corresponding to the remote calling request based on the configuration parameter set, and send the serialized request data to the server;

[0153] A first receiving module 430 is used to receive a first remote call result after serialization fed back by the server based on the serialization request data;

[0154] The first processing module 440 is used to deserialize the first remote call result based on the configuration parameter set to obtain a second remote call result.

[0155] In an optional implementation manner, the first calling module 420 is specifically configured to:

[0156] Obtaining instances corresponding to the target serialization protocol, target network protocol, and target call model indicated by the configuration parameter set;

[0157] Preprocessing the request data carried by the remote call request based on the instance corresponding to the target call model to obtain preprocessed request data;

[0158] Based on the instance corresponding to the target serialization protocol, serialize the preprocessed request data to obtain serialized request data;

[0159] Based on the instance corresponding to the target network protocol, the serialization request data is sent to the server.

[0160] In an optional implementation manner, the first processing module 440 is specifically configured to:

[0161] Based on the instance corresponding to the target serialization protocol, the first remote call result is deserialized to obtain the second remote call result.

[0162] In an optional implementation manner, after obtaining the second remote call result, the first processing module 440 is further configured to:

[0163] Based on the instance corresponding to the target call model, the second remote call result is restored to obtain a third remote call result.

[0164] Reference Figure 5 FIG. 1 is a schematic diagram of another remote calling device provided by an embodiment of the present disclosure, wherein the device includes:

[0165] The second receiving module 510 is used to receive serialization request data sent by the client;

[0166] A second determination module 520 is used to determine a configuration parameter set corresponding to the serialization request data based on the serialization request data; the configuration parameter set includes a target serialization protocol and a target call model selected from multiple serialization protocols and multiple call models;

[0167] A second processing module 530 is used to deserialize the serialized request data based on the configuration parameter set to obtain deserialized request data;

[0168] A second calling module 540 is used to call the target program based on the deserialized request data to obtain a second remote calling result;

[0169] The third processing module 550 is used to serialize the second remote call result based on the configuration parameter set to generate a first remote call result, and send the first remote call result to the client.

[0170] In an optional implementation manner, the second processing module 530 is specifically configured to:

[0171] Obtaining the instance corresponding to the target serialization protocol and the target call model indicated by the configuration parameter set;

[0172] Deserialize the serialization request data based on the instance corresponding to the target serialization protocol to obtain deserialized initial request data;

[0173] The initial request data is restored based on the instance corresponding to the target call model to obtain the deserialized request data.

[0174] In an optional implementation, when the third processing module 550 performs serialization processing on the second remote call result based on the configuration parameter set to generate the first remote call result, it is configured to:

[0175] Preprocessing the second remote call result based on the instance corresponding to the target call model to obtain a preprocessed second remote call result;

[0176] The preprocessed remote call result is serialized based on an instance corresponding to the target serialization protocol to obtain the first remote call result.

[0177] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.

[0178] Corresponds to Figure 1 The remote calling method in the present disclosure also provides an electronic device 600, such as Figure 6 FIG. 6 is a schematic diagram of the structure of an electronic device 600 provided in an embodiment of the present disclosure, including:

[0179] Processor 61, memory 62, and bus 63; memory 62 is used to store execution instructions, including internal memory 621 and external memory 622; the internal memory 621 is also called internal memory, which is used to temporarily store the operation data in the processor 61 and the data exchanged with the external memory 622 such as a hard disk. The processor 61 exchanges data with the external memory 622 through the internal memory 621. When the electronic device 600 is running, the processor 61 communicates with the memory 62 through the bus 63, so that the processor 61 executes the following instructions:

[0180] In response to a remote call request, determining a configuration parameter set matching the remote call request based on a target call method indicated by the remote call request; the configuration parameter set includes a target serialization protocol, a target network protocol, and a target call model selected from a plurality of serialization protocols, a plurality of network protocols, and a plurality of call models;

[0181] Based on the configuration parameter set, generate serialized request data corresponding to the remote call request, and send the serialized request data to the server;

[0182] Receiving a first remote call result after serialization fed back by the server based on the serialization request data;

[0183] The first remote call result is deserialized based on the configuration parameter set to obtain a second remote call result.

[0184] Corresponds to Figure 2 The remote calling method in the present disclosure also provides another electronic device 700, such as Figure 7 FIG. 7 is a schematic diagram of the structure of an electronic device 700 provided in an embodiment of the present disclosure, including:

[0185] Processor 71, memory 72, and bus 73; memory 72 is used to store execution instructions, including internal memory 721 and external memory 722; the internal memory 721 is also called internal memory, which is used to temporarily store the operation data in the processor 71 and the data exchanged with the external memory 722 such as a hard disk. The processor 71 exchanges data with the external memory 722 through the internal memory 721. When the electronic device 700 is running, the processor 71 communicates with the memory 72 through the bus 73, so that the processor 71 executes the following instructions:

[0186] Receive serialized request data sent by the client;

[0187] Based on the serialization request data, determining a configuration parameter set corresponding to the serialization request data; the configuration parameter set includes a target serialization protocol and a target call model selected from a plurality of serialization protocols and a plurality of call models;

[0188] Based on the configuration parameter set, deserialize the serialized request data to obtain deserialized request data;

[0189] Calling the target program based on the deserialized request data to obtain a second remote call result;

[0190] The second remote call result is serialized based on the configuration parameter set to generate a first remote call result, and the first remote call result is sent to the client.

[0191] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the XXXX method described in the above method embodiment are executed. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0192] The present disclosure also provides a computer program product that carries a program code. The program code includes instructions that can be used to execute the steps of the remote calling method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0193] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0194] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0195] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0196] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0197] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0198] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims

1. A remote calling method, characterized in that: Applied to the client, including: In response to a remote call request, based on a target call method indicated by the remote call request, a configuration parameter set matching the remote call request is determined; the configuration parameter set includes a target serialization protocol, a target network protocol, and a target call model selected from a plurality of serialization protocols, a plurality of network protocols, and a plurality of call models, the target call model is used to describe how the target serialization protocol and the target network protocol are executed, the plurality of call models include ping-pong, oneway, or streaming, and the call model is an interaction model used when the server and the client call each other; Based on the configuration parameter set, generate serialized request data corresponding to the remote call request, and send the serialized request data to the server; Receiving a first remote call result after serialization fed back by the server based on the serialization request data; The first remote call result is deserialized based on the configuration parameter set to obtain a second remote call result.

2. The method according to claim 1, characterized in that The generating, based on the configuration parameter set, serialized request data corresponding to the remote call request, and sending the serialized request data to the server includes: Obtaining instances corresponding to the target serialization protocol, target network protocol, and target call model indicated by the configuration parameter set; Preprocessing the request data carried by the remote call request based on the instance corresponding to the target call model to obtain preprocessed request data; Based on the instance corresponding to the target serialization protocol, serialize the preprocessed request data to obtain serialized request data; Based on the instance corresponding to the target network protocol, the serialization request data is sent to the server.

3. The method according to claim 2, characterized in that The deserializing the first remote call result based on the configuration parameter set to obtain a second remote call result includes: Based on the instance corresponding to the target serialization protocol, the first remote call result is deserialized to obtain the second remote call result.

4. The method according to claim 3, characterized in that After obtaining the second remote call result, the method further includes: Based on the instance corresponding to the target call model, the second remote call result is restored to obtain a third remote call result.

5. A remote calling method, characterized in that: Applicable to servers, including: Receive serialized request data sent by the client; Based on the serialization request data, determine a configuration parameter set corresponding to the serialization request data; the configuration parameter set includes a target serialization protocol and a target call model selected from multiple serialization protocols and multiple call models, the target call model is used to describe how the target serialization protocol and the target network protocol are executed, the multiple call models include ping-pong, oneway or streaming, and the call model is an interaction model used when the server and the client call each other; Based on the configuration parameter set, deserialize the serialized request data to obtain deserialized request data; Calling the target program based on the deserialized request data to obtain a second remote call result; The second remote call result is serialized based on the configuration parameter set to generate a first remote call result, and the first remote call result is sent to the client.

6. The method according to claim 5, characterized in that The deserializing the serialized request data based on the configuration parameter set to obtain the deserialized request data includes: Obtaining the instance corresponding to the target serialization protocol and the target call model indicated by the configuration parameter set; Deserialize the serialization request data based on the instance corresponding to the target serialization protocol to obtain deserialized initial request data; The initial request data is restored based on the instance corresponding to the target call model to obtain the deserialized request data.

7. The method according to claim 6, characterized in that The serializing the second remote call result based on the configuration parameter set to generate the first remote call result includes: Preprocessing the second remote call result based on the instance corresponding to the target call model to obtain a preprocessed second remote call result; The preprocessed remote call result is serialized based on an instance corresponding to the target serialization protocol to obtain the first remote call result.

8. A remote calling device, characterized in that: For clients, including: A first determination module is used to determine, in response to a remote call request, a configuration parameter set matching the remote call request based on a target call method indicated by the remote call request; the configuration parameter set includes a target serialization protocol, a target network protocol and a target call model selected from a plurality of serialization protocols, a plurality of network protocols and a plurality of call models, the target call model is used to describe how the target serialization protocol and the target network protocol are executed, the plurality of call models include ping-pong, oneway or streaming, and the call model is an interaction model used when the server and the client call each other; A first calling module, configured to generate serialized request data corresponding to the remote calling request based on the configuration parameter set, and send the serialized request data to the server; A first receiving module, configured to receive a first remote call result after serialization fed back by the server based on the serialization request data; The first processing module is used to deserialize the first remote call result based on the configuration parameter set to obtain a second remote call result.

9. A remote calling device, characterized in that: For servers, including: The second receiving module is used to receive serialization request data sent by the client; A second determination module is used to determine a configuration parameter set corresponding to the serialization request data based on the serialization request data; the configuration parameter set includes a target serialization protocol and a target call model selected from multiple serialization protocols and multiple call models, the target call model is used to describe how the target serialization protocol and the target network protocol are executed, the multiple call models include ping-pong, oneway or streaming, and the call model is an interaction model used when the server and the client call each other; A second processing module, configured to perform deserialization processing on the serialized request data based on the configuration parameter set to obtain deserialized request data; A second calling module, used to call the target program based on the deserialized request data to obtain a second remote calling result; The third processing module is used to serialize the second remote call result based on the configuration parameter set to generate a first remote call result, and send the first remote call result to the client.

10. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the remote call method as described in any one of claims 1 to 4 or claims 5 to 7 are performed.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the remote calling method as claimed in any one of claims 1 to 4 or claims 5 to 7 are executed.