Server API automatic construction method and device based on WSDL and medium
By automatically processing JSON structures to generate Java classes and dynamically deploying WebService services, the low efficiency problem in existing technologies is solved and efficient automatic construction and deployment of WebService services is achieved.
Patent Information
- Application Number
- CN202511141950.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-15
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-08-15
AI Technical Summary
Existing technologies cannot automatically deduce Java classes from arbitrary JSON examples or automatically build and deploy WebServices, resulting in low development efficiency and prone to errors.
By obtaining the JSON data structure, determining the type mapping rules, automatically and recursively processing the Java naming rules to generate Java data class files, performing abnormal state analysis, marking standard annotations, and dynamically compiling to build service classes that comply with the JAX-WS specification, the WebService service is finally dynamically deployed.
It can automatically deduce Java classes from any JSON example and automatically construct methods and service classes annotated with @WebService, which improves development efficiency and ensures the automatic deployment of WebService services and compliance with JAX-WS specifications.
Smart Images

Figure CN120743288A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of information system development, and in particular to a method, device, and medium for automatically constructing a server-side API based on WSDL. Background Art
[0002] In today's enterprise information system development, Web Services are still widely used for cross-system and cross-language data exchange, particularly in government, finance, telecommunications, and other fields. WSDL (Web Services Description Language), as a standard for defining service interfaces, plays a key role. Traditionally, Web Service development requires manually writing Java classes on the server side, annotating them with the @WebService or @WebMethod annotations, and manually defining method parameters and return types. When frequently accessing request messages with varying structures, developers must manually code data structure classes and service methods, which is inefficient and error-prone.
[0003] Existing solutions for deriving Java classes from JSON examples include Jsonschema2pojo, which can generate Java classes from JSON schemas. However, this requires pre-prepared JSON schemas and is not dynamically generated. Low-code platform build services have some automatic generation capabilities, but these are often proprietary implementations and cannot dynamically construct complex WebService interfaces. Summary of the Invention
[0004] The embodiments of the present application provide a method, device, and medium for automatically building a server-side API based on WSDL, which solves the technical problems of the prior art in being unable to automatically derive Java classes from any JSON example and in being unable to automatically build and deploy WebService services.
[0005] In the first aspect, an embodiment of the present application provides a method for automatically constructing a server-side API based on WSDL, characterized in that the method includes: obtaining a JSON data structure, and determining a type mapping rule based on the JSON data structure; obtaining a Java data class file through automatic recursive processing of Java naming rules based on the JSON data structure and the type mapping rule; performing abnormal status analysis on the Java data class file to determine a solution to the file abnormality; obtaining a standard annotation based on the Java data class file through service class annotation; constructing a service skeleton that complies with the JAX-WS specification for the standard annotation to determine a directly identifiable service class; and dynamically compiling the directly identifiable service class to obtain a dynamically deployed service.
[0006] In one implementation of the present application, a type mapping rule is determined based on the JSON data structure, specifically including: distinguishing the type features of the JSON data structure to determine the JSON feature type; wherein, the JSON feature types include: integer value, floating point value, Boolean value, object, array; when the JSON feature type is an integer value, the type mapping rule is that the integer value corresponds to the Java Integer type; when the JSON feature type is a floating point value, the type mapping rule is that the floating point value corresponds to the Java Double type; when the JSON feature type is a Boolean value, the type mapping rule is that the Boolean value corresponds to the Java Boolean type; when the JSON feature type is an object, the type mapping rule is that the object is mapped to a nested Java class; when the JSON feature type is an array, the type mapping rule is that the array is mapped to a List <t>; Where T is the inferred type of the array elements.
[0007] In one implementation of the present application, based on the JSON data structure and type mapping rules, a Java data class file is obtained through automatic recursive processing of the Java naming rules, specifically including: deserializing the string of the JSON data structure to obtain memory tree structure data; performing field traversal on the memory tree structure data, and recursively mapping the results of the field traversal according to the type mapping rules to determine the nested class naming; wherein the nested class naming includes main naming and sub-naming; based on the nested class naming, the relationship between nested classes is obtained through field reference in the main class; according to the relationship between nested classes, a Java data class file is obtained through modeling dynamic transformation.
[0008] In one implementation of the present application, an abnormal status analysis is performed on a Java data class file to determine a file abnormality solution, specifically including: when there is a field name conflict in the Java data class file, adding a non-conflicting suffix to the field name to determine a first file abnormality solution; when there is an illegal field name in the Java data class file, escaping or replacing the illegal field name to determine a second file abnormality solution; when the array of the Java data class file is an empty set, generating a user-specified configuration to determine a third file abnormality solution; and determining a file abnormality solution based on the first file abnormality solution, the second file abnormality solution, and the third file abnormality solution.
[0009] In one implementation of the present application, standard annotations are obtained based on Java data class files through service class annotation annotations, specifically including: based on Java data class files, obtaining service class files that comply with the JAX-WS specification; dividing the service class files that comply with the JAX-WS specification into annotation types to determine standard annotations to be defined; wherein, the standard annotations to be defined include: @WebService, @WebMethod, @WebParam, @WebResult; setting the annotation class of @WebService to the externally published SOAP service; setting the annotation class of @WebMethod to the callable method; setting the annotation class of @WebParam and @WebResult to the input parameter name and output parameter name; obtaining standard annotations based on the externally published SOAP service, the callable method, the input parameter name and the output parameter name.
[0010] In one implementation of the present application, a service skeleton is constructed for standard annotations that complies with the JAX-WS specification to determine a service class that can be directly identified, specifically including: determining core business words through business semantic analysis based on the JSON data structure; obtaining data to be annotated through service class structure construction based on the core business words; wherein, the service class structure construction includes: service class naming and method construction; based on the JAX-WS specification, standard annotations are added to the data to be annotated to determine a service class that can be directly identified.
[0011] In one implementation of the present application, a directly identifiable service class is dynamically compiled to obtain a dynamically deployed service, specifically including: writing the directly identifiable service class into a string structure in memory, and constructing it through a compilation task to obtain a compilation task; executing the compilation task, and determining the compilation product data through JavaFileManager; performing abnormal monitoring on the compilation product data to determine the correction field; and loading it through ClassLoader according to the correction field to obtain a dynamically deployed service.
[0012] In one implementation of the present application, after dynamically compiling the directly identifiable service class to obtain the dynamically deployed service, the method further includes: extending the interface of the dynamic code sandbox of the dynamically deployed service to obtain a secure extension interface.
[0013] In the second aspect, an embodiment of the present application also provides a WSDL-based server-side API automatic construction device, characterized in that the device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can: obtain a JSON data structure, and determine a type mapping rule based on the JSON data structure; obtain a Java data class file through automatic recursive processing of Java naming rules based on the JSON data structure and the type mapping rule; perform abnormal status analysis on the Java data class file to determine a solution to the file abnormality; obtain standard annotations based on the Java data class file through service class annotations; construct a service skeleton that complies with the JAX-WS specification for the standard annotations to determine a directly identifiable service class; and dynamically compile the directly identifiable service class to obtain a dynamically deployed service.
[0014] On the third aspect, the embodiment of the present application also provides a non-volatile computer storage medium that is automatically constructed based on the WSDL server-side API, storing computer executable instructions, characterized in that the computer executable instructions are set to: obtain a JSON data structure, and determine the type mapping rules based on the JSON data structure; based on the JSON data structure and the type mapping rules, obtain a Java data class file through automatic recursive processing of the Java naming rules; perform abnormal status analysis on the Java data class file to determine a solution to the file abnormality; based on the Java data class file, obtain a standard annotation through service class annotation; construct a service skeleton that complies with the JAX-WS specification for the standard annotation to determine a directly identifiable service class; dynamically compile the directly identifiable service class to obtain a dynamically deployed service.
[0015] The embodiments of the present application provide a method, device and medium for automatically building a server-side API based on WSDL, which automatically derives a Java class structure that conforms to the WebService interface and dynamically generates standard WebService code through a JSON structure, solving the technical problems of the prior art that cannot automatically derive Java classes from any JSON example and cannot automatically build and deploy WebService services. It realizes the automatic derivation of Java classes from any JSON example, the automatic construction of methods and service classes with @WebService annotations, and the automatic compilation and deployment as WebService services, outputs standard WSDL, and improves development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings: Figure 1 A flowchart of a method for automatically constructing a server-side API based on WSDL provided in an embodiment of the present application; Figure 2 A WSDL-based server-side API automatically constructs a schematic diagram of the internal structure of a device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0018] The embodiments of the present application provide a method, device and medium for automatically building a server-side API based on WSDL, which automatically derives a Java class structure that conforms to the WebService interface and dynamically generates standard WebService code through a JSON structure, solving the technical problems of the prior art that cannot automatically derive Java classes from any JSON example and cannot automatically build and deploy WebService services. It realizes the automatic derivation of Java classes from any JSON example, the automatic construction of methods and service classes with @WebService annotations, and the automatic compilation and deployment as WebService services, outputs standard WSDL, and improves development efficiency.
[0019] The technical solutions proposed in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0020] Figure 1 The following is a flow chart of a method for automatically building a server-side API based on WSDL provided in an embodiment of the present application. Figure 1 As shown, the embodiment of the present application provides a method for automatically constructing a server-side API based on WSDL, which specifically includes the following steps: Step 101: Obtain a JSON data structure, and determine a type mapping rule based on the JSON data structure.
[0021] Exemplarily, the type mapping rule derives the corresponding Java field type based on the type characteristics of each type of value in JSON.
[0022] Specifically, according to the JSON data structure, the type mapping rule is determined, including: distinguishing the type features of the JSON data structure to determine the JSON feature type; wherein, the JSON feature types include: integer value, floating point value, Boolean value, object, array; when the JSON feature type is an integer value, the type mapping rule is that the integer value corresponds to the Java Integer type; when the JSON feature type is a floating point value, the type mapping rule is that the floating point value corresponds to the Java Double type; when the JSON feature type is a Boolean value, the type mapping rule is that the Boolean value corresponds to the Java Boolean type; when the JSON feature type is an object, the type mapping rule is that the object is mapped to a nested Java class; when the JSON feature type is an array, the type mapping rule is that the array is mapped to a List <t>; Where T is the inferred type of the array elements.
[0023] Step 102: Based on the JSON data structure and type mapping rules, a Java data class file is obtained through automatic recursive processing of Java naming rules.
[0024] For example, when building a WebService server, the input and output parameters of service methods are often custom Java Beans. These types often have complex nested structures and require manual definition, making them difficult to quickly adapt to structural changes. This application uses automatic recursive processing based on Java naming rules. Simply providing a representative JSON example automatically analyzes its field structure, data types, and nesting relationships, generating the corresponding Java class definition. This enables automatic derivation of Java classes from any JSON example.
[0025] Specifically, based on the JSON data structure and type mapping rules, a Java data class file is obtained through automatic recursive processing of the Java naming rules, including: deserializing the string of the JSON data structure to obtain memory tree structure data; performing field traversal on the memory tree structure data, and recursively mapping the results of the field traversal according to the type mapping rules to determine the nested class naming; wherein the nested class naming includes main naming and sub-naming; based on the nested class naming, the relationship between nested classes is obtained through field reference in the main class; according to the relationship between nested classes, the Java data class file is obtained through dynamic transformation through modeling.
[0026] In one embodiment, to automatically map JSON request structures to Java class structures, a recursive modeling mechanism is used to fully traverse and parse nested structures, array structures, and primitive type fields. Automatic recursive processing of Java naming rules generates Java data class files that have features such as naming conventions and automatic reference creation.
[0027] First, parse the JSON data structure and deserialize the JSON string into a memory tree structure (JsonNode). For each field, traverse the memory tree structure data and determine its type: Basic types (string, number, boolean) are mapped to Java basic fields; Object types (object) are recursively modeled as nested classes; Array type (array) extracts element type and generates corresponding List <t>.
[0028] Then, the main class is named Request by default or named according to business rules; subclasses are named using the first letter of the field name in capital letters; after the nested class is generated, the relationship between classes is established in the main class through field references.
[0029] Finally, the modeling results are converted into Java class files, supporting template rendering or AST construction, and the generated class files are stored or dynamically loaded for subsequent reflection to create objects to obtain Java data class files.
[0030] For example, given the following JSON input: { "userId": 101, "userName": "Alice", "details": { "age": 30, "email": "alice@example.com" }, "tags": ["admin", "editor"] }.
[0031] The corresponding output class structure is: public class Request { private int userId; private String userName; private Details details; private List <string>tags; / / getters and setters } public class Details { private int age; private String email; / / getters and setters }.
[0032] Step 103: Analyze the abnormal status of the Java data class file to determine a solution to the file abnormality.
[0033] Exemplarily, the present application performs abnormal state analysis on Java data class files, realizes real-time abnormality detection on inferred Java data class files, and avoids abnormalities in subsequent dynamic recursion.
[0034] Specifically, the Java data class file is analyzed for abnormal status to determine a solution to the file abnormality, including: when there is a field name conflict in the Java data class file, a non-conflicting suffix is added to the field name to determine a first file abnormality solution; when there is an illegal field name in the Java data class file, the illegal field name is escaped or replaced to determine a second file abnormality solution; when the array of the Java data class file is an empty set, a user-specified configuration is generated to determine a third file abnormality solution; based on the first file abnormality solution, the second file abnormality solution and the third file abnormality solution, a file abnormality solution is determined.
[0035] In one embodiment, the system checks whether the field name already exists in the class. If it is repeated, it will automatically add a suffix or prompt the developer. If the field name is a number or contains special characters, it will automatically escape or replace them. When the array is empty, the system defaults to the type of List. <object>, which can be manually specified by the user; to avoid infinite recursion caused by malicious or incorrect input, the maximum nesting level can be configured for JSON substructures with exactly the same structure, and class definition reuse is supported to reduce redundancy.
[0036] Step 104: According to the Java data class file, obtain the standard annotation through the service class annotation.
[0037] For example, in order to automatically generate a service class that complies with the JAX-WS specification, this application provides a data basis for subsequent annotation additions through service class annotations.
[0038] Specifically, based on the Java data class file, the standard annotation is obtained through the service class annotation annotation, which specifically includes: based on the Java data class file, through, obtaining the service class file that conforms to the JAX-WS specification; dividing the service class file that conforms to the JAX-WS specification into annotation types to determine the standard annotations to be defined; among which, the standard annotations to be defined include: @WebService, @WebMethod, @WebParam, @WebResult; setting the annotation class of @WebService to the externally published SOAP service; setting the annotation class of @WebMethod to the callable method; setting the annotation class of @WebParam and @WebResult to the input parameter name and output parameter name; obtaining the standard annotation according to the externally published SOAP service, the callable method, the input parameter name and the output parameter name.
[0039] In one embodiment, the service class will be defined using the following standard annotations: @WebService annotated classes are externally published SOAP services; @WebMethod annotates the callable method; @WebParam and @WebResult annotations inject and output parameter names; The return type and parameter types are automatically generated Java classes (Request, Response).
[0040] Step 105: Build a service skeleton that complies with the JAX-WS specification for standard annotations to ensure that the service class can be directly identified.
[0041] For example, to ensure good consistency and serializability of the generated classes during WebService transmission, all fields have getter / setter methods, and JAXB annotations can be optionally added to enhance XML compatibility. After completing Java class modeling, JAX-WS-compliant service classes are automatically generated based on these classes, serving as the entry point for the WebService server, and the JAX-WS-compliant service class skeleton code is constructed.
[0042] Specifically, a service skeleton is constructed for standard annotations that complies with the JAX-WS specification to determine a directly identifiable service class, including: determining core business terms through business semantic analysis based on the JSON data structure; obtaining data to be annotated through service class structure construction based on the core business terms; wherein, service class structure construction includes: service class naming and method construction; based on the JAX-WS specification, standard annotations are added to the data to be annotated to determine a directly identifiable service class.
[0043] In one embodiment, the service class name is taken from the business semantics or JSON example source by default, and the system automatically converts it to PascalCase to avoid naming irregularities.
[0044] Each JSON example generates a corresponding method, with a configurable method name based on business needs. Based on the JAX-WS standard, the following annotations are automatically added to the service class and method. The parameter types are derived from the Request class automatically generated by the model, and the return type is the Response class (either with the default structure or generated based on configuration).
[0045] The generated service class structure is as follows: import javax.jws.WebService; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; @WebService public class UserService { @WebMethod @WebResult(name = "response") public Response process(@WebParam(name = "request") Request request){ Response resp = new Response(); resp.setStatus("ok"); return resp; } }.
[0046] Step 106: Dynamically compile the directly identifiable service class to obtain a dynamically deployed service.
[0047] For example, in order to avoid manual compilation and deployment, the system introduces a dynamic compilation and runtime publishing mechanism, which supports automatic generation of service classes, dynamic compilation, and registration to the service container during operation.
[0048] Specifically, the directly identifiable service class is dynamically compiled to obtain a dynamically deployed service, which specifically includes: writing the directly identifiable service class into a string structure in memory, and constructing it through a compilation task to obtain a compilation task; executing the compilation task, and determining the compilation product data through JavaFileManager; monitoring the compilation product data for anomalies to determine the correction fields; and loading through ClassLoader according to the correction fields to obtain a dynamically deployed service.
[0049] Furthermore, after dynamically compiling the directly identifiable service class to obtain the dynamically deployed service, the method further includes: performing dynamic code sandbox interface expansion on the dynamically deployed service to obtain a secure expansion interface.
[0050] In one embodiment, based on javax.tools.JavaCompiler (Java standard compiler API), the generated service class and data class are written into a string structure in memory.
[0051] Then, create a compilation task through JavaCompiler.getTask(), and use a custom JavaFileManager to save the compilation product (.class file) in memory through memory file management. Syntax errors and compilation failure information are captured and output in real time to facilitate debugging and positioning.
[0052] Finally, a custom ClassLoader is used to load the compiled class into the JVM runtime environment.
[0053] After the service class is successfully compiled and loaded, the system will call the Endpoint class provided by JAX-WS to publish the service. The process is as follows: Object serviceInstance = classLoader.loadClass("UserService").newInstance(); Endpoint.publish("http: / / localhost:8080 / ws / user", serviceInstance).
[0054] It supports automatic adaptation to mainstream JAX-WS implementation containers. After the service is deployed, the WSDL document can be automatically generated and accessed through ?wsdl, and the classes output by the compiler can be verified at runtime to prevent malicious code injection.
[0055] This application automatically derives the Java class structure that conforms to the WebService interface and dynamically generates standard WebService code through the JSON structure. Compared with existing technical solutions, it does not require manual editing of classes, compilers or configuration files; it supports incremental generation and deployment of interfaces at runtime, fully complies with JAX-WS and WSDL specifications, has wide availability, and can be embedded as a plug-in in low-code platforms, ESB systems, etc.
[0056] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, this application embodiment also provides a WSDL-based server API automatic construction device, whose structure is as follows Figure 2 shown.
[0057] Figure 2 The embodiment of the present application provides a WSDL-based server API that automatically constructs a schematic diagram of the internal structure of the device. Figure 2 As shown, the equipment includes: at least one processor 201; and, a memory 202 communicatively coupled to the at least one processor; The memory 202 stores instructions that can be executed by at least one processor, and the instructions are executed by the at least one processor 201 to enable the at least one processor 201 to: Obtain the JSON data structure and determine the type mapping rules based on the JSON data structure; based on the JSON data structure and type mapping rules, obtain the Java data class file through automatic recursive processing of the Java naming rules; perform abnormal status analysis on the Java data class file to determine the solution to the file abnormality; based on the Java data class file, obtain standard annotations through service class annotations; construct a service skeleton that complies with the JAX-WS specification for the standard annotations to determine a directly identifiable service class; dynamically compile the directly identifiable service class to obtain a dynamically deployed service.
[0058] Some embodiments of the present application provide corresponding Figure 1 A non-volatile computer storage medium automatically constructed based on a WSDL server API stores computer executable instructions, wherein the computer executable instructions are set to: Obtain the JSON data structure and determine the type mapping rules based on the JSON data structure; based on the JSON data structure and type mapping rules, obtain the Java data class file through automatic recursive processing of the Java naming rules; perform abnormal status analysis on the Java data class file to determine the solution to the file abnormality; based on the Java data class file, obtain standard annotations through service class annotations; construct a service skeleton that complies with the JAX-WS specification for the standard annotations to determine a directly identifiable service class; dynamically compile the directly identifiable service class to obtain a dynamically deployed service.< / object> < / string> < / t> < / t> < / t>
Claims
1. A method for automatically building a server-side API based on WSDL, characterized in that: The method comprises: Obtaining a JSON data structure, and determining a type mapping rule based on the JSON data structure; Based on the JSON data structure and the type mapping rule, a Java data class file is obtained through automatic recursive processing of Java naming rules; Analyze the abnormal state of the Java data class file to determine a solution to the file abnormality; According to the Java data class file, standard annotations are obtained through service class annotations; Constructing a service skeleton that complies with the JAX-WS specification for the standard annotations to ensure that the service class can be directly identified; The directly identifiable service class is dynamically compiled to obtain a dynamically deployed service.
2. The method for automatically constructing a server-side API based on WSDL according to claim 1, characterized in that: According to the JSON data structure, determine the type mapping rules, including: Performing type feature differentiation on the JSON data structure to determine a JSON feature type; wherein the JSON feature type includes: integer value, floating point value, Boolean value, object, and array; When the JSON feature type is the integer value, the type mapping rule is that the integer value corresponds to the Java Integer type; When the JSON feature type is the floating point value, the type mapping rule is that the floating point value corresponds to the Java Double type; When the JSON feature type is the Boolean value, the type mapping rule is that the Boolean value corresponds to the Java Boolean type; When the JSON feature type is the object, the type mapping rule is that the object is mapped to a nested Java class; When the JSON feature type is the array, the type mapping rule is that the array is mapped to List <t> ; Where T is the inferred type of the array elements.< / t> 3. The method for automatically constructing a server-side API based on WSDL according to claim 1, characterized in that: Based on the JSON data structure and the type mapping rules, a Java data class file is obtained through automatic recursive processing of Java naming rules, specifically including: Deserialize the string of the JSON data structure to obtain memory tree structure data; Performing field traversal on the memory tree structure data, and recursively mapping the results of the field traversal according to the type mapping rule to determine a nested class name; wherein the nested class name includes a main name and a sub-name; Based on the nested class naming, the relationship between nested classes is obtained through field reference in the main class; According to the nested inter-class relationship, the Java data class file is obtained through modeling dynamic transformation.
4. The method for automatically building a server-side API based on WSDL according to claim 1, characterized in that: Analyze the abnormal status of the Java data class file to determine the solution to the file abnormality, specifically including: In the case where there is a field name conflict in the Java data class file, adding a non-conflicting suffix to the field name to determine a solution to the first file exception; In the case where the Java data class file has an illegal field name, escaping or replacing the illegal field name to determine a second file exception solution; If the array of the Java data class files is an empty set, generating a user-specified configuration to determine a third file exception resolution method; The file abnormality solution is determined based on the first file abnormality solution, the second file abnormality solution, and the third file abnormality solution.
5. The method for automatically constructing a server-side API based on WSDL according to claim 1, characterized in that: According to the Java data class file, standard annotations are obtained through service class annotations, including: Based on the Java data class file, obtain a service class file that complies with the JAX-WS specification; Classifying the service class files that conform to the JAX-WS specification by annotation type to determine standard annotations to be defined; wherein the standard annotations to be defined include: @WebService, @WebMethod, @WebParam, and @WebResult; Set the @WebService annotation class as a SOAP service to be published externally; Set the @WebMethod annotation class to a callable method; Set the annotation classes of @WebParam and @WebResult to the input parameter name and output parameter name; The standard annotation is obtained according to the externally published SOAP service, the callable method, the input parameter name and the output parameter name.
6. The method for automatically building a server-side API based on WSDL according to claim 1, characterized in that: The standard annotations are used to construct a service skeleton that complies with the JAX-WS specification to ensure that the service class can be directly identified, including: Based on the JSON data structure, determine the core business words through business semantic analysis; According to the core business words, the data to be annotated is obtained through the service class structure construction; wherein the service class structure construction includes: service class naming and method construction; Based on the JAX-WS specification, the standard annotation is added to the data to be annotated to determine the directly identifiable service class.
7. The method for automatically building a server-side API based on WSDL according to claim 1, characterized in that: Dynamically compiling the directly identifiable service class to obtain a dynamically deployed service specifically includes: Writing the directly identifiable service class into a string structure in memory and constructing it through a compile task to obtain a compile task; Execute the compilation task and determine the compilation product data through JavaFileManager; Performing abnormality monitoring on the compiled product data to determine correction fields; According to the correction field, the dynamic deployment service is obtained by loading through ClassLoader.
8. The method for automatically constructing a server-side API based on WSDL according to claim 1, characterized in that: After dynamically compiling the directly identifiable service class to obtain a dynamically deployed service, the method further includes: An interface of a dynamic code sandbox is extended for the dynamic deployment service to obtain a secure extension interface.
9. A WSDL-based server API automatic construction device, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to: Obtaining a JSON data structure, and determining a type mapping rule based on the JSON data structure; Based on the JSON data structure and the type mapping rule, a Java data class file is obtained through automatic recursive processing of Java naming rules; Analyze the abnormal state of the Java data class file to determine a solution to the file abnormality; According to the Java data class file, standard annotations are obtained through service class annotations; Constructing a service skeleton that complies with the JAX-WS specification for the standard annotations to ensure that the service class can be directly identified; The directly identifiable service class is dynamically compiled to obtain a dynamically deployed service.
10. A non-volatile computer storage medium automatically constructed based on a WSDL server API, storing computer executable instructions, characterized in that: The computer executable instructions are configured to: Obtaining a JSON data structure, and determining a type mapping rule based on the JSON data structure; Based on the JSON data structure and the type mapping rule, a Java data class file is obtained through automatic recursive processing of Java naming rules; Analyze the abnormal state of the Java data class file to determine a solution to the file abnormality; According to the Java data class file, standard annotations are obtained through service class annotations; Constructing a service skeleton that complies with the JAX-WS specification for the standard annotations to ensure that the service class can be directly identified; The directly identifiable service class is dynamically compiled to obtain a dynamically deployed service.
Citation Information
Patent Citations
Software component service packaging method
CN101840334A
Deserialization method and device
CN109542541A
JSON deserialization method and device without hierarchical structure and storage medium
CN109871519A
An interface calling file generation method and device
CN113094195A
API interface access method and device, API interface conversion method and device, equipment and storage medium
CN115509647A
