Interface calling method, device, computer equipment and storage medium
By dividing the system into multiple method code blocks according to functions, the system complexity and workload problems caused by the increase of interfaces are solved, and efficient interface calls and resource optimization are achieved.
Patent Information
- Application Number
- CN202111150377.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2041-09-29
AI Technical Summary
The increase in the interface in the prior art leads to an increase in system complexity and the increase in development and testing workload, especially when calling between multiple systems, it requires a lot of repeated configuration and debugging.
The calling system and service system are divided into multiple method code blocks according to their functions, corresponding to the general calling interface and the general service interface respectively. By serializing and deserializing the parameter information, the unified configuration and cache processing results of the interface are realized.
It reduces the number of interface configurations of the system, reduces the workload of development, testing and operation and maintenance, improves the system development efficiency and testing efficiency, and avoids the system resource consumption caused by multiple reflections.
Smart Images

Figure CN113886103B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of information data processing and artificial intelligence technology, and in particular to an interface calling method, apparatus, computer equipment, and storage medium. Background Art
[0002] With the increasing informatization of society, the prevalence of microservice architectures, and the simplification of system functionality, companies are integrating more and more systems, and the number of scenarios in which systems call each other through interfaces is increasing. This proliferation of interfaces requires extensive system configuration and debugging, which consumes significant development and testing manpower. For example, implementing a specific function may require services from multiple, or even dozens, of interfaces in other systems. Each interface requires a series of steps, including defining a name, parameter types, return value types, interface registration, process approval, and interface connectivity debugging. This requires the full involvement of development, testing, and interface scheduling and configuration systems throughout the entire process.
[0003] In the existing technology, interfaces correspond one-to-one by calling system methods and service methods of service systems. The two are connected through corresponding interfaces, and each additional method requires a new interface. When there are thousands of interfaces and different calling systems and service systems call each other, thousands of repeated development and testing will be required. This not only increases the complexity of the system, but also greatly increases the workload of development and testing. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to propose an interface calling method, apparatus, computer equipment and storage medium, which can solve the problem in the prior art that the increase of interfaces brings about a large amount of system configuration and interface debugging, and occupies a large amount of development and testing manpower.
[0005] In order to solve the above technical problems, an embodiment of the present application provides an interface calling method, which is applied to an interface scheduling system, wherein the interface scheduling system includes a calling system and a service system, the calling system includes multiple first method code blocks and a general calling interface connected to the multiple first method code blocks, and the service system includes multiple second method code blocks and a general service interface connected to the second method code blocks. The interface calling method includes: the calling system obtains parameter information of the multiple first method code blocks through the general calling interface; performs a first serialization processing on the parameter information to obtain a byte sequence; sends the byte sequence to the corresponding general service interface in the service system; the general service interface receives the byte sequence and performs a first deserialization processing on the byte sequence to obtain parameter information; the service system calls the service method of the corresponding second method code block according to the parameter information, so that the service method of the second method code block is processed according to the parameter information; the service system returns the processing result to the corresponding general calling interface in the calling system; the general calling interface receives the processing result and caches it.
[0006] Furthermore, the performing a first serialization process on the parameter information to obtain a byte sequence includes: creating an object output stream according to the parameter information; and converting the parameter information into the byte sequence through the object output stream.
[0007] Furthermore, calling the service method of the corresponding second method code block according to the parameter information includes: creating an object corresponding to the service method of the second method code block according to the parameter information; passing the parameter information to the object so that the object executes the service method according to the parameter information.
[0008] Furthermore, the creating of an object corresponding to the service method of the second method code block according to the parameter information includes: sending the parameter information to a Java virtual machine; the Java virtual machine creating an object corresponding to the service method of the second method code block according to the parameter information, wherein the parameter information includes one or a combination of business parameters, a Java class name of a service system, and a method code name.
[0009] Furthermore, the universal service interface receives the byte sequence and performs a first deserialization process on the byte sequence to obtain parameter information, including: creating an object input stream according to the byte sequence; and converting the byte sequence into the parameter information according to the object input stream.
[0010] Furthermore, before returning the processing result to the corresponding universal calling interface in the calling system, the method includes: performing a second serialization process on the processing result; and sending the processing result after the second serialization process to the universal calling interface.
[0011] Furthermore, the general call interface receives and caches the processing result, including: performing a second deserialization process on the processing result; and caching the result after the second deserialization process.
[0012] In order to solve the above technical problems, an embodiment of the present application also provides an interface scheduling device, which includes: an acquisition module, used for a general call interface to obtain parameter information of multiple first method code blocks; a first processing module, used for performing a first serialization processing on the parameter information to obtain a byte sequence; a sending module, used for sending the byte sequence to the corresponding general service interface in the service system; a second processing module, used for the general service interface to receive the byte sequence and perform a first deserialization processing on the byte sequence to obtain parameter information; a calling module, used for the service system to call the service method of the corresponding second method code block according to the parameter information, so that the service method of the second method code block is processed according to the parameter information; a return module, used for the service system to return the processing result to the corresponding general call interface in the calling system; and a receiving module, used for the general call interface to receive the processing result and cache it.
[0013] In order to solve the above technical problems, an embodiment of the present application also provides a computer device, including a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the interface calling method described in any one of the above items are implemented.
[0014] In order to solve the above technical problems, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the interface calling method described in any one of the above items are implemented.
[0015] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0016] The present application provides an interface calling method, apparatus, computer equipment and storage medium. By dividing the calling system and service system into a plurality of first method code blocks corresponding to a universal calling interface and a plurality of second method code blocks corresponding to a universal service interface according to their functions, the number of interface configurations of the system can be reduced. The universal calling interface and universal service interface of the present application only need to be configured once, and subsequently newly added method code blocks can be connected through the existing interface. This can reduce the workload of system development, testing and operation and maintenance, thereby improving the development efficiency and testing efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0018] Figure 1 This is a structural diagram of an implementation scheme of the interface scheduling system of the present application;
[0019] Figure 2 This is a flowchart of an implementation method of the interface calling method of this application;
[0020] Figure 3 This is a flowchart of an implementation method of step S110 of the present application;
[0021] Figure 4 This is a flowchart of an implementation method of step S130 of the present application;
[0022] Figure 5 This is a flowchart of an implementation method of step S140 of the present application;
[0023] Figure 6 This is a flowchart of an implementation method of step S141 of the present application;
[0024] Figure 7 This is a structural diagram of an embodiment of the interface calling device of the present application;
[0025] Figure 8 is a schematic diagram of the processing module 120 in one embodiment of the present application;
[0026] Figure 9 is a schematic diagram of the receiving and processing module 140 in one embodiment of the present application;
[0027] Figure 10 is a schematic diagram of the calling and processing module 150 in one embodiment of the present application;
[0028] Figure 11 This is the basic structural block diagram of the computer equipment of this application. DETAILED DESCRIPTION
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0030] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0032] See also Figure 1 , Figure 1 This is a structural diagram of an implementation scheme of the interface scheduling system of this application, as shown in FIG. Figure 1 The interface scheduling system 500 of the present application includes a calling system 101 and a service system 501 .
[0033] Optionally, in this application, the calling system 101 is the requester of the service and needs to obtain the data of the service system 501 through the interface method. The service system 501 is the provider of the service and can provide data to the calling system 101 through the interface method. Furthermore, a method refers to a code block with a certain processing capability, wherein an interface is a method and a function is a collection of a series of methods. Among them, each function of the calling system 101 obtains a variety of data of the service system 501 through the interface method, and each method obtains one kind of data. Specifically, if the calling system 101 is a financial system and the service system 501 is an insurance policy system, the financial system can call the service method in the method sub-code block corresponding to the insurance policy system through the calling method in its internal method sub-code block to obtain the insurance policy insured information, and call the service method in the method sub-code block corresponding to the insurance policy system through the calling method of the method sub-code block of another function, thereby obtaining the insurance policy insured person information.
[0034] Combine Figure 1 In this application, the calling system 101 can be divided into multiple first method code blocks and a general calling interface connected to the multiple first method code blocks according to their functions. Figure 1 Specifically for the application scenario of this application, each first method code block may contain multiple method sub-code blocks, such as Figure 1 The first method code block 102 includes a method sub-code block A and a method sub-code block B, and method sub-code block A and method sub-code block B are respectively connected to their corresponding universal call interface 103. The first method code block 104 may include a method sub-code block C, a method sub-code block D, a method sub-code block E, and a method sub-code block F, and method sub-code block C, method sub-code block D, method sub-code block E, and method sub-code block F are respectively connected to their corresponding universal call interface 105. Optionally, the calling methods in each method sub-code block in this application are different.
[0035] Furthermore, the service system 501 in this application can be divided into multiple second method code blocks and a general service interface connected to the multiple second method code blocks according to their functions. Figure 1 Each second method code block can contain multiple method sub-code blocks, such as Figure 1 The second method code block 502 includes a method sub-code block a and a method sub-code block b, and method sub-code block a and method sub-code block b are respectively connected to their corresponding universal service interface 503. The second method code block 505 may include a method sub-code block c, a method sub-code block d, a method sub-code block e, and a method sub-code block f, and method sub-code block c, method sub-code block d, method sub-code block e, and method sub-code block f are respectively connected to their corresponding universal service interface 504, and the service methods in each method sub-code block in this application are different.
[0036] It is understandable that in this application, by corresponding multiple first method code blocks of the calling system to a universal calling interface and multiple second method code blocks in the service system to a universal service interface, the number of interface configurations can be greatly reduced, further reducing the workload of development, testing, and operation and maintenance. For example, the interface of the interface scheduling system of this application only needs to be configured once, and subsequent newly added method code blocks can be connected through the existing interface. In this way, there is no need to develop interfaces, test interfaces, or perform interface connectivity tests, and operation and maintenance do not need to register and configure interfaces, thereby achieving the purpose of reducing the workload at each stage.
[0037] In addition, the release of the interface in this application is more flexible. The calling system and the service system only need to agree on parameters to release the new method code block, eliminating the intermediate links and being able to quickly respond to external changes and support business changes.
[0038] Furthermore, in this application, the calling system 101 and the service system 501 can correspond based on business needs, specifically, the first method code block in the calling system 101 corresponds to the second method code block in the service system 501, that is, Figure 1 In the example, first method code block 102 corresponds to second method code block 502, first method code block 104 corresponds to second method code block 505, method sub-code block A and method sub-code block B correspond to method sub-code block a and method sub-code block b, respectively. Method sub-code block C, method sub-code block D, method sub-code block E, and method sub-code block F also correspond to method sub-code block c, method sub-code block d, method sub-code block e, and method sub-code block f, respectively. Furthermore, universal call interface 103 and universal call interface 105 correspond to universal service interface 503 and universal service interface 504, respectively.
[0039] It is understandable that the interface scheduling system of the present application can further include a scheduling configuration system 401. Among them, the calling system 101 and the service system 501 are connected to the scheduling configuration system 401 through a universal service interface and a universal calling interface respectively. Optionally, each universal service interface and universal calling interface needs to be registered and scheduled in the scheduling configuration system 401, that is, the scheduling configuration system 401 configures the corresponding relationship between the calling system 101 and the service system 501 based on business needs. Specifically, the method sub-code block A and the method sub-code block B in the calling system 101 are respectively corresponded to the method sub-code block a and the method sub-code block b, and the method sub-code block C, the method sub-code block D, the method sub-code block E and the method sub-code block F are respectively corresponded to the method sub-code block c, the method sub-code block d, the method sub-code block e and the method sub-code block f.
[0040] In the above implementation, by dividing the calling system and the service system into multiple first method code blocks corresponding to a universal calling interface and multiple second method code blocks corresponding to a universal service interface according to their functions, the number of interface configurations of the system and the workload of system development, testing and operation and maintenance can be reduced, thereby improving the development efficiency and testing efficiency of the system.
[0041] See also Figure 2 , Figure 2 This is a flow chart of an embodiment of the interface calling method of this application. It can be understood that the interface calling method of this application is applied to Figure 1 The interface scheduling system in Figure 2 The application interface calling method includes the following steps:
[0042] S100: The calling system obtains parameter information of multiple first method code blocks through a universal calling interface.
[0043] Specifically, the calling system obtains parameter information for multiple first method code blocks through the universal call interface. It is understandable that the first method code block of the calling system needs to encapsulate parameter information when making a service call. The parameter information includes business parameters, the Java class name of the service system, and the method code name, and different first method code blocks may encapsulate different parameter information when making a call. Furthermore, after the parameter information of the first method code block is encapsulated, the encapsulated parameter information is sent to the universal call interface.
[0044] S110: Perform a first serialization process on the parameter information to obtain a byte sequence.
[0045] Furthermore, in order to transmit parameter information over the network, the general call interface needs to serialize the parameter information after obtaining it. Serialization refers to the process of converting Java objects into byte sequences, and the most important role of serialization is to ensure the integrity and transferability of Java objects when transferring and saving Java objects. Java objects are converted into ordered byte streams for transmission over the network or storage in local files. Figure 3 , Figure 3 This is a flow chart of an implementation method of step S110 of this application, as shown in FIG. Figure 3 Step S110 further includes the following sub-steps:
[0046] S111: Create an object output stream according to the parameter information.
[0047] Specifically, an object output stream is created based on the parameter information, and the object output stream can wrap another type of target output stream, such as a file output stream. In a specific embodiment, java.io.ObjectOutputStream represents the object output stream, and its writeObject method can serialize the obj object specified by the parameter (here, the parameter information).
[0048] S112, converting the parameter information into a byte sequence through the object output stream.
[0049] Furthermore, the parameter information is serialized using the writeObject(Object obj) method to obtain a byte sequence, which is then written to a target output stream. The parameter information in this application may include, but is not limited to, business parameters, the Java class name of the service system, and the method code name, or a combination thereof.
[0050] S120: Send the byte sequence to the corresponding universal service interface in the service system.
[0051] Furthermore, the serialized parameter information (that is, the byte sequence of this application) is further sent to the corresponding universal service interface in the service system. Optionally, in this application, the byte sequence can be sent directly to the interface scheduling configuration system, and then the interface scheduling configuration system sends the byte sequence to the corresponding universal service interface in the service system.
[0052] S130: The universal service interface receives the byte sequence and performs a first deserialization process on the byte sequence to obtain parameter information.
[0053] Specifically, the interface scheduling configuration system acquires the universal service interface corresponding to the IP address and port information of the universal call interface based on the serialized byte sequence, and then sends the byte sequence to the corresponding universal service interface. Furthermore, to obtain parameter data that the system can recognize, the universal service interface must first deserialize the received byte sequence, a process that converts the byte sequence back into a Java object (parameter data). The most important function of deserialization is to reconstruct the object through deserialization based on the object state and description information stored in the byte sequence.
[0054] Optionally, the first deserialization process of the general service interface may include creating an object input stream based on the byte sequence and converting the byte sequence into parameter information based on the object input stream. It is understandable that the deserialization process in the embodiment of the present application is the reverse process of the serialization process, that is, the process of restoring the byte sequence to an object. Figure 4 , Figure 4 This is a flow chart of an implementation of step S130 of the present application. Step S130 further includes the following sub-steps:
[0055] S131, creating an object input stream according to the byte sequence.
[0056] Optionally, an object input stream is created based on the byte sequence, and the object input stream can wrap a source input stream of another type, such as a file input stream.
[0057] S132: Convert the byte sequence into parameter information according to the object input stream.
[0058] It is understood that the deserialization process in the embodiments of this application is the inverse of the serialization process, that is, the process of restoring the byte sequence to an object. The method is similar to serialization. An object input stream is created based on the byte sequence, and this object input stream can wrap another type of source input stream, such as a file input stream. The Java object is then read through the readObject() method of the object input stream to obtain recognizable parameter information.
[0059] It is understandable that the core function of the above serialization and deserialization processing is to save and rebuild the object state, and the core point of the entire processing process is the Java object state and description information saved in the byte sequence.
[0060] S140: The service system calls the service method of the corresponding second method code block according to the parameter information, so that the service method of the second method code block performs processing according to the parameter information.
[0061] Specifically, the parameter information includes at least the Java class name, method code name, and business parameters of the service system. The general service interface uses the Java class name and method name in the parameter information. The service system calls the corresponding second method module through Java reflection and passes the business parameters. Figure 5 , Figure 5 This is a flow chart of an implementation of step S140 of the present application. Step S140 further includes the following sub-steps:
[0062] S141: Create an object corresponding to the service method of the second method module according to the parameter information.
[0063] Furthermore, the general service interface uses the Java class name and method code name in the parameter information to call the corresponding service method of the second method code block through Java reflection and pass the business parameters. Figure 6 , Figure 6 This is a flow chart of an implementation of step S141 of the present application. Step S141 further includes the following sub-steps:
[0064] S1411, sending parameter information to the Java virtual machine.
[0065] It is understandable that Java reflection in this application is a native function of Java. In a specific implementation, by sending parameter information to a Java virtual machine, the Java virtual machine can create an object corresponding to the parameter information based on the parameter information.
[0066] S1412: The Java virtual machine creates an object corresponding to the service method of the second method code block according to the parameter information.
[0067] In a specific implementation, the Java virtual machine can create corresponding Java class objects and method objects based on parameter information, such as the Java class name and method code name.
[0068] S142: Pass the parameter information to the object so that the object executes the service method according to the parameter information.
[0069] Furthermore, the parameter information is passed to the object, causing the object to execute the method in the second method code block based on the parameter information and return the result. Specifically, the parameter information obtained after the first deserialization process includes the Java class name and method code name of the service system. The universal service interface uses these two parameters to call the method in the second method code block corresponding to the service system. The business parameters in the parameter information are ultimately passed to the method in the second method code block corresponding to the service system. The method in the second method code block receives the business parameters and performs business processing, such as querying or calculation, to obtain a processing result, such as a JSON string or a Java object.
[0070] S150, the service system returns the processing result to the corresponding universal calling interface in the calling system.
[0071] Furthermore, the obtained processing result is returned to the corresponding universal call interface of the calling system. It is understood that before returning the processing result to the universal call interface, the processing result needs to be further serialized a second time. The second serialization process of the processing result is the same as the first serialization process described above, both of which involve creating an object output stream and converting the processing result into a byte sequence that can be transmitted over the network.
[0072] Furthermore, after the second serialization is completed, the processing result of the second serialization needs to be sent to the general call interface. Specifically, the serialized byte sequence is first sent to the scheduling configuration system, and then sent to the general call interface through the scheduling configuration system.
[0073] S160: The general call interface receives and caches the processing result.
[0074] It is understandable that the processing result in this application is the result of the second serialization processing by the service system, and the processing result needs to be further deserialized for a second time before caching. The method of the second deserialization processing is the same as the method of the first deserialization processing, that is, creating an object input stream based on the byte sequence, and obtaining parameter information that can be recognized by the scheduling configuration system through the object input stream. The specific processing process will not be repeated here.
[0075] Furthermore, the processing result after the second deserialization is cached. Optionally, what is cached in this application are the Java class objects and method objects obtained by the service system reflection call. It is understandable that because each call is an independent event, it is necessary to perform operations such as encapsulating parameters and serialization. Therefore, in this application, by caching the Java class objects and method objects obtained by the service system reflection call, the consumption of system resources caused by multiple reflections can be avoided. And with the first cache, when making subsequent calls, as long as the parameters are passed to the method object, it can be directly executed, thereby improving the calling efficiency of the interface.
[0076] In the above implementation, by dividing the calling system and the service system into multiple first method code blocks corresponding to a universal calling interface and multiple second method code blocks corresponding to a universal service interface according to their functions, the number of interface configurations of the system and the workload of system development, testing and operation and maintenance can be reduced, thereby improving the development efficiency and testing efficiency of the system, and caching the processing results returned by the service system during the call can avoid the consumption of system resources caused by multiple reflections and improve the calling efficiency of the interface.
[0077] It should be emphasized that in order to further ensure the privacy and security of the interface calling method, the above parameter information and processing results can be stored in a blockchain node.
[0078] The blockchain referred to in this application is a new application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0079] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware using computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When executed, the program can include the processes in the above-described method embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0080] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0081] Furthermore, the above-mentioned embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0082] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0083] Further references Figure 7 , as a response to the above Figure 2 The present application provides an embodiment of an interface calling device, which is similar to the embodiment of the interface calling method shown in FIG. Figure 2 Corresponding to the embodiment of the interface calling method shown, the device can be specifically applied to various electronic devices.
[0084] like Figure 7 As shown, the interface calling device 100 described in this embodiment includes an acquisition module 110 , a first processing module 120 , a sending module 130 , a second processing module 140 , a calling module 150 , a returning module 160 and a receiving module 170 .
[0085] The acquisition module 110 is used by the calling system to acquire parameter information of multiple first method code blocks according to a universal calling interface.
[0086] The first processing module 120 is configured to perform a first serialization process on the parameter information to obtain a byte sequence.
[0087] The sending module 130 is configured to send the byte sequence to a corresponding universal service interface in the service system.
[0088] The second processing module 140 is used for the universal service interface to receive the byte sequence and perform a first deserialization process on the byte sequence to obtain parameter information.
[0089] The calling module 150 is used by the service system to call the service method of the corresponding second method code block according to the parameter information, so that the service method of the second method code block is processed according to the parameter information.
[0090] The return module 160 is used by the service system to return the processing result to the corresponding universal calling interface in the calling system.
[0091] The receiving module 170 is used to receive the processing result through the general call interface and cache it. The receiving module 170 is also used to perform a second deserialization process on the processing result and cache the processing result after the second deserialization process.
[0092] See Figure 8 , Figure 8 FIG. 1 is a schematic diagram of the processing module 120 in one embodiment of the present application.
[0093] In some optional implementations of this embodiment, the first processing module 120 further includes a creation submodule 121 and a conversion submodule 122 .
[0094] The creation submodule 121 is used to create an object output stream according to the parameter information, and the conversion submodule 122 is used to convert the parameter information into the byte sequence through the object output stream.
[0095] See Figure 9 , Figure 9 FIG. 1 is a schematic diagram of the second processing module 140 in one embodiment of the present application.
[0096] In some optional implementations of this embodiment, the second processing module 140 further includes a creation submodule 141 and a conversion submodule 142 .
[0097] The creation submodule 141 is used to create an object input stream according to the byte sequence.
[0098] The conversion submodule 142 is configured to convert the byte sequence of the object input stream into the parameter information.
[0099] See Figure 10 , Figure 10 FIG. 1 is a schematic diagram of the calling and processing module 150 in one embodiment of the present application.
[0100] In some optional implementations of this embodiment, the calling module 150 further includes a creating submodule 151 and a transferring submodule 152 .
[0101] The creation submodule 151 is configured to create an object corresponding to the service method of the second method code block based on the parameter information. In this application, the creation submodule 151 is further configured to send the parameter information to a Java virtual machine; the Java virtual machine creates an object corresponding to the service method of the second method code block based on the parameter information, wherein the parameter information includes one or a combination of business parameters, a Java class name of the service system, and a method code name.
[0102] The transfer submodule 152 is configured to transfer the parameter information to the object, so that the object executes the service method according to the parameter information.
[0103] The above implementation method can reduce the number of interface configurations of the system by dividing the calling system and the service system into multiple first method code blocks corresponding to a universal calling interface and multiple second method code blocks corresponding to a universal service interface according to their functions. The universal calling interface and universal service interface of this application only need to be configured once, and subsequently newly added method code blocks can be connected through existing interfaces. This can reduce the workload of system development, testing, and operation and maintenance, thereby improving the development efficiency and testing efficiency of the system.
[0104] To solve the above technical problems, the present application also provides a computer device. Figure 11 , Figure 11 This is a basic structural block diagram of the computer device in this embodiment.
[0105] The computer device 300 includes a memory 301, a processor 302, and a network interface 303 that are interconnected through a system bus. It should be noted that Figure 11 Only a computer device 300 having components 301-303 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead. Among them, those skilled in the art will understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0106] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.
[0107] The memory 301 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory 301 may be an internal storage unit of the computer device 300, such as a hard disk or memory of the computer device 300. In other embodiments, the memory 301 may also be an external storage device of the computer device 300, such as a plug-in hard disk equipped on the computer device 300, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Of course, the memory 301 may also include both the internal storage unit of the computer device 300 and its external storage device. In this embodiment, the memory 301 is generally used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions for interface calling methods, etc. In addition, the memory 301 can also be used to temporarily store various data that has been output or is to be output.
[0108] In some embodiments, the processor 302 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 302 is generally used to control the overall operation of the computer device 300. In this embodiment, the processor 302 is used to execute computer-readable instructions stored in the memory 301 or process data, such as computer-readable instructions for executing the interface calling method.
[0109] The network interface 303 may include a wireless network interface or a wired network interface. The network interface 303 is generally used to establish a communication connection between the computer device 300 and other electronic devices.
[0110] By dividing the calling system and the service system into multiple first method code blocks corresponding to a universal calling interface and multiple second method code blocks corresponding to a universal service interface according to their functions, the number of interface configurations of the system can be reduced, and the universal calling interface and universal service interface of the present application only need to be configured once, and subsequently newly added method code blocks can be connected through existing interfaces, which can reduce the workload of system development, testing, and operation and maintenance, thereby improving the development efficiency and testing efficiency of the system.
[0111] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the interface calling method as described above.
[0112] By dividing the calling system and the service system into multiple first method code blocks corresponding to a universal calling interface and multiple second method code blocks corresponding to a universal service interface according to their functions, the number of interface configurations of the system can be reduced, and the universal calling interface and universal service interface of the present application only need to be configured once, and subsequently newly added method code blocks can be connected through existing interfaces, which can reduce the workload of system development, testing, and operation and maintenance, thereby improving the development efficiency and testing efficiency of the system.
[0113] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of this application, or the part that contributes to the existing technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of this application.
[0114] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. An interface calling method, characterized in that: The interface calling method is applied to an interface scheduling system, the interface scheduling system includes a calling system and a service system, the calling system includes multiple first method code blocks and a universal calling interface connected to the multiple first method code blocks, the service system includes multiple second method code blocks and a universal service interface connected to the second method code blocks, the interface scheduling system also includes a scheduling configuration system, the calling system and the service system are connected to the scheduling configuration system through the universal service interface and the universal calling interface respectively, the universal service interface and the universal calling interface are registered and scheduled in the scheduling configuration system, and the scheduling configuration system configures the corresponding relationship between the calling system and the service system based on business needs, the interface calling method includes: The calling system obtains parameter information of the plurality of first method code blocks through the universal calling interface, wherein the parameter information includes business parameters, a Java class name of the service system, and a method code name; Performing a first serialization process on the parameter information to obtain a byte sequence, wherein serialization refers to the process of converting a Java object into a byte sequence, and the Java object refers to an object instance that encapsulates the parameter information; Sending the byte sequence to a corresponding universal service interface in the service system; The universal service interface receives the byte sequence and performs a first deserialization process on the byte sequence to obtain parameter information, wherein the first deserialization process refers to a process of restoring the byte sequence to a Java object; Sending the parameter information obtained from the first deserialization process to a Java virtual machine; The Java virtual machine creates an object corresponding to the service method of the second method code block according to the parameter information obtained by the first deserialization process; Passing the parameter information obtained by the first deserialization process to the object, so that the object executes the service method of the second method code block according to the parameter information obtained by the first deserialization process; The service system returns the processing result to the corresponding universal calling interface in the calling system; The general call interface receives and caches the processing result.
2. The interface calling method according to claim 1, characterized in that: The first serialization processing of the parameter information to obtain a byte sequence includes: Create an object output stream according to the parameter information; The parameter information is converted into the byte sequence through the object output stream.
3. The interface calling method according to claim 1, characterized in that: The universal service interface receives the byte sequence and performs a first deserialization process on the byte sequence to obtain parameter information, including: Creating an object input stream according to the byte sequence; The byte sequence is converted into the parameter information according to the object input stream.
4. The interface calling method according to claim 1, characterized in that: Before returning the processing result to the corresponding universal calling interface in the calling system, the following steps are included: Performing a second serialization process on the processing result; The processing result after the second serialization processing is sent to the general calling interface.
5. The interface calling method according to claim 1, characterized in that: The general call interface receives the processing result and caches it, including: Performing a second deserialization process on the processing result; The processing result after the second deserialization processing is cached.
6. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the interface calling method according to any one of claims 1 to 5 when executing the computer-readable instructions.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the interface calling method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Data transmission method and device, electronic equipment and storage medium
CN112468585A
Index calculation method and device based on universal interface, equipment and storage medium
CN113342860A