CN112988289B - Method and system for calling interface - Google Patents
Method and system for calling interface Download PDFInfo
- Publication number
- CN112988289B CN112988289B CN202110384038.3A CN202110384038A CN112988289B CN 112988289 B CN112988289 B CN 112988289B CN 202110384038 A CN202110384038 A CN 202110384038A CN 112988289 B CN112988289 B CN 112988289B
- Authority
- CN
- China
- Prior art keywords
- target interface
- interface
- attribute information
- calling
- serialized data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 129
- 238000012545 processing Methods 0.000 claims abstract description 96
- 230000005540 biological transmission Effects 0.000 claims abstract description 16
- 230000008569 process Effects 0.000 claims description 36
- 230000002452 interceptive effect Effects 0.000 claims description 28
- 238000004590 computer program Methods 0.000 claims description 17
- 230000003993 interaction Effects 0.000 claims description 8
- 230000002618 waking effect Effects 0.000 claims 4
- 238000004891 communication Methods 0.000 description 40
- 238000010586 diagram Methods 0.000 description 14
- 235000013599 spices Nutrition 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 230000002159 abnormal effect Effects 0.000 description 6
- 230000000694 effects Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 6
- 238000013507 mapping Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 5
- 230000002457 bidirectional effect Effects 0.000 description 4
- 239000003795 chemical substances by application Substances 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000000903 blocking effect Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 239000013078 crystal Substances 0.000 description 1
- 125000004122 cyclic group Chemical group 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/449—Object-oriented method invocation or resolution
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the disclosure provides a method and a system for calling an interface, comprising the following steps: the method comprises the steps of obtaining the serialized data of a target interface, performing deserialization processing on 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 for indicating that the target interface is called and/or executed, performing deserialization processing on the serialized data by obtaining the serialized data to obtain the attribute information of the target interface, executing interface calling and executing operation of the interface based on the attribute information of the target interface, and not requiring definition of a transmission format when each interface is called or respectively corresponding coding and decoding of each transmission format on the basis of the attribute information of the target interface, so that the complexity of interface calling is reduced, the interface calling cost is reduced, and the flexibility of calling the interface is improved.
Description
Technical Field
The embodiment of the disclosure relates to the technical field of computer and network communication, in particular to a method and a system for calling an interface.
Background
With the development of cloud computing technology, a scene application based on cloud computing, such as a game scene, is used. In a cloud computing-based scenario, a server may virtualize an operating system (e.g., an android system) on a host through a virtualization technology, and the same software development kit (Software Development Kit, SDK) may be implemented in different languages in the virtual machine and the host.
In the prior art, when an application program in a virtual machine needs to call an SDK, a call operation of the virtual machine may be put into a host machine to be implemented, and specifically, for each call of the SDK, a transport format is defined according to an application program interface (Application Programming Interface, API, which may be simply referred to as an interface) of the SDK, so that the virtual machine and the host machine perform corresponding encoding and decoding based on the transport format.
However, with the invocation of each SDK (specifically, the invocation of the interface), the transport format is defined, and the encoding and decoding are performed accordingly, which may cause problems of higher complexity and poorer flexibility.
Disclosure of Invention
The embodiment of the disclosure provides a method and a system for calling an interface, which are used for solving the problem of higher complexity of interface calling.
In a first aspect, an embodiment of the present disclosure provides a method for calling an interface, including:
Obtaining serialized data of a target interface, wherein an interactive party completing the method for calling the interface adopts different interface calling languages;
Performing deserialization processing on the serialized data to obtain attribute information of the target interface;
And calling and executing the target interface according to the attribute information of the target interface, and generating and outputting feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed.
In a second aspect, an embodiment of the present disclosure provides a method for calling an interface, including:
Determining a target interface to be called according to the acquired interface calling requirement, and determining attribute information of the target interface, wherein an interactive party completing the interface calling method adopts different interface calling languages;
Carrying out serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used for indicating to call and execute the target interface;
and receiving feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed.
In a third aspect, an embodiment of the present disclosure provides a terminal device, including:
The acquisition module is used for acquiring the serialized data of the target interface, wherein the interaction party for completing the interface calling method adopts different interface calling languages;
The first processing module is used for performing deserialization processing on the serialized data to obtain attribute information of the target interface;
The first generation module is used for calling and executing the target interface according to the attribute information of the target interface and generating feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed;
and the first output module is used for outputting the feedback information.
In a fourth aspect, embodiments of the present disclosure provide a server, including:
the second determining module is used for determining a target interface to be called according to the acquired interface calling requirement and determining attribute information of the target interface, wherein an interactive party completing the interface calling method adopts different interface calling languages;
the second processing module is used for carrying out serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used for indicating to call and execute the target interface;
And the receiving module is used for receiving feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed.
In a fifth aspect, embodiments of the present disclosure provide an electronic device, including: at least one processor and memory;
The memory stores computer-executable instructions;
The at least one processor executing computer-executable instructions stored in the memory, causing the at least one processor to perform the method as described above in the first aspect and the various possible designs of the first aspect; or cause the at least one processor to perform the method as described above for the second aspect and the various possible designs for the second aspect.
In a sixth aspect, embodiments of the present disclosure provide a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the method as described above in the first aspect and the various possible designs of the first aspect; or implementing the method as described above for the second aspect and the various possible designs of the second aspect.
In a seventh aspect, there is provided a computer program product comprising: a computer program stored in a readable storage medium, from which at least one processor of an electronic device can read, the at least one processor executing the computer program causing the electronic device to perform the method of the first aspect; or alternatively
The execution of the computer program by the at least one processor causes the electronic device to perform the method of the second aspect and the various possible designs of the second aspect.
In an eighth aspect, a system for calling an interface is provided, including:
the terminal device as described in the third aspect and the various possible designs of the third aspect;
the server as described in the fourth aspect and the various possible designs of the fourth aspect.
The method and system for calling the interface provided by the embodiment comprise the following steps: the method comprises the steps that serialized data of a target interface are obtained, an interactive party completing a method for calling the interface adopts different interface calling languages, deserializing processing is conducted on the serialized data to obtain attribute information of the target interface, the target interface is called and executed according to the attribute information of the target interface, feedback information is generated and output, the feedback information is used for indicating that the target interface is called and/or executed, in the embodiment, deserializing processing (namely, the reverse process of the serialization processing) is conducted on the serialized data by obtaining the serialized data (namely, the serialized data obtained by the serialization processing of the attribute information of the target interface), the operation of calling and executing the interface is conducted on the basis of the attribute information of the target interface, and through the combination of the serialization processing and the deserializing processing, transmission formats during calling of each interface are not required to be defined, and coding and decoding of each transmission format are not required to be conducted on the basis, so that the complexity of calling of the interface is reduced, and the flexibility of calling the interface is improved.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the solutions in the prior art, a brief description will be given below of the drawings that are needed in the embodiments or the description of the prior art, it being obvious that the drawings in the following description are some embodiments of the present disclosure, and that other drawings may be obtained from these drawings without inventive effort to a person of ordinary skill in the art.
FIG. 1 is a flow diagram of a method of invoking an interface according to one embodiment of the present disclosure;
FIG. 2 is a flow chart of a method of invoking an interface according to another embodiment of the present disclosure;
FIG. 3 is a flow chart of a method of invoking an interface according to another embodiment of the present disclosure;
fig. 4 is a schematic diagram of a terminal device according to an embodiment of the disclosure;
Fig. 5 is a schematic diagram of a terminal device according to another embodiment of the disclosure;
FIG. 6 is a schematic diagram of a server according to one embodiment of the present disclosure;
FIG. 7 is a schematic diagram of a server according to another embodiment of the present disclosure;
fig. 8 is a schematic hardware structure of an electronic device according to an embodiment of the disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some embodiments of the present disclosure, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without inventive effort, based on the embodiments in this disclosure are intended to be within the scope of this disclosure.
With the development of internet technology and big data technology, cloud computing (or called grid computing) related technology has been rapidly developed, and since it can complete processing of tens of thousands of data in a very short time (e.g., several seconds), it reaches a powerful network service, and is widely applied to different scenes, such as a game scene based on cloud computing, etc.
As can be seen from the above description in the background, the same SDK is implemented in different languages in the virtual machine and the host machine, and if a transport format is defined according to an application program interface of each SDK for each call of the SDK, the virtual machine and the host machine perform encoding and decoding based on the transport format accordingly, which is likely to cause technical problems of higher complexity and poorer flexibility.
In order to solve the above technical problems, the inventors of the present disclosure have creatively worked to obtain the inventive concept of the present disclosure: and carrying out serialization processing on the attribute information of any interface by one of the interactive parties completing the method for calling the interface to obtain serialized data, carrying out deserialization processing on the serialized data by the other of the interactive parties to obtain the attribute information of any interface, and calling and executing the interface based on the attribute information of any interface.
The following describes the technical solutions of the present disclosure and how the technical solutions of the present disclosure solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for calling an interface according to an embodiment of the disclosure.
As shown in fig. 1, the method includes:
s101: and acquiring the serialized data of the target interface.
The interactive party for completing the method for calling the interface adopts different interface calling languages.
The execution body of the embodiment may be an interface calling device, and the interface calling device may be a terminal device, a processor, a chip, or the like, which is not limited in this embodiment.
If the execution body of the embodiment is a terminal device, the terminal device may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices, or other processing devices connected to a wireless modem with wireless communication functions.
In particular, the terminal device may be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket, hand-held, computer-built-in or vehicle-mounted mobile device that exchanges voice and/or data with the radio access network; the terminal device may also be a Personal Communication service (Personal Communication Service, PCS) phone, cordless phone, session initiation protocol (Session Initiation Protocol, SIP) phone, wireless local loop (Wireless Local Loop, WLL) station, personal digital assistant (Personal DIGITAL ASSISTANT, PDA), tablet, wireless modem (modem), handheld device (handset), laptop (laptop computer), machine type Communication (MACHINE TYPE Communication, MTC) terminal, etc.; the Terminal device may also be referred to as a system, subscriber Unit (Subscriber Unit), subscriber Station (Subscriber Station), mobile Station (Mobile Station), remote Terminal (Remote Terminal), access Terminal (ACCESS TERMINAL), user Terminal (User Terminal), user Agent (User Agent), user device (User Device or User Equipment), and the like, without limitation.
In some embodiments, if the execution body of the embodiment is a terminal device, the terminal device includes a host machine that establishes a bidirectional full duplex communication link with another one of the interaction parties through an inter-process communication Domain Socket, and generates by adopting a desktop virtualization data transmission SPICE protocol.
That is, the host may act as a party to the interaction that completes the method of invoking the interface. Accordingly, the other party of the interacting party who completes the method of calling the interface may be a server, and the server includes a virtual machine that establishes a bi-directional full duplex communication link with the other party of the interacting party through interprocess communication and that is generated using a desktop virtualization data transfer protocol.
That is, the interactive party that completes the method of calling the interface may include two parties, one party is a host machine (i.e., a terminal device), one party is a virtual machine (i.e., a server), on the one hand, the host machine and the virtual machine may monitor the bidirectional duplex communication link through interprocess communication, and the host machine may use a desktop virtualized data transmission protocol as a client of the desktop virtualized data transmission protocol, and the virtual machine may be a server of the Linux operating system interface using the desktop virtualized data transmission protocol and an event-driven selection mechanism.
Based on the above analysis, this embodiment can be understood as: the terminal equipment (particularly a host machine) receives the serialized data of the target interface sent by the server (particularly a virtual machine), and different interface calling languages are adopted between the terminal equipment and the server.
It should be understood that the target interface may be any interface of interfaces, and in this embodiment, in order to distinguish between a currently invoked interface and a non-currently invoked interface, the currently invoked interface is referred to as a target interface, and thus, the target interface should not be construed as limiting the interface (such as a type of interface, etc.).
Serialization (Serialization) may be understood, among other things, as a process of converting attribute information of an object into a form that may be stored and/or transmitted.
Accordingly, in this embodiment, the serialized data may be understood as data obtained by serializing the attribute information of the target interface. The serialized data is specifically understood as data of attribute information of the target interface in a transmission format.
S102: and performing deserialization processing on the serialized data to obtain the attribute information of the target interface.
Wherein the inverse serialization process is the inverse of the serialization process. This step can be understood as: the host machine obtains the attribute information of the target interface through the reverse serialization processing of the reverse process.
By way of example, attribute information of the target interface may be understood as information related to characterizing (or describing) a state or a feature of the target interface, such as a type of the target interface, and so on.
Illustratively, in the embodiments of the present disclosure, attribute information of the target interface obtained by serialization and deserialization using mutually inverse processes is introduced, as set forth in the above embodiments: the host receives the serialized data of the target interface sent by the virtual machine (namely, the virtual machine performs serialization processing on the attribute information of the target interface to obtain the serialized data), and the host performs deserialization processing (namely, the reverse process of the serialization processing) on the serialized data to obtain the attribute information of the target interface, so that subsequent S103 is performed on the basis of the attribute information of the target interface, namely, the call and execution of the target interface are performed, the problem that the complexity is high and the flexibility is poor due to the fact that a transmission format is required to be defined for each interface, the corresponding coding and decoding are performed is avoided, the flexibility of interface call is realized, and the technical effect of calling cost is reduced is achieved.
S103: and calling and executing the target interface according to the attribute information of the target interface, and generating and outputting feedback information.
Wherein the feedback information is used to indicate that the target interface has been invoked and/or executed.
In one example, feedback information may be used to indicate that the target interface has been invoked. For example, the device calling the interface may generate feedback information upon completion of calling the target interface, so as to indicate through the feedback information that the device calling the interface has completed the call to the target interface.
In another example, feedback information may be used to indicate that a target interface has been executed. For example, the device calling the interface may generate feedback information when executing the target interface, so as to indicate through the feedback information that the device calling the interface has executed the target interface.
Of course, in yet another example, the feedback information may be used to indicate both that the device calling the interface has completed the call to the target interface and that the device calling the interface has executed the target interface.
By way of example, in combination with the above embodiment, the feedback information is used to indicate that the target interface has been invoked and is used to indicate that the target interface has been executed, and after the host performs deserialization processing on the serialized data to obtain the attribute information of the target interface, the host may execute the operation of invoking the target interface according to the attribute information of the target interface, and may execute the operation of the target interface, and generate the feedback information based on the invoked and/or executed operation, so as to send the feedback information to the virtual machine.
Based on the above analysis, the embodiment of the disclosure provides a method for calling an interface, which includes: the method comprises the steps that serialized data of a target interface are obtained, an interactive party completing a method for calling the interface adopts different interface calling languages, deserializing processing is conducted on the serialized data to obtain attribute information of the target interface, the target interface is called and executed according to the attribute information of the target interface, feedback information is generated and output, the feedback information is used for indicating that the target interface is called and/or executed, in the embodiment, the serialized data are deserialized (the reverse process of the serialization processing) by obtaining the serialized data (the serialized data obtained by serializing the attribute information of the target interface), the attribute information of the target interface is obtained, the calling of the target interface and the operation of executing the target interface are executed based on the attribute information of the target interface, the definition of a transmission format of each interface call is not needed through the combination of the serialization processing and the deserialization processing, and the corresponding encoding and decoding of each transmission format are not needed on the basis, the complexity of the call of the interface is reduced, and the call cost of the interface is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for calling an interface according to another embodiment of the disclosure.
As shown in fig. 2, the method includes:
S201: the terminal equipment and the server establish a bidirectional full duplex communication link between each other through interprocess communication, the terminal equipment and the server determine that the terminal equipment is used as a host machine for realizing a method for calling the interface based on SPICE communication protocol, and the server is used as a virtual machine for realizing the method for calling the interface.
In some embodiments, the virtual machine may establish communication with the host machine through a proxy interface (AGENT INTERFACE), and the proxy interface may be mapped to a string device in the virtual machine.
S202: and the virtual machine determines attribute information of the target interface according to the target interface to be called.
For example, the virtual machine may determine the target interface based on the service requirement, and obtain attribute information of the target interface after determining the target interface.
Specifically, the virtual machine may determine an interface call requirement based on the service requirement, determine a target interface to be called based on the interface call requirement, and acquire attribute information of the target interface.
For example, if an application in the virtual machine is using an audio/video interface, the operation of the virtual machine may be implemented in the host machine to improve performance, the service requirement may be understood as a service for audio/video push, the interface call requirement is a call requirement for calling an interface for completing the service for audio/video push, and the determined target interface is an audio/video interface, that is, an interface that needs to call and execute audio/video.
S203: and the virtual machine performs serialization processing on the attribute information of the target interface to obtain serialized data.
The serialization data is used for indicating calling and executing the target interface.
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 a parameter.
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 a parameter. For example, the target interfaces have the same names in the virtual machine and the host machine, and also have the same parameters.
Wherein the parameters may include: handles, structures, string pointer types, etc., are not listed here.
Accordingly, the attribute information of the target interface includes a name and a parameter, and when the virtual machine performs serialization processing on the attribute information of the target interface, the virtual machine may perform serialization processing on the name and the parameter in the attribute information of the target interface, so as to obtain serialized data.
S204: the virtual machine sends the serialized data to the host machine.
Accordingly, the host machine receives the serialized data sent by the virtual machine.
According to the analysis, communication can be established between the virtual machine and the host machine through the proxy interface, and the proxy interface can be mapped into character string equipment in the virtual machine, so that the virtual machine can be realized in a mode of writing the character string equipment when sending the serialized data to the host machine, and the interaction efficiency between the virtual machine and the interaction machine is improved.
Accordingly, a plurality of receiving processes can be set in the host, a descriptor list can be set, and when the serialized data sent by the virtual machine needs to be received, the descriptor of the corresponding character string device is added to the monitored descriptor list, the host can traverse the monitored descriptor list in a cyclic traversing manner, when the descriptor list is traversed, the receiving process corresponding to the character string device which is not in the descriptor list can be put into a sleep state for the character string device which is not in the descriptor list, and the receiving process corresponding to the character string device in the descriptor list can be awakened for the character string device in the descriptor list, so that the awakened receiving process can execute the receiving task, namely, the serialized data sent by the virtual machine is received.
In this embodiment, the receiving tasks corresponding to the receiving threads are executed by different receiving threads, so that asynchronous calling in a non-blocking manner can be realized, and the technical effect of improving the efficiency of the calling interface is achieved.
S205: and the host machine performs deserialization processing on the serialized data to obtain the attribute information of the target interface.
As can be seen from the above embodiments, the serialization process and the inverse serialization process are inverse processes, and when the host receives the serialized data sent by the host after the serialization process, the host can process the serialized data based on the inverse process of the serialization process, i.e. the inverse serialization process, so as to obtain the attribute information of the target interface.
Illustratively, serialization and deserialization are inverse processes to each other, so the host and virtual machine may preset the manner of serialization and deserialization.
For example, if the virtual machine performs serialization processing by Java to obtain serialized data, the host machine also performs deserialization processing by Java to obtain attribute information of the target interface.
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.
S206: and the host determines a target interface corresponding to the attribute information of the target interface from a preset storage relationship.
The storage relationship is used for representing the corresponding relationship between the attribute information and the interface.
It should be noted that the storage relationship in this embodiment is not limited, and for example, the storage relationship may be a relationship mapping table or a key value pair.
This step can be understood as: after the host machine obtains the attribute information of the target interface through the deserialization processing, the attribute information of the target interface in the storage relationship can be determined based on the attribute information of the target interface, and the target interface corresponding to the attribute information of the target interface is determined from the storage relationship.
The host determines the target interface corresponding to the attribute information of the target interface in a storage relation mode, so that the target interface can be determined quickly and conveniently, and the technical effects of improving the efficiency and accuracy of determining the target interface are achieved.
Based on the above analysis, the target interface has the same attribute information in the host and the virtual machine, the attribute information of the target interface includes a name and a parameter, the stored relationship may be a relationship mapping table or a key value pair, and if the stored relationship is a key value pair, S206 may include the following steps:
step 1: keys corresponding to names are determined from the key-value pair store, and values corresponding to parameters are determined from the key-value pair store.
When the attribute information of any interface is stored in the key value pair, the name of the interface can be determined as a key in the key value pair, and the parameter can be determined as a value in the key value pair.
Step 2: and determining 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.
Illustratively, this embodiment may be understood as: the host machine stores a key value pair, keys in the key value pair correspond to names, values in the key value pair correspond to parameters, if the host machine determines attribute information of the target interface, the host machine can judge whether the attribute information of the target interface hits the key value pair, if yes, the host machine indicates that the host machine comprises the target interface with the corresponding name and parameters, the host machine can determine that the hit interface is the target interface, and subsequent operations such as calling and executing can be performed.
In this embodiment, the host determines the target interface corresponding to the attribute information of the target interface information by combining the key value pair, so that accuracy and reliability of determining the target interface can be achieved, and technical effects of determining the target interface can be improved.
S207: and the host invokes and executes the target interface to generate feedback information.
Wherein the feedback information is used to indicate that the target interface has been invoked and/or executed.
In addition, when the host computer calls the target interface, different results of calling the target interface may be generated according to different situations.
For example, when the host machine calls the target interface, an abnormal situation such as a network error occurs, and the call result of the host machine for calling the target interface may be call failure, which is not listed here.
Similarly, after the host machine finishes calling the target interface, when executing the target interface, different results of executing the target interface may be generated according to different situations.
For example, when the host machine executes the target interface, an abnormal situation such as a network error occurs, and the execution result of the host machine calling the target interface may be execution failure, which is not listed here.
In some embodiments, the feedback information includes: information obtained by serializing the call result of the call target interface and information obtained by serializing the execution result generated by the execution target interface.
In combination with the above analysis, the serialized data sent by the virtual machine to the host machine is attribute information of the target interface after the serialization processing performed by the virtual machine, and accordingly, when the host machine determines the call result of the call target interface, the host machine can perform serialization processing on the call result to obtain information after the serialization processing corresponding to the call result, and similarly, when the host machine determines the execution result of the execution target interface, the host machine can perform serialization processing on the execution result to obtain information after the serialization processing corresponding to the execution result, so as to obtain feedback information, so as to send feedback information to the virtual machine.
In this embodiment, by generating feedback information after serialization processing, the recognition efficiency of the virtual machine on the feedback information can be improved, the reliability and efficiency of interface calling are improved, and the effects of game experience, video experience and the like of a user are improved.
Based on the above analysis, when the target interface is invoked and/or the target interface is executed, there may be a failure result caused by factors such as a network, and in some embodiments, if the execution result characterizes that the execution target interface fails, the execution result carries an exception code corresponding to the failure of the execution target interface, where the exception code is used to indicate a cause of the failure of the execution target interface.
In this embodiment, if the host machine fails to execute the target interface, an execution result carrying an exception code of the cause of the failure to execute the target interface is generated, so that the virtual machine can quickly and accurately locate the failure to execute the target interface, so as to adjust the policy of the subsequent execution target interface, thereby achieving the technical effect of improving the accuracy and reliability of the execution target interface.
The exception code may be preset for the host and the virtual machine, so as to determine different failure types through different exception codes.
In some embodiments, the host may store a mapping of the exception code to the failure cause. For example, when the host machine executes the target interface, if the execution of the target interface fails, determining the reason of the failure, determining the abnormal code corresponding to the reason for executing the target interface identification based on the mapping relation between the stored abnormal code and the identification reason, carrying the abnormal code in the execution result, and sending the abnormal code to the virtual machine.
Accordingly, the virtual machine may also store a mapping relationship between the exception code and the failure cause. For example, the virtual machine receives feedback information sent by the host machine, determines whether the feedback information includes an anomaly code, if the feedback information includes the anomaly code, the virtual machine may determine a failure reason corresponding to the anomaly code according to a mapping relationship between the anomaly code and the failure reason, and may send a notification message to a caller (such as a user) of the target interface based on the failure reason.
It should be understood that the notification message may be generated by the virtual machine based on the feedback information and is used to indicate the call result of the target interface and the execution result generated by the target interface executing the call, and when the feedback information includes the exception code, the notification message may include the cause of the failure of executing the call interface.
S208: the host machine sends feedback information to the virtual machine.
Accordingly, the virtual machine receives feedback information sent by the host machine.
S209: and the virtual machine generates a notification message according to the feedback information.
The notification message is used for indicating a calling result of the target interface and an executing result generated by the target interface executing the calling.
That is, the notification message may include two-dimensional contents, where one-dimensional content is a call interface that calls the target interface, and the other-dimensional content is an execution result of the execution target interface.
In some embodiments, the virtual machine may output notification information to a client that initiated the call request to the virtual machine.
For example, as is known from the analysis in connection with the above embodiment, if the method of calling the interface of the present embodiment is applied to a game scenario, the client may be a client for a game provided at the user terminal, and the virtual machine may output a notification message to the client, and accordingly, the client may adaptively display the notification message, that is, the client may display corresponding content, such as network anomaly, on the display of the user terminal based on the specific content of the notification message.
Similarly, if the method for calling the interface of the embodiment is applied to an audio/video push scenario, the client may be a client set in the user terminal and used for pushing the audio/video, the virtual machine may output a notification message to the client, and accordingly, the client may adaptively display the notification message, that is, the client may display corresponding content, such as network anomaly, on the display of the user terminal based on the specific content of the notification message.
The host machine may send feedback information to the virtual machine after completing the call to the target interface and executing the target interface, or may output a prompt message based on time if there is a failure of the host machine to call the target interface, but the host machine does not complete the call to the target interface.
For example, if the virtual machine does not receive the feedback information within the preset time period, a prompt message is output.
The prompt message is used for prompting the calling overtime.
The preset time period may be set by the virtual machine based on requirements, history, experiments, and the like, which is not limited in this embodiment.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for calling an interface according to another embodiment of the disclosure.
As shown in fig. 3, the method includes:
s301: and determining a target interface to be called according to the acquired interface calling requirement, and determining attribute information of the target interface.
Illustratively, the executing body of the present embodiment may be a server, and the server includes a virtual machine that establishes a bidirectional full duplex communication link with the other one of the interacting parties through interprocess communication, and that is generated using a desktop virtualization data transfer protocol.
The interactive party for completing the method for calling the interface adopts different interface calling languages.
S302: and carrying out serialization processing on the attribute information of the target interface to obtain and output serialized data.
The serialization data is used for indicating calling and executing the target interface.
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 a parameter; s302 may include: and carrying out serialization processing on the names and the parameters in the attribute information of the target interface to obtain serialized data.
S303: feedback information is received, wherein the feedback information is used for indicating that a target interface is invoked and/or executed.
In some embodiments, the feedback information includes: information obtained by serializing the call result of the call target interface and information obtained by serializing the execution result generated by the execution target interface.
S304: and generating and outputting a notification message according to the feedback information.
The notification message is used for indicating a calling result of the target interface and an executing result generated by the target interface executing the calling.
In some embodiments, if no feedback information is received within a preset time period, a prompt message is output, where the prompt message is used to prompt for invoking a timeout.
Referring to fig. 4, fig. 4 is a schematic diagram of a terminal device according to an embodiment of the disclosure.
As shown in fig. 4, the terminal device 400 includes:
the obtaining module 401 is configured to obtain serialized data of the target interface, where an interactive party that completes a method for calling the interface adopts different interface calling languages.
The first processing module 402 is configured to perform deserialization processing on the serialized data to obtain attribute information of the target interface.
The first generating module 403 is configured to call and execute a target interface according to attribute information of the target interface, and generate feedback information, where the feedback information is used to indicate that the target interface has been called and/or executed.
The first output module 404 is configured to output feedback information.
Referring to fig. 5, fig. 5 is a schematic diagram of a terminal device according to another embodiment of the disclosure.
As shown in fig. 5, the terminal device 500 includes:
the obtaining module 501 is configured to obtain serialized data of the target interface, where an interactive party that completes a method for calling the interface adopts different interface calling languages.
In some embodiments, the terminal device includes a host that establishes a bi-directional full duplex communication link with another one of the interacting parties through an inter-process communication Domain Socket and that is generated using SPICE communication protocol.
The first processing module 502 is configured to perform deserialization processing on the serialized data to obtain attribute information of the target interface.
A first determining module 503, configured to determine a target interface corresponding to attribute information of the target interface from a preset storage relationship, where the storage relationship is used to characterize a correspondence between the attribute information and the interface.
In some embodiments, 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 first determining module 503 includes:
and the first determining submodule is used for determining keys corresponding to the names from the key value pair storage and determining values corresponding to the parameters from the key value pair storage.
And the second determining submodule is used for determining 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.
The first generating module 504 is configured to invoke and execute a target interface according to attribute information of the target interface, and generate feedback information, where the feedback information is used to indicate that the target interface has been invoked and/or executed.
In some embodiments, the feedback information includes: information obtained by serializing the call result of the call target interface and information obtained by serializing the execution result generated by the execution target interface.
In some embodiments, if the execution result indicates that the execution target interface fails, the execution result carries an exception code corresponding to the execution target interface failure, where the exception code is used to indicate a cause of the execution target interface failure.
In some embodiments, the feedback information is used to generate notification information, where the notification information is used to indicate a call result of the target interface and/or an execution result generated by the target interface executing the call.
The first output module 505 is configured to output feedback information.
Referring to fig. 6, fig. 6 is a schematic diagram of a server according to an embodiment of the disclosure.
As shown in fig. 6, the server 600 includes:
And the second determining module 601 is configured to determine a target interface to be invoked according to the obtained interface invoking requirement, and determine attribute information of the target interface, where an interactive party that completes a method for invoking the interface adopts different interface invoking languages.
The second processing module 602 is configured to perform serialization processing on the attribute information of the target interface, so as to obtain and output serialized data, where the serialized data is used to instruct to call and execute the target interface.
The receiving module 603 is configured to receive feedback information, where the feedback information is used to indicate that the target interface has been invoked and/or executed.
Referring to fig. 7, fig. 7 is a schematic diagram of a server according to another embodiment of the disclosure.
As shown in fig. 7, the server 700 includes:
The second determining module 701 is configured to determine a target interface to be invoked according to the obtained interface invocation requirement, and determine attribute information of the target interface, where an interactive party that completes a method for invoking the interface adopts different interface invocation languages.
In some embodiments, the server includes a virtual machine that establishes a bi-directional full duplex communication link with another one of the interacting parties through an inter-process communication Domain Socket and that is generated using SPICE communication protocol.
The second processing module 702 is configured to perform serialization processing on the attribute information of the target interface, so as to obtain and output serialized data, where the serialized data is used to instruct to call and execute the target interface.
In some embodiments, the same interface has the same attribute information in the interactive party, the attribute information of the target interface includes a name and a parameter, and the second processing module 702 is configured to perform serialization processing on the name and the parameter in the attribute information of the target interface, so as to obtain serialized data.
A receiving module 703, configured to receive feedback information, where the feedback information is used to indicate that the target interface has been invoked and/or executed.
In some embodiments, the feedback information includes: information obtained by serializing the call result of the call target interface and information obtained by serializing the execution result generated by the execution target interface.
And a second generating module 704, configured to generate a notification message according to the feedback information, where the notification message is used to indicate a call result of the target interface and an execution result generated by the target interface that executes the call.
A second output module 705, configured to output a notification message.
In some embodiments, the second output module 705 is further configured to output a prompt message if no feedback information is received within a preset time period, where the prompt message is used to prompt for invoking a timeout.
Referring to fig. 8, there is shown a schematic structural diagram of an electronic device 800 suitable for use in implementing embodiments of the present disclosure, which electronic device 800 may be a terminal device or a server. The terminal device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a Personal Digital Assistant (PDA) or the like, a tablet computer (Portable Android Device) or the like, a Portable Multimedia Player (PMP) or the like, a car-mounted terminal (e.g., car navigation terminal) or the like, and a fixed terminal such as a digital TV or a desktop computer or the like. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, the electronic device 800 may include a processing means (e.g., a central processor, a graphics processor, etc.) 801 that may 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 808 into a random access Memory (Random Access Memory RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
In general, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 807 including, for example, a Liquid Crystal Display (LCD) CRYSTAL DISPLAY, a speaker, a vibrator, and the like; storage 808 including, for example, magnetic tape, hard disk, etc.; communication means 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 8 shows an electronic device 800 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 809, or installed from storage device 808, or installed from ROM 802. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 801.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above-described embodiments.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (Local Area Network, LAN for short) or a wide area network (Wide Area Network, WAN for short), or may be connected to an external computer (e.g., through the internet using an internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The name of the unit does not in any way constitute a limitation of the unit itself, for example the first acquisition unit may also be described as "unit acquiring at least two internet protocol addresses".
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: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to another aspect of the disclosed embodiments, the disclosed embodiments provide a system for invoking an interface, comprising:
the terminal device according to any of the above embodiments, such as the terminal device shown in fig. 4 or fig. 5;
a server as in any above embodiment, such as the server shown in fig. 6 or fig. 7.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided a method of invoking an interface, comprising:
Obtaining serialized data of a target interface, wherein an interactive party completing the method for calling the interface adopts different interface calling languages;
Performing deserialization processing on the serialized data to obtain attribute information of the target interface;
And calling and executing the target interface according to the attribute information of the target interface, and generating and outputting feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed.
According to one or more embodiments of the present disclosure, before invoking and executing the target interface according to the attribute information of the target interface, further comprising:
and determining a target interface corresponding to the attribute information of the target interface from a preset storage relationship, wherein the storage relationship is used for representing the corresponding relationship between the attribute information and the interface.
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, wherein the determining comprises the following steps:
Determining a key corresponding to the name from the key value pair storage, and determining a value corresponding to the parameter from the key value pair storage;
And determining a 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.
According to one or more embodiments of the present disclosure, the feedback information includes: and the information obtained by carrying out serialization processing on the calling result of the target interface and the information obtained by carrying out serialization processing on the execution result generated by executing the target interface.
According to one or more embodiments of the present disclosure, if the execution result characterizes that the execution of the target interface fails, the execution result carries an exception code corresponding to the failure of executing the target interface, where the exception code is used to indicate a cause of the failure of executing the target interface.
According to one or more embodiments of the present disclosure, the feedback information is used to generate notification information, where the notification information is used to indicate a call result of the target interface and/or an execution result generated by the target interface that executes the call.
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 that establishes a bi-directional full duplex communication link with the other of the interacting parties through an inter-process communication Domain Socket and that is generated using SPICE communication protocol.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided a method of invoking an interface, comprising:
Determining a target interface to be called according to the acquired interface calling requirement, and determining attribute information of the target interface, wherein an interactive party completing the interface calling method adopts different interface calling languages;
Carrying out serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used for indicating to call and execute the target interface;
And receiving feedback information, wherein the feedback information is used for indicating that the target interface is called and executed.
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 a parameter; carrying out serialization processing on the attribute information of the target interface to obtain serialized data, wherein the serialization processing comprises the following steps:
And carrying out serialization processing on the names and the parameters in the attribute information of the target interface to obtain the serialization data.
According to one or more embodiments of the present disclosure, the feedback information includes: and carrying out serialization processing on the information obtained by carrying out serialization processing on the calling result of the target interface and the information obtained by carrying out serialization processing on the execution result generated by executing the target interface.
According to one or more embodiments of the present disclosure, after receiving the feedback information, further comprising:
And generating and outputting a notification message according to the feedback information, wherein the notification message is used for indicating a calling result of the target interface and an executing result generated by the target interface for executing the calling.
According to one or more embodiments of the present disclosure, after outputting the serialized data, further comprising:
And if the feedback information is not received within the preset time period, outputting a prompt message, wherein the prompt message is used for prompting the calling overtime.
In accordance with one or more embodiments of the present disclosure, if one of the interacting parties includes a server, the server includes a virtual machine that establishes a bi-directional full duplex communication link with the other of the interacting parties through an inter-process communication Domain Socket and that is generated using SPICE communication protocol.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided a terminal device, including:
The acquisition module is used for acquiring the serialized data of the target interface, wherein the interaction party for completing the interface calling method adopts different interface calling languages;
The first processing module is used for performing deserialization processing on the serialized data to obtain attribute information of the target interface;
The first generation module is used for calling and executing the target interface according to the attribute information of the target interface and generating feedback information, wherein the feedback information is used for indicating that the target interface is called and executed;
and the first output module is used for outputting the feedback information.
According to one or more embodiments of the present disclosure, further comprising:
The first determining module is used for determining a target interface corresponding to the attribute information of the target interface from a preset storage relationship, wherein the storage relationship is used for representing the corresponding relationship between the attribute information and the interface.
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; the first determining module includes:
A first determining submodule, configured to determine a key corresponding to the name from the key-value pair storage, and determine a value corresponding to the parameter from the key-value pair storage;
And the second determining submodule is used for determining 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.
According to one or more embodiments of the present disclosure, the feedback information includes: and the information obtained by carrying out serialization processing on the calling result of the target interface and the information obtained by carrying out serialization processing on the execution result generated by executing the target interface.
According to one or more embodiments of the present disclosure, if the execution result characterizes that the execution of the target interface fails, the execution result carries an exception code corresponding to the failure of executing the target interface, where the exception code is used to indicate a cause of the failure of executing the target interface.
According to one or more embodiments of the present disclosure, the feedback information is used to generate notification information, where the notification information is used to indicate a call result of the target interface and/or an execution result generated by the target interface that executes the call.
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 that establishes a bi-directional full duplex communication link with the other of the interacting parties through an inter-process communication Domain Socket and that is generated using SPICE communication protocol.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a server comprising:
the second determining module is used for determining a target interface to be called according to the acquired interface calling requirement and determining attribute information of the target interface, wherein an interactive party completing the interface calling method adopts different interface calling languages;
the second processing module is used for carrying out serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used for indicating to call and execute the target interface;
and the receiving module is used for receiving feedback information, wherein the feedback information is used for indicating that the target interface is called and executed.
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 a parameter; and the second processing module is used for carrying out serialization processing on the names and parameters in the attribute information of the target interface to obtain the serialization data.
According to one or more embodiments of the present disclosure, the feedback information includes: and carrying out serialization processing on the information obtained by carrying out serialization processing on the calling result of the target interface and the information obtained by carrying out serialization processing on the execution result generated by executing the target interface.
According to one or more embodiments of the present disclosure, further comprising:
The second generation module is used for generating a notification message according to the feedback information, wherein the notification message is used for indicating a calling result of the target interface and an executing result generated by the target interface for executing the calling;
and the second output module is used for outputting the notification message.
According to one or more embodiments of the present disclosure, the second output module is configured to output a prompt message if no feedback information is received within a preset time period, where the prompt message is used to prompt for invoking a timeout.
In accordance with one or more embodiments of the present disclosure, if one of the interacting parties includes a server, the server includes a virtual machine that establishes a bi-directional full duplex communication link with the other of the interacting parties through an inter-process communication Domain Socket and that is generated using SPICE communication protocol.
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 memory;
The memory stores computer-executable instructions;
The at least one processor executing computer-executable instructions stored in the memory, causing the at least one processor to perform the method as described above in the first aspect and the various possible designs of the first aspect; or alternatively
Causing the at least one processor to perform the method as described above for the second aspect and the various possible designs for the second aspect.
In a sixth aspect, according to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the method as described above in the first aspect and the various possible designs of the first aspect; or alternatively
The method described above for the second aspect and the various possible designs of the second aspect is implemented.
In a seventh aspect, according to one or more embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method as described above for the first aspect and the various possible designs of the first aspect; or alternatively
The computer program when executed by a processor implements the method as described above for the second aspect and the various possible designs of the second aspect.
In an eighth aspect, according to one or more embodiments of the present disclosure, there is provided a system for invoking an interface, comprising:
the terminal device as described above in the third aspect and the various possible designs of the third aspect;
the server as described above in the fourth aspect and in the various possible designs of the fourth aspect.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.
Claims (17)
1. A method of invoking an interface, comprising:
Obtaining serialized data of a target interface, wherein an interactive party completing the method for calling the interface adopts different interface calling languages; the serialized data are data of attribute information of a target interface in a transmission form;
The obtaining the serialized data of the target interface includes: adding the descriptors of the corresponding character string devices to a monitored descriptor list when the serialized data sent by the interactive party is required to be received; circulating to traverse the monitored descriptor list, and when traversing the descriptor list, entering a sleep state for a corresponding receiving process aiming at a character string device of which the descriptor is not in the descriptor list, waking up the corresponding receiving process aiming at the character string device of which the descriptor is in the descriptor list, and receiving serialized data of a target interface sent by an interactive party by the wake-up receiving process;
Performing deserialization processing on the serialized data to obtain attribute information of the target interface;
And calling and executing the target interface according to the attribute information of the target interface, and generating and outputting feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed.
2. The method of claim 1, wherein before invoking and executing the target interface according to the attribute information of the target interface, further comprising:
and determining a target interface corresponding to the attribute information of the target interface from a preset storage relationship, wherein the storage relationship is used for representing the corresponding relationship between the attribute information and the interface.
3. The method of 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 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, wherein the determining comprises the following steps:
Determining a key corresponding to the name from the key value pair storage, and determining a value corresponding to the parameter from the key value pair storage;
And determining a 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.
4. The method of claim 1, wherein the feedback information comprises: and the information obtained by carrying out serialization processing on the calling result of the target interface and the information obtained by carrying out serialization processing on the execution result generated by executing the target interface.
5. The method of 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 of executing the target interface, where the exception code is used to indicate a cause of the failure of executing 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 a call result of the target interface and/or an execution result generated by the target interface executing the call.
7. A method of invoking an interface, comprising:
Determining a target interface to be called according to the acquired interface calling requirement, and determining attribute information of the target interface, wherein an interactive party completing the interface calling method adopts different interface calling languages;
Carrying out serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used for indicating to call and execute the target interface; the serialized data are data of attribute information of a target interface in a transmission form;
The outputting of the serialized data includes: the method comprises the steps of sending the serialized data of a target interface to a host, so that the host adds descriptors of corresponding character string equipment to a monitored descriptor list when the host needs to receive the serialized data sent by an interaction party; circulating to traverse the monitored descriptor list, and when traversing the descriptor list, entering a sleep state for a corresponding receiving process aiming at a character string device of which the descriptor is not in the descriptor list, waking up the corresponding receiving process aiming at the character string device of which the descriptor is in the descriptor list, and receiving serialized data of a target interface sent by an interactive party by the wake-up receiving process;
and receiving feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed.
8. The method of claim 7, wherein the same interface has the same attribute information in the interacting party, the attribute information of the target interface including a name and a parameter; carrying out serialization processing on the attribute information of the target interface to obtain serialized data, wherein the serialization processing comprises the following steps:
And carrying out serialization processing on the names and the parameters in the attribute information of the target interface to obtain the serialization data.
9. The method of claim 7, the feedback information comprising: and carrying out serialization processing on the information obtained by carrying out serialization processing on the calling result of the target interface and the information obtained by carrying out serialization processing on the execution result generated by executing the target interface.
10. The method of any of claims 7 to 9, further comprising, after receiving the feedback information:
And generating and outputting a notification message according to the feedback information, wherein the notification message is used for indicating a calling result of the target interface and an executing result generated by the target interface for executing the calling.
11. The method of any of claims 7 to 9, further comprising, after outputting the serialized data:
And if the feedback information is not received within the preset time period, outputting a prompt message, wherein the prompt message is used for prompting the calling overtime.
12. A terminal device, comprising:
The system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring the serialized data of the target interface, and an interactive party for completing the method for calling the interface adopts different interface calling languages; the serialized data are data of attribute information of a target interface in a transmission form; the obtaining the serialized data of the target interface includes: adding the descriptors of the corresponding character string devices to a monitored descriptor list when the serialized data sent by the interactive party is required to be received; circulating to traverse the monitored descriptor list, and when traversing the descriptor list, entering a sleep state for a corresponding receiving process aiming at a character string device of which the descriptor is not in the descriptor list, waking up the corresponding receiving process aiming at the character string device of which the descriptor is in the descriptor list, and receiving serialized data of a target interface sent by an interactive party by the wake-up receiving process;
The first processing module is used for performing deserialization processing on the serialized data to obtain attribute information of the target interface;
The first generation module is used for calling and executing the target interface according to the attribute information of the target interface and generating feedback information, wherein the feedback information is used for indicating that the target interface is called and/or executed;
and the first output module is used for outputting the feedback information.
13. A server, comprising:
The second determining module is used for determining a target interface to be called according to the acquired interface calling requirement and determining attribute information of the target interface, wherein an interactive party completing a method for calling the interface adopts different interface calling languages;
The second processing module is used for carrying out serialization processing on the attribute information of the target interface to obtain and output serialization data, wherein the serialization data is used for indicating to call and execute the target interface; the serialized data are data of attribute information of a target interface in a transmission form; the outputting of the serialized data includes: the method comprises the steps of sending the serialized data of a target interface to a host, so that the host adds descriptors of corresponding character string equipment to a monitored descriptor list when the host needs to receive the serialized data sent by an interaction party; circulating to traverse the monitored descriptor list, and when traversing the descriptor list, entering a sleep state for a corresponding receiving process aiming at a character string device of which the descriptor is not in the descriptor list, waking up the corresponding receiving process aiming at the character string device of which the descriptor is in the descriptor list, and receiving serialized data of a target interface sent by an interactive party by the wake-up receiving process;
And the receiving module is used for receiving feedback information, wherein the feedback information is used for indicating that the target interface is 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 executing computer-executable instructions stored in the memory, causing the at least one processor to perform the method of any one of claims 1 to 6; or alternatively
Causing the at least one processor to perform the method of any one of claims 7 to 11.
15. A computer readable storage medium having stored therein computer executable instructions which, when executed by a processor, implement the method of any one of claims 1 to 6; or alternatively
A method according to any one of claims 7 to 11.
16. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 6; or alternatively
The computer program, when executed by a processor, implements the method according to any of claims 7 to 11.
17. A system for invoking an interface, comprising:
The terminal device of claim 12;
The server of claim 13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110384038.3A CN112988289B (en) | 2021-04-09 | 2021-04-09 | Method and system for calling interface |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110384038.3A CN112988289B (en) | 2021-04-09 | 2021-04-09 | Method and system for calling interface |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112988289A CN112988289A (en) | 2021-06-18 |
CN112988289B true CN112988289B (en) | 2024-09-20 |
Family
ID=76339694
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110384038.3A Active CN112988289B (en) | 2021-04-09 | 2021-04-09 | Method and system for calling interface |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112988289B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113783743B (en) * | 2021-11-11 | 2022-04-15 | 阿里云计算有限公司 | Communication method, circuit board, and optical transmission device |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109976761A (en) * | 2019-02-27 | 2019-07-05 | 平安科技(深圳)有限公司 | Generation method, device and the terminal device of Software Development Kit |
CN111722947A (en) * | 2020-06-28 | 2020-09-29 | 深圳壹账通智能科技有限公司 | Service calling method and system |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7426734B2 (en) * | 2003-10-24 | 2008-09-16 | Microsoft Corporation | Facilitating presentation functionality through a programming interface media namespace |
CN105573758A (en) * | 2015-12-16 | 2016-05-11 | 福建星网智慧科技股份有限公司 | Dynamic byte-code compilation technology-based codejson frame |
CN110324169B (en) * | 2018-03-30 | 2023-06-27 | 北京京东尚科信息技术有限公司 | Interface management method and device |
CN111367685B (en) * | 2020-02-28 | 2022-11-15 | 深圳平安医疗健康科技服务有限公司 | Interface calling method and device, computer equipment and storage medium |
-
2021
- 2021-04-09 CN CN202110384038.3A patent/CN112988289B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109976761A (en) * | 2019-02-27 | 2019-07-05 | 平安科技(深圳)有限公司 | Generation method, device and the terminal device of Software Development Kit |
CN111722947A (en) * | 2020-06-28 | 2020-09-29 | 深圳壹账通智能科技有限公司 | Service calling method and system |
Also Published As
Publication number | Publication date |
---|---|
CN112988289A (en) | 2021-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102082347B1 (en) | Electronic device and method for transmitting notification information | |
US8639749B2 (en) | Platform independent information handling system, communication method, and computer program product thereof | |
WO2018077041A1 (en) | Method and apparatus for running application | |
WO2020207085A1 (en) | Method and device for information sharing, electronic device, and storage medium | |
US12182443B2 (en) | Data storage method and apparatus, readable medium, and electronic device | |
US20220392130A1 (en) | Image special effect processing method and apparatus | |
CN108874554B (en) | Information communication method and device | |
CN112948129B (en) | Data transmission optimization method, device and readable storage medium based on federated learning | |
KR102133514B1 (en) | Status message service providing method of electronic apparatus and electronic apparatus thereof | |
CN110933075B (en) | Service calling method and device, electronic equipment and storage medium | |
CN113190362B (en) | Service calling method and device, computer equipment and storage medium | |
CN112835615B (en) | Plug-in processing method and device for software development kit and electronic equipment | |
CN113391860B (en) | Service request processing method and device, electronic equipment and computer storage medium | |
CN112988289B (en) | Method and system for calling interface | |
US11818491B2 (en) | Image special effect configuration method, image recognition method, apparatus and electronic device | |
CN112835632B (en) | A terminal capability calling method, device and computer storage medium | |
CN113518183A (en) | Camera calling method and device and electronic equipment | |
CN113850055B (en) | Data processing method, device, storage medium and product | |
CN110751592A (en) | Graphic resource conversion method, device, electronic device and storage medium | |
CN113724711A (en) | Method, device, system, medium and equipment for realizing voice recognition service | |
CN113891441A (en) | Network connection method, device and electronic device | |
CN113778566A (en) | Native application calling method and device, electronic equipment and computer readable medium | |
CN110308958A (en) | Component jump method, device, electronic device and storage medium | |
US20250060973A1 (en) | Method of program running, electronic device and storage medium | |
EP4589436A1 (en) | Inter-application communication method and apparatus based on virtualized device, and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |