CN111290806B - Calling method and device of application program interface, computer equipment and storage medium - Google Patents

Calling method and device of application program interface, computer equipment and storage medium Download PDF

Info

Publication number
CN111290806B
CN111290806B CN202010084324.3A CN202010084324A CN111290806B CN 111290806 B CN111290806 B CN 111290806B CN 202010084324 A CN202010084324 A CN 202010084324A CN 111290806 B CN111290806 B CN 111290806B
Authority
CN
China
Prior art keywords
component
native
application program
call request
target
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
Application number
CN202010084324.3A
Other languages
Chinese (zh)
Other versions
CN111290806A (en
Inventor
丁海盛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN202010084324.3A priority Critical patent/CN111290806B/en
Publication of CN111290806A publication Critical patent/CN111290806A/en
Application granted granted Critical
Publication of CN111290806B publication Critical patent/CN111290806B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-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)

Abstract

The embodiment of the invention discloses a method and a device for calling an application program interface, computer equipment and a storage medium. The method comprises the following steps: receiving a call request sent by a non-native application program through an interface management component; calling a matched target native application program interface through an interface management component according to the calling request and the prestored information of the native application program interface; and processing the call request by the target native component according to the inherited functional component and the included native function, wherein the target native application program interface is associated with the target native component, and the functional component is used for carrying out parameter verification and parameter conversion on the call request. The embodiment of the invention can reduce the development cost of the application program and improve the development efficiency of the application program.

Description

Calling method and device of application program interface, computer equipment and storage medium
Technical Field
The embodiment of the invention relates to the field of application program processing, in particular to a calling method and device of an application program interface, computer equipment and a storage medium.
Background
As people use mobile terminals more and more frequently, the requirements for application programs are also higher and higher. Developers are better at developing the functionality of an application, typically using a development framework.
When the application function programs developed by the development framework and the original application programs in the operating system communicate, a communication mechanism needs to be built for realizing the communication. However, the implementation of the communication mechanism is only to provide a communication channel, and the interfaces of each native application program need to be maintained separately, for example, parameter conversion needs to be performed one by one, so that the development cost of the application program is increased and the development efficiency is reduced.
Disclosure of Invention
The embodiment of the invention provides a calling method, a device, computer equipment and a storage medium of an application program interface, which can reduce the development cost of an application program and improve the development efficiency of the application program.
In a first aspect, an embodiment of the present invention provides a method for calling an application program interface, including:
Receiving a call request sent by a non-native application program through an interface management component;
Calling a matched target native application program interface through an interface management component according to the calling request and the stored information of the native application program interface;
And processing the call request by the target native component according to the inherited functional component and the included native function, wherein the target native application program interface is associated with the target native component, and the functional component is used for carrying out parameter verification and parameter conversion on the call request.
In a second aspect, an embodiment of the present invention further provides an apparatus for calling an application program interface, including:
The call request receiving module is used for receiving a call request sent by the non-native application program through the interface management component;
The target interface calling module is used for calling the matched target native application program interface through the interface management component according to the calling request and the stored information of the native application program interface;
and the call request processing module is used for processing the call request through the target native component according to the inherited functional component and the included native function, the target native application program interface is associated with the target native component, and the functional component is used for carrying out parameter verification and parameter conversion on the call request.
In a third aspect, an embodiment of the present invention further provides a computer device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements a method for calling an application program interface according to any one of the embodiments of the present invention when the processor executes the program.
In a fourth aspect, an embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the program when executed by a processor implements a method for calling an application program interface according to any of the embodiments of the present invention.
According to the embodiment of the invention, when the interface management component receives the call request, the target native application program interface is called according to the stored information of the native application program interface, the call target native component is realized, the call request is processed according to the inherited functional component and the native function included by the target native application program interface through the target native component associated with the target native application program interface, the problem of high cost of developing the application program of a development framework caused by the need of carrying out interface development and maintenance on the native application program during application program development in the prior art is solved, the fact that the native component can realize parameter verification and parameter conversion functions through the inheritance functional component can be realized, so that modification of the native component is reduced, the development cost of the application program is reduced, the development efficiency of the application program is improved, and meanwhile, the interface management component stores the information of the native application program interface, unified management of the native application program interface can be realized, and the maintenance cost of the native application program interface is reduced.
Drawings
FIG. 1 is a flow chart of a method of invoking an application program interface in accordance with a first embodiment of the present invention;
FIG. 2a is a flowchart of a method for invoking an application program interface according to a second embodiment of the present invention;
FIG. 2b is a diagram illustrating an architecture of a calling system of an application program interface according to a second embodiment of the present invention;
FIG. 2c is a schematic diagram of an error page in a second embodiment of the present invention;
FIG. 3 is a schematic diagram of a calling device of an application program interface in a third embodiment of the present invention;
Fig. 4 is a schematic structural diagram of a computer device in a fourth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a schematic diagram of a flowchart of a method for calling an application program interface in the first embodiment of the present invention, where the present embodiment is applicable to a case where a developed non-application program calls a native application program interface, the method may be executed by a calling device of an application program interface provided in the embodiment of the present invention, and the device may be implemented in a software and/or hardware manner, and may be generally integrated into a computer device, specifically, a terminal device. As shown in fig. 1, the method in this embodiment specifically includes:
S110, receiving a call request sent by the non-native application program through the interface management component.
The interface management component is used for receiving and processing the call request for the native component. The call request is for invoking a native component. The native component is an application program developed by directly calling an application programming interface (Application Programming Interface, API) provided by an operating system in a local operating system (such as iOS system or android system) of the terminal device by using a supported programming language and a development tool. The native component includes a plurality of native functions, and in particular, one native component may refer to a class and one native function may refer to a method.
The non-native application is an application developed based on a third party framework. Illustratively, the third party framework is Flutter framework, optionally the non-native application is an application developed based on Flutter framework (Flutter Framework). Wherein Flutter framework is a mobile application development framework, i.e., a software development kit (Software Development Kit, SDK) built by the dart language. Flutter framework can quickly build high quality native User Interfaces (UIs) on iOS and Android.
S120, calling the matched target native application program interface through the interface management component according to the calling request and the information of the pre-stored native application program interface.
The target native application program interface is for providing access to the target native component and for enabling direct communication of the interface management component with the target native component and for enabling indirect communication of the non-native application program with the native application program.
The information of the native application program interface is used for the interface management component to query the target native application program interface that matches the call request. Specifically, the information of the native application program interfaces stores information of a plurality of native application program interfaces. The interface management component selects one of the plurality of native application program interfaces as a target native application program interface. Specifically, the call request includes identification information of the native component, and correspondingly, the information of the native application program interface stored in the interface management component may include: the interface management component can determine the matched target native application program interface according to the call request, call the target native application program interface, send the call request to the associated target native component through the target native application program interface, and process the call request by the target native component. The identification information of the native component may include information such as a name and/or a function of the target native component.
S130, the call request is processed through the target native component according to the inherited functional component and the included native function, the target native application program interface is associated with the target native component, and the functional component is used for carrying out parameter verification and parameter conversion on the call request.
The target native component is for processing the call request processing. The functional component is used for realizing parameter verification and parameter conversion. Specifically, the target native component inherits the functional component, so that the target native component has the functions of parameter conversion, parameter verification and the like. The target native application program interface is associated with the target native component, which indicates that the target native application program interface is called, and the input data is actually sent to the target native component, so that the target native component operates according to the input data, obtains output data and feeds back the output data, and/or performs corresponding operations, thereby completing the response process of the call request.
And processing the call request through the target native component, feeding back a response result to the interface management component, and feeding back to the non-native application program through the interface management component.
Optionally, the processing, by the target native component, the call request according to the inherited functional component includes: extracting, by the target native component, at least one function parameter from the call request according to the inherited functional component; determining a matched target native function through the target native component according to the call request, and calling a parameter processing component matched with the target native function to perform parameter checksum parameter conversion; and processing the call request by the target native component according to the target native function and the feedback result of the parameter processing component.
The function parameters may refer to parameters included in the call request. In general, when an interface is called, a called party needs to determine whether input data is legal, i.e., parameter verification, and needs to convert a data type of the input data into a set data type, i.e., parameter conversion. The native component originally does not have the parameter verification and parameter conversion functions, and the functions can be realized through the inheritance function component. In particular, the functional component portion inherited by the native component may extract the function parameters from the call request.
One native component may include a plurality of native functions, and at least one target native function to be invoked may be determined from the invocation request. The target native function may be determined by the identification information of the function in the call request, and the identification information of the native function may include information such as a name and/or a function of the native function.
Therefore, the matched parameter processing components can be determined for each target primary function, so that legal parameters which accord with preset conditions are obtained and input into the target primary function, and the target primary function is ensured to run correctly and a correct result is obtained. The parameter processing component is used for parameter checksum parameter conversion. A plurality of parameter processing components may be preconfigured, one parameter processing component corresponding to one native function, and different parameter processing components corresponding to different native functions. The parameter processing component may implement a parameter checksum parameter transformation of the function parameters in a native function.
The parameter verification is used for judging whether the function parameters are legal or not, and specifically, the parameter verification can be carried out based on a pre-configured verification rule. Illustratively, the verification rule may include at least one of: parameter length check, parameter value size check, parameter regular check and the like. The parameter conversion is used for converting the received parameters into parameters conforming to a preset format. For example, integer data is converted into floating point data.
The feedback result may refer to a result that the parameter processing component feeds back to the target native component, and generally includes a parameter verification result and a parameter conversion result. When the parameter verification is passed, the target native component responds to the call request; when the parameter verification fails, the target native component does not respond to the call request and prompts an error. The parameter conversion result includes the converted parameters. Specifically, when the parameter verification is passed, the target native component calls the target native function to respond to the call request, and performs parameter conversion on the result fed back by the target native function, so as to obtain a parameter conversion result for feedback.
The function parameters are extracted from the call request through the target native component and are forwarded to the matched parameter processing component to carry out parameter checksum parameter conversion, the call request is correspondingly processed based on the feedback result, the parameter checksum parameter conversion can be automatically realized, the correct response of the native application program interface is ensured, and therefore the non-native application program can correctly call the native function.
Optionally, the parameter processing component is configured to obtain a function signature of the target native function, and perform parameter checksum parameter conversion on the call request according to the function signature.
The function signature is used to describe attribute information of input data and attribute information of output data of the native function. By way of example, the function signature may include the type of function parameters in the native function, the return type, and so forth. The type of function parameter specifically refers to the type of data of the function parameter that needs to be input into the native function. The return type specifically refers to the data type of the result output by the native function.
It will be appreciated that the conditions for parameter checksum parameter conversion may be determined based on the function signature. Therefore, the call request can be processed under the condition that the function parameters in the call request pass the parameter verification, and the response result is subjected to parameter conversion to obtain the output result of the set type, so that the correctness of the response operation of the original application program interface is realized.
Optionally, the processing, by the target native component, the call request according to the target native function and the feedback result of the parameter processing component includes: if the feedback result is determined to comprise a legal verification passing result, extracting a native function identifier from the call request through the target native component; and calling the target native function through the target native component so that the target native function responds to the call request.
And the legal verification shows that the function parameters are legal parameters. Under the condition that the function parameters are legal parameters, the original function can be correctly operated according to the function parameters, and a correct operation result is obtained. The native function identification is used to identify the native function.
In effect, the target native function in the target native component processes the call request. One native function can correspondingly realize a method, different native functions respectively realize different treatments of the call request, and feed back a response result to the target native component, forward the response result to the interface management component and further send the response result to the non-native application program. The response result may not be the type intended by the native component, the parameter processing component may convert the parameter in the response result to obtain a conversion parameter, and correct the response result according to the conversion parameter. The conversion parameters are parameters formed by converting the function parameters.
The parameter processing component is used for automatically realizing parameter checksum parameter conversion, the target native component is used for acquiring a result fed back by the parameter processing component, and when the function parameter is legal, the target native function is called to process a call request according to the converted target native function, and the response result is subjected to parameter conversion to obtain an output result meeting the requirement, so that the non-native application program can be ensured to correctly call the native function, and the response result meeting the requirement is obtained.
Optionally, the processing, by the target native component, the call request according to the feedback result of the parameter processing component includes: and if the feedback result is determined to comprise a legal verification failing result, generating an error page according to the inherited functional component through the target native component, and displaying the error page.
Failure of the legal verification results indicates that the function parameter is not a legal parameter. Under the condition that the function parameters are illegal parameters, the original function cannot obtain a correct operation result according to the function parameters. The error page is used for describing the existing errors and the positions of the errors, namely, determining that the function parameters are illegal and performing error positioning.
In addition, the error page is used to determine whether a native function exists that handles the call request. Accordingly, the target native component is further configured to determine, according to the inherited functional component, whether a target native function that matches the call request exists. If the target native function does not exist, i.e., there is no method to respond to the call request, the target native component generates an error page from the inherited functional component and displays it.
When the function parameters do not pass legal verification, the error page is generated to quickly locate the error, so that a developer can conveniently and quickly process the error, and the original application program interface is quickly and correctly called.
Optionally, before receiving the call request sent by the non-native application program through the interface management component, the method further includes: and registering the native application program interface through the interface management component.
Native application interface registration may refer to storing information of a native application interface in an interface management component. Specifically, the information may include a correspondence between the native application program interface and identification information of the native component, input and output of the definition of the native component, a description of functions implemented by the native component, and the like.
The interface management component registers and manages the native application program interface, so that the native component to be called can be rapidly determined and called, and the calling accuracy is improved.
Optionally, the receiving, by the interface management component, a call request sent by a non-native application program includes: and receiving a call request sent by a channel component through an interface management component, wherein the call request is sent by the non-native application program.
The channel component is used to establish communication between the interface management component and the non-native application. The interface management component and the Native component are both located at the Native (Native) end. While non-native applications are located at the development end, illustratively Flutter. Communication between Flutter and Native ends is achieved by invoking a channel component. Communication between the interface management component and the non-native application can be accomplished quickly and accurately through the channel component.
According to the embodiment of the invention, when the interface management component receives the call request, the target native application program interface is called according to the stored information of the native application program interface, the call target native component is realized, the call request is processed according to the inherited functional component and the native function included by the target native application program interface through the target native component associated with the target native application program interface, the problem of high cost of developing the application program of a development framework caused by the need of carrying out interface development and maintenance on the native application program during application program development in the prior art is solved, the fact that the native component can realize parameter verification and parameter conversion functions through the inheritance functional component can be realized, so that modification of the native component is reduced, the development cost of the application program is reduced, the development efficiency of the application program is improved, and meanwhile, the interface management component stores the information of the native application program interface, unified management of the native application program interface can be realized, and the maintenance cost of the native application program interface is reduced.
Example two
Fig. 2a is a flowchart of a method for calling an application program interface according to a second embodiment of the present invention, which is embodied based on the above-described embodiment. The non-native application is an application developed based on Flutter framework. The method of the embodiment specifically comprises the following steps:
S210, receiving a call request sent by the channel component through the interface management component, wherein the call request is sent by a non-native application program.
The interface management component, the channel component, the call request, the non-native application, the target native application interface, the function component, the parameter verification, the parameter conversion, the native function, the function signature, and the parameter processing component in the embodiments of the present invention may refer to the description of the above embodiments.
S220, calling the matched target native application program interface through the interface management component according to the calling request and the information of the pre-stored native application program interface.
S230, extracting at least one function parameter from the call request by the target native component according to the inherited function component, wherein the target native application program interface is associated with the target native component, and the function component is used for carrying out parameter verification and parameter conversion on the call request.
S240, determining a matched target native function according to the call request through the target native component, and calling a parameter processing component matched with the target native function to perform parameter checksum parameter conversion, wherein the parameter processing component is used for acquiring a function signature of the target native function, and performing parameter checksum parameter conversion on the call request according to the function signature.
S250, acquiring the feedback results of the target native function and the parameter processing component through the target native component.
And S260, if the feedback result is determined to comprise a legal verification passing result, extracting a native function identifier from the call request through the target native component.
S270, calling the target native function through the target native component so that the target native function responds to the call request.
The target native component feeds back a response result of the target native function to the interface management component, calls the channel component through the interface management component and feeds back the response result to the non-native application program.
Optionally, the processing, by the target native component, the call request according to the feedback result of the parameter processing component includes: and if the feedback result is determined to comprise a legal verification failing result, generating an error page according to the inherited functional component through the target native component, and displaying the error page.
Optionally, before receiving the call request sent by the non-native application program through the interface management component, the method further includes: and registering the native application program interface through the interface management component.
Accordingly, a system architecture diagram for implementing a calling method of an application program interface is shown in fig. 2 b. Wherein:
the non-native application 201 generates a call request for a first native function in a first native component and the call channel component 202 sends the call request to the interface management component 203. The interface management component 203 is used to register and manage the native application program interfaces. In practice, the native application programming interface is used to encapsulate the functional components 204. The function component 204 exposes the native application program interface to the outside, and performs interface registration at the interface management component 203, so that the interface management component 203 can uniformly manage the native application program interface, and at this time, the interface management component 203 corresponds to the plurality of function components 204.
Since native component 206 inherits functional component 204, native component 206 has all the functionality of functional component 204. The interface management component 203 invokes a native application interface equivalent to invoking a native component 206 that inherits the functional component 204. Accordingly, the interface management component 203 corresponds to a plurality of native components 206.
In addition, the function component 204 may also call the parameter processing component 206 to perform parameter checksum parameter conversion on the call request, so that the native component 206 that inherits the function component 204 may also perform parameter checksum parameter conversion by calling the parameter processing component 206. In practice, one native component corresponds to a plurality of native functions, and the parameter transformations and parameter checks of different native functions are different, i.e. each native function needs to correspond to one parameter processing component 205. Thus, one functional component 204 corresponds to a plurality of parameter processing components 205, and different parameter processing components 205 corresponding to one functional component 204 correspond to different native functions in the same native component 206.
The non-native application 201 is an application located at Flutter, that is, the non-native application 201 may be a client developed based on the Flutter framework. And Native component 206 is a class at Native end. The Channel component is a Channel component for establishing communication between Flutter ends and Native ends.
Wherein, the registering process of the native application program interface comprises the following steps: when the non-native application 201 is started, the run time is loaded in Objectiev-C language, and all class load methods are called during the loading process. The Load method is used to Load classes to register native application interfaces, i.e., to register functional components, based on the Load method. Specifically, the class_ copyMethodList function in Objectiev-C may traverse all methods, and by using this function, the function component 204 may be traversed to expose the native application program interface to the outside, so as to register the function component 204 in the interface management component 203 to expose the native application program interface to the outside, that is, the native application program interface exposed by the native component 206 to the outside. The functionality component 204 automatically generates a corresponding instance for each native application program interface.
Meanwhile, in Objectiev-C language, function signatures can be obtained through instanceMethodSignatureForSelector functions, the function parameter types and the return types can be known through the function signatures, and automatic conversion and verification of parameters can be realized through the function. The parameter processing component 205 encapsulates the parameter conversion and parameter verification methods.
Thus, the module can automatically perform API registration, parameter conversion, parameter verification, and the like through the functional component 204 and the parameter processing component 205. Thus, the native component 206 need only inherit the functional component 204 to implement the API.
In addition, the native component 206 can automatically check whether the parameters are legal and whether the native function exists, and display an error page when the native function does not exist or the parameters are illegal, and can quickly locate an error based on the error page. The error page is shown in particular in fig. 2 c. Therefore, the developed application program only needs to concern the API of the original component (specific service), and the error page is automatically displayed when the call is illegal, so that the development efficiency can be greatly improved.
According to the embodiment of the invention, the upper layer of the Flutter channel is abstracted to realize automatic registration, parameter conversion and parameter verification of the application program interface, so that decoupling of the native component and the Flutter channel is realized, maintenance operation for maintaining the native component interface is reduced, and development efficiency can be improved.
Example III
Fig. 3 is a schematic diagram of a calling device of an application program interface in a third embodiment of the present invention. The third embodiment is a corresponding device for implementing the calling method of the application program interface provided by the above embodiment of the present invention, where the device may be implemented in a software and/or hardware manner, and may be generally integrated into a computer device.
Accordingly, the apparatus of this embodiment may include:
A call request receiving module 310, configured to receive, through an interface management component, a call request sent by a non-native application;
A target interface calling module 320, configured to call, through an interface management component, the matched target native application program interface according to the calling request and the stored information of the native application program interface;
And a call request processing module 330, configured to process, by the target native component, the call request according to the inherited functional component and the included native function, where the target native application program interface is associated with the target native component, and the functional component is configured to perform parameter checksum parameter conversion on the call request.
According to the embodiment of the invention, when the interface management component receives the call request, the target native application program interface is called according to the stored information of the native application program interface, the call target native component is realized, the call request is processed according to the inherited functional component and the native function included by the target native application program interface through the target native component associated with the target native application program interface, the problem of high cost of developing the application program of a development framework caused by the need of carrying out interface development and maintenance on the native application program during application program development in the prior art is solved, the fact that the native component can realize parameter verification and parameter conversion functions through the inheritance functional component can be realized, so that modification of the native component is reduced, the development cost of the application program is reduced, the development efficiency of the application program is improved, and meanwhile, the interface management component stores the information of the native application program interface, unified management of the native application program interface can be realized, and the maintenance cost of the native application program interface is reduced.
Further, the call request processing module 330 includes: a parameter processing unit, configured to extract, by the target native component, at least one function parameter from the call request according to the inherited function component; determining a matched target native function through the target native component according to the call request, and calling a parameter processing component matched with the target native function to perform parameter checksum parameter conversion; and processing the call request by the target native component according to the target native function and the feedback result of the parameter processing component.
Further, the parameter processing unit includes: a legal verification subunit, configured to extract, if it is determined that the feedback result includes a legal verification passing result, a native function identifier from the call request through the target native component; and calling the target native function through the target native component so that the target native function responds to the call request.
Further, the calling device of the application program interface further includes: and the interface registration module is used for registering the interface of the native application program through the interface management component before receiving a call request sent by the non-native application program through the interface management component.
Further, the call request receiving module 310 includes: and the channel communication unit is used for receiving a call request sent by the channel component through the interface management component, wherein the call request is sent by the non-native application program.
Further, the legal verification subunit is further configured to: and if the feedback result is determined to comprise a legal verification failing result, generating an error page according to the inherited functional component through the target native component, and displaying the error page.
Further, the parameter processing component is configured to obtain a function signature of the target native function, and perform parameter checksum parameter conversion on the call request according to the function signature.
The device can execute the method provided by the embodiment of the invention, and has the corresponding functional components and beneficial effects of the execution method.
Example IV
Fig. 4 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention. Fig. 4 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in fig. 4 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in FIG. 4, the computer device 12 is in the form of a general purpose computing device. Components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, a bus 18 that connects the various system components, including the system memory 28 and the processing units 16. Computer device 12 may be a device that is attached to a bus.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include industry standard architecture (Industry Standard Architecture, ISA) bus, micro channel architecture (Micro Channel Architecture, MCA) bus, enhanced ISA bus, video electronics standards association (Video Electronics Standards Association, VESA) local bus, and peripheral component interconnect (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache memory 32. The computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, commonly referred to as a "hard disk drive"). Although not shown in fig. 4, a disk drive for reading from and writing to a removable nonvolatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from and writing to a removable nonvolatile optical disk (e.g., a compact disk read only memory (CD-ROM), digital versatile disk (Digital Video Disc-read only memory, DVD-ROM), or other optical media) may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program components configured to carry out the functions of the various embodiments of the invention.
A program/utility 40 having a set (at least one) of program components 42 may be stored, for example, in system memory 28, such program components 42 including, but not limited to, an operating system, one or more application programs, other program components, and program data, each or some combination of which may include an implementation of a network environment. Program component 42 generally performs the functions and/or methods of the described embodiments of the invention.
The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), one or more devices that enable a user to interact with the computer device 12, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 12 to communicate with one or more other computing devices. Such communication may be via an Input/Output (I/O) interface 22. The computer device 12 may also communicate with one or more networks such as a local area network (Local Area Network, LAN), a wide area network (Wide Area Network, WAN) via the network adapter 20. As shown, the network adapter 20 communicates with other components of the computer device 12 via the bus 18. It should be understood that although not shown in FIG. 4, other hardware and/or software components may be used in connection with the computer device 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive array (Redundant Arrays of Inexpensive Disks, RAID) systems, tape drives, data backup storage systems, and the like.
The processing unit 16 executes various functional applications and data processing, such as the methods provided by any of the embodiments of the present invention, by running programs stored in the system memory 28.
Example five
A fifth embodiment of the present application provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for calling an application program interface as provided by all embodiments of the present application:
That is, the program, when executed by the processor, implements: receiving a call request sent by a non-native application program through an interface management component; calling a matched target native application program interface through an interface management component according to the calling request and the prestored information of the native application program interface; and processing the call request by the target native component according to the inherited functional component and the included native function, wherein the target native application program interface is associated with the target native component, and the functional component is used for carrying out parameter verification and parameter conversion on the call request.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. 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 (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a RAM, a read-only memory (ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, 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.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. 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 wireless, wireline, optical fiber cable, radio frequency (RadioFrequency, RF), etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of 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 remote computers, the remote computer may be connected to the user computer through any kind of network, including a LAN or WAN, or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (9)

1. A method for invoking an application program interface, comprising:
Receiving a call request sent by a non-native application program through an interface management component;
Calling a matched target native application program interface through the interface management component according to the calling request and the information of the pre-stored native application program interface;
Processing the call request by the target native component according to the inherited functional component and the included native function, wherein the target native application program interface is associated with the target native component, and the functional component is used for carrying out parameter verification and parameter conversion on the call request;
Wherein the target native application program interface is configured to provide access to the target native component, and to enable direct communication of the interface management component with the target native component, and to enable indirect communication of the non-native application program with the native application program; wherein, the information of the original application program interfaces stores information of a plurality of original application program interfaces;
The processing, by the target native component, the call request according to the inherited functional component and the included native function, including:
Extracting, by the target native component, at least one function parameter from the call request according to the inherited functional component;
determining a matched target native function through the target native component according to the call request, and calling a parameter processing component matched with the target native function to perform parameter checksum parameter conversion;
And processing the call request by the target native component according to the target native function and the feedback result of the parameter processing component.
2. The method according to claim 1, wherein the processing, by the target native component, the call request according to the feedback result of the target native function and the parameter processing component includes:
if the feedback result is determined to comprise a legal verification passing result, extracting a native function identifier from the call request through the target native component;
And calling the target native function through the target native component so that the target native function responds to the call request.
3. The method of claim 1, further comprising, prior to receiving, by the interface management component, the call request sent by the non-native application:
and registering the native application program interface through the interface management component.
4. The method of claim 1, wherein receiving, by the interface management component, a call request sent by a non-native application, comprises:
And receiving a call request sent by a channel component through the interface management component, wherein the call request is sent by the non-native application program.
5. The method of claim 1, wherein the processing the call request by the target native component according to the feedback result of the parameter processing component comprises:
And if the feedback result is determined to comprise a legal verification failing result, generating an error page according to the inherited functional component through the target native component, and displaying the error page.
6. The method of claim 1, wherein the parameter processing component is configured to obtain a function signature of the target native function and perform parameter checksum parameter conversion on the call request based on the function signature.
7. A call device for an application program interface, comprising:
The call request receiving module is used for receiving a call request sent by the non-native application program through the interface management component;
the target interface calling module is used for calling the matched target native application program interface through the interface management component according to the calling request and the stored information of the native application program interface;
The call request processing module is used for processing the call request through the target native component according to the inherited functional component and the included native function, the target native application program interface is associated with the target native component, and the functional component is used for carrying out parameter verification and parameter conversion on the call request;
Wherein the target native application program interface is configured to provide access to the target native component, and to enable direct communication of the interface management component with the target native component, and to enable indirect communication of the non-native application program with the native application program; wherein, the information of the original application program interfaces stores information of a plurality of original application program interfaces;
the call request processing module comprises:
a parameter processing unit, configured to extract, by the target native component, at least one function parameter from the call request according to the inherited function component;
determining a matched target native function through the target native component according to the call request, and calling a parameter processing component matched with the target native function to perform parameter checksum parameter conversion;
And processing the call request by the target native component according to the target native function and the feedback result of the parameter processing component.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements a method of invoking an application program interface according to any of claims 1-6 when the program is executed by the processor.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements a method of invoking an application program interface according to any of claims 1-6.
CN202010084324.3A 2020-02-10 2020-02-10 Calling method and device of application program interface, computer equipment and storage medium Active CN111290806B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010084324.3A CN111290806B (en) 2020-02-10 2020-02-10 Calling method and device of application program interface, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010084324.3A CN111290806B (en) 2020-02-10 2020-02-10 Calling method and device of application program interface, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111290806A CN111290806A (en) 2020-06-16
CN111290806B true CN111290806B (en) 2024-04-19

Family

ID=71021361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010084324.3A Active CN111290806B (en) 2020-02-10 2020-02-10 Calling method and device of application program interface, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111290806B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112000491A (en) * 2020-08-14 2020-11-27 天聚地合(苏州)数据股份有限公司 Application program interface calling method, device, equipment and storage medium
CN112130850A (en) * 2020-08-28 2020-12-25 北京达佳互联信息技术有限公司 Method and device for realizing functions in application program
CN112256421A (en) * 2020-11-12 2021-01-22 Oppo广东移动通信有限公司 Communication processing method, communication processing device, storage medium and electronic equipment
CN112860230A (en) * 2021-02-18 2021-05-28 爱驰汽车有限公司 Service implementation method, device, equipment and storage medium for hybrid application
CN112860344A (en) * 2021-02-19 2021-05-28 中国工商银行股份有限公司 Component processing method and device, electronic equipment and storage medium
CN113220380A (en) * 2021-05-25 2021-08-06 北京小米移动软件有限公司 Calling method and device of local native program, electronic equipment and storage medium
CN113489600B (en) * 2021-06-08 2024-05-10 北京达佳互联信息技术有限公司 Network parameter configuration method, device and storage medium
CN114840276A (en) * 2022-04-15 2022-08-02 北京百度网讯科技有限公司 Object calling method, device, equipment, storage medium and program product
CN115373595B (en) * 2022-07-21 2023-09-01 华为技术有限公司 Storage system access method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106126284A (en) * 2016-06-21 2016-11-16 东软集团股份有限公司 The method and device shown for application program UI
CN109408250A (en) * 2018-09-27 2019-03-01 天津字节跳动科技有限公司 Call application programming interface API approach, device, electronic equipment
CN110221813A (en) * 2019-05-27 2019-09-10 北京小米移动软件有限公司 Data connection establishing method, device, storage medium and the electronic equipment of application
CN110659028A (en) * 2019-09-30 2020-01-07 北京达佳互联信息技术有限公司 Data processing system, method, device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9092235B2 (en) * 2012-05-25 2015-07-28 Microsoft Technology Licensing, Llc Virtualizing integrated calls to provide access to resources in a virtual namespace

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106126284A (en) * 2016-06-21 2016-11-16 东软集团股份有限公司 The method and device shown for application program UI
CN109408250A (en) * 2018-09-27 2019-03-01 天津字节跳动科技有限公司 Call application programming interface API approach, device, electronic equipment
CN110221813A (en) * 2019-05-27 2019-09-10 北京小米移动软件有限公司 Data connection establishing method, device, storage medium and the electronic equipment of application
CN110659028A (en) * 2019-09-30 2020-01-07 北京达佳互联信息技术有限公司 Data processing system, method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111290806A (en) 2020-06-16

Similar Documents

Publication Publication Date Title
CN111290806B (en) Calling method and device of application program interface, computer equipment and storage medium
CN111428462B (en) Communication protocol template construction method and terminal equipment
CN109213611B (en) Cross-process communication method, device, terminal and storage medium
WO2017166447A1 (en) Method and device for loading kernel module
US9665465B1 (en) Automated determination of application permissions
US11726799B2 (en) Preventing framework conflicts for multi-OS applications
US7536599B2 (en) Methods and systems for validating a system environment
CN110457038B (en) Card display method, device and equipment of auxiliary application terminal and storage medium
KR20090007614A (en) Portable object serialization
CN114528044B (en) Interface calling method, device, equipment and medium
CN113448756B (en) Inter-process communication system and method and computing device
CN110221840B (en) Function implementation method and device of application program, equipment and storage medium
US20220035731A1 (en) Test method based on improved rest protocols and electronic device
CN114461223A (en) Code generation method and device and terminal equipment
CN112732547B (en) Service testing method and device, storage medium and electronic equipment
CN113760318A (en) Information processing method, information processing apparatus, server, and storage medium
CN113515271B (en) Service code generation method and device, electronic equipment and readable storage medium
CN115904317A (en) Method, device, equipment and storage medium for uniformly calling front-end interface and back-end interface
CN111970349B (en) Communication system, method, device, equipment and medium based on remote procedure call
CN113760490B (en) Method and device for processing micro-service, electronic equipment and storage medium
CN112748930B (en) Compilation detection method, device, equipment and storage medium
CN112261072B (en) Service calling method, device, equipment and storage medium
CN114489667A (en) Script generation method and device, electronic equipment and storage medium
CN113761588A (en) Data verification method and device, terminal equipment and storage medium
CN112988192A (en) Version updating method and device, electronic equipment and storage medium

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