Method and system for calling interface
By serializing and deserializing the attribute information of the target interface, it solves the problem of high complexity of SDK calls between the virtual machine and the host machine, and achieves more flexible and efficient interface calls.
Patent Information
- Application Number
- CN202110384038.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-09
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-04-09
AI Technical Summary
In a scenario based on cloud computing, SDK calls between virtual machines and hosts need to define the transmission format and encode and decode, resulting in high complexity and poor flexibility in interface calls.
By obtaining the serialized data of the target interface, performing deserialization processing to obtain attribute information, and calling and executing the interface based on these attribute information, it avoids the transmission format definition and encoding and decoding process of each interface.
It reduces the complexity and cost of interface calling and improves the flexibility of calling interfaces.
Smart Images

Figure CN112988289B
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of computer and network communication technology, and more particularly to a method and system for calling an interface. Background Art
[0002] With the development of cloud computing technology, cloud computing-based scene applications are emerging, such as game scenes, etc. In cloud computing-based scenes, the server can virtualize an operating system (such as Android system) on the host machine through virtualization technology, and the same software development kit (SDK) is implemented in different languages on the virtual machine and the host machine.
[0003] In the prior art, when an application in a virtual machine needs to call an SDK, the calling operation of the virtual machine can be implemented in the host machine. Specifically, for each SDK call, the transmission format is defined according to the Application Programming Interface (API, which can be referred to as the interface) of the SDK, so that the virtual machine and the host machine can encode and decode accordingly based on the transmission format.
[0004] However, defining the transmission format for each call to the SDK (specifically, a call to the interface) and performing corresponding encoding and decoding may result in problems of high complexity and poor flexibility. Summary of the invention
[0005] The embodiments of the present disclosure provide a method and system for calling an interface to overcome the problem of high complexity of interface calling.
[0006] In a first aspect, an embodiment of the present disclosure provides a method for calling an interface, including:
[0007] Acquire serialized data of the target interface, wherein the interactive party that completes the method of calling the interface adopts different interface calling languages;
[0008] Deserialize the serialized data to obtain the attribute information of the target interface;
[0009] The target interface is called and executed according to the attribute information of the target interface, and feedback information is generated and output, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0010] In a second aspect, an embodiment of the present disclosure provides a method for calling an interface, including:
[0011] Determining a target interface to be called according to the acquired interface calling requirements, and determining attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages;
[0012] Serializing the attribute information of the target interface to obtain and output serialized data, wherein the serialized data is used to indicate calling and executing the target interface;
[0013] Feedback information is received, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0014] In a third aspect, an embodiment of the present disclosure provides a terminal device, including:
[0015] An acquisition module, used to acquire serialized data of a target interface, wherein the interactive party that completes the method of calling the interface adopts different interface calling languages;
[0016] A first processing module, used for deserializing the serialized data to obtain the attribute information of the target interface;
[0017] A first generating module, configured to call and execute the target interface according to the attribute information of the target interface, and generate feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed;
[0018] The first output module is used to output the feedback information.
[0019] In a fourth aspect, an embodiment of the present disclosure provides a server, including:
[0020] A second determination module is used to determine the target interface to be called according to the acquired interface calling requirement, and determine the attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages;
[0021] A second processing module is used to perform serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used to indicate calling and executing the target interface;
[0022] The receiving module is used to receive feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0023] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor and a memory;
[0024] The memory stores computer-executable instructions;
[0025] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method described in the first aspect and various possible designs of the first aspect above; or, the at least one processor executes the method described in the second aspect and various possible designs of the second aspect above.
[0026] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer execution instructions. When a processor executes the computer execution instructions, the method described in the first aspect and various possible designs of the first aspect are implemented; or, the method described in the second aspect and various possible designs of the second aspect are implemented.
[0027] In a seventh aspect, a computer program product is provided, the program product comprising: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the electronic device executes the method according to the first aspect; or
[0028] The at least one processor executes the computer program so that the electronic device executes the method described in the second aspect and various possible designs of the second aspect.
[0029] In an eighth aspect, a system for calling an interface is provided, comprising:
[0030] The terminal device as described in the third aspect and various possible designs of the third aspect;
[0031] A server as described in the fourth aspect and various possible designs of the fourth aspect.
[0032] The method and system for calling an interface provided in this embodiment include: obtaining serialized data of a target interface, wherein the interactive party that completes the method of calling the interface uses different interface calling languages to deserialize the serialized data to obtain attribute information of the target interface, calling and executing the target interface according to the attribute information of the target interface, generating and outputting feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed. In this embodiment, serialized data (i.e., serialized data obtained by serializing the attribute information of the target interface) is obtained, and deserialization processing (i.e., the inverse process of serialization processing) is performed on the serialized data to obtain the attribute information of the target interface, and interface calling and interface execution operations are performed based on the attribute information of the target interface. Through the combination of serialization processing and deserialization processing, there is no need to define the transmission format for each interface call, nor is there any need to encode and decode each transmission format accordingly on this basis, thereby reducing the complexity of interface calling, reducing the cost of interface calling, and improving the flexibility of calling the interface. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0034] Figure 1 A flowchart of a method for calling an interface according to an embodiment of the present disclosure;
[0035] Figure 2 A flowchart of a method for calling an interface according to another embodiment of the present disclosure;
[0036] Figure 3 A flowchart of a method for calling an interface according to another embodiment of the present disclosure;
[0037] Figure 4 A schematic diagram of a terminal device according to an embodiment of the present disclosure;
[0038] Figure 5 A schematic diagram of a terminal device according to another embodiment of the present disclosure;
[0039] Figure 6 A schematic diagram of a server according to an embodiment of the present disclosure;
[0040] Figure 7 A schematic diagram of a server according to another embodiment of the present disclosure;
[0041] Figure 8A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution 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 part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0043] With the development of Internet technology and big data technology, cloud computing (or grid computing) related technologies have developed rapidly. Because it can process tens of thousands of data in a very short time (such as a few seconds), thereby achieving powerful network services, it has been widely used in different scenarios, such as gaming scenarios based on cloud computing.
[0044] Combined with the description of the above background technology, it can be known that the same SDK is implemented in different languages in the virtual machine and the host machine. If the transmission format is defined according to the application program interface of the SDK for each SDK call, so that the virtual machine and the host machine can encode and decode accordingly based on the transmission format, it is likely to cause technical problems with high complexity and poor flexibility.
[0045] In order to solve the above technical problems, the inventors of the present invention have obtained the inventive concept of the present invention through creative work: one of the interacting parties that completes the method of calling the interface serializes the attribute information of any interface to obtain serialized data, the other of the interacting parties deserializes the serialized data to obtain the attribute information of any interface, and calls and executes the interface based on the attribute information of any interface.
[0046] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0047] See also Figure 1 , Figure 1 The present invention is a flowchart of a method for calling an interface according to an embodiment of the present invention.
[0048] like Figure 1 As shown, the method includes:
[0049] S101: Obtain serialized data of the target interface.
[0050] Among them, the interactive parties that complete the method of calling the interface use different interface calling languages.
[0051] Exemplarily, the execution subject of this embodiment may be a device for calling an interface, and the device for calling the interface may be a terminal device, a processor, a chip, etc., which is not limited in this embodiment.
[0052] If the execution subject of this embodiment is a terminal device, the terminal device may include various handheld devices with wireless communication functions, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem.
[0053] Specifically, the terminal device can be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-built-in or vehicle-mounted mobile device, which exchanges language and / or data with a wireless access network; the terminal device can also be a personal communication service (Personal Communication Service, PCS) phone, a cordless phone, a session initiation protocol (Session Initiation Protocol, SIP) phone, a wireless local loop (Wireless Local Loop, WLL) station, a personal digital assistant (Personal Digital Assistant, PDA), a tablet computer, a wireless modem (modem), a handheld device (handset), a laptop computer (laptop computer), a machine type communication (Machine Type Communication, MTC) terminal and other equipment; the terminal device can also be called a system, a subscriber unit (Subscriber Unit), a subscriber station (Subscriber Station), a mobile station (Mobile Station), a mobile station (Mobile), a remote station (Remote Station), a remote terminal (Remote Terminal), an access terminal (Access Terminal), a user terminal (User Terminal), a user agent (User Agent), User Device or User Equipment, etc., are not limited here.
[0054] In some embodiments, if the execution subject of this embodiment is a terminal device, the terminal device includes a host machine that establishes a bidirectional full-duplex communication link with the other party in the interaction through an inter-process communication Domain Socket and uses a desktop virtualization data transmission SPICE protocol to generate the data.
[0055] That is, the host machine can be used as one of the interactive parties that completes the method of calling the interface. Correspondingly, the other interactive party that completes the method of calling the interface can be a server, and the server includes a virtual machine generated by using a desktop virtualization data transmission protocol and establishing a bidirectional full-duplex communication link with the other interactive party through inter-process communication.
[0056] That is to say, the interactive parties that complete the method of calling the interface may include two parties, one is the host machine (i.e., the terminal device), and the other is the virtual machine (i.e., the server). The host machine and the virtual machine can supervise a two-way duplex communication link through inter-process communication, and the host machine can be a client of the desktop virtualization data transmission protocol using the desktop virtualization data transmission protocol, and the virtual machine can be a server of the Linux operating system interface using the desktop virtualization data transmission protocol and an event-driven selection mechanism.
[0057] Based on the above analysis, this embodiment can be understood as: the terminal device (specifically the host machine) receives the serialized data of the target interface sent by the server (specifically the virtual machine), and different interface calling languages are used between the terminal device and the server.
[0058] It should be understood that the target interface can be any interface. In this embodiment, in order to distinguish between the currently called interface and the non-currently called interface, the currently called interface is called the target interface. Therefore, the target interface should not be understood as a limitation on the interface (such as the type of interface, etc.).
[0059] Serialization can be understood as a process of converting attribute information of an object into a form that can be stored and / or transmitted.
[0060] Accordingly, in this embodiment, the serialized data can be understood as data obtained by serializing the attribute information of the target interface, and specifically, the serialized data can be understood as data of the attribute information of the target interface in a transmission form.
[0061] S102: Deserialize the serialized data to obtain attribute information of the target interface.
[0062] The deserialization process is the reverse process of the serialization process. This step can be understood as: the host machine performs the deserialization process of the reverse process to obtain the attribute information of the target interface.
[0063] Exemplarily, the attribute information of the target interface may be understood as relevant information characterizing (or describing) the state or characteristics of the target interface, such as the type of the target interface, and so on.
[0064] It is worth noting that in the embodiments of the present disclosure, the attribute information of the target interface obtained by serialization and deserialization, which are inverse processes of each other, is introduced, as described in the above embodiments: the host machine receives the serialized data of the target interface sent by the virtual machine (that is, the virtual machine serializes the attribute information of the target interface to obtain the serialized data), and the host machine deserializes the serialized data (that is, the inverse process of the serialization process) to obtain the attribute information of the target interface, so as to perform subsequent S103 based on the attribute information of the target interface, that is, call and execute the target interface, thereby avoiding the need to define the transmission format for each interface call, and perform corresponding encoding and decoding, which causes high complexity and poor flexibility, thereby achieving the flexibility of interface calling and reducing the technical effect of calling cost.
[0065] S103: calling and executing the target interface according to the attribute information of the target interface, and generating and outputting feedback information.
[0066] The feedback information is used to indicate that the target interface has been called and / or executed.
[0067] In one example, the feedback information may be used to indicate that the target interface has been called. For example, when the device for calling the interface completes calling the target interface, the feedback information may be generated to indicate that the device for calling the interface has completed calling the target interface.
[0068] In another example, the feedback information may be used to indicate that the target interface has been executed. For example, when the device that calls the interface executes the target interface, the feedback information may be generated so as to indicate that the device that calls the interface has executed the target interface through the feedback information.
[0069] Of course, in another example, the feedback information can be used to indicate that the device for calling the interface has completed the call to the target interface, and also to indicate that the device for calling the interface has executed the target interface.
[0070] Exemplarily, in combination with the above embodiments, and taking the feedback information used to indicate that the target interface has been called and used to indicate that the target interface has been executed as an example, after the host machine deserializes the serialized data and obtains the attribute information of the target interface, it can perform the operation of calling the target interface according to the attribute information of the target interface, and can execute the operation of the target interface, and generate feedback information based on the called and / or executed operations, thereby sending feedback information to the virtual machine.
[0071] Based on the above analysis, it can be seen that the embodiment of the present disclosure provides a method for calling an interface, including: obtaining serialized data of a target interface, wherein the interactive party that completes the method of calling the interface uses different interface calling languages to deserialize the serialized data to obtain attribute information of the target interface, calling and executing the target interface according to the attribute information of the target interface, generating and outputting feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed. In this embodiment, by obtaining serialized data (serialized data obtained by serializing the attribute information of the target interface), deserializing the serialized data (which is the inverse process of serialization) to obtain the attribute information of the target interface, and executing the call of the target interface and the operation of executing the target interface based on the attribute information of the target interface, through the combination of serialization and deserialization, there is no need to define the transmission format for each interface call, nor is there any need to encode and decode each transmission format accordingly on this basis, which reduces the complexity of interface calling, reduces the cost of interface calling, and improves the flexibility of calling the interface.
[0072] See also Figure 2 , Figure 2 The present invention is a flowchart of a method for calling an interface according to another embodiment of the present invention.
[0073] like Figure 2 As shown, the method includes:
[0074] S201: The terminal device and the server establish a bidirectional full-duplex communication link between each other through inter-process communication, and the two determine the terminal device as a host machine for implementing the method of calling the interface and the server as a virtual machine for implementing the method of calling the interface based on the SPICE communication protocol.
[0075] In some embodiments, the virtual machine can establish communication with the host machine through an agent interface (Agent Interface), and the agent interface can be mapped into a string device in the virtual machine.
[0076] S202: The virtual machine determines attribute information of the target interface according to the target interface to be called.
[0077] Exemplarily, the virtual machine may determine a target interface based on a business requirement, and after determining the target interface, obtain attribute information of the target interface.
[0078] Specifically, the virtual machine may determine an interface call requirement based on a business requirement, determine a target interface to be called based on the interface call requirement, and obtain attribute information of the target interface.
[0079] For example, if the application in the virtual machine is using the audio and video interface, the operation of the virtual machine can be implemented on the host machine to improve performance. The business demand can be understood as the business of audio and video push, and the interface call demand is the call demand for the interface of the business of calling to complete the audio and video push, and the determined target interface is the audio and video interface, that is, the audio and video interface needs to be called and executed.
[0080] S203: The virtual machine performs serialization processing on the attribute information of the target interface to obtain serialized data.
[0081] The serialized data is used to indicate the calling and execution of the target interface.
[0082] In some embodiments, the same interface has the same attribute information in the interacting party, and the attribute information of the target interface includes a name and parameters.
[0083] That is, the same interface has the same attribute information in the virtual machine and the host machine, and the attribute information may include a name and parameters. For example, the target interface has the same name and the same parameters in the virtual machine and the host machine.
[0084] The parameters may include: handles, structures, and string pointer types, etc., which are not listed here one by one.
[0085] Correspondingly, the attribute information of the target interface includes a name and parameters, so when the virtual machine performs serialization processing on the attribute information of the target interface, it can perform serialization processing on the name and parameters in the attribute information of the target interface to obtain serialized data.
[0086] S204: The virtual machine sends serialized data to the host machine.
[0087] Accordingly, the host machine receives the serialized data sent by the virtual machine.
[0088] Based on the above analysis, it can be seen that the virtual machine and the host machine can establish communication through the proxy interface, and the proxy interface can be mapped into a string device in the virtual machine. When the virtual machine sends serialized data to the host machine, it can be implemented by writing to the string device, thereby improving the interaction efficiency between the virtual machine and the interactive machine.
[0089] Accordingly, multiple receiving processes can be set in the host machine, and a descriptor list can be set. When it is necessary to receive serialized data sent by the virtual machine, the descriptor of the corresponding string device is added to the monitored descriptor list. The host machine can traverse the monitored descriptor list in a loop. When the traversal of the descriptor list is completed, for string devices that are not in the descriptor list, the receiving process corresponding to the string device that is not in the descriptor list can be put into a sleep state. For string devices in the descriptor list, the receiving process corresponding to the string device in the descriptor list can be awakened, so that the awakened receiving process can perform the receiving task, that is, receive the serialized data sent by the virtual machine.
[0090] It is worth noting that, in this embodiment, by having different receiving threads execute their respective corresponding receiving tasks, asynchronous calling in a non-blocking manner can be implemented, thereby achieving the technical effect of improving the efficiency of calling the interface.
[0091] S205: The host machine deserializes the serialized data to obtain attribute information of the target interface.
[0092] From the above embodiments, it can be seen that serialization and deserialization are inverse processes. When the host machine receives serialized data after serialization, it can process the serialized data based on the inverse process of serialization, that is, deserialization, to obtain the attribute information of the target interface.
[0093] It is worth noting that serialization and deserialization are inverse processes of each other, so the host machine and the virtual machine can pre-set the serialization and deserialization methods.
[0094] For example, if the virtual machine performs serialization processing in a Java manner to obtain serialized data, the host machine also performs deserialization processing in a Java manner to obtain attribute information of the target interface.
[0095] For another example, if the virtual machine performs serialization processing in a Json manner to obtain serialized data, the host machine also performs deserialization processing in a Json manner to obtain attribute information of the target interface.
[0096] S206: The host machine determines a target interface corresponding to the attribute information of the target interface from a preset storage relationship.
[0097] The storage relationship is used to represent the corresponding relationship between the attribute information and the interface.
[0098] It should be noted that this embodiment does not limit the storage relationship. For example, the storage relationship may be a relationship mapping table or a key-value pair.
[0099] This step can be understood as: after the host machine obtains the attribute information of the target interface through deserialization processing, it can determine the attribute information of the target interface in the storage relationship based on the attribute information of the target interface, and determine the target interface corresponding to the attribute information of the target interface from the storage relationship.
[0100] The host machine determines the target interface corresponding to the attribute information of the target interface by combining the storage relationship, so that the target interface can be determined quickly and conveniently, thereby achieving the technical effect of improving the efficiency and accuracy of determining the target interface.
[0101] Based on the above analysis, it can be known that the target interface has the same attribute information in the host machine and the virtual machine. The attribute information of the target interface includes a name and parameters. The storage relationship can be a relationship mapping table or a key-value pair. If the storage relationship is a key-value pair, S206 can include the following steps:
[0102] Step 1: Determine the key corresponding to the name from the key-value store and determine the value corresponding to the parameter from the key-value store.
[0103] When storing the attribute information of any interface in a key-value pair, the name of the interface may be determined as the key in the key-value pair, and the parameter may be determined as the value in the key-value pair.
[0104] Step 2: Determine the target interface corresponding to the attribute information of the target interface according to the key corresponding to the name and the value corresponding to the parameter.
[0105] Exemplarily, this embodiment can be understood as: key-value pairs are stored in the host machine, the key in the key-value pair corresponds to the name, and the value in the key-value pair corresponds to the parameter. If the host machine determines the attribute information of the target interface, the host machine can determine whether the attribute information of the target interface hits the key-value pair. If it hits, it means that the host machine includes the target interface with the corresponding name and parameters. The host machine can determine that the hit interface is the target interface, and can perform subsequent calls and executions and other operations.
[0106] It is worth noting that in this embodiment, the host machine determines the target interface corresponding to the attribute information of the target interface information by combining key-value pairs, which can achieve the technical effect of determining the target interface accurately and reliably and improving the efficiency of determining the target interface.
[0107] S207: The host machine calls and executes the target interface to generate feedback information.
[0108] The feedback information is used to indicate that the target interface has been called and / or executed.
[0109] It should be noted that when the host machine calls the target interface, different results of calling the target interface may be generated due to different situations.
[0110] For example, if an abnormal situation such as a network error occurs when the host calls the target interface, the result of the host calling the target interface may be a call failure, etc., which are not listed here one by one.
[0111] Similarly, after the host completes calling the target interface, when executing the target interface, different results of executing the target interface may be generated due to different situations.
[0112] For example, if an abnormal situation such as a network error occurs when the host executes the target interface, the execution result of the host calling the target interface may be execution failure, etc., which are not listed here one by one.
[0113] In some embodiments, the feedback information includes: information obtained by serializing the call result of calling the target interface, and information obtained by serializing the execution result generated by executing the target interface.
[0114] Combined with the above analysis, it can be known that the serialized data sent by the virtual machine to the host machine is the attribute information of the target interface after serialization processing by the virtual machine. Accordingly, when the host machine determines the call result of calling the target interface, it can serialize the call result to obtain the serialized information corresponding to the call result. Similarly, when the host machine determines the execution result of executing the target interface, it can serialize the execution result to obtain the serialized information corresponding to the execution result, thereby obtaining feedback information so as to send the feedback information to the virtual machine.
[0115] In this embodiment, by generating serialized feedback information, the virtual machine's recognition efficiency of feedback information can be improved, the reliability and efficiency of interface calls can be improved, and the user's gaming and video experiences can be improved.
[0116] Based on the above analysis, it can be seen that when calling the target interface and / or executing the target interface, there may be failure results caused by network factors and other factors. In some embodiments, if the execution result represents a failure to execute the target interface, the execution result carries an exception code corresponding to the failure to execute the target interface. The exception code is used to indicate the reason for the failure to execute the target interface.
[0117] It is worth noting that, in this embodiment, if the host machine fails to execute the target interface, an execution result carrying an exception code carrying the reason for the failure to execute the target interface is generated, which can enable the virtual machine to quickly and accurately locate the failure to execute the target interface, so as to adjust the subsequent strategy for executing the target interface, thereby achieving the technical effect of improving the accuracy and reliability of executing the target interface.
[0118] The exception code may be pre-set for the host machine and the virtual machine, so that different failure types can be determined by different exception codes.
[0119] In some embodiments, the host machine may store a mapping relationship between an exception code and a failure cause. For example, when the host machine executes a target interface, if the execution of the target interface fails, the cause of the failure is determined, and based on the mapping relationship between the stored exception code and the identification cause, the exception code corresponding to the cause of executing the target interface identification is determined, and the exception code is carried in the execution result and sent to the virtual machine.
[0120] Correspondingly, the virtual machine may also store a mapping relationship between an exception code and a failure cause. For example, the virtual machine receives feedback information sent by the host machine, determines whether the feedback information includes an exception code, and if the feedback information includes an exception code, the virtual machine may determine the failure cause corresponding to the exception code based on the mapping relationship between the exception code and the failure cause, and may send a notification message to the caller (such as a user) of the target interface based on the failure cause.
[0121] It should be understood that the notification message can be generated for the virtual machine based on the feedback information, and is used to indicate the calling result of the target interface and the execution result generated by the target interface that executes the call. When the feedback information includes an exception code, the notification message can include the reason for the failure of executing the calling interface.
[0122] S208: The host machine sends feedback information to the virtual machine.
[0123] Correspondingly, the virtual machine receives feedback information sent by the host machine.
[0124] S209: The virtual machine generates a notification message according to the feedback information.
[0125] The notification message is used to indicate the calling result of the target interface and the execution result generated by the calling target interface.
[0126] That is to say, the notification message may include two dimensions of content, one dimension of content being the calling interface for calling the target interface, and the other dimension of content being the execution result of executing the target interface.
[0127] In some embodiments, the virtual machine may output notification information to the client that initiates a call request to the virtual machine.
[0128] For example, combined with the analysis of the above embodiments, it can be seen that if the method of calling the interface of this embodiment is applied to a game scenario, the client can be a client for the game set on the user terminal, and the virtual machine can output a notification message to the client. Accordingly, the client can adaptively display the notification message, that is, the client can display corresponding content on the display of the user terminal based on the specific content of the notification message, such as network abnormalities.
[0129] Similarly, if the method of calling the interface of this embodiment is applied to the audio and video push scenario, the client can be a client set on the user terminal for pushing audio and video, then the virtual machine can output a notification message to the client, and accordingly, the client can adaptively display the notification message, that is, the client can display the corresponding content on the display of the user terminal based on the specific content of the notification message, such as network abnormalities.
[0130] It is worth noting that the host machine can send feedback information to the virtual machine after completing the call to the target interface and executing the target interface. The virtual machine can also output a prompt message based on time when the host machine fails to call the target interface and the host machine does not complete the call to the target interface.
[0131] Exemplarily, if the virtual machine does not receive feedback information within a preset time period, a prompt message is output.
[0132] The prompt message is used to prompt that the call has timed out.
[0133] The preset time period may be set by the virtual machine based on demand, historical records, and experiments, and is not limited in this embodiment.
[0134] See also Figure 3 , Figure 3 The present invention is a flowchart of a method for calling an interface according to another embodiment of the present invention.
[0135] like Figure 3 As shown, the method includes:
[0136] S301: Determine the target interface to be called according to the acquired interface calling requirement, and determine the attribute information of the target interface.
[0137] Exemplarily, the execution subject of this embodiment may be a server, and the server includes a virtual machine that establishes a bidirectional full-duplex communication link with the other party in the interaction through inter-process communication and is generated using a desktop virtualization data transmission protocol.
[0138] Among them, the interactive parties that complete the method of calling the interface use different interface calling languages.
[0139] S302: Serialize the attribute information of the target interface to obtain and output serialized data.
[0140] The serialized data is used to indicate the calling and execution of the target interface.
[0141] In some embodiments, the same interface has the same attribute information in the interacting party, and the attribute information of the target interface includes a name and parameters; S302 may include: serializing the name and parameters in the attribute information of the target interface to obtain serialized data.
[0142] S303: Receive feedback information, where the feedback information is used to indicate that the target interface has been called and / or executed.
[0143] In some embodiments, the feedback information includes: information obtained by serializing a call result of calling a target interface, and information obtained by serializing an execution result generated by executing the target interface.
[0144] S304: Generate and output a notification message according to the feedback information.
[0145] The notification message is used to indicate the calling result of the target interface and the execution result generated by the calling target interface.
[0146] In some embodiments, if no feedback information is received within a preset time period, a prompt message is output, wherein the prompt message is used to prompt that the call has timed out.
[0147] See also Figure 4 , Figure 4 A schematic diagram of a terminal device according to an embodiment of the present disclosure.
[0148] like Figure 4 As shown, the terminal device 400 includes:
[0149] The acquisition module 401 is used to acquire serialized data of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages.
[0150] The first processing module 402 is used to perform deserialization processing on the serialized data to obtain the attribute information of the target interface.
[0151] The first generating module 403 is used to call and execute the target interface according to the attribute information of the target interface, and generate feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0152] The first output module 404 is used to output feedback information.
[0153] See also Figure 5 , Figure 5 A schematic diagram of a terminal device according to another embodiment of the present disclosure.
[0154] like Figure 5 As shown, the terminal device 500 includes:
[0155] The acquisition module 501 is used to acquire serialized data of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages.
[0156] In some embodiments, the terminal device includes a host machine that establishes a bidirectional full-duplex communication link with another party in the interaction through an inter-process communication Domain Socket and is generated using a SPICE communication protocol.
[0157] The first processing module 502 is used to perform deserialization processing on the serialized data to obtain the attribute information of the target interface.
[0158] The first determination module 503 is used to determine the target interface corresponding to the attribute information of the target interface from a preset storage relationship, wherein the storage relationship is used to represent the correspondence between the attribute information and the interface.
[0159] In some embodiments, the same interface has the same attribute information in the interacting party, and the attribute information of the target interface includes a name and parameters. The first determining module 503 includes:
[0160] The first determination submodule is used to determine the key corresponding to the name from the key-value pair storage, and to determine the value corresponding to the parameter from the key-value pair storage.
[0161] The second determination submodule is used to determine the target interface corresponding to the attribute information of the target interface according to the key corresponding to the name and the value corresponding to the parameter.
[0162] The first generating module 504 is used to call and execute the target interface according to the attribute information of the target interface, and generate feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0163] In some embodiments, the feedback information includes: information obtained by serializing the call result of calling the target interface, and information obtained by serializing the execution result generated by executing the target interface.
[0164] In some embodiments, if the execution result indicates that the execution target interface fails, the execution result carries an exception code corresponding to the failure to execute the target interface, and the exception code is used to indicate the reason for the failure to execute the target interface.
[0165] In some embodiments, the feedback information is used to generate notification information, wherein the notification message is used to indicate the result of calling the target interface and / or the execution result generated by the target interface that executes the call.
[0166] The first output module 505 is used to output feedback information.
[0167] See also Figure 6 , Figure 6 A schematic diagram of a server according to an embodiment of the present disclosure.
[0168] like Figure 6 As shown, the server 600 includes:
[0169] The second determination module 601 is used to determine the target interface to be called according to the acquired interface calling requirement and determine the attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages.
[0170] The second processing module 602 is used to perform serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used to indicate the calling and execution of the target interface.
[0171] The receiving module 603 is used to receive feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0172] See also Figure 7 , Figure 7 A schematic diagram of a server according to another embodiment of the present disclosure.
[0173] like Figure 7 As shown, the server 700 includes:
[0174] The second determination module 701 is used to determine the target interface to be called according to the acquired interface calling requirement and determine the attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages.
[0175] In some embodiments, the server includes a virtual machine generated by using a SPICE communication protocol to establish a bidirectional full-duplex communication link with another party in the interaction through an inter-process communication Domain Socket.
[0176] The second processing module 702 is used to perform serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used to indicate the calling and execution of the target interface.
[0177] In some embodiments, the same interface has the same attribute information in the interacting party, and the attribute information of the target interface includes a name and parameters. The second processing module 702 is used to serialize the name and parameters in the attribute information of the target interface to obtain serialized data.
[0178] The receiving module 703 is used to receive feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0179] In some embodiments, the feedback information includes: information obtained by serializing a call result of calling a target interface, and information obtained by serializing an execution result generated by executing the target interface.
[0180] The second generating module 704 is used to generate a notification message according to the feedback information, wherein the notification message is used to indicate the calling result of the target interface and the execution result generated by the calling target interface.
[0181] The second output module 705 is used to output a notification message.
[0182] In some embodiments, the second output module 705 is further used to output a prompt message if no feedback information is received within a preset time period, wherein the prompt message is used to prompt a call timeout.
[0183] refer to Figure 8 , which shows a schematic diagram of the structure of an electronic device 800 suitable for implementing the embodiment of the present disclosure, and the electronic device 800 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0184] like Figure 8As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. Various programs and data required for the operation of the electronic device 800 are also stored in the RAM 803. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0185] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication device 809 may allow the electronic device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 800 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0186] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 809, or installed from the storage device 808, or installed from the ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0187] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0188] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0189] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0190] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0191] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0192] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0193] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0194] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0195] According to another aspect of an embodiment of the present disclosure, an embodiment of the present disclosure provides a system for calling an interface, including:
[0196] The terminal device as described in any of the above embodiments, Figure 4 or Figure 5 The terminal equipment shown;
[0197] A server as described in any of the above embodiments, Figure 6 or Figure 7 The server shown.
[0198] In a first aspect, according to one or more embodiments of the present disclosure, a method for calling an interface is provided, comprising:
[0199] Acquire serialized data of the target interface, wherein the interactive party that completes the method of calling the interface adopts different interface calling languages;
[0200] Deserialize the serialized data to obtain the attribute information of the target interface;
[0201] The target interface is called and executed according to the attribute information of the target interface, and feedback information is generated and output, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
[0202] According to one or more embodiments of the present disclosure, before calling and executing the target interface according to the attribute information of the target interface, the method further includes:
[0203] A target interface corresponding to the attribute information of the target interface is determined from a preset storage relationship, wherein the storage relationship is used to characterize a corresponding relationship between the attribute information and the interface.
[0204] According to one or more embodiments of the present disclosure, the same interface has the same attribute information in the interacting party, the attribute information of the target interface includes a name and a parameter, and the storage relationship includes a key-value pair storage; determining a target interface corresponding to the attribute information of the target interface from a preset storage relationship includes:
[0205] determining from the key-value pair store a key corresponding to the name, and determining from the key-value pair store a value corresponding to the parameter;
[0206] A target interface corresponding to the attribute information of the target interface is determined according to the key corresponding to the name and the value corresponding to the parameter.
[0207] According to one or more embodiments of the present disclosure, the feedback information includes: information obtained by serializing a call result of calling the target interface, and information obtained by serializing an execution result generated by executing the target interface.
[0208] According to one or more embodiments of the present disclosure, if the execution result indicates that the execution of the target interface fails, the execution result carries an exception code corresponding to the failure to execute the target interface, and the exception code is used to indicate the reason for the failure to execute the target interface.
[0209] According to one or more embodiments of the present disclosure, the feedback information is used to generate notification information, wherein the notification message is used to indicate the calling result of the target interface and / or the execution result generated by the target interface that executes the call.
[0210] According to one or more embodiments of the present disclosure, if one of the interacting parties includes a terminal device, the terminal device includes a host machine generated using a SPICE communication protocol and establishing a bidirectional full-duplex communication link with the other interacting party through an inter-process communication Domain Socket.
[0211] In a second aspect, according to one or more embodiments of the present disclosure, a method for calling an interface is provided, comprising:
[0212] Determining a target interface to be called according to the acquired interface calling requirements, and determining attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages;
[0213] Serializing the attribute information of the target interface to obtain and output serialized data, wherein the serialized data is used to indicate calling and executing the target interface;
[0214] Feedback information is received, wherein the feedback information is used to indicate that the target interface has been called and executed.
[0215] According to one or more embodiments of the present disclosure, the same interface has the same attribute information in the interacting party, and the attribute information of the target interface includes a name and parameters; the attribute information of the target interface is serialized to obtain serialized data, including:
[0216] The name and parameters in the attribute information of the target interface are serialized to obtain the serialized data.
[0217] According to one or more embodiments of the present disclosure, the feedback information includes: information obtained by serializing a call result of calling the target interface, and information obtained by serializing an execution result generated by executing the target interface.
[0218] According to one or more embodiments of the present disclosure, after receiving the feedback information, the method further includes:
[0219] A notification message is generated and output according to the feedback information, wherein the notification message is used to indicate the calling result of the target interface and the execution result generated by the target interface that executes the call.
[0220] According to one or more embodiments of the present disclosure, after outputting the serialized data, the method further includes:
[0221] If no feedback information is received within a preset time period, a prompt message is output, wherein the prompt message is used to prompt that the call has timed out.
[0222] According to one or more embodiments of the present disclosure, if one of the interacting parties includes a server, the server includes a virtual machine generated using a SPICE communication protocol and establishing a bidirectional full-duplex communication link with the other interacting party through an inter-process communication Domain Socket.
[0223] In a third aspect, according to one or more embodiments of the present disclosure, a terminal device is provided, including:
[0224] An acquisition module, used to acquire serialized data of a target interface, wherein the interactive party that completes the method of calling the interface adopts different interface calling languages;
[0225] A first processing module, used for deserializing the serialized data to obtain the attribute information of the target interface;
[0226] A first generating module, configured to call and execute the target interface according to the attribute information of the target interface, and generate feedback information, wherein the feedback information is used to indicate that the target interface has been called and executed;
[0227] The first output module is used to output the feedback information.
[0228] According to one or more embodiments of the present disclosure, the present invention further includes:
[0229] The first determination module is used to determine the target interface corresponding to the attribute information of the target interface from a preset storage relationship, wherein the storage relationship is used to represent the correspondence between the attribute information and the interface.
[0230] According to one or more embodiments of the present disclosure, the same interface has the same attribute information in the interacting party, the attribute information of the target interface includes a name and parameters, and the storage relationship includes key-value pair storage; the first determination module includes:
[0231] A first determination submodule, configured to determine a key corresponding to the name from the key-value pair storage, and to determine a value corresponding to the parameter from the key-value pair storage;
[0232] The second determination submodule is used to determine the target interface corresponding to the attribute information of the target interface according to the key corresponding to the name and the value corresponding to the parameter.
[0233] According to one or more embodiments of the present disclosure, the feedback information includes: information obtained by serializing a call result of calling the target interface, and information obtained by serializing an execution result generated by executing the target interface.
[0234] According to one or more embodiments of the present disclosure, if the execution result indicates that the execution of the target interface fails, the execution result carries an exception code corresponding to the failure to execute the target interface, and the exception code is used to indicate the reason for the failure to execute the target interface.
[0235] According to one or more embodiments of the present disclosure, the feedback information is used to generate notification information, wherein the notification message is used to indicate the calling result of the target interface and / or the execution result generated by the target interface that executes the call.
[0236] According to one or more embodiments of the present disclosure, if one of the interacting parties includes a terminal device, the terminal device includes a host machine generated using a SPICE communication protocol and establishing a bidirectional full-duplex communication link with the other interacting party through an inter-process communication Domain Socket.
[0237] In a fourth aspect, according to one or more embodiments of the present disclosure, a server is provided, including:
[0238] A second determination module is used to determine the target interface to be called according to the acquired interface calling requirement, and determine the attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages;
[0239] A second processing module is used to perform serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used to indicate calling and executing the target interface;
[0240] The receiving module is used to receive feedback information, wherein the feedback information is used to indicate that the target interface has been called and executed.
[0241] According to one or more embodiments of the present disclosure, the same interface has the same attribute information in the interacting party, and the attribute information of the target interface includes a name and parameters; the second processing module is used to serialize the name and parameters in the attribute information of the target interface to obtain the serialized data.
[0242] According to one or more embodiments of the present disclosure, the feedback information includes: information obtained by serializing a call result of calling the target interface, and information obtained by serializing an execution result generated by executing the target interface.
[0243] According to one or more embodiments of the present disclosure, the present invention further includes:
[0244] A second generating module, used to generate a notification message according to the feedback information, wherein the notification message is used to indicate the calling result of the target interface and the execution result generated by the target interface executing the call;
[0245] The second output module is used to output the notification message.
[0246] According to one or more embodiments of the present disclosure, the second output module is used to output a prompt message if no feedback information is received within a preset time period, wherein the prompt message is used to prompt a call timeout.
[0247] According to one or more embodiments of the present disclosure, if one of the interacting parties includes a server, the server includes a virtual machine generated using a SPICE communication protocol and establishing a bidirectional full-duplex communication link with the other interacting party through an inter-process communication Domain Socket.
[0248] In a fifth aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;
[0249] The memory stores computer-executable instructions;
[0250] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the method described in the first aspect and various possible designs of the first aspect; or,
[0251] Enable the at least one processor to execute the method described in the second aspect and various possible designs of the second aspect.
[0252] In a sixth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method described in the first aspect and various possible designs of the first aspect is implemented; or,
[0253] Implement the method described in the second aspect and various possible designs of the second aspect.
[0254] In a seventh aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method described in the first aspect and various possible designs of the first aspect is implemented; or,
[0255] When the computer program is executed by a processor, the computer program implements the method described in the second aspect and various possible designs of the second aspect.
[0256] In an eighth aspect, according to one or more embodiments of the present disclosure, a system for calling an interface is provided, comprising:
[0257] The terminal device as described in the third aspect and various possible designs of the third aspect;
[0258] The server as described in the fourth aspect and various possible designs of the fourth aspect.
[0259] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0260] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0261] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A method for calling an interface, comprising: Acquire serialized data of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages; the serialized data is data of attribute information of the target interface in a transmission form; The obtaining of the serialized data of the target interface includes: adding the descriptor of the corresponding string device to the monitored descriptor list when the serialized data sent by the interactive party needs to be received; looping through the monitored descriptor list, and when the descriptor list is traversed, for the string device whose descriptor is not in the descriptor list, putting the corresponding receiving process into a sleep state, and for the string device whose descriptor is in the descriptor list, waking up the corresponding receiving process, and the awakened receiving process receives the serialized data of the target interface sent by the interactive party; Deserialize the serialized data to obtain the attribute information of the target interface; The target interface is called and executed according to the attribute information of the target interface, and feedback information is generated and output, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
2. The method according to claim 1, wherein: Before calling and executing the target interface according to the attribute information of the target interface, the method further includes: A target interface corresponding to the attribute information of the target interface is determined from a preset storage relationship, wherein the storage relationship is used to characterize a corresponding relationship between the attribute information and the interface.
3. The method according to claim 2, wherein: The same interface has the same attribute information in the interacting party, the attribute information of the target interface includes a name and parameters, and the storage relationship includes key-value pair storage; Determining a target interface corresponding to the attribute information of the target interface from a preset storage relationship includes: determining from the key-value pair store a key corresponding to the name, and determining from the key-value pair store a value corresponding to the parameter; A target interface corresponding to the attribute information of the target interface is determined according to the key corresponding to the name and the value corresponding to the parameter.
4. The method according to claim 1, wherein: The feedback information includes: information obtained by serializing a call result of calling the target interface, and information obtained by serializing an execution result generated by executing the target interface.
5. The method according to claim 4, wherein: If the execution result indicates that the execution of the target interface fails, the execution result carries an exception code corresponding to the failure to execute the target interface, and the exception code is used to indicate the reason for the failure to execute the target interface.
6. The method according to any one of claims 1 to 5, wherein: The feedback information is used to generate notification information, wherein the notification information is used to indicate the calling result of the target interface and / or the execution result generated by the calling target interface.
7. A method for calling an interface, comprising: Determining a target interface to be called according to the acquired interface calling requirements, and determining attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages; Serializing the attribute information of the target interface to obtain and output serialized data, wherein the serialized data is used to indicate calling and executing the target interface; the serialized data is data of the attribute information of the target interface in a transmission form; The outputting of serialized data includes: sending serialized data of the target interface to the host machine, so that the host machine adds the descriptor of the corresponding string device to the monitored descriptor list when it needs to receive the serialized data sent by the interactive party; looping through the monitored descriptor list, and when the descriptor list is traversed, for the string device whose descriptor is not in the descriptor list, putting the corresponding receiving process into a sleep state, and for the string device whose descriptor is in the descriptor list, waking up the corresponding receiving process, and the awakened receiving process receives the serialized data of the target interface sent by the interactive party; Feedback information is received, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
8. The method according to claim 7, wherein: The same interface has the same attribute information in the interacting party, and the attribute information of the target interface includes a name and parameters; Serializing the attribute information of the target interface to obtain serialized data, including: The name and parameters in the attribute information of the target interface are serialized to obtain the serialized data.
9. The method according to claim 7, wherein the feedback information comprises: Information obtained by serializing a call result of calling the target interface and information obtained by serializing an execution result generated by executing the target interface.
10. The method according to any one of claims 7 to 9, after receiving the feedback information, further comprising: A notification message is generated and output according to the feedback information, wherein the notification message is used to indicate the calling result of the target interface and the execution result generated by the target interface that executes the call.
11. The method according to any one of claims 7 to 9, after outputting the serialized data, further comprising: If no feedback information is received within a preset time period, a prompt message is output, wherein the prompt message is used to prompt that the call has timed out.
12. A terminal device, comprising: An acquisition module is used to acquire serialized data of a target interface, wherein the interactive party that completes the method of calling the interface adopts different interface calling languages; the serialized data is data of attribute information of the target interface in a transmission form; the acquisition of serialized data of the target interface includes: when it is necessary to receive serialized data sent by the interactive party, adding the descriptor of the corresponding string device to the monitored descriptor list; looping through the monitored descriptor list, when the descriptor list is traversed, for the string device whose descriptor is not in the descriptor list, the corresponding receiving process is put into a sleep state, and for the string device whose descriptor is in the descriptor list, the corresponding receiving process is awakened, and the awakened receiving process receives the serialized data of the target interface sent by the interactive party; A first processing module, used for deserializing the serialized data to obtain the attribute information of the target interface; A first generating module, configured to call and execute the target interface according to the attribute information of the target interface, and generate feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed; The first output module is used to output the feedback information.
13. A server, comprising: A second determination module is used to determine the target interface to be called according to the acquired interface calling requirement, and determine the attribute information of the target interface, wherein the interactive parties that complete the method of calling the interface use different interface calling languages; The second processing module is used to serialize the attribute information of the target interface to obtain and output serialized data, wherein the serialized data is used to indicate calling and executing the target interface; the serialized data is data of the attribute information of the target interface in a transmission form; the output serialized data includes: sending the serialized data of the target interface to the host machine, so that the host machine adds the descriptor of the corresponding string device to the monitored descriptor list when it needs to receive the serialized data sent by the interactive party; looping through the monitored descriptor list, when the descriptor list is traversed, for the string device whose descriptor is not in the descriptor list, the corresponding receiving process is put into a sleep state, and for the string device whose descriptor is in the descriptor list, the corresponding receiving process is awakened, and the awakened receiving process receives the serialized data of the target interface sent by the interactive party; The receiving module is used to receive feedback information, wherein the feedback information is used to indicate that the target interface has been called and / or executed.
14. An electronic device comprising: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 6; or, The at least one processor is caused to execute the method according to any one of claims 7 to 11.
15. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when a processor executes the computer-executable instructions, the method according to any one of claims 1 to 6 is implemented; or Implement the method according to any one of claims 7 to 11.
16. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented; or The computer program implements the method according to any one of claims 7 to 11 when executed by a processor.
17. A system for calling an interface, comprising: The terminal device as claimed in claim 12; The server as claimed in claim 13.
