Method, device, storage medium and processor for publishing network services
By generating and loading bytecode files, the problem of low efficiency in WebService service deployment is solved, enabling rapid deployment and dynamic updates, and improving the efficiency of web service deployment.
Patent Information
- Application Number
- CN202211453320.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-21
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-11-21
AI Technical Summary
The existing methods for publishing WebService services are inefficient, requiring repeated compilation of Java source code and restarts of the program, which cannot meet the needs of rapid deployment. Furthermore, the Java class loader cannot load class files in the same directory multiple times, resulting in extremely low flexibility.
The bytecode generator generates bytecode files using data protocols and data transmission protocols, loads and publishes network services using a preset class loader, eliminating the Java source code compilation step. It introduces a bytecode generator to directly generate compiled files and designs a class loading system to support dynamic updates of network services.
It improves the efficiency of publishing WebService services, reduces the size of source code, and enables rapid publishing and dynamic updates of network services.
Smart Images

Figure CN115718588B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of network communication, in particular to a method and device for publishing network service, storage medium and processor. BACKGROUND
[0002] The existing WebService service is generally published by generating source code Java file according to WebService interface call request, compiling and deploying the source code Java file, and then publishing. Whenever a WebService service is updated or added, the source code Java file needs to be spliced again according to the configuration file parsed by the WebService interface call request, and after the new source code Java file is generated, the Java source code needs to be compiled and deployed again to successfully publish. This way of publishing WebService service after repeated compilation is very low in efficiency. In addition, if the interface configuration changes, because the Java built-in class loader cannot load the same class in the same directory multiple times, after the source code Java file changes, the entire program needs to be restarted to compile, load and publish the updated WebService service. This way of publishing WebService service needs to spend a lot of time to repeatedly recompile the java source file and repeatedly restart the java program to deploy and publish the compiled file, which is extremely low in flexibility and cannot meet the existing demand for quick publishing of WebService service. SUMMARY
[0003] The purpose of the embodiments of the present application is to provide a method and device for publishing network service, storage medium and processor.
[0004] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a method for publishing network service, comprising:
[0005] receiving a first business requirement; parsing the first business requirement to obtain configuration data of the first business requirement, the configuration data including a network service to be published; determining a data protocol bytecode generator and a data transmission protocol bytecode generator corresponding to the configuration data; generating a bytecode file according to the data protocol bytecode generator, the data transmission protocol bytecode generator and the configuration data, wherein the bytecode file includes files required when registering a network interface, files required when running a request class set, and files required when running a response class set; loading the bytecode file through a preset class loader to obtain a class instance; running the class instance to register the network interface to a bus; and publishing the network service through the bus.
[0006] In one embodiment, the loading the bytecode file by the preset class loader to obtain the class instance comprises: the preset class loader generating a preset class loader instance; and loading the bytecode file by the preset class loader instance to create the class instance.
[0007] In one embodiment, the method further comprises: in the case that the network service has an update requirement, uninstalling the published network service; and receiving a second service requirement corresponding to the updated network service to publish the updated network service.
[0008] In one embodiment, the uninstalling the published network service comprises: cleaning the bytecode file; setting the class loader instance as an invalid reference; and uninstalling the class instance and the preset class loader.
[0009] In one embodiment, the uninstalling the published network service further comprises: the preset class loading system configuring a preset uninstall class loader to enable the network service to be uninstalled by the preset uninstall class loader.
[0010] In one embodiment, the method further comprises: the preset class loading system configuring the preset class loader according to the bytecode file to enable the bytecode file to generate the class instance by the preset class loader.
[0011] In one embodiment, the running the class instance to register the network interface to the bus comprises: binding the class instance with a service address of the network service to register the network interface to the bus.
[0012] The second aspect of the present application provides a processor configured to execute the method of publishing a network service.
[0013] The third aspect of the present application provides an apparatus for publishing a network service, comprising a processor configured to execute the method of publishing a network service.
[0014] The fourth aspect of the present application provides a machine readable storage medium having instructions stored thereon, which, when executed by a processor, cause the processor to be configured to execute the method of publishing a network service.
[0015] Through the above technical solution, the network service can be directly published after being loaded by a preset class loader without going through a complicated and inefficient source code Java file compiling process before publication. The bytecode generator is introduced to directly generate a compiled bytecode file, and the bytecode file is directly published after being loaded by the preset class loader corresponding to the bytecode file. The solution saves the compiling step, reduces the size of the source code, and effectively improves the publication efficiency of the network service.
[0016] Other features and advantages of the embodiments of the present application will be described in detail in the following specific implementation part. BRIEF DESCRIPTION OF DRAWINGS
[0017] The accompanying drawings are included to provide a further understanding of embodiments of the application, and are incorporated in and constitute a part of the specification, illustrate embodiments of the application, and together with the description serve to explain the principles of the application. In the drawings:
[0018] Figure 1 An application environment schematic diagram of the method for publishing web service according to the embodiments of the application is schematically shown;
[0019] Figure 2 A flowchart of the method for publishing web service according to the embodiments of the application is schematically shown;
[0020] Figure 3 A flowchart of the class loading system according to the embodiments of the application is schematically shown;
[0021] Figure 4 A flowchart of the method for publishing web service according to the embodiments of the application is schematically shown;
[0022] Figure 5 A structural block diagram of the apparatus for publishing web service according to the embodiments of the application is schematically shown;
[0023] Figure 6 An internal structure diagram of the computer device according to the embodiments of the application is schematically shown. DETAILED DESCRIPTION
[0024] In order to make the objects, technical solutions and advantages of the embodiments of the application clearer, the technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. It should be understood that the specific embodiments described herein are only used to explain and illustrate the embodiments of the application, and are not used to limit the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the application.
[0025] The method for publishing web service provided by the application can be applied in the application environment as shown in Figure 1 The client 102 communicates with the server 104 through the network. The client 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers. The client 102 is used to initiate a web service request. The server 104 is used to receive and respond to the web service request published by the client 102 and publish corresponding web service.
[0026] Figure 2The illustration shows a flowchart of a method for publishing network services according to an embodiment of this application. Figure 2 As shown, in one embodiment of this application, a method for publishing network services is provided. This embodiment mainly applies this method to the above-mentioned... Figure 1 Taking server 104 as an example, the following steps are included:
[0027] Step 201: Receive the first service request.
[0028] Step 202: Parse the first business requirement to obtain the configuration data of the first business requirement, which includes the network service to be published.
[0029] Step 203: Determine the data protocol bytecode generator and the data transmission protocol bytecode generator corresponding to the configuration data.
[0030] Step 204: Generate bytecode files based on the data protocol bytecode generator, the data transmission protocol bytecode generator, and the configuration data. The bytecode files include files required when registering the network interface, files required when the request class set is run, and files required when the response class set is run.
[0031] Step 205: Load the bytecode file using the preset class loader to obtain a class instance.
[0032] Step 206: Run the class instance to register the network interface to the bus.
[0033] Step 207: Publish network services via the bus.
[0034] The network interface refers to a tool used by two terminals for communication. In the technical solution, the network interface can refer to a webservice interface. The webservice interface is an interface of a server system to the outside. For example, a user needs to obtain resources or information from some website or server. The website or server does not directly share the database with the user. The website or server instructs the user to provide a well-written method to help the user obtain data. The user can use the method written by them by calling the webservice interface provided by the website or server, so as to achieve the purpose of data sharing. Receiving the first calling request for the network interface can refer to receiving a webservice interface calling request. Specifically, the client 102 wants to obtain the resources or information of the server 104, and then publishes a network service request. The server 104 receives the first business demand initiated by the client and requests to call the webservice interface. After receiving the webservice interface calling request, the first business demand is parsed, and configuration data is configured for the first business demand. The configuration data includes a to-be-published network service, and the to-be-published network service can refer to a webservice service. After the configuration data is parsed, the configuration data is stored in the database.
[0035] The data protocol can refer to an xml protocol or a json protocol. The xml protocol is the earliest network transmission protocol. The xml has extensibility, self-description, and simplicity. Specifically, the xml is easy to fully utilize data. The xml has the characteristics of cross-platform and easy data exchange and sharing, and the data can be utilized by more users and devices. The json protocol is a simple data exchange format. Compared with the xml, the json has the characteristics of simple structure, convenient generation and parsing. The data transmission protocol can refer to a soap protocol or an http protocol. The soap is a simple object access protocol, which is used to describe the format of information transmission and is a lightweight, simple, and xml-based protocol. The http is a hypertext transfer protocol, which is a json-based protocol. After the first business demand is parsed and the configuration data is configured for the first business demand, the data protocol type in the configuration data is determined to determine the data protocol bytecode generator and the data transmission protocol bytecode generator corresponding to the data protocol type. Specifically, when the data protocol in the configuration data is xml, the xml bytecode generator and the soap bytecode generator are selected. When the data protocol in the configuration data is json, the json bytecode generator and the http bytecode generator are selected.
[0036] After determining the data protocol bytecode generator and the data transmission protocol bytecode generator, a bytecode file is generated according to the selected data protocol bytecode generator and the data transmission protocol bytecode generator and the configuration data. The bytecode refers to a binary file containing an execution program, composed of a sequence of op code or data pairs, and is an intermediate code. The bytecode file can refer to a class file. The class file is the full name of the java class file, which is a compiled java file. The java file can only be published and run after being compiled into a class file. Specifically, after determining that the xml bytecode generator and the soap bytecode generator are selected, a class file is generated according to the configuration data and the xml bytecode generator and the soap bytecode generator. After determining that the json bytecode generator and the http bytecode generator are selected, a class file is generated according to the configuration data and the json bytecode generator and the http bytecode generator. The generated class file includes a class file required when registering a network interface, a class file required when running a request class set, and a class file required when running a response class set.
[0037] After generating the bytecode file according to the configuration data and the bytecode generator, the bytecode file is loaded by a preset class loader to obtain a class instance. The class loader refers to a code block that obtains the binary byte stream of the class through the authority name of the class, and is an indispensable part of the runtime of the java program, responsible for compiling the java source program into a class file loaded into the memory space of the java virtual machine, and converting the static data of the class file into the data structure of the method area at runtime. The class refers to an abstract collection of objects with the same properties and functions, and the instance refers to a real object of a class. Specifically, the class file can be loaded by the preset class loader to obtain the class instance of the class file.
[0038] After obtaining the class instance, the class instance is run to register the network interface to the bus. The bus can refer to an address bus, which is a computer bus, a CPU or a unit with DMA capability, used to communicate the physical address of the unit that wants to access (read / write) the computer memory component / place. Specifically, after obtaining the class instance, the class instance is run to register the webservcie interface to the bus. After registering the interface to the bus, the network service is published through the bus. Specifically, the webservcie interface can be registered to the bus, and the webservcie service can be published.
[0039] The above technical solution can make the webservice service not need to pass through a complex and low-efficiency source code Java file compiling process before publishing, introduce a bytecode generator to directly generate a compiled class file, and publish the class file after loading by a preset class loader corresponding to the class file. The solution saves the compiling step, reduces the size of the source code, and can effectively improve the publishing efficiency of the webservice service.
[0040] In one embodiment, loading the bytecode file by the preset class loader to obtain the class instance includes that the preset class loader generates a preset class loader instance, and the preset class loader instance loads the bytecode file to create the class instance. Specifically, loading the class file by the preset class loader to obtain the class instance of the class file can include that the preset class loader first generates a preset class loader instance, and the preset class loader instance loads the class file to create the class instance of the class file.
[0041] In one embodiment, in the case that the network service needs to be updated, uninstalling the published network service can mean that the server 104 uninstalls the published network service when the client 102 modifies or updates the initiated network service request. Receiving a second business requirement corresponding to the updated network service to publish the updated network service can mean that the server 104 receives a new business requirement for the modified or updated network service request, requests to call an interface, and publishes the updated network service. Specifically, after the client 102 modifies or updates the webservice service, the client 102 reinitiates a business requirement and requests to call a webservice interface. The server 104 receives the request, reanalyzes, configures configuration data, reselects a bytecode generator according to the configuration data, generates a new class file, loads the class file by a loader to create a new class file class instance, runs the class instance, and re-registers the webservice interface to a bus to publish the updated webservice service.
[0042] In one embodiment, unloading a published web service includes: cleaning up bytecode files, setting class loader instances to null references, and unloading class instances and default class loaders. Here, "null reference" can mean setting the value to null, which is a null pointer and indicates that the value does not reference a valid object. Specifically, this can mean that after client 102 modifies or updates the web service and then re-initiates a business request to call the web service interface, server 104, upon receiving the new business request, needs to unload the already published web service before publishing the updated web service. Unloading the published web service involves cleaning up its associated class files, setting the class loader instance that loads the class files to null, and unloading both the class instances and class loaders of the created class files. After unloading the already published web service, server 104 then republishes the updated web service for the new web service interface call request.
[0043] In one embodiment, such as Figure 3 As shown, a class loading system flowchart is provided, including:
[0044] When uninstalling a web service, its associated class loader needs to be uninstalled. Unloading a class loader requires an uninstaller. In this technical solution, server 104 has a class loading system configured to uninstall class loaders based on the class loader's configuration. Furthermore, the class loading system can also configure the corresponding class loader based on the bytecode file; that is, the class loader can configure the corresponding class loader based on the class file. For example... Figure 3 As shown, when a server needs to publish Service A, Service B (version 1), and Service B (version 2), the class loading system configures corresponding class loaders A, B, and C based on the Service A class set corresponding to Service A, Service B (version 1) class set corresponding to Service B, and Service B (version 2) class set corresponding to Service B, to load the Service A class set, Service B (version 1) class set, and Service B (version 2) class set, and create the corresponding class instances. Furthermore, if it is necessary to unload Service A, Service B (version 1), and Service B (version 2), the class loading system also configures corresponding unloading class loaders A, B, and C based on their respective class loaders A, B, and C, and unloads class loaders A, B, and C respectively.
[0045] In one embodiment, the running class instance is used to register the network interface to the bus, including binding the class instance with the service address of the network service to register the network interface to the bus. Specifically, it can refer to that the client 102 initiates a business requirement to the server 104 and requests to call the webservice interface, the server 104 receives the business requirement, configures configuration data for the business requirement, and stores the configuration data in a database for calling, the server 104 selects a corresponding bytecode generator according to the configuration data to generate a running class file, the generated class file is loaded by a class loader configured by a class loading system, the class loader generates a class loading instance and loads the class file, creates a class instance corresponding to the class file, runs the class instance, the server 104 registers the webservice interface to the address bus, and binds the class instance with the client address through the address bus, so that the webservice service is successfully published to the client 102.
[0046] In one embodiment, as shown in Figure 4 a flowchart for publishing webservice service is provided, including:
[0047] The client 102 has a webservice service requirement, initiates a business requirement to the server 104, and requests to call the webservice interface. The server 104 receives the business requirement and configures configuration data for the business requirement. The server 104 selects a corresponding xml bytecode generator and soap bytecode generator, or a json bytecode generator and http bytecode generator according to the configuration data. Then, the server 104 generates a java compiled class file according to the selected data protocol bytecode generator and data transmission protocol bytecode generator. The class loading system in the server 104 configures a suitable special class loader according to the generated class file, the class loader generates a class loading instance and loads the class file to create a class instance of the class file. The webservice interface is registered to the bus, the class instance is bound with the address of the client 102 through the bus, and the webservice service is successfully published.
[0048] In the case that the client 102 updates the webservice service requirement, the server 104 first unloads the already published webservice service. The server 104 cleans up the class file corresponding to the already published webservice service, sets the class loading instance to null, and configures a corresponding unloading class loader according to the class loader, and unloads the class loader through the unloading class loader. After the server unloads the published webservice service, the server re-receives the business requirement initiated by the client 102, and publishes the updated webservice service according to the updated business requirement.
[0049] The technical solution can make the webservcie service not need to go through a complex and low-efficiency source code Java file compilation process before publication, and directly generate a class file after Java compilation by introducing a bytecode generator, and a class loading system is designed, which can configure a corresponding class loader according to a class file set corresponding to the webservcie service to be published or unloaded. The technical solution saves the compilation step, reduces the size of the source code, can update the webservcie service in real time and dynamically, and effectively improves the publication efficiency of the webservcie service.
[0050] In one embodiment, as shown in Figure 5 An apparatus for publishing a network service is provided, comprising:
[0051] A business requirement receiving module 502 is configured to receive a first business requirement.
[0052] A business requirement analyzing module 504 is configured to analyze the first business requirement to obtain configuration data of the first business requirement, and the configuration data comprises a network service to be published.
[0053] A service configuring module 506 is configured to determine a data protocol bytecode generator and a data transmission protocol bytecode generator corresponding to the configuration data, and generate a bytecode file according to the data protocol bytecode generator, the data transmission protocol bytecode generator and the configuration data, wherein the bytecode file comprises a file required when a network interface is registered, a file required when a request class set runs, and a file required when a response class set runs.
[0054] A service loading module 508 is configured to load the bytecode file through a preset class loader to obtain a class instance.
[0055] A service publishing module 510 is configured to run the class instance to register the network interface to a bus, and publish the network service through the bus.
[0056] The processor includes a core, and the core calls corresponding program units in the memory. The core can be one or more, and the method of publishing a network service is implemented by adjusting core parameters.
[0057] The memory can include non-permanent memory in a computer readable medium, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
[0058] The embodiment of the present application provides a storage medium, which has a program stored thereon, and the program is executed by a processor to implement the method of publishing a network service.
[0059] The embodiment of the present application provides a processor, which is used for running a program, and the program is executed to implement the method of publishing a network service.
[0060] In one embodiment, a computer device can be provided, which can be a server, and an internal structure diagram of the computer device can be as shown in Figure 6 The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected through a system bus. The processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The database of the computer device is used to store data of the network service publishing. The network interface A02 of the computer device is used to communicate with an external terminal through network connection. The computer program B02 is executed by the processor A01 to implement a method of publishing a network service.
[0061] Those skilled in the art can understand that Figure 6 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0062] The embodiment of the present application provides a device, and the device includes a processor, a memory and a program stored in the memory and executable on the processor. The processor implements the following steps when executing the program.
[0063] receiving a first service requirement; parsing the first service requirement to obtain configuration data of the first service requirement, the configuration data comprising a network service to be published; determining a data protocol bytecode generator and a data transmission protocol bytecode generator corresponding to the configuration data; generating a bytecode file according to the data protocol bytecode generator, the data transmission protocol bytecode generator, and the configuration data, wherein the bytecode file comprises files required when registering a network interface, files required when running a request class set, and files required when running a response class set; loading the bytecode file by a preset class loader to obtain a class instance; running the class instance to register the network interface to a bus; and publishing the network service through the bus.
[0064] In one embodiment, loading the bytecode file by the preset class loader to obtain the class instance comprises: generating a preset class loader instance by the preset class loader; and loading the bytecode file by the preset class loader instance to create the class instance.
[0065] In one embodiment, the method further comprises: in a case where there is an update requirement for the network service, uninstalling the published network service; and receiving a second service requirement corresponding to an updated network service based on the updated network service to publish the updated network service.
[0066] In one embodiment, uninstalling the published network service comprises: cleaning up the bytecode file; setting the class loader instance as an invalid reference; and uninstalling the class instance and the preset class loader.
[0067] In one embodiment, uninstalling the published network service further comprises: configuring a preset uninstall class loader by the preset class loading system to enable the network service to be uninstalled through the preset uninstall class loader.
[0068] In one embodiment, the method further comprises: configuring the preset class loader by the preset class loading system according to the bytecode file to enable the bytecode file to generate the class instance through the preset class loader.
[0069] In one embodiment, running the class instance to register the network interface to the bus comprises: binding the class instance to a service address of the network service to register the network interface to the bus.
[0070] The application further provides a computer program product, which is adapted to execute the program of the following method steps when executed on a data processing device: receiving a first service requirement; parsing the first service requirement to obtain configuration data of the first service requirement, the configuration data comprising a network service to be published; determining a data protocol bytecode generator and a data transmission protocol bytecode generator corresponding to the configuration data; generating a bytecode file according to the data protocol bytecode generator, the data transmission protocol bytecode generator and the configuration data, wherein the bytecode file comprises files required when registering a network interface, files required when running a request class set, and files required when running a response class set; loading the bytecode file by a preset class loader to obtain a class instance; running the class instance to register the network interface to a bus; and publishing the network service through the bus.
[0071] In one embodiment, loading the bytecode file by the preset class loader to obtain the class instance comprises: the preset class loader generating a preset class loader instance; and loading the bytecode file by the preset class loader instance to create the class instance.
[0072] In one embodiment, the method further comprises: in the case that there is an update requirement for the network service, uninstalling the published network service; receiving a second service requirement corresponding to an updated network service based on the updated network service to publish the updated network service.
[0073] In one embodiment, uninstalling the published network service comprises: cleaning up the bytecode file; setting the class loader instance as an invalid reference; and uninstalling the class instance and the preset class loader.
[0074] In one embodiment, uninstalling the published network service further comprises: the preset class loading system configuring a preset uninstall class loader to enable the network service to be uninstalled through the preset uninstall class loader.
[0075] In one embodiment, the method further comprises: the preset class loading system configuring the preset class loader according to the bytecode file to enable the bytecode file to generate the class instance through the preset class loader.
[0076] In one embodiment, running the class instance to register the network interface to the bus comprises: binding the class instance with a service address of the network service to register the network interface to the bus.
[0077] Those skilled in the art will understand that embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk memory, CD-ROM, optical memory, etc.) containing computer-usable program code.
[0078] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps of the flowchart block or blocks
[0079] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps of the flowchart block or blocks
[0080] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks Figure 1 means for functionally implementing the steps of the flowchart block or blocks
[0081] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0082] The memory can include non-persistent memory and / or volatile memory, such as a random access memory (RAM) including a cache area for the temporary storage of data. The memory can also include non-volatile memory, such as read only memory (ROM) for storing structural information and / or instruction data. Access and control of memory can be facilitated by a Memory Controller. Note that the software can be downloaded to the computer in electronic form over a network, for example, or it can be supplied
[0083] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0084] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0085] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the scope of claims of the present application.
Claims
1. A method of publishing a network service, characterized by, The method comprises: receiving a first service requirement; parsing the first service requirement to obtain configuration data of the first service requirement, the configuration data comprising a network service to be published; determining a data protocol bytecode generator and a data transmission protocol bytecode generator corresponding to the configuration data; generating a bytecode file according to the data protocol bytecode generator, the data transmission protocol bytecode generator, and the configuration data, wherein the bytecode file comprises files required when registering a network interface, files required when running a request class set, and files required when running a response class set; loading the bytecode file by a preset class loader to obtain a class instance; running the class instance to register the network interface to a bus; publishing the network service through the bus.
2. The method of publishing a web service according to claim 1, wherein, The loading of the bytecode file by the preset class loader to obtain a class instance comprises: the preset class loader generates a preset class loader instance; the bytecode file is loaded by the preset class loader instance to create the class instance.
3. The method of publishing a web service of claim 2, wherein, The method further comprises: in the case that there is an update requirement for the network service, uninstalling the published network service; receiving a second service requirement corresponding to an updated network service to publish the updated network service.
4. The method of publishing web services according to claim 3, wherein, The uninstalling of the published network service comprises: cleaning up the bytecode file; setting the class loader instance as an invalid reference; uninstalling the class instance and the preset class loader.
5. The method of publishing web services according to claim 3, wherein, The uninstalling of the published network service further comprises: a preset class loading system configures a preset uninstall class loader so that the network service is uninstalled through the preset uninstall class loader.
6. The method of publishing web services of claim 1, wherein, The method further comprises: a preset class loading system configures a preset class loader according to the bytecode file so that the bytecode file generates the class instance through the preset class loader.
7. The method of publishing web services of claim 1, wherein, The running of the class instance to register the network interface to a bus comprises: binding the class instance with a service address of the network service to register the network interface to the bus.
8. A processor, comprising: A processor configured to perform the method of publishing a network service according to any one of claims 1 to 7.
9. An apparatus for publishing a network service, the apparatus comprising: A processor according to claim 8.
10. A machine-readable storage medium having stored thereon instructions, the instructions being executable by a machine to cause the machine to: The instructions, when executed by a processor, cause the processor to be configured to perform the method of publishing a network service according to any one of claims 1 to 7.
Citation Information
Patent Citations
Automatic publication and combination method for Web service
CN102811257A
Method and device for dynamically publishing Web service
CN103473034A