Data access method and system based on dynamically published web service interface
The method and system dynamically publish WebService interfaces using Spring Boot and Apache CXF to address flexibility issues in interface integration, improving integration efficiency and reducing manual configuration.
Patent Information
- Application Number
- CN202210110340.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-29
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2042-01-29
AI Technical Summary
Existing WebService interface integration methods lack flexibility and require manual modifications of URL and parameter names during interface integration, leading to inefficiencies in data transmission.
A method and system for dynamically publishing WebService interfaces based on customizing interface parameters, using Spring Boot and Apache CXF to generate and register.class files, enabling real-time interface matching and data access without manual modifications.
Facilitates efficient and flexible integration of various vendor interfaces by dynamically generating and publishing WebService interfaces, enhancing integration efficiency and reducing manual configuration needs.
Smart Images

Figure CN114518968B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data communication, and particularly relates to a data access method and system based on dynamically published webservice interfaces. Background Art
[0002] WebService is a platform-independent, low-coupling, self-contained, programmable web-based application that can use open XML standards to describe, publish, discover, coordinate, and configure these applications for developing distributed interoperable applications.
[0003] WebService technology enables different applications running on different machines to exchange data or integrate with each other without the need for additional, specialized third-party software or hardware. Among applications implemented according to the Web Service specification, regardless of the language, platform, or internal protocol they use, they can exchange data with each other. Based on this, Web Service technology is widely used in data communication.
[0004] When manufacturers connect data, data transmission is more or less carried out through interfaces. However, when conducting interface docking, problems such as diverse interface call URLs and interface input parameters may occur, resulting in the inability to smoothly proceed with the docking work in a timely manner, and situations where the called party needs to modify the URL and interface parameter names. In such a case, how to conveniently and quickly dock or modify the interface has become a necessary operation.
[0005] Patent document CN107315754A discloses a method for implementing a general Webservice interface, including: writing a Webservice interface based on a mathematical model; calling a database based on the Webservice interface according to the submitted SQL commands, and encapsulating a set of AJAX call interfaces based on Javascript; matching the AJAX call interfaces with the webservice interface, and using the matched call interfaces to obtain information from the database to implement the Webservice service. This method calls data from the database according to the user's data selection. Since it is a pre-adapted interface, it lacks flexibility.
[0006] Patent document CN111966512A discloses a general method for accessing a database via a Webservice, including creating a Webservice interface and an implementation class for accessing the database; building a distributed cluster based on Tomcat and Keepalived; creating a dynamic library for calling the Webservice based on a computer high-level language; and accessing the dynamic library to complete the call of the Webservice. This general method generates a Webservice interface with fixed names for parameter configuration, lacking flexibility. Summary of the Invention
[0007] In view of the above, an object of the present invention is to provide a data access method and system based on dynamically publishing a Webservice interface, which customizes and dynamically publishes the Webservice interface according to the interface parameters of different manufacturers to achieve efficient data access from different manufacturers.
[0008] To achieve the above object of the invention, an embodiment of the present invention provides a data access method based on dynamically publishing a Webservice interface, including the following steps:
[0009] Configure the interface call address, interface call method, and interface call parameters to form configuration parameters;
[0010] After obtaining the configuration parameters, dynamically generate a.java file based on the configuration parameters, and compile a recognizable.class file according to the.java file for different types of Webservice interfaces;
[0011] Dynamically register the.class file corresponding to the Webservice interface into the sparingbean based on the spring boot framework; the server dynamically publishes the Webservice interface using the Endpoint based on the Apache CXF technology;
[0012] The manufacturer accesses the data based on the dynamically published Webservice interface.
[0013] In one embodiment, on the client web page, the interface call address, interface call method, and interface call parameters are visually configured according to the business data requirements. Among them, the interface call parameters include the business data parameter field name messageTag, the business type parameter field name messageTypeTag for identifying specific business operations, and the serial number data parameter field name messageIdTag.
[0014] In one embodiment, when the server dynamically publishes a webservice interface based on Apache CXF technology, it publishes the compiled webservice interface to the spring service, and then calls the wsdl address of the webservice to confirm that the webservice interface has been published.
[0015] In one embodiment, for the interface calling method, during parameter configuration, it can be customized according to the calling habits of third parties or one's own naming preferences, so that third parties do not need to modify the calling interface when configuring the call.
[0016] In one embodiment, during parameter configuration, multiple groups of configuration parameters are configured, and each group of configuration parameters corresponds to a type of webservice interface, and multiple types of webservice interfaces are dynamically published in sequence.
[0017] In one embodiment, the manufacturer monitors the dynamically published webservice interface in real time. When the webservice interface matches its own service interface, data access is performed through the webservice interface.
[0018] To achieve the above invention objective, another embodiment of the present invention provides a data access system based on dynamically publishing a webservice interface, including a data platform and a manufacturer. Among them, the data platform includes a client and a server;
[0019] The client is used to provide a parameter configuration interface through a web page, and is also used to receive the interface call address, interface call method, and interface call parameters configured by the user through the parameter configuration interface to form configuration parameters;
[0020] The server is used to dynamically generate a.java file based on the configuration parameters obtained from the client, and compile a recognizable.class file according to the.java file, corresponding to different types of webservice interfaces;
[0021] The server is also used to dynamically register the.class file corresponding to the webservice interface into the sparing bean based on the spring boot framework; and is also used to dynamically publish the webservice interface using Endpoint based on Apache CXF technology;
[0022] The manufacturer is used to monitor the dynamically published webservice interface in real time. When the webservice interface matches its own service interface, data access is performed through the webservice interface.
[0023] Compared with the prior art, the beneficial effects of the present invention at least include:
[0024] By configuring the interface call address url, interface call method, and interface call parameters on the client side to form configuration parameters corresponding to different interface classes, then generating the.class file corresponding to the interface according to the configuration parameters, and integrating the Apache CXF framework based on spring Boot to realize the dynamic publishing of different interfaces. In this way, different manufacturers do not need to modify the interface call address. By listening to the dynamically published webservice interfaces in real time, when the webservice interface matches their own service interface, data access is performed through the webservice interface. This method can adapt to various types of manufacturer interfaces, improve the docking efficiency of interfaces, and the construction method of various webservice interfaces is simple, which can be achieved only through configuration parameters, with simple operation and improved construction efficiency of webservice interfaces. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0026] Figure 1 It is a flowchart of a data access method based on dynamically published webservice interfaces provided by an embodiment;
[0027] Figure 2 It is a schematic structural diagram of a data access system based on dynamically published webservice interfaces provided by an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0028] To make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention and do not limit the protection scope of the present invention.
[0029] In order to enable the rapid access of data for various service interfaces of manufacturers, an embodiment provides a data access method and system based on dynamically published webservice interfaces.
[0030] Figure 1 It is a flowchart of a data access method based on dynamically published webservice interfaces provided by an embodiment. As Figure 1As shown in the figure, the data access method based on the dynamically published webservice interface provided by the embodiment includes the following steps:
[0031] Step 1, configure the interface call address, interface call method, and interface call parameters to form configuration parameters.
[0032] WebService is an architecture of SOA (service-oriented programming). It is language-independent and platform-independent, and can achieve mutual calls between different languages. It enables the interaction between network applications based on the Http protocol through the Internet. In actual calls, it is necessary to know the call address, call method, call parameters, and their meanings.
[0033] Based on this, the client Web page of the embodiment provides a parameter configuration interface. Users can visually fill in or select the interface call address, interface call method, and interface call parameters through this parameter configuration interface. These three types of parameters form configuration parameters, and the configuration parameters are sent to the server.
[0034] Among them, the interface call parameters include the business data parameter field name messageTag, the business type parameter field name messageTypeTag, and the serial number data parameter field name messageIdTag. Among them, messageTypeTag is used for specific business operations.
[0035] Among them, the interface call method includes Run (default value) or is customized according to the calling habits of third parties or one's own naming preferences, so that third parties do not need to modify the call interface when configuring the call.
[0036] Step 2, after obtaining the configuration parameters, dynamically generate a.java file according to the configuration parameters, and compile a recognizable.class file according to the.java file, corresponding to different types of webservice interfaces.
[0037] After the server obtains the configuration parameters configured by the client, it generates a.java file that needs to dynamically publish these parameters according to the interface call address, interface call method, and interface call parameters, and compiles these.java files into recognizable.class files. Since the configured parameters are different, multiple sets of configuration parameters will be formed. Each set of configuration parameters corresponds to a type of webservice interface. In this way,.class files corresponding to multiple types of webservice interfaces can be obtained, and subsequent multiple types of webservice interfaces are dynamically published in turn for the manufacturer service to listen.
[0038] Step 3: Dynamically register the.class file corresponding to the webservice interface into the sparing bean based on the spring boot framework; the server uses Endpoint to dynamically publish the webservice interface based on the Apache CXF technology.
[0039] In the embodiment, after the.class file is compiled, the.class file corresponding to the webservice interface class is registered into the sparing bean of the spring boot framework; then, according to the Apache CXF technology, Endpoint is called to dynamically publish the webservice interface to achieve the dynamic publishing of the interface. When there are multiple webservice interfaces, these webservice interfaces are dynamically published in sequence.
[0040] In the embodiment, when the server uses Endpoint to dynamically publish the webservice interface based on the Apache CXF technology, the compiled webservice interface is published to the spring service, and then the wsdl address of the webservice is called to confirm that the webservice interface has been published, which can ensure the accuracy of the dynamic publishing of the webservice interface.
[0041] Step 4: The manufacturer performs data access based on the dynamically published webservice interface.
[0042] In the embodiment, the manufacturer monitors the dynamically published webservice interface in real time. When the webservice interface matches its own service interface, data access is performed through the webservice interface.
[0043] Figure 2 It is a schematic structural diagram of a data access system based on the dynamically published webservice interface provided by the embodiment. As Figure 2 shown, the embodiment also provides a data access system based on the dynamically published webservice interface, including a data platform and a manufacturer. Among them, the data platform includes a client and a server.
[0044] Among them, the client is used to provide a parameter configuration interface through a web page, and is also used to receive the interface call address, interface call method, and interface call parameters configured by the user through the parameter configuration interface to form configuration parameters.
[0045] The server is used to obtain the configuration parameters configured by the client, dynamically generate.java files according to the configuration parameters, and compile the recognizable.class files according to the.java files, corresponding to the webservice interfaces of different classes. It is also used to dynamically register the.class files corresponding to the webservice interfaces into the sparing bean based on the spring boot framework; it is also used to dynamically publish the webservice interfaces using the Endpoint based on the Apache CXF technology.
[0046] The manufacturer is used to listen to the dynamically published webservice interfaces in real time through the manufacturer service. When the webservice interface matches its own service interface, data access is performed through the webservice interface.
[0047] It should be noted that the data access system based on the dynamically published webservice interface provided by the embodiment implements the above data access method based on the dynamically published webservice interface. This method and system form the configuration parameters corresponding to different interface classes by configuring the interface call address url, interface call method, and interface call parameters on the client, then generate the.class files corresponding to the interfaces according to the configuration parameters, and combine the integration of the Apache CXF framework based on spring Boot to achieve the dynamic publication of different interfaces. In this way, different manufacturers do not need to modify the interface call address. By listening to the dynamically published webservice interfaces in real time, when the webservice interface matches its own service interface, data access is performed through the webservice interface. This method can adapt to various types of manufacturer interfaces, improve the docking efficiency of the interfaces, and the construction method of various webservice interfaces is simple, which can be achieved as long as the configuration parameters are set, and the operation is simple, improving the construction efficiency of the webservice interfaces.
[0048] The above specific embodiments have detailed the technical solutions and beneficial effects of the present invention. It should be understood that the above is only the most preferred embodiment of the present invention and is not used to limit the present invention. Any modifications, supplements, equivalent replacements, etc. made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A data access method based on dynamically publishing web service interfaces, characterized in that It includes the following steps: Configure the interface call address, interface call method, and interface call parameters to form configuration parameters; After obtaining the configuration parameters, dynamically generate a.java file based on the configuration parameters, and compile a recognizable.class file according to the.java file, corresponding to different types of webservice interfaces; Dynamically register the.class file corresponding to the webservice interface into the spring bean based on the spring boot framework; The server uses Endpoint to dynamically publish the webservice interface based on the Apache CXF technology; The manufacturer performs data access based on the dynamically published webservice interface; The data access method further includes: when configuring parameters, configure multiple groups of configuration parameters, each group of configuration parameters corresponding to a type of webservice interface, and multiple types of webservice interfaces are dynamically published in sequence.
2. The data access method based on dynamically publishing a webservice interface according to claim 1, wherein On the client web page, visually configure the interface call address, interface call method, and interface call parameters according to the business data requirements. Among them, the interface call parameters include the business data parameter field name, business type parameter field name, and serial number data parameter field name.
3. The data access method based on dynamically publishing a webservice interface according to claim 1, wherein When the server uses Endpoint to dynamically publish the webservice interface based on the Apache CXF technology, publish the compiled webservice interface to the spring service, and then call the wsdl address of the webservice to confirm that the webservice interface has been published.
4. The data access method based on dynamically publishing webservice interfaces according to claim 1, characterized in that, For the interface call method, customize the configuration according to the calling habits of the third party or your own naming preferences during parameter configuration, so that the third party does not need to modify the calling interface during configuration.
5. The data access method based on dynamically publishing webservice interfaces according to claim 1, characterized in that The manufacturer monitors the dynamically published webservice interface in real time. When the webservice interface matches its own service interface, data access is performed through the webservice interface.
6. A data access system based on a dynamically published web service interface, characterized in that, It includes a data platform and a manufacturer, where the data platform includes a client and a server; The client is used to provide a parameter configuration interface through the web page, and is also used to receive the interface call address, interface call method, and interface call parameters configured by the user through the parameter configuration interface to form configuration parameters; The server is used to dynamically generate a.java file based on the configuration parameters after obtaining the configuration parameters configured by the client, and compile a recognizable.class file according to the.java file, corresponding to different types of webservice interfaces; The server is also used to dynamically register the.class file corresponding to the webservice interface into the spring bean based on the spring boot framework; It is also used to dynamically publish the webservice interface using the Apache CXF technology; The manufacturer is used to monitor the dynamically published webservice interface in real time. When the webservice interface matches its own service interface, data access is performed through the webservice interface. The data access system further includes: when configuring parameters, multiple groups of configuration parameters are configured, and each group of configuration parameters corresponds to a type of webservice interface, and multiple types of webservice interfaces are dynamically published in sequence.
7. The data access system based on dynamically publishing web service interfaces according to claim 6, wherein The interface call parameters include the field name of the business data parameter, the field name of the business type parameter, and the field name of the serial number data parameter. For the interface call method, custom configuration is performed according to the calling habits of the third party or one's own naming preferences during parameter configuration, so that the third party does not need to modify the calling interface during configuration.
8. The data access system based on dynamically published webservice interfaces according to claim 6, characterized in that, When the server uses Endpoint to dynamically publish the webservice interface based on Apache CXF technology, it is also used to publish the compiled webservice interface to the spring service, and then call the wsdl address of the webservice to confirm that the webservice interface has been published.
Citation Information
Patent Citations
Implementation method for universal webservice interface
CN107315754A
Webservice universal method and device for accessing database, computer equipment and storage medium
CN111966512A
CXF-based Web-Service dynamic issuance and management method under OSGI framework
CN107690003A