CN112612460A - Interface packaging and calling method, electronic device and storage medium - Google Patents

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

Info

Publication number
CN112612460A
CN112612460A CN202011581640.8A CN202011581640A CN112612460A CN 112612460 A CN112612460 A CN 112612460A CN 202011581640 A CN202011581640 A CN 202011581640A CN 112612460 A CN112612460 A CN 112612460A
Authority
CN
China
Prior art keywords
interface
service
class
party
plug
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.)
Pending
Application number
CN202011581640.8A
Other languages
Chinese (zh)
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.)
Beijing Ruian Technology Co Ltd
Original Assignee
Beijing Ruian 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 Beijing Ruian Technology Co Ltd filed Critical Beijing Ruian Technology Co Ltd
Priority to CN202011581640.8A priority Critical patent/CN112612460A/en
Publication of CN112612460A publication Critical patent/CN112612460A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Abstract

The invention relates to an interface packaging and calling method, wherein the packaging method comprises the following steps: creating a WebService service project to serve as a development framework of an interface query service system; creating a universal three-party interface query class by using a Java reflection mechanism; generating a JAVA file package plug-in for an interface file provided by any third-party company and adding the JAVA file package plug-in into an interface query service system; creating a plug-in configuration file in the interface query service system for configuring the class path corresponding to one or more added JAVA file package plug-ins and the contained interface name; creating an initialization method for the interface query service system to start any JAVA file package plug-in; creating a service layer class, and creating a uniform calling method in the service layer class. The invention can reduce the coupling degree between the called interface and the main code, is convenient for code maintenance, improves code reusability and can flexibly process different requests.

Description

Interface packaging and calling method, electronic device and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computer application, in particular to an interface packaging and calling method, electronic equipment and a storage medium.
Background
Based on the enterprise that needs to heavily interface and call third party data, almost every project needs to heavily interface and call third party data interfaces, and therefore it is necessary to develop a common component that calls third party interfaces.
For the docking and calling of the third-party interface, the commonly adopted method comprises the following steps: one is to adopt the most direct and common interface calling method, namely to use httpparent to connect the three-party interface in the code needing query calling and return data. Another method is to encapsulate the interface request into a tool class, and when the tool class is called, the request address and parameters are transmitted to obtain the return data, that is, a common connection layer is encapsulated on the basis of the former method, the address is transmitted, and the request parameters obtain the return data.
According to the two methods for butting and calling the third-party interfaces, the called interfaces and the main code form high coupling, the maintenance is inconvenient, the reusability is low, and different results or objects returned by different requests cannot be flexibly processed.
Disclosure of Invention
In view of this, embodiments of the present invention provide an interface packaging and calling method, an electronic device, and a storage medium, so as to provide an entry system for querying a three-party interface uniformly for each item, where codes achieve low coupling, high cohesion, and high reusability.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of embodiments of the invention.
In a first aspect of the present disclosure, an embodiment of the present invention provides an interface packaging method, including:
creating a WebService service project to serve as a development framework of an interface query service system;
creating a universal three-party interface query Class by using a Java reflection mechanism, wherein a return object of the three-party interface query Class adopts a Class general type;
generating a JAVA file package plug-in for an interface file provided by any third party company, and adding the jar file package plug-in into the interface query service system;
creating a plug-in configuration file in the interface query service system for configuring class paths corresponding to one or more added JAVA file package plug-ins and contained interface names;
creating an initialization method used when the interface query service system starts any JAVA file package plug-in, and when any host system calls any interface provided by any third party company, reading the name and the class path of the corresponding JAVA file package plug-in from the plug-in configuration file by executing the initialization method and then loading the name and the class path into a global resource container;
creating a service layer class and creating a uniform calling method for any host system to call any interface provided by any third party company in the service layer class.
In an embodiment, the parameters transmitted by the unified calling method include a return object, a request parameter map of a three-party interface, a JAVA package plug-in name and a connection time, wherein the return object adopts a Class general type.
In one embodiment, the initialization method is used for: when any main system calls any interface provided by any third-party company, the name and the class path of the corresponding JAVA file package plug-in are read from the plug-in configuration file by executing the initialization method and then loaded into the global resource container.
In one embodiment, when any host system calls any interface provided by any third-party company through the unified calling method, a web service mode of Hessian is adopted for connection query.
In one embodiment, creating a WebService service item includes: a web project using SpringMVC is created.
In a second aspect of the present disclosure, an embodiment of the present invention further provides an interface calling method, executed by any host system, including: defining corresponding three-party interface object in configuration file of the main system, and assigning service interface attribute and service address attribute to the three-party interface object
In response to receiving a third-party interface request, calling an interface generated by the encapsulation method of the interface according to any one of the first aspect to query a service interface provided by a service system.
In an embodiment, the service interface provided by the interface query service system is a Hessian service interface.
In a third aspect of the disclosure, an electronic device is provided. The electronic device includes: a processor; and a memory for storing executable instructions that, when executed by the processor, cause the electronic device to perform the method of the first aspect.
In a fourth aspect of the disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the method in the first aspect.
The technical scheme provided by the embodiment of the invention has the beneficial technical effects that:
the embodiment of the invention creates a WebService service project to be used as a development framework of an interface query service system, uses a Java reflection mechanism to create a universal three-party interface query class, generates a JAVA file package plug-in for an interface file provided by any third party company, adds the jar file package plug-in into the interface query service system, creates a plug-in configuration file in the interface query service system for configuring the class path corresponding to one or more added JAVA file package plug-ins and the contained interface name, creates an initialization method for the interface query service system when starting any JAVA file package plug-in, when any host system calls any interface provided by any third party company, reads the name and class path of the corresponding JAVA file package plug-in from the plug-in configuration file by executing the initialization method and then loads the corresponding JAVA file package plug-in into a global resource container, the method comprises the steps of creating a service layer class, creating a uniform calling method for any host system to call any interface provided by any third party company in the service layer class, reducing the coupling degree between the called interface and the main code, facilitating code maintenance, improving code reusability and flexibly processing different requests.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only a part of the embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the contents of the embodiments of the present invention and the drawings without creative efforts.
FIG. 1 is an interaction diagram of encapsulation and invocation of an interface provided in accordance with an embodiment of the present invention;
fig. 2 is a schematic flowchart of a packaging method of an interface according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a method for calling an interface according to an embodiment of the present invention;
FIG. 4 shows a schematic diagram of an electronic device suitable for use in implementing embodiments of the present invention.
Detailed Description
In order to make the technical problems solved, the technical solutions adopted and the technical effects achieved by the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings, and it is obvious that the described embodiments are only some embodiments, but not all embodiments, of the embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, belong to the scope of protection of the embodiments of the present invention.
It should be noted that the terms "system" and "network" are often used interchangeably herein in embodiments of the present invention. Reference to "and/or" in embodiments of the invention is intended to include any and all combinations of one or more of the associated listed items. The terms "first", "second", and the like in the description and claims of the present disclosure and in the drawings are used for distinguishing between different objects and not for limiting a particular order.
It should be further noted that, in the embodiments of the present invention, each of the following embodiments may be executed alone, or may be executed in combination with each other, and the embodiments of the present invention are not limited in this respect.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
The technical solutions of the embodiments of the present invention are further described by the following detailed description with reference to the accompanying drawings.
Fig. 1 is an interaction diagram of encapsulation and invocation of an interface according to an embodiment of the present invention, and as shown in fig. 1, an object of an embodiment of the present invention is to provide a uniform three-party interface query entry system for each host system, that is, the three-party query interface system shown in fig. 1, which enables each host system to implement low coupling, high cohesion, and high reusability of a call code when each host system calls a third-party interface, and different host system items can obtain different returned result objects and processing results through the uniform query entry.
In the embodiment, the third-party interface is queried separately from each main system through the three-party query interface system, low coupling and high cohesion of the third-party interface and each main system are realized through Hessian lightweight service call data, and uniform third-party interface query service is provided for each main system. The interfaces are not mutually dependent, and different returned objects are obtained through a java reflection mechanism and a generic type according to data returned by different interfaces, so that the query modes of the interfaces are unified, and codes are multiplexed. When a new three-party interface needs to be developed, the developed interface codes are packaged into jar packages and are put into an interface query service system and configured in an xml file, and then the interface query service system can take effect and query. When the interface is abnormal, only the method of the interface needs to be tested without debugging other codes of the main system when faults are eliminated, the workload of searching and debugging is greatly reduced, the debugging time is saved, jar packets are printed again after modification and are put into the interface query service system, the codes of the main system do not need to be modified, and the main system is packaged again and started.
Fig. 2 is a schematic flowchart illustrating an interface packaging method according to an embodiment of the present invention, where this embodiment is applicable to a case where a third-party interface entry is provided for invoking a third-party interface to obtain data, and as shown in fig. 2, the interface packaging method according to this embodiment includes:
in step S210, a WebService service item is created as an interface to query the development framework of the service system.
For example, a generic SpringMVC web project may be created, an abstract class PluginThread created and inherits Callabl < T >, the Map variable of the write request parameters, and the global resource Container object Container. The global resource Container object Container is used for storing global resources and storing data including interface plug-in objects loaded during initialization, and the abstract class PluginThread is a parent class which the interface plug-ins need to inherit.
In step S220, a Java reflection mechanism is used to create a universal three-party interface query Class, where a Class generic type is used as a return object of the three-party interface query Class.
For example, the third party data in the travel aspect is needed by a plurality of host systems of the current enterprise, and a plurality of three-party interfaces can be used, such as an interface provided by 12306 for supporting the acquisition of 12306 train ticket number and ticket price inquiry, an interface provided by where for supporting the acquisition of the content of where network, an interface provided by a tourist for supporting the content of a tourist network, an interface provided by a portable terminal for supporting the content of a tourist network, and an interface provided by an artistic dragon for supporting the acquisition of the product data.
In the embodiment, a java reflection mechanism and a generic flexible dynamic object creating mechanism are used to create the object and call the attribute of the object, so that different data objects returned by different three-party interfaces can be obtained.
In step S230, a JAVA package plug-in is generated for the interface file provided by any third party company, and the jar package plug-in is added to the interface query service system.
The method comprises the steps that a common java project creates a three-party interface query class, the class inherits a PluginThread class and rewrites an Override call method, a specific three-party interface request step is written in the call method, returned data are obtained and packaged into a specific object to be returned, the class is packaged into a jar packet to be placed into the web project, and the method can be called an interface query system.
For interface information configuration, an interface plug-in configuration extensible markup language xml file can be created, and information such as the name of each interface and the path of a class is configured in the xml file.
Specifically, a bean object with a type of HessianServiceExporter may be defined in the configuration file of SpringMVC, and the bean object needs to receive two attributes, one is a service attribute for associating the real service object and the service layer class created in step S330, and the other is a service interface attribute for specifying the interface corresponding to the current service. The HessianserviceExporter implements an HttpRequestHandler interface, and when the main system requests an interface query call, the HessianserviceExporter object corresponding to the interface is actually requested.
Therefore, each interface code is packaged into a jar package plug-in a plug-in form, and the jar package plug-in is placed into the interface query system and configured on the xml file. And reading the xml file to obtain the information of the plug-in file when the system is initialized, and putting the plug-in file into a memory for each main system to call.
In step S240, a plug-in configuration file is created in the interface query service system for configuring the class path corresponding to the added one or more JAVA package plug-ins and the included interface name.
In step S250, an initialization method used when the interface query service system starts any JAVA package plug-in is created, and when any host system calls any interface provided by any third party company, the initialization method is executed to read the name and class path of the corresponding JAVA package plug-in from the plug-in configuration file and load the JAVA package plug-in into the global resource container.
For example, an initialization class may be created, and when the interface query system is started, the class initialization method is run, and the class initialization method reads the xml file configured in step S330, and obtains information such as the name of the plug-in, the class path, and the like, and loads the information to the global resource container.
The initialization method can be used for reading the name and the class path of the corresponding JAVA file package plug-in from the plug-in configuration file and loading the corresponding JAVA file package plug-in into the global resource container by executing the initialization method when any host system calls any interface provided by any third party company.
According to one or more embodiments of the present disclosure, when any host system can call any interface provided by any third-party company through the unified call method, a web service manner of Hessian is adopted to connect the query. Hessian is a lightweight remoting onhttp tool that provides RMI (Remote Method Invocation) functionality using simple methods. Compared with the common WebService service, Hessian is simpler and quicker.
It should be noted that RMI is implemented in JDK1.2 using Java, which greatly enhances the ability of Java to develop distributed applications. Java is a popular network development language, and its power is reflected in its strong ability to develop distributed network applications, while RMI is one of the core solutions for developing one hundred percent pure Java network distributed application systems. In fact it can be seen as a Java version of RPC (Remote Procedure Call).
In step S260, a service layer class is created, and a uniform calling method for any host system to call any interface provided by any third-party company is created in the service layer class.
In order to unify and facilitate the calling, the method for loading the interface can be provided with a unified method for setting a calling interface of a main system, the transmitted parameters are respectively a Class general type of a returned result, a request parameter map of a three-party interface, an interface plug-in name and connection time, and the returned result uses the general type.
The method for loading the interface can be specifically realized by the following steps: acquiring an object Plugin of the plug-in a global resource container through an incoming interface plug-in name, wherein the object comprises an interface plug-in name, a class path, and a Constructor object Constructor < PluginThread? > > etc.), obtain the constructor object for the plug-in object, and then create an instance PluginThread <? If the result is not valid, the thread is used to submit the instance task and return the result.
For the calling of a plurality of main systems, the multi-thread mode can be adopted to execute and quickly call the interface.
According to one or more embodiments of the disclosure, the parameters introduced by the unified calling method include a return object, a request parameter map of a three-party interface, a JAVA package plug-in name, a connection time and the like, wherein the return object may adopt a Class general type.
By separating the query from the main system and calling data through the Hessian lightweight service, the low coupling and high cohesion with the system are realized, and a uniform third-party interface query service is provided for each system. The interfaces are not mutually dependent, and different returned objects are obtained through a java reflection mechanism and a generic type according to data returned by different interfaces, so that the query is unified, and the codes are multiplexed. When a new three-party interface needs to be developed, the developed interface codes are packaged into jar packages and are put into an interface query system and configured in an xml file, and then the jar packages can be effective and queried. When the interface is abnormal, only the method of the interface needs to be tested without debugged other codes of the main system, so that the time for searching the bug and solving the bug is greatly reduced, the jar packet is re-packed and put into the interface query system after modification, the code of the main system does not need to be modified, and the main system is re-packed and started.
The embodiment creates a WebService service project to serve as a development framework of an interface query service system, uses a Java reflection mechanism to create a universal three-party interface query class, generates a JAVA file package plug-in for an interface file provided by any third-party company, adds the jar file package plug-in into the interface query service system, creates a plug-in configuration file in the interface query service system for configuring a class path corresponding to one or more added JAVA file package plug-ins and an interface name contained in the added JAVA file package plug-ins, creates an initialization method for the interface query service system when starting any JAVA file package plug-in, and when any main system calls any interface provided by any third-party company, reads the name and class path of the corresponding JAVA file package plug-in from the plug-in configuration file by executing the initialization method and then loads the JAVA file package plug-in a global resource container, the method comprises the steps of creating a service layer class, creating a uniform calling method for any host system to call any interface provided by any third party company in the service layer class, reducing the coupling degree between the called interface and the main code, facilitating code maintenance, improving code reusability and flexibly processing different requests.
Fig. 3 is a schematic flow chart illustrating another interface calling method according to an embodiment of the present invention, where the embodiment uses the interface packaged in the foregoing embodiment as a basis to make a call. As shown in fig. 3, the method for calling an interface according to this embodiment includes:
in step S310, a corresponding three-party interface object is defined in the configuration file of the host system, and a service interface attribute and a service address attribute are specified for the three-party interface object.
The following attributes of the corresponding following objects may be defined in the configuration file of the host system:
a spring frame moving. calculating. cause. sessionproxyfactor bean object in which a serviceInterface attribute and a serviceUrl attribute are specified.
The HessiansproxyFactoryBean object needs to specify two attributes, one is a serviceInterface attribute which represents an interface corresponding to the remote service (namely, the interface query system) of the current request; the other is a serviceUrl attribute which indicates the request address of the server (i.e. interface query system) corresponding to the current remote service.
In step S320, in response to receiving the third-party interface request, an interface built by a predetermined interface packaging method is called to query a service interface provided by the service system.
When the main system needs to request a third-party interface, the Hessian service interface provided by the interface query system is called.
According to the technical scheme, the three-party system can be inquired by each main system project through the unified interface, codes used for inquiring the interface and adopted by each main system can achieve low coupling, high cohesion and high reusability, and different main system projects can obtain different returned result objects and processing results through the unified inquiry interface.
Referring now to FIG. 4, a block diagram of an electronic device 400 suitable for use in implementing embodiments of the present invention is shown. The terminal device in the embodiment of the present invention is, for example, a mobile device, a computer, or a vehicle-mounted device built in a floating car, or any combination thereof. In some embodiments, the mobile device may include, for example, a cell phone, a smart home device, a wearable device, a smart mobile device, a virtual reality device, and the like, or any combination thereof. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 4, electronic device 400 may include a processing device (e.g., central processing unit, graphics processor, etc.) 401 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage device 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the electronic apparatus 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
Generally, the following devices may be connected to the I/O interface 405: input devices 406 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 407 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 408 including, for example, tape, hard disk, etc.; and a communication device 409. The communication means 409 may allow the electronic device 400 to communicate wirelessly or by wire with other devices to exchange data. While fig. 4 illustrates an electronic device 400 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as a computer software program. For example, embodiments of the invention include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 409, or from the storage device 408, or from the ROM 402. The computer program performs the above-described functions defined in the methods of embodiments of the invention when executed by the processing apparatus 401.
It should be noted that the computer readable medium mentioned above can be a computer readable signal medium or a computer readable storage medium or any combination of the two. 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 of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In yet another embodiment of the invention, a computer readable signal medium may comprise 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: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: creating a WebService service project to serve as a development framework of an interface query service system; creating a universal three-party interface query Class by using a Java reflection mechanism, wherein a return object of the three-party interface query Class adopts a Class general type; generating a JAVA file package plug-in for an interface file provided by any third party company, and adding the jar file package plug-in into the interface query service system; creating a plug-in configuration file in the interface query service system for configuring class paths corresponding to one or more added JAVA file package plug-ins and contained interface names; creating an initialization method used when the interface query service system starts any JAVA file package plug-in, and when any host system calls any interface provided by any third party company, reading the name and the class path of the corresponding JAVA file package plug-in from the plug-in configuration file by executing the initialization method and then loading the name and the class path into a global resource container; creating a service layer class and creating a uniform calling method for any host system to call any interface provided by any third party company in the service layer class.
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).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The foregoing description is only a preferred embodiment of the invention and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure in the embodiments of the present invention is not limited to the specific combinations of the above-described features, but also encompasses other embodiments in which any combination of the above-described features or their equivalents is possible without departing from the spirit of the disclosure. For example, the above features and (but not limited to) the features with similar functions disclosed in the embodiments of the present invention are mutually replaced to form the technical solution.

Claims (9)

1. A method for packaging an interface, comprising:
creating a WebService service project to serve as a development framework of an interface query service system;
creating a universal three-party interface query Class by using a Java reflection mechanism, wherein a return object of the three-party interface query Class adopts a Class general type;
generating a JAVA file package plug-in for an interface file provided by any third party company, and adding the jar file package plug-in into the interface query service system;
creating a plug-in configuration file in the interface query service system for configuring class paths corresponding to one or more added JAVA file package plug-ins and contained interface names;
creating an initialization method used when the interface query service system starts any JAVA file package plug-in, and when any host system calls any interface provided by any third party company, reading the name and the class path of the corresponding JAVA file package plug-in from the plug-in configuration file by executing the initialization method and then loading the name and the class path into a global resource container;
creating a service layer class and creating a uniform calling method for any host system to call any interface provided by any third party company in the service layer class.
2. The method for encapsulating the interface according to claim 1, wherein the parameters introduced by the unified calling method comprise a return object, a request parameter map of a three-party interface, a JAVA file package plug-in name and a connection time, wherein the return object adopts a Class general type.
3. The method for encapsulating the interface according to claim 1, wherein the initialization method is configured to: when any main system calls any interface provided by any third-party company, the name and the class path of the corresponding JAVA file package plug-in are read from the plug-in configuration file by executing the initialization method and then loaded into the global resource container.
4. The method for packaging an interface of claim 1, wherein when any host system calls any interface provided by any third party company through the unified call method, a web service manner of Hessian is adopted for connection query.
5. The method for packaging an interface of claim 1, wherein creating a WebService service item comprises: a web project using SpringMVC is created.
6. An interface calling method, performed by any host system, comprising:
defining a corresponding three-party interface object in a configuration file of the main system, and assigning a service interface attribute and a service address attribute to the three-party interface object;
in response to receiving a third-party interface request, calling an interface built by the interface packaging method according to any one of claims 1-5 to inquire a service interface provided by a service system.
7. The interface calling method according to claim 6, wherein the service interface provided by the interface query service system is a Hessian service interface.
8. An electronic device, comprising:
a processor; and
a memory to store executable instructions that, when executed by the one or more processors, cause the electronic device to perform the method of any of claims 1-7.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202011581640.8A 2020-12-28 2020-12-28 Interface packaging and calling method, electronic device and storage medium Pending CN112612460A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011581640.8A CN112612460A (en) 2020-12-28 2020-12-28 Interface packaging and calling method, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011581640.8A CN112612460A (en) 2020-12-28 2020-12-28 Interface packaging and calling method, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN112612460A true CN112612460A (en) 2021-04-06

Family

ID=75248365

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011581640.8A Pending CN112612460A (en) 2020-12-28 2020-12-28 Interface packaging and calling method, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN112612460A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626109A (en) * 2021-09-17 2021-11-09 平安普惠企业管理有限公司 Report path acquisition method and device, intelligent terminal and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105867944A (en) * 2016-04-19 2016-08-17 郑州宇通客车股份有限公司 Web front-end terminal operating layer and implementing method thereof
US20170286069A1 (en) * 2016-03-29 2017-10-05 Microsoft Technology Licensing, Llc Generating a services application
CN108958842A (en) * 2018-07-12 2018-12-07 北京猫眼文化传媒有限公司 The business plug-in unit application method of application program and application program
WO2019104973A1 (en) * 2017-11-30 2019-06-06 平安科技(深圳)有限公司 Cross-language invoking method, server, and storage medium
CN109857404A (en) * 2019-01-11 2019-06-07 平安科技(深圳)有限公司 The packaging method and device of SDK interface, storage medium, electronic equipment
CN111897527A (en) * 2020-06-28 2020-11-06 福建亿能达信息技术股份有限公司 Hospital equipment budget management system, equipment and medium based on holographic view

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170286069A1 (en) * 2016-03-29 2017-10-05 Microsoft Technology Licensing, Llc Generating a services application
CN105867944A (en) * 2016-04-19 2016-08-17 郑州宇通客车股份有限公司 Web front-end terminal operating layer and implementing method thereof
WO2019104973A1 (en) * 2017-11-30 2019-06-06 平安科技(深圳)有限公司 Cross-language invoking method, server, and storage medium
CN108958842A (en) * 2018-07-12 2018-12-07 北京猫眼文化传媒有限公司 The business plug-in unit application method of application program and application program
CN109857404A (en) * 2019-01-11 2019-06-07 平安科技(深圳)有限公司 The packaging method and device of SDK interface, storage medium, electronic equipment
CN111897527A (en) * 2020-06-28 2020-11-06 福建亿能达信息技术股份有限公司 Hospital equipment budget management system, equipment and medium based on holographic view

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
SUNNY潘先生: "Java 通过反射获取泛型的类型", pages 1 - 4, Retrieved from the Internet <URL:https://blog.csdn.net/qq_42239765/article/details/107788985> *
WODEDIQIZHANG: "Hessian知识学习总结(三)——Spring + Hessian + Spring MVC", pages 1 - 10, Retrieved from the Internet <URL:https://blog.csdn.net/wodediqizhang/article/details/51723821> *
愚人节第二天: "SpringMVC整合Hessian远程服务调用", pages 1 - 7, Retrieved from the Internet <URL:https://blog.csdn.net/xnf1991/article/details/73896185> *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626109A (en) * 2021-09-17 2021-11-09 平安普惠企业管理有限公司 Report path acquisition method and device, intelligent terminal and storage medium

Similar Documents

Publication Publication Date Title
CN111176626B (en) Cross-programming-language code calling method and device, medium and equipment
CN109002362B (en) Service method, device and system and electronic equipment
CN110489101B (en) Interface simulation method, system, medium and electronic equipment
CN111488285B (en) Interface testing method, device, electronic equipment and computer readable storage medium
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN110489323B (en) Visual RPC API debugging method, device, medium and equipment
CN111221572B (en) Method, device, medium and equipment for automatically adapting to running environment
CN111581555B (en) Document loading method, device, equipment and storage medium
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN111651219A (en) Method and equipment for managing multi-module project configuration file
CN107977260B (en) Task submitting method and device
CN107273226B (en) Method and device for integrating components in android system and calling integrated components
CN109766319B (en) Compression task processing method and device, storage medium and electronic equipment
CN111459497A (en) WebPack-based resource package compiling method, system, server and storage medium
CN112612460A (en) Interface packaging and calling method, electronic device and storage medium
CN106775916B (en) Method and device for reducing application installation packages and electronic equipment
CN111414154A (en) Method and device for front-end development, electronic equipment and storage medium
WO2023083071A1 (en) View interaction method and apparatus, electronic device, and computer readable medium
CN113448585B (en) Compiling method and device of thread pool, electronic equipment and storage medium
CN114327404A (en) File processing method and device, electronic equipment and computer readable medium
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN115373869A (en) Process processing method and device based on AAR and electronic equipment
CN109669679B (en) Service detection and processing method and device and electronic equipment
CN109669720B (en) Chain type asynchronous request processing method and device based on Promise and electronic equipment
CN115809060B (en) Openlayers map construction method and device and electronic equipment

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