CN113742008A - Interface calling method and device, electronic equipment and storage medium - Google Patents

Interface calling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113742008A
CN113742008A CN202111068121.6A CN202111068121A CN113742008A CN 113742008 A CN113742008 A CN 113742008A CN 202111068121 A CN202111068121 A CN 202111068121A CN 113742008 A CN113742008 A CN 113742008A
Authority
CN
China
Prior art keywords
interface
target
called
character string
attribute information
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.)
Granted
Application number
CN202111068121.6A
Other languages
Chinese (zh)
Other versions
CN113742008B (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.)
Guahao Net Hangzhou Technology Co Ltd
Original Assignee
Guahao Net Hangzhou 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 Guahao Net Hangzhou Technology Co Ltd filed Critical Guahao Net Hangzhou Technology Co Ltd
Priority to CN202111068121.6A priority Critical patent/CN113742008B/en
Publication of CN113742008A publication Critical patent/CN113742008A/en
Application granted granted Critical
Publication of CN113742008B publication Critical patent/CN113742008B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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 invention discloses an interface calling method, an interface calling device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a target interface to be called, and analyzing the target interface to be called to obtain interface attribute information; determining reusable components corresponding to the interface attribute information; analyzing and processing a calling method template to obtain a character string to be used; and determining a target binary file based on the reusable component and the character string to be used so as to call the target interface to be called based on the target binary file. The technical scheme of the embodiment of the invention solves the problems of higher interface calling difficulty and higher error rate in the prior art, realizes the convenient calling of the interface and improves the calling performance of the interface.

Description

Interface calling method and device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to a computer application technology, in particular to an interface calling method and device, electronic equipment and a storage medium.
Background
During the development process, in order to realize certain functions, a developer needs to call a relevant interface from a server. In general, after a developer inputs parameters of an interface to be called, the developer needs to manually perform subsequent operations to call the interface, which brings great inconvenience to the developer.
At present, API is one of interfaces frequently called by developers in a software development stage, and for a calling method of the interface in the prior art, the developers need to know calling logic, so that the development workload is increased, and the beginners have high difficulty in starting; if various parameters in the interface are not known, problems such as affecting system performance are also likely to occur.
Disclosure of Invention
The invention provides an interface calling method, an interface calling device, electronic equipment and a storage medium, and aims to realize convenient calling of an interface.
In a first aspect, an embodiment of the present invention provides an interface calling method, where the method includes:
acquiring a target interface to be called, and analyzing the target interface to be called to obtain interface attribute information;
determining reusable components corresponding to the interface attribute information;
analyzing and processing a calling method template to obtain a character string to be used;
and determining a target binary file based on the reusable component and the character string to be used so as to call the target interface to be called based on the target binary file.
In a second aspect, an embodiment of the present invention further provides an interface invoking device, where the interface invoking device includes:
the interface to be called processing module is used for acquiring a target interface to be called and analyzing the target interface to be called to obtain interface attribute information;
the reusable component determining module is used for determining reusable components corresponding to the interface attribute information;
the calling method template processing module is used for analyzing and processing the calling method template to obtain a character string to be used;
and the binary file determining module is used for determining a target binary file based on the reusable component and the character string to be used so as to call the target interface to be called based on the target binary file.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement an interface call method as in any of the embodiments of the invention.
In a fourth aspect, the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the interface call method according to any one of the embodiments of the present invention.
According to the method and the device, the interface attribute information is obtained by analyzing the target interface to be called, the interface attribute information is recombined to form the reusable component, the calling method template is analyzed, the character string to be used of the replaceable parameter information is obtained, the parameter information in the character string to be used is replaced by the parameter information in the reusable component, and the target binary file is obtained, so that a user can call the target interface according to the binary file, the problems that a beginner has high difficulty in calling the interface, high error rate and the like in the prior art are solved, convenience in calling the interface is realized, the code development amount of the calling interface is reduced, and the calling performance of the interface is improved.
Drawings
In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, a brief description is given below of the drawings used in describing the embodiments. It should be clear that the described figures are only views of some of the embodiments of the invention to be described, not all, and that for a person skilled in the art, other figures can be derived from these figures without inventive effort.
Fig. 1 is a schematic flowchart of an interface calling method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of an interface calling method according to a second embodiment of the present invention;
fig. 3 is a schematic flowchart of an interface calling method in an application scenario according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an interface calling apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of an interface calling method according to an embodiment of the present invention, where the embodiment is applicable to a case where an interface is called in a development process, and the method may be executed by an interface calling device according to an embodiment of the present invention, where the interface calling device may be implemented in a form of software and/or hardware, and the hardware may be an electronic device, such as a mobile terminal or a PC.
As shown in fig. 1, the method of the embodiment of the present invention specifically includes the following steps:
and 110, acquiring a target interface to be called, and analyzing the target interface to be called to obtain interface attribute information.
The target interface to be called may be understood as an interface waiting to be called at the present time, or an interface to be called by other developers. In this embodiment, the target Interface to be called may be an API (Application Programming Interface). The API may refer to some predefined interfaces, for example, the API may include a function or an HTTP interface, and the present embodiment does not limit this. An API may be used to provide applications and developers the ability to access a set of routines based on certain software or hardware without having to access source code or understand the details of internal working mechanisms.
The interface attribute information may be understood as various information including the property of the interface and the relationship between the interfaces. Optionally, the interface attribute information may include an entry, an exit, a method name, and the like, which is not limited in this embodiment. It should be noted that the entry may refer to parameter information input by a developer when the target interface to be called is called, and may be used to indicate to the server what interface needs to be called. The parameter output may refer to data information fed back to a developer after the target to-be-called interface is called based on the parameter input according to the calling method. For example, in JAVA, an in-argument may refer to a request parameter and an out-argument may refer to a return parameter. A method name may refer to a name of a method that is used to solve a certain thing or implement a certain function, and is obtained by following a naming rule.
Specifically, after the client acquires the target to-be-called interface, the client needs to perform analysis processing on the target to-be-called interface before performing subsequent operations on the target to-be-called interface, so as to obtain interface attribute information corresponding to the target to-be-called interface. It should be noted that the interface attribute information generally exists in the form of Key-Value Key Value pairs. However, the interface attribute information obtained by analysis only contains keys in Key-Value Key Value pairs, but does not contain Value values, and the Value values can be determined according to parameters input when a certain interface needs to be called subsequently.
And step 120, determining reusable components corresponding to the interface attribute information.
The reusable components can be understood as new software formed by partially modifying or not modifying past components. In this embodiment, the reusable component may be a JavaBean. The JavaBean is a reusable component written by applying JAVA language. Users can use javabeans to package functions, processes, values, database accesses and any other objects that can be created in JAVA code, and other developers can use these objects through internal JSP pages, servlets, other javabeans, applets or applications. The user can think that the JavaBean provides a copy and paste function anytime and anywhere without concern for any changes.
Specifically, after the interface attribute information of the target interface to be called is obtained through analysis, the server can recombine according to part of information in the interface attribute information, and the reusable component is automatically generated. The reusable component comprises certain interface attribute information corresponding to the target interface to be called.
And step 130, analyzing and processing the calling method template to obtain a character string to be used.
A calling method may be understood as a set of statements or code that perform the function of calling an interface. The calling method template may refer to a preset template corresponding to attribute information in each calling method, or may be understood as a test method written based on form parameters, in which form parameters are used to replace specific input parameters. The formal parameters, which may also be referred to as virtual parameters, are parameters used in defining the name and body of a method in a test method, and the function of the formal parameters may be to receive specific parameters input when the method is called. It should be noted that the language used for calling the method template may be a general-purpose programming language, and the general-purpose programming language may be Objective-C, Java, Python, C language, or the like.
Wherein a string may refer to a string of characters consisting of numbers, letters, and underlines. In this embodiment, the character string to be used may be understood as a string of characters that can be replaced by the parameter information, obtained after the calling method template is parsed. Various parameter information in the character string can be replaced according to different calling interfaces. The character string may be in json format or in other formats, which is not limited in this embodiment
Specifically, after the server analyzes the predefined calling method template, a string of characters which can replace the parameter information therein can be obtained, so that the server can replace the parameter information in the string of characters according to the difference of target interfaces to be called by developers.
And step 140, determining a target binary file based on the reusable component and the character string to be used.
The target binary file can be understood as a code file which is obtained in the current project operation process and can realize a specific function. Binary files may refer to files containing data or instructions written in ASCII and extended ASCII characters. The binary file is a file for coding values, and the functions of the binary file can include saving storage space, being convenient for storage process, and for some more accurate data, the loss of valid bits and the like can not be caused by using the binary file for storage.
Specifically, after the reusable component containing the interface attribute information and the character string to be used obtained by analyzing according to the calling method template are obtained, the parameter information in the character string to be used is replaced by the interface attribute information such as the input and output parameters, the method name and the like in the reusable component to form new file information, and the new file information is stored in a corresponding position in a form of a binary file which can be recognized by a machine, so that a developer can call a target interface to be called based on the binary file.
According to the embodiment of the invention, the target interface to be called is analyzed to obtain the interface attribute information, the interface attribute information is recombined to form the reusable component, the calling method template is analyzed to obtain the character string to be used capable of replacing the parameter information, the parameter information in the character string to be used is replaced by the parameter information in the reusable component to obtain the target binary file, so that a user can call the target interface according to the binary file, the problems of high difficulty, high error rate and the like of a beginner on calling the interface in the prior art are solved, the convenience of calling the interface is realized, the code development amount of the calling interface is reduced, and the calling performance of the interface is improved.
Example two
Fig. 2 is a schematic flowchart of an interface calling method according to a second embodiment of the present invention. On the basis of the above technical solutions, the present embodiment further refines the technical solutions. On the basis of any optional technical solution in the embodiment of the present invention, optionally after determining the reusable component corresponding to the interface attribute information, the embodiment further includes: and calling an encryption key corresponding to the target interface to be called from a database, and encrypting the interface attribute information based on a preset encryption tool and the encryption key to obtain an encrypted file.
On the basis of any optional technical solution in the embodiment of the present invention, optionally, after the obtaining the target interface to be called and performing analysis processing on the target interface to be called to obtain the interface attribute information, the method further includes: and generating a preprocessing class file based on the interface attribute information so as to write information corresponding to the reusable components and the character strings to be used in the preprocessing class file to obtain the target binary file.
The technical terms that are the same as or corresponding to the above embodiments are not repeated herein. As shown in fig. 2, the method of this embodiment specifically includes the following steps:
and step 210, acquiring the target interface to be called, analyzing the target interface to be called to obtain interface information corresponding to the target interface to be called, and obtaining the input and output parameters and the method name in the interface attribute information.
Step 220, generating a preprocessing class file based on the interface attribute information.
The preprocessing class file can be understood as a class file containing preprocessing commands. A pre-processing command may refer to a set of programs or code in a programming language for processing prior to compilation. Specifically, the interface attribute information obtained by analysis is combined with the source code of the operation interface attribute to form a "class". It should be noted that a class may include a member attribute and a member method, for example, the member attribute may correspond to interface attribute information, and the member method may be used to operate each attribute of the class.
It should be noted that the preprocessed class file generated according to the interface attribute information may be corresponding to the target to-be-called interface, and the preprocessed class file obtained at this time has no content, and may write content in a file in a subsequent operation, so as to obtain a data file required by a developer.
In this embodiment, a pre-processing class file including a pre-processing command is generated in advance according to interface attribute information such as an access parameter, an exit parameter, a method name and the like obtained after parsing, so that information corresponding to a reusable component and a character string to be used is written in the pre-processing class file to obtain a target binary file.
Step 230, determine reusable components corresponding to the interface attribute information.
Step 240, calling an encryption key corresponding to the target interface to be called from the database, and encrypting the interface attribute information based on a preset encryption tool and the encryption key to obtain an encrypted file.
The encryption key is understood to be a set of codes for both sending and receiving data, and the encryption and decryption operations are performed on the plaintext by using the same or symmetrical key. The encryption key may typically be a string of characters and may be changed as often as desired.
It should be noted that the encryption keys corresponding to each interface to be called are different, and before the interface attribute information is encrypted by applying the encryption keys, the encryption keys corresponding to the target interface to be called need to be called from the database, so that the encryption processing on the interface attribute information can be realized.
The encryption tool may be some code that protects the program or data. The encryption tool may function to protect the developer's own interests from pirating developed software or captured data information or that the developer only expects a subset of people to use it. In this embodiment, the encryption tool may be the MD5 algorithm. The MD5 algorithm is a widely used cryptographic hash function that generates a 128-bit (16-byte) hash value that can be used to ensure the integrity of the message transmission.
The encrypted file may be a data file obtained by encrypting the interface attribute information.
Specifically, after obtaining the analyzed interface attribute information such as the incoming call, the outgoing call, and the method name, it is necessary to encrypt the obtained information in order to prevent the obtained information from being stolen or leaked by other developers. Each interface is provided with an encryption key corresponding to the interface, some attribute information or all attribute information in the interface attribute information corresponding to the target interface to be called is encrypted, the encryption key corresponding to the target interface to be called needs to be called from a database, then the encryption key and the interface attribute information are combined by applying an MD5 algorithm to obtain the encrypted interface attribute information, and the encrypted interface attribute information is stored in a corresponding position to generate an encrypted file, so that developers can call the encrypted interface attribute information at any time, and the encrypted interface attribute information can be prevented from being stolen or leaked by other developers.
And step 250, analyzing and processing the calling method template to obtain a character string to be used.
The calling method template can be understood as a normative template of the interface calling method. Each interface calling method can find corresponding data information in the calling method template.
Step 260, generating a target character string based on the reusable component, the character string to be used and the encrypted file; and determining a target binary file based on the target character string and the preprocessing class file.
The target character string may be understood as a character string generated in the processing process of the target to-be-called interface at the current time, so that a developer may use the character string in subsequent operations.
In this embodiment, variable information in the character string to be used is replaced based on variable information in the reusable component, so as to obtain a character string to be processed; generating a target character string based on the character string to be processed and the encrypted file;
further, adding the target character string into the preprocessed class file to obtain a class file to be processed; and compiling the class file to be processed to obtain a target binary file corresponding to the target interface to be called, so as to determine interface feedback information corresponding to the interface request based on the target binary file when the interface request corresponding to the target interface to be called is received.
Specifically, after interface attribute information such as the analyzed entry and exit parameters and the method name is obtained and a preprocessing class file containing a preprocessing command is generated, various information in the interface attribute information is combined to generate the reusable component. Then, in order to prevent the obtained interface attribute information from being stolen or leaked by other developers, some attribute information in the interface attribute information needs to be encrypted, and an encryption tool is applied to combine an encryption key and the interface attribute information to generate an encrypted file, so that the developers can call the encrypted file at any time. It should be noted that, variable information in the character string to be used, which is obtained after the calling method template is analyzed, is form parameter information, and needs to be replaced according to different calling methods. And replacing variable information in the reusable component corresponding to the interface attribute information with variable information in the character string analyzed by the calling method template to generate a character string corresponding to the target interface to be called, so that a developer can perform subsequent processing on the generated character string information. And recombining the obtained character string to be processed and the encrypted file to obtain the target character string. Further, the obtained target character string is written into a preprocessing class file, and a class file which can be compiled and processed by a developer can be obtained. And compiling the class file to be processed to obtain a binary file corresponding to the target interface to be called. After receiving a call request for calling the interface corresponding to the target interface to be called, the server can feed back the target interface corresponding to the call request to developers according to the binary file corresponding to the target interface to be called.
In this embodiment, the API is analyzed to obtain interface attribute information such as an input parameter, an output parameter, a method name, and the like, and a predefined class file is generated; then, combining the attribute information of the interfaces such as the input parameter and the output parameter to generate a reusable component in a JavaBean form; encrypting the access information in the interface attribute information, and combining an encryption key with the access information by using a pre-constructed encryption tool to generate an encrypted file; analyzing the method template calling the API to obtain a character string capable of being replaced by variable information, so that the variable information in the character string can be replaced by the variable information in the JavaBean to generate a method character string capable of calling the API; recombining the obtained method character string and the interface attribute information in the encrypted file to generate a new method character string; writing the method character string into a predefined class file to generate one method in the class; and compiling the generated class file to obtain a binary file corresponding to the calling API interface, and providing the binary file for developers to use.
The embodiment of the invention obtains the interface attribute information by analyzing the target interface to be called, recombines the interface attribute information to generate the reusable component, encrypts some information in the interface attribute information, replaces the parameter information in the character string analyzed by the calling method template with the parameter information in the reusable component to form the character string capable of realizing calling of the target interface to be called, writes the character string into a pre-generated pre-processing file, and forms a binary file capable of being recognized by a server through compiling processing, so that a developer can call the target interface based on the binary file, the problems of high interface calling difficulty and high error rate in the prior art are solved, and the technical effects of enabling the developer to easily and conveniently call the target interface, shortening the calling time and improving the interface calling performance are achieved.
EXAMPLE III
In order to make the technical solutions of the embodiments of the present invention further clear to those skilled in the art, a specific application scenario example is given below by taking a target to-be-called interface as an API example.
Fig. 3 is a schematic flowchart of an interface calling method in an application scenario according to an embodiment of the present invention; as shown in fig. 3, the target to-be-called interface is an API.
The method of the embodiment of the invention can comprise the following steps:
the first step is as follows: obtaining an API;
the second step is that: analyzing the input and output of the API and the method name, and generating a predefined class file;
the third step: recombining the analyzed input parameter and the analyzed output parameter to generate a JavaBean file;
the fourth step: acquiring an encryption key from a database, and combining the participation information with the encryption key by using an MD5 algorithm to generate an encrypted file;
the fifth step: analyzing and calling the method template of the API to generate a character string; replacing variables in the JavaBean file with variable information in the JavaBean file to form a method character string capable of calling the API;
and a sixth step: and recombining the encrypted file containing the access information and the method character string capable of calling the API to generate the method character string.
The seventh step: writing the method character string into a predefined class file to form a method in the class;
eighth step: compiling the formed class file into a binary file through Javassist, and generating a jar package through JarOutputStream so that a user can realize convenient calling of an API based on an SDK.
According to the embodiment of the invention, the target interface to be called is analyzed to obtain the interface attribute information, the interface attribute information is recombined to form the reusable component, the calling method template is analyzed to obtain the character string to be used capable of replacing the parameter information, and the parameter information in the character string to be used is replaced by the parameter information in the reusable component to obtain the target binary file, so that a user can call the target interface according to the binary file, the problems of high difficulty, high error rate and the like of a beginner on calling the interface in the prior art are solved, the convenience of calling the interface is realized, the code development amount of the calling interface is reduced, and the calling performance of the interface is improved.
Example four
Fig. 4 is a schematic structural diagram of an interface invoking device according to a fourth embodiment of the present invention, where the interface invoking device includes: a to-be-called interface processing module 410, a reusable component determining module 420, a calling method template processing module 430, and a binary file determining module 440.
The interface to be called processing module 410 is configured to obtain a target interface to be called, and perform analysis processing on the target interface to be called to obtain interface attribute information;
a reusable component determining module 420 for determining a reusable component corresponding to the interface attribute information;
the calling method template processing module 430 is used for analyzing and processing the calling method template to obtain a character string to be used;
a binary file determining module 440, configured to determine a target binary file based on the reusable component and the to-be-used character string, so as to call the target to-be-called interface based on the target binary file.
According to the embodiment of the invention, the target interface to be called is analyzed to obtain the interface attribute information, the interface attribute information is recombined to form the reusable component, the calling method template is analyzed to obtain the character string to be used capable of replacing the parameter information, the parameter information in the character string to be used is replaced by the parameter information in the reusable component to obtain the target binary file, so that a user can call the target interface according to the binary file, the problems of high difficulty, high error rate and the like of a beginner on calling the interface in the prior art are solved, the convenience of calling the interface is realized, the code development amount of the calling interface is reduced, and the calling performance of the interface is improved.
Optionally, the interface to be called processing module 410 is configured to obtain the target interface to be called, analyze the target interface to be called to obtain interface information corresponding to the target interface to be called, and obtain an entry parameter, an exit parameter, and a method name in the interface attribute information.
Optionally, after determining the reusable component corresponding to the interface attribute information, the apparatus further includes: and the interface attribute information processing module is used for calling an encryption key corresponding to the target interface to be called from a database, and encrypting the interface attribute information based on a preset encryption tool and the encryption key to obtain an encrypted file.
Optionally, after the obtaining the target interface to be called and performing analysis processing on the target interface to be called to obtain the interface attribute information, the apparatus further includes: and the preprocessing class file generating module is used for generating a preprocessing class file based on the interface attribute information so as to write information corresponding to the reusable component and the character string to be used in the preprocessing class file to obtain the target binary file.
Optionally, the binary file determining module 440 further includes a character string generating unit and a binary file determining unit.
The character string generating unit is used for generating a target character string based on the reusable component, the character string to be used and the encrypted file; a binary file determining unit, configured to determine the target binary file based on the target character string and the pre-processing class file.
Optionally, the character string generating unit is further configured to replace variable information in the character string to be used based on the variable information in the reusable component, so as to obtain a character string to be processed; generating the target character string based on the character string to be processed and the encrypted file
Optionally, the binary file determining unit is further configured to add the target character string to the preprocessed class file to obtain a class file to be processed; and compiling the class file to be processed to obtain a target binary file corresponding to the target interface to be called, so as to determine interface feedback information corresponding to the interface request based on the target binary file when the interface request corresponding to the target interface to be called is received.
The interface calling device provided by the embodiment of the invention can execute the interface calling method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
It should be noted that, the units and modules included in the system are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention. FIG. 5 illustrates a block diagram of an exemplary electronic device 50 suitable for use in implementing embodiments of the present invention. The electronic device 50 shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 5, electronic device 50 is embodied in the form of a general purpose computing device. The components of the electronic device 50 may include, but are not limited to: one or more processors or processing units 501, a system memory 502, and a bus 503 that couples the various system components (including the system memory 502 and the processing unit 501).
Bus 503 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 50 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 50 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 502 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)504 and/or cache memory 505. The electronic device 50 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 506 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard drive"). Although not shown in FIG. 5, a magnetic 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 or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 503 by one or more data media interfaces. Memory 502 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 508 having a set (at least one) of program modules 507 may be stored, for instance, in memory 502, such program modules 507 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 507 generally perform the functions and/or methodologies of embodiments of the invention as described herein.
The electronic device 50 may also communicate with one or more external devices 509 (e.g., keyboard, pointing device, display 510, etc.), with one or more devices that enable a user to interact with the electronic device 50, and/or with any devices (e.g., network card, modem, etc.) that enable the electronic device 50 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 511. Also, the electronic device 50 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 512. As shown, the network adapter 512 communicates with the other modules of the electronic device 50 over the bus 503. It should be appreciated that although not shown in FIG. 5, other hardware and/or software modules may be used in conjunction with electronic device 50, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 501 executes various functional applications and data processing, for example, implementing an interface calling method provided by an embodiment of the present invention, by running a program stored in the system memory 502.
EXAMPLE six
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform an interface call method, including:
acquiring a target interface to be called, and analyzing the target interface to be called to obtain interface attribute information;
determining reusable components corresponding to the interface attribute information;
analyzing and processing a calling method template to obtain a character string to be used;
and determining a target binary file based on the reusable component and the character string to be used so as to call the target interface to be called based on the target binary file.
Computer storage media for embodiments of the invention may employ 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. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 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 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.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments 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 + + or the like 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. 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, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. An interface calling method, comprising:
acquiring a target interface to be called, and analyzing the target interface to be called to obtain interface attribute information;
determining reusable components corresponding to the interface attribute information;
analyzing and processing a calling method template to obtain a character string to be used;
and determining a target binary file based on the reusable component and the character string to be used so as to call the target interface to be called based on the target binary file.
2. The method according to claim 1, wherein the obtaining the target interface to be called and analyzing the target interface to be called to obtain interface attribute information comprises:
and acquiring the target interface to be called, analyzing the target interface to be called to obtain interface attribute information corresponding to the target interface to be called, and acquiring the input and output parameters and the method name in the interface attribute information.
3. The method of claim 1, after determining reusable components corresponding to the interface attribute information, further comprising:
and calling an encryption key corresponding to the target interface to be called from a database, and encrypting the interface attribute information based on a preset encryption tool and the encryption key to obtain an encrypted file.
4. The method according to claim 1, wherein after the obtaining the target interface to be called and analyzing the target interface to be called to obtain the interface attribute information, the method further comprises:
and generating a preprocessing class file based on the interface attribute information so as to write information corresponding to the reusable components and the character strings to be used in the preprocessing class file to obtain the target binary file.
5. The method of claim 4, wherein determining a target binary file based on the reusable component and the string to be used comprises:
generating a target character string based on the reusable component, the character string to be used and the encrypted file;
and determining the target binary file based on the target character string and the preprocessing class file.
6. The method of claim 5, wherein generating a target string based on the reusable component, the string to be used, and the encrypted file comprises:
replacing variable information in the character string to be used based on the variable information in the reusable component to obtain a character string to be processed;
and generating the target character string based on the character string to be processed and the encrypted file.
7. The method of claim 5, wherein determining the target binary file based on the target string and the pre-processing class file comprises:
adding the target character string into the preprocessing class file to obtain a class file to be processed;
and compiling the class file to be processed to obtain a target binary file corresponding to the target interface to be called, so as to determine interface feedback information corresponding to the interface request based on the target binary file when the interface request corresponding to the target interface to be called is received.
8. An interface invocation apparatus, comprising:
the target to-be-called interface processing module is used for acquiring a target to-be-called interface and analyzing the target to-be-called interface to obtain interface attribute information;
the reusable component determining module is used for determining reusable components corresponding to the interface attribute information;
the calling method template processing module is used for analyzing and processing the calling method template to obtain a character string to be used;
and the binary file determining module is used for determining a target binary file based on the reusable component and the character string to be used so as to call the target interface to be called based on the target binary file.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the interface call method as recited in any of claims 1-7.
10. A storage medium containing computer-executable instructions for performing the interface call method of any one of claims 1-7 when executed by a computer processor.
CN202111068121.6A 2021-09-13 2021-09-13 Interface calling method and device, electronic equipment and storage medium Active CN113742008B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111068121.6A CN113742008B (en) 2021-09-13 2021-09-13 Interface calling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111068121.6A CN113742008B (en) 2021-09-13 2021-09-13 Interface calling method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113742008A true CN113742008A (en) 2021-12-03
CN113742008B CN113742008B (en) 2024-04-02

Family

ID=78738279

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111068121.6A Active CN113742008B (en) 2021-09-13 2021-09-13 Interface calling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113742008B (en)

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6427228B1 (en) * 1999-05-12 2002-07-30 International Business Machines Corporation Combining a meta data file and java source code to dynamically create java classes and javabeans
CN1513145A (en) * 2001-06-07 2004-07-14 �Ҵ���˾ System and method of mapping between software objects and structure languige element-based documents
US20070101253A1 (en) * 2005-10-31 2007-05-03 Holger Bohle Systems and methods for extensible document generation
US20100318574A1 (en) * 2009-06-10 2010-12-16 International Business Machines Corporation Generating references to reusable code in a schema
KR20110114754A (en) * 2010-04-14 2011-10-20 (주)앵글스톤테크놀러지 Media containing a program convert sk-vm and wipi-java application to android application
CN108965486A (en) * 2018-10-08 2018-12-07 深圳市创维软件有限公司 A kind of document down loading method, system, server and storage medium
CN109032662A (en) * 2018-06-19 2018-12-18 上海陆家嘴国际金融资产交易市场股份有限公司 Code file generation method, device, computer equipment and storage medium
US20190138284A1 (en) * 2017-11-03 2019-05-09 International Business Machines Corporation Self re-encoding interpreted application
CN109857480A (en) * 2018-12-27 2019-06-07 优估(上海)信息科技有限公司 A kind of method and system of Administration API interface IP address
CN109885347A (en) * 2017-12-01 2019-06-14 财付通支付科技有限公司 A kind of acquisition methods of configuration data, device and terminal, system, storage medium
CN110309071A (en) * 2019-06-27 2019-10-08 杭州数梦工场科技有限公司 Test the generation method and module, test method and system of code
CN110674625A (en) * 2019-08-29 2020-01-10 浙江数链科技有限公司 Code generation method and device, computer equipment and storage medium
CN110806863A (en) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 Interface document generation method and device, electronic equipment and storage medium
CN110968296A (en) * 2019-12-03 2020-04-07 政采云有限公司 Data acquisition method, device, equipment and readable storage medium
CN111209005A (en) * 2020-01-06 2020-05-29 腾讯科技(深圳)有限公司 Method and apparatus for compiling program file, and computer-readable storage medium
CN111338717A (en) * 2020-03-27 2020-06-26 广州华多网络科技有限公司 Interface calling method, application program upgrading method, server and client
CN111459495A (en) * 2020-03-30 2020-07-28 招商局金融科技有限公司 Unit test code file generation method, electronic device and storage medium
CN112181542A (en) * 2020-09-30 2021-01-05 微医云(杭州)控股有限公司 Function calling method and device, electronic equipment and storage medium
CN113076153A (en) * 2021-03-29 2021-07-06 北京京东振世信息技术有限公司 Interface calling method and device
CN113238740A (en) * 2021-06-11 2021-08-10 腾讯科技(深圳)有限公司 Code generation method, code generation device, storage medium, and electronic apparatus

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6427228B1 (en) * 1999-05-12 2002-07-30 International Business Machines Corporation Combining a meta data file and java source code to dynamically create java classes and javabeans
CN1513145A (en) * 2001-06-07 2004-07-14 �Ҵ���˾ System and method of mapping between software objects and structure languige element-based documents
US20070101253A1 (en) * 2005-10-31 2007-05-03 Holger Bohle Systems and methods for extensible document generation
US20100318574A1 (en) * 2009-06-10 2010-12-16 International Business Machines Corporation Generating references to reusable code in a schema
KR20110114754A (en) * 2010-04-14 2011-10-20 (주)앵글스톤테크놀러지 Media containing a program convert sk-vm and wipi-java application to android application
US20190138284A1 (en) * 2017-11-03 2019-05-09 International Business Machines Corporation Self re-encoding interpreted application
CN109885347A (en) * 2017-12-01 2019-06-14 财付通支付科技有限公司 A kind of acquisition methods of configuration data, device and terminal, system, storage medium
CN109032662A (en) * 2018-06-19 2018-12-18 上海陆家嘴国际金融资产交易市场股份有限公司 Code file generation method, device, computer equipment and storage medium
CN108965486A (en) * 2018-10-08 2018-12-07 深圳市创维软件有限公司 A kind of document down loading method, system, server and storage medium
CN109857480A (en) * 2018-12-27 2019-06-07 优估(上海)信息科技有限公司 A kind of method and system of Administration API interface IP address
CN110309071A (en) * 2019-06-27 2019-10-08 杭州数梦工场科技有限公司 Test the generation method and module, test method and system of code
CN110674625A (en) * 2019-08-29 2020-01-10 浙江数链科技有限公司 Code generation method and device, computer equipment and storage medium
CN110806863A (en) * 2019-11-05 2020-02-18 泰康保险集团股份有限公司 Interface document generation method and device, electronic equipment and storage medium
CN110968296A (en) * 2019-12-03 2020-04-07 政采云有限公司 Data acquisition method, device, equipment and readable storage medium
CN111209005A (en) * 2020-01-06 2020-05-29 腾讯科技(深圳)有限公司 Method and apparatus for compiling program file, and computer-readable storage medium
CN111338717A (en) * 2020-03-27 2020-06-26 广州华多网络科技有限公司 Interface calling method, application program upgrading method, server and client
CN111459495A (en) * 2020-03-30 2020-07-28 招商局金融科技有限公司 Unit test code file generation method, electronic device and storage medium
CN112181542A (en) * 2020-09-30 2021-01-05 微医云(杭州)控股有限公司 Function calling method and device, electronic equipment and storage medium
CN113076153A (en) * 2021-03-29 2021-07-06 北京京东振世信息技术有限公司 Interface calling method and device
CN113238740A (en) * 2021-06-11 2021-08-10 腾讯科技(深圳)有限公司 Code generation method, code generation device, storage medium, and electronic apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KEEP THINKING: "如何使用Java代码自动生成一个JavaBean文件", Retrieved from the Internet <URL:https://blog.csdn.net/CNDXX_88/article/details/119744099> *
白想519: "golang深入源代码***之三:自动生成代码", Retrieved from the Internet <URL:https://www.jianshu.com/p/a9a9dbf15ffd> *

Also Published As

Publication number Publication date
CN113742008B (en) 2024-04-02

Similar Documents

Publication Publication Date Title
US11120018B2 (en) Spark query method and system supporting trusted computing
WO2020253061A1 (en) Page generating method and apparatus, computer device, and storage medium
CN108090351B (en) Method and apparatus for processing request message
CN107506256B (en) Method and device for monitoring crash data
US20110055813A1 (en) Black Box Testing Optimization Using Information from White Box Testing
US20200089873A1 (en) DYNAMIC CODE EXTRACTION-based AUTOMATIC ANTI-ANALYSIS EVASION AND CODE LOGIC ANALYSIS APPARATUS
CN112597454A (en) Code obfuscation method, code operation method, device, medium, and apparatus
JP7506266B2 (en) Blockchain-based data processing method and device
WO2022095518A1 (en) Automatic interface test method and apparatus, and computer device and storage medium
CN110457869B (en) Program compiling and encrypting method and device, storage medium and electronic equipment
CN111260080A (en) Process optimization method, device, terminal and storage medium based on machine learning
CN114925338A (en) Compiling method, device, equipment, medium and product
CN114866258A (en) Method and device for establishing access relationship, electronic equipment and storage medium
CN112965736A (en) Code processing method and device, electronic equipment and medium
CN114626061A (en) Webpage Trojan horse detection method and device, electronic equipment and medium
CN113051231A (en) File analysis method and device, computer equipment and storage medium
CN113742008B (en) Interface calling method and device, electronic equipment and storage medium
CN114978649B (en) Information security protection method, device, equipment and medium based on big data
CN114036364B (en) Method, apparatus, device, medium, and system for identifying crawlers
WO2023279698A1 (en) Data transmission method and system, computer device and storage medium
CN114756833A (en) Code obfuscation method, apparatus, device, medium, and program product
CN115442164A (en) Multi-user log encryption and decryption method, device, equipment and storage medium
CN115203674A (en) Automatic login method, system, device and storage medium for application program
CN112748930B (en) Compilation detection method, device, equipment and storage medium
CN113254889A (en) Code encryption method and 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