WSDL-based service-side api automatic construction method, device and medium

By using a WSDL-based automatic server API construction method to obtain JSON data structures, generate Java data class files, perform exception state analysis and dynamic compilation, the problem of the inability to automatically generate WebService services in existing technologies is solved, thus improving development efficiency.

CN120743288BActive Publication Date: 2026-02-17INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511141950.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-15
Publication Date
2026-02-17
Estimated Expiration
2045-08-15

AI Technical Summary

Technical Problem

Existing technologies cannot automatically derive Java classes from JSON examples, nor can they automatically generate WebService services, resulting in low development efficiency and the inability to automatically generate WebService services.

Method used

By obtaining the JSON data structure, identifying technical issues, and providing a technical approach based on WSDL, this paper presents an automatic construction method for server-side APIs. This method includes obtaining the JSON data structure, determining type mapping rules, generating Java data class files through automatic recursive processing of Java naming rules, performing exception state analysis, adding standard annotations, constructing a service skeleton that conforms to the JAX-WS specification, and performing dynamic compilation and deployment.

Benefits of technology

It enables the automatic derivation of Java classes from any JSON example and the automatic generation of WebService services, improving development efficiency and solving the problem that existing technologies cannot automatically build and deploy WebService services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743288B_ABST
    Figure CN120743288B_ABST
Patent Text Reader

Abstract

The application discloses a WSDL-based service end API automatic construction method and device and medium, relates to the technical field of information system development, and comprises the following steps: determining a type mapping rule according to a JSON data structure; obtaining a Java data class file through automatic recursive processing of a Java naming rule based on the JSON data structure and the type mapping rule; performing abnormal state analysis on the Java data class file to determine a file exception solution method; obtaining a standard annotation through service class annotation marking according to the Java data class file; performing service skeleton construction conforming to a JAX-WS specification on the standard annotation to determine a directly identifiable service class; and performing dynamic compilation on the directly identifiable service class to obtain a dynamically deployed service. The application solves the technical problems that the prior art cannot automatically deduce a Java class from an arbitrary JSON example and cannot automatically construct and deploy a WebService service.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of information system development, and particularly relates to a WSDL-based service-side API automatic construction method, device and medium. BACKGROUND

[0002] In the development of enterprise information systems today, WebService is still widely used for cross-system and cross-language data interaction, especially in the fields of government affairs, finance and telecommunications. WSDL (Web Services Description Language) plays a key role as a service interface definition standard. In the development of traditional WebService services, the service side needs to manually write Java classes, mark @WebService or @WebMethod annotations, and manually define method parameters and return types. When frequently accessing request messages with variable structures, developers must manually write data structure classes and service method codes, which is inefficient and prone to errors.

[0003] In the prior art, the technical solution of deriving Java classes from JSON examples can generate Java classes from JSON Schema through Jsonschema2pojo, but JSON Schema needs to be prepared in advance and is not dynamically generated. Low-code platforms have certain automatic generation capabilities, but they are mostly private implementations and cannot dynamically construct complex WebService interfaces. SUMMARY

[0004] The embodiments of the present application provide a WSDL-based service-side API automatic construction method, device and medium, which solves the technical problems that the prior art cannot automatically derive Java classes from any JSON examples and cannot automatically construct and deploy WebService services.

[0005] In a first aspect, the embodiments of the present application provide a WSDL-based service-side API automatic construction method, characterized in that the method comprises: obtaining a JSON data structure, and determining a type mapping rule according to the JSON data structure; based on the JSON data structure and the type mapping rule, obtaining a Java data class file through automatic recursive processing of Java naming rules; performing abnormal state analysis on the Java data class file to determine a file exception solution method; obtaining a standard annotation through service class annotation marking according to the Java data class file; performing service skeleton construction in accordance with JAX-WS specifications on the standard annotation to determine a directly identifiable service class; and performing dynamic compilation on the directly identifiable service class to obtain a dynamically deployed service.

[0006] In an implementation form of the application, the type mapping rule is determined according to the JSON data structure, specifically comprising: distinguishing the type characteristics of the JSON data structure to determine the JSON characteristic type; wherein the JSON characteristic type comprises: integer value, floating point value, Boolean value, object, array; in the case of the JSON characteristic type being an integer value, the type mapping rule is that the integer value corresponds to the Integer type of Java; in the case of the JSON characteristic type being a floating point value, the type mapping rule is that the floating point value corresponds to the Double type of Java; in the case of the JSON characteristic type being a Boolean value, the type mapping rule is that the Boolean value corresponds to the Boolean type of Java; in the case of the JSON characteristic type being an object, the type mapping rule is that the object is mapped to a nested Java class; in the case of the JSON characteristic type being an array, the type mapping rule is that the array is mapped to a List <t>; where T is the deduced type of the array element.

[0007] In an implementation manner of the present application, based on the JSON data structure and the type mapping rule, the Java data class file is obtained through automatic recursive processing of Java naming rules, specifically including: the JSON data structure string is deserialized to obtain the memory tree structure data; the field traversal is performed on the memory tree structure data, and the recursive mapping is performed on the field traversal result according to the type mapping rule to determine the nested class naming; wherein the nested class naming includes the main naming and the sub-naming; based on the nested class naming, the relationship between the nested classes is obtained through the field reference in the main class; according to the relationship between the nested classes, the Java data class file is obtained through modeling dynamic conversion.

[0008] In an implementation manner of the present application, the abnormal state of the Java data class file is analyzed to determine the file abnormality solving method, specifically including: in the case that the Java data class file has field name conflict, a non-conflict suffix is added to the field name to determine the first file abnormality solving method; in the case that the Java data class file has illegal field name, the illegal field name is escaped or replaced to determine the second file abnormality solving method; in the case that the array of the Java data class file is empty set, a user specified configuration is generated to determine the third file abnormality solving method; based on the first file abnormality solving method, the second file abnormality solving method and the third file abnormality solving method, the file abnormality solving method is determined.

[0009] In an implementation manner of the present application, according to the Java data class file, the standard annotation is obtained through service class annotation marking, specifically including: based on the Java data class file, the service class file conforming to the JAX-WS specification is obtained; the service class file conforming to the JAX-WS specification is divided into annotation types to determine the to-be-defined standard annotation; wherein the to-be-defined standard annotation includes: @WebService, @WebMethod, @WebParam, @WebResult; the marked class of @WebService is set as the SOAP service published externally; the marked class of @WebMethod is set as the method available for calling; the marked classes of @WebParam and @WebResult are set as the parameter name and the result name; according to the SOAP service published externally, the method available for calling, the parameter name and the result name, the standard annotation is obtained.

[0010] In an implementation manner of the present application, the standard annotation is built according to a JAX-WS specification service skeleton to determine the directly identifiable service class, specifically comprising: determining core business words based on a JSON data structure through business semantic analysis; obtaining the data to be annotated according to the core business words through service class structure construction; wherein the service class structure construction comprises service class naming and method construction; adding the standard annotation to the data to be annotated based on the JAX-WS specification to determine the directly identifiable service class.

[0011] In an implementation manner of the present application, the directly identifiable service class is dynamically compiled to obtain the dynamically deployed service, specifically comprising: writing the directly identifiable service class into a string structure in the memory and obtaining a compilation task through compilation task construction; executing the compilation task and determining the compilation product data through JavaFileManager; monitoring the compilation product data for exceptions to determine the correction field; loading the dynamically deployed service through ClassLoader according to the correction field.

[0012] In an implementation manner of the present application, after the directly identifiable service class is dynamically compiled to obtain the dynamically deployed service, the method further comprises: performing interface extension of the dynamically deployed service through a dynamic code sandbox to obtain a security extension interface.

[0013] In a second aspect, the embodiments of the present application further provide a WSDL-based service end API automatic construction device, characterized in that the device comprises: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable 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: obtain a JSON data structure and determine a type mapping rule according to 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; analyze the Java data class file for an abnormal state to determine a file exception solution method; obtain a standard annotation through service class annotation marking according to the Java data class file; build a standard annotation according to a JAX-WS specification service skeleton to determine a directly identifiable service class; and dynamically compile the directly identifiable service class to obtain a dynamically deployed service.

[0014] In a third aspect, the embodiments of the present application further provide a non-volatile computer storage medium for automatically constructing a WSDL-based service-side API, which stores computer executable instructions. The computer executable instructions are configured to: obtain a JSON data structure, and determine a type mapping rule according to 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 state analysis on the Java data class file to determine a file abnormality solving method; obtain a standard annotation through service class annotation based on the Java data class file; perform service skeleton construction conforming to a JAX-WS specification on the standard annotation to determine a directly identifiable service class; and perform dynamic compilation on the directly identifiable service class to obtain a dynamically deployed service.

[0015] The embodiments of the present application provide a WSDL-based service-side API automatic construction method and device and medium. The Java class structure conforming to the WebService interface and the dynamic self-generation of the standard WebService code are automatically derived based on the JSON structure. The technical problems that the prior art cannot automatically derive the Java class from any JSON example and cannot automatically construct and deploy the WebService service are solved. The Java class is automatically derived from any JSON example, the method and service class with the @WebService annotation are automatically constructed, and the WebService service is automatically compiled and deployed. The standard WSDL is output. The development efficiency is improved. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings, which are included to provide a further understanding of the application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:

[0017] Figure 1 A WSDL-based service-side API automatic construction method flowchart is provided for the embodiments of the present application.

[0018] Figure 2 A WSDL-based service-side API automatic construction device internal structure schematic diagram is provided for the embodiments of the present application. DETAILED DESCRIPTION

[0019] In order to make the purposes, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described below in connection with specific embodiments of the present application and corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0020] The embodiments of the present application provide a WSDL-based server API automatic construction method, device and medium. The Java class structure conforming to the WebService interface and the dynamic self-generation of the standard WebService code are automatically derived from the JSON structure, the technical problems that the prior art cannot automatically derive the Java class from any JSON example and cannot automatically construct and deploy the WebService service are solved, the Java class is automatically derived from any JSON example, the method and service class with the @WebService annotation are automatically constructed, the WebService service is automatically compiled and deployed, the standard WSDL is output, and the development efficiency is improved.

[0021] The technical solutions of the embodiments of the present application will be described in detail below with reference to the drawings.

[0022] Figure 1 A WSDL-based server API automatic construction method flowchart is provided for the embodiments of the present application. As shown in the figure, Figure 1 The WSDL-based server API automatic construction method provided by the embodiments of the present application specifically includes the following steps:

[0023] Step 101, obtain the JSON data structure, and determine the type mapping rule according to the JSON data structure.

[0024] For example, the type mapping rule maps the corresponding Java field type according to the type characteristics of each value in the JSON.

[0025] Specifically, according to the JSON data structure, a type mapping rule is determined, including: performing type feature distinction on the JSON data structure to determine a JSON feature type; wherein the JSON feature type includes: an integer value, a floating point value, a Boolean value, an object, and an array; in a case where the JSON feature type is an integer value, the type mapping rule is that the integer value corresponds to an Integer type of Java; in a case where the JSON feature type is a floating point value, the type mapping rule is that the floating point value corresponds to a Double type of Java; in a case where the JSON feature type is a Boolean value, the type mapping rule is that the Boolean value corresponds to a Boolean type of Java; in a case where the JSON feature type is an object, the type mapping rule is that the object is mapped to a nested Java class; and in a case where 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 deduced type of the array element.

[0026] In step 102, 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.

[0027] For example, when building a WebService server, the input and output parameter types of the service method are usually custom Java Beans. These types often have complex nested structures and need to be manually defined, which is not easy to quickly adapt to structural changes. The present application automatically analyzes the field structure, data type and nesting relationship of a representative JSON example through automatic recursive processing of Java naming rules, and generates the corresponding Java class definition, thereby achieving automatic derivation of Java classes from any JSON example.

[0028] Specifically, 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, including: deserializing the JSON data structure string to obtain in-memory tree structure data; field traversal is performed on the in-memory tree structure data, and the results of the field traversal are recursively mapped according to the type mapping rule to determine the nested class naming; wherein the nested class naming includes the main naming and the sub-naming; based on the nested class naming, the relationship between the nested classes is obtained through field reference in the main class; according to the relationship between the nested classes, the Java data class file is obtained through modeling dynamic conversion.

[0029] In one embodiment, in order to automatically map the JSON request structure to the Java class structure, the recursive modeling mechanism can be used to perform full traversal and analysis of nested structures, array structures and basic type fields. The Java data class file generated by the automatic recursive processing of Java naming rules needs to have the characteristics of naming specification and automatic reference establishment.

[0030] First, the JSON data structure is parsed, and the JSON string is deserialized into an in-memory tree structure (JsonNode); for each field, the in-memory tree structure data is field-traversed, and its type is determined:

[0031] Basic types (string, number, boolean) are mapped to Java basic fields;

[0032] Object type (object) is recursively modeled as a nested class;

[0033] Array type (array) extracts element type and generates corresponding List <t>.

[0034] Then, the main class is named as Request by default or according to business rules; the sub-class is named using the first letter of the field name in capital; and the nested class is generated and the relationship between classes is established through field reference in the main class.

[0035] Finally, the modeling result is converted into a Java class file, template rendering or AST construction is supported, and the generated class file is stored or dynamically loaded for subsequent reflection to create objects, so as to obtain a Java data class file.

[0036] For example, given the following JSON input:

[0037] {

[0038] "userId": 101,

[0039] "userName": "Alice",

[0040] "details": {

[0041] "age": 30,

[0042] "email": "alice@example.com"

[0043] },

[0044] "tags": ["admin", "editor"]

[0045] }。

[0046] The corresponding class structure of the output is:

[0047] public class Request {

[0048] private int userId;

[0049] private String userName;

[0050] private Details details;

[0051] private List <string>tags;

[0052] / / getters and setters

[0053] }

[0054] public class Details {

[0055] private int age;

[0056] private String email;

[0057] / / getters and setters

[0058] }。

[0059] Step 103, performing abnormal state analysis on the Java data class file to determine a file exception solution method.

[0060] For example, the present application performs abnormal state analysis on the Java data class file, realizes real-time exception detection on the inferred Java data class file, and avoids subsequent dynamic recursion exceptions.

[0061] Specifically, the abnormal state analysis on the Java data class file is performed to determine the file exception solution method, which specifically includes: in the case that the Java data class file has a field name conflict, a non-conflict suffix is added to the field name to determine a first file exception solution method; in the case that the Java data class file has an illegal field name, the illegal field name is escaped or replaced to determine a second file exception solution method; in the case that the array of the Java data class file is an empty set, a user-specified configuration is generated to determine a third file exception solution method; and based on the first file exception solution method, the second file exception solution method and the third file exception solution method, the file exception solution method is determined.

[0062] In one embodiment, whether a field name already exists in the class is detected, and if it is repeated, a suffix is automatically added or the developer is prompted; if the field name is a number or contains special characters, it is automatically escaped or replaced; and when the array is empty, the system default type is List <object>The maximum nesting level can be manually specified by a user; to avoid infinite recursion caused by malicious or erroneous input, a maximum nesting level can be configured. For JSON substructures that are structurally identical, class definition reuse is supported to reduce redundancy.

[0063] Step 104: obtaining standard annotations according to the Java data class file through service class annotation marking.

[0064] For example, to automatically generate a service class conforming to the JAX-WS specification, the application provides a data basis for subsequent annotation addition through service class annotation marking.

[0065] Specifically, obtaining standard annotations according to the Java data class file through service class annotation marking includes: obtaining a service class file conforming to the JAX-WS specification based on the Java data class file; performing annotation type division on the service class file conforming to the JAX-WS specification to determine a standard annotation to be defined; wherein the standard annotation to be defined includes @WebService, @WebMethod, @WebParam, and @WebResult; setting a marked class of @WebService as a SOAP service published externally; setting a marked class of @WebMethod as a method available for calling; setting marked classes of @WebParam and @WebResult as parameter names; and obtaining the standard annotation according to the SOAP service published externally, the method available for calling, and the parameter names.

[0066] In one embodiment, the service class is defined through the following standard annotations:

[0067] A marked class of @WebService is a SOAP service published externally;

[0068] A marked method of @WebMethod is a method available for calling;

[0069] Marked classes of @WebParam and @WebResult are parameter names;

[0070] Return types and parameter types are both automatically generated Java classes (Request and Response).

[0071] Step 105: constructing a service skeleton conforming to the JAX-WS specification according to the standard annotations to determine a service class that can be directly recognized.

[0072] For example, to ensure that the generated class has good consistency and serializability in WebService transmission, all fields have getter / setter methods and optional JAXB annotations are added to enhance compatibility with XML. After completing the Java class modeling, the service class that meets the JAX-WS specification will be automatically generated based on these classes as the entrance of the WebService server, and the service class skeleton code that meets the JAX-WS specification will be constructed.

[0073] Specifically, the standard annotation is constructed according to the service skeleton of the JAX-WS specification to determine the directly identifiable service class, specifically including: based on the JSON data structure, the core business word is determined through business semantic analysis; according to the core business word, the data to be annotated is obtained through service class structure construction; wherein the service class structure construction includes: service class naming, 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.

[0074] In one embodiment, the service class name is automatically converted to PascalCase form from the business semantics or JSON example source to avoid the problem of non-standard naming.

[0075] Each JSON example can correspond to a generated method, and the method name can be configured according to business requirements. According to the JAX-WS standard, the following annotations are automatically added to the service class and method, and the parameter type is from the Request class generated by the previous automatic modeling, and the return type is the Response class (default structure or generated according to the configuration).

[0076] The generated service class structure is as follows:

[0077] import javax.jws.WebService;

[0078] import javax.jws.WebMethod;

[0079] import javax.jws.WebParam;

[0080] import javax.jws.WebResult;

[0081] @WebService

[0082] public class UserService {

[0083] @WebMethod

[0084] @WebResult(name = "response")

[0085] public Response process(@WebParam(name = "request") Request request){

[0086] Response resp = new Response();

[0087] resp.setStatus("ok");

[0088] return resp;

[0089] }

[0090] }。

[0091] Step 106, dynamically compiling the directly identifiable service class to obtain a dynamically deployed service.

[0092] For example, to avoid manual compilation and deployment, the system introduces a dynamic compilation and runtime publishing mechanism to support automatic generation of service classes, dynamic compilation, and registration to a service container during runtime.

[0093] 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 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 exceptions to determine correction fields; loading the dynamic deployment service through ClassLoader according to the correction fields.

[0094] Further, after dynamically compiling the directly identifiable service class to obtain a dynamically deployed service, the method further includes: performing interface extension of the dynamic code sandbox for the dynamically deployed service to obtain a security extension interface.

[0095] 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.

[0096] Then, a compilation task is created through JavaCompiler.getTask(), and the compilation product (.class file) is saved in memory through memory file management using a custom JavaFileManager to capture syntax errors and compilation failure information in real time and output them for debugging and positioning.

[0097] Finally, the compiled class is loaded into the JVM runtime environment using a custom ClassLoader.

[0098] After the service class is successfully compiled and loaded, the system calls the Endpoint class provided by JAX-WS for service publishing, and the process is as follows:

[0099] Object serviceInstance = classLoader.loadClass("UserService").newInstance();

[0100] Endpoint.publish("http: / / localhost:8080 / ws / user", serviceInstance).

[0101] Supports automatic adaptation to mainstream JAX-WS implementation containers, and after service deployment, WSDL documents can be automatically generated and accessed through?wsdl, and the compiler output classes are checked at runtime to prevent malicious code injection.

[0102] The present application automatically derives the Java class structure conforming to the WebService interface and the dynamic self-generation of the standard WebService code from the JSON structure. Compared with the existing technical solutions, there is no need for manual editing of classes, compilers or configuration files; supports incremental generation and deployment of interfaces at runtime, fully conforms to the JAX-WS and WSDL specifications, has wide applicability, and can be embedded as a plug-in into a low-code platform, an ESB system, etc.

[0103] The above is the method embodiment of the present application. Based on the same inventive concept, the present application embodiment also provides a WSDL-based service end API automatic construction device, the structure of which is as shown in Figure 2 .

[0104] Figure 2 The above is the method embodiment of the present application. Based on the same inventive concept, the present application embodiment also provides a WSDL-based service end API automatic construction device, the structure of which is as shown in Figure 2 .

[0105] at least one processor 201;

[0106] and a memory 202 in communication connection with the at least one processor;

[0107] The memory 202 stores instructions executable by the 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:

[0108] Obtain the JSON data structure and determine the type mapping rules based on it; based on the JSON data structure and type mapping rules, obtain the Java data class file through automatic recursive processing of Java naming rules; perform exception state analysis on the Java data class file to determine the solution to file exceptions; based on the Java data class file, obtain standard annotations by annotating service classes; construct a service skeleton conforming to the JAX-WS specification on the standard annotations to identify directly identifiable service classes; dynamically compile the directly identifiable service classes to obtain dynamically deployable services.

[0109] Some embodiments of this application provide corresponding to Figure 1 A non-volatile computer storage medium automatically constructed based on a WSDL server API, storing computer-executable instructions, wherein the computer-executable instructions are configured as follows:

[0110] Obtain the JSON data structure and determine the type mapping rules based on it; based on the JSON data structure and type mapping rules, obtain the Java data class file through automatic recursive processing of Java naming rules; perform exception state analysis on the Java data class file to determine the solution to file exceptions; based on the Java data class file, obtain standard annotations by annotating service classes; construct a service skeleton conforming to the JAX-WS specification on the standard annotations to identify directly identifiable service classes; dynamically compile the directly identifiable service classes to obtain dynamically deployable services.< / object> < / string> < / t> < / t> < / t>

Claims

1. A WSDL-based service-side API automatic construction method, characterized in that, The method comprises: obtaining a JSON data structure, and determining a type mapping rule according to the JSON data structure; based on the JSON data structure and the type mapping rule, obtaining a Java data class file through automatic recursive processing of Java naming rules; performing abnormal state analysis on the Java data class file to determine a file exception solution method; according to the Java data class file, obtaining a standard annotation through service class annotation marking; performing service skeleton construction conforming to the JAX-WS specification on the standard annotation to determine a directly identifiable service class; performing dynamic compilation on the directly identifiable service class to obtain a dynamically deployed service; performing service skeleton construction conforming to the JAX-WS specification on the standard annotation to determine a directly identifiable service class, specifically comprising: based on the JSON data structure, determining a core business word through business semantic analysis; according to the core business word, obtaining annotated data through service class structure construction; wherein the service class structure construction comprises service class naming and method construction; based on the JAX-WS specification, adding the standard annotation to the annotated data to determine the directly identifiable service class.

2. The method of claim 1, wherein the WSDL-based service API automatic construction method is characterized by, According to the JSON data structure, determine the type mapping rule, specifically comprising: distinguishing the type characteristics of the JSON data structure to determine the JSON characteristic type; wherein the JSON characteristic type comprises integer value, floating point value, Boolean value, object, array; in the case of the JSON characteristic type being the integer value, the type mapping rule is that the integer value corresponds to the Integer type of Java; in the case of the JSON characteristic type being the floating point value, the type mapping rule is that the floating point value corresponds to the Double type of Java; in the case of the JSON characteristic type being the Boolean value, the type mapping rule is that the Boolean value corresponds to the Boolean type of Java; in the case of the JSON characteristic type being the object, the type mapping rule is that the object is mapped to a nested Java class; In the case that the JSON feature type is the array, the type mapping rule is that the array is mapped as List <t>wherein T is the derived type of the array element.< / t> 3. The method of claim 1, wherein the WSDL-based service API automatic construction method is characterized by, Based on the JSON data structure and the type mapping rule, obtain a Java data class file through automatic recursive processing of Java naming rules, specifically comprising: deserializing the string of the JSON data structure to obtain in-memory tree structure data; performing field traversal on the in-memory tree structure data, and recursively mapping the results of the field traversal according to the type mapping rule to determine nested class naming; wherein the nested class naming comprises main naming and sub-naming; based on the nested class naming, obtaining the relationship between nested classes through field reference in the main class; according to the relationship between the nested classes, obtaining the Java data class file through modeling dynamic conversion.

4. The method of claim 1, wherein the WSDL-based service API automatic construction method is characterized by, Performing abnormal state analysis on the Java data class file to determine a file exception solution method, specifically comprising: In the case that the Java data class file has a field name conflict, a non-conflict suffix is added to the field name to determine a first file exception resolution method; In the case that the Java data class file has an illegal field name, the illegal field name is escaped or replaced to determine a second file exception resolution method; In the case that the array of the Java data class file is an empty set, a user-specified configuration is generated to determine a third file exception resolution method; Based on the first file exception resolution method, the second file exception resolution method, and the third file exception resolution method, the file exception resolution method is determined.

5. The method of claim 1, wherein the WSDL-based service API automatic construction method is characterized by, According to the Java data class file, a standard annotation is obtained through service class annotation, specifically including: Based on the Java data class file, a service class file conforming to the JAX-WS specification is obtained through; The service class file conforming to the JAX-WS specification is divided into annotation types to determine a to-be-defined standard annotation; wherein the to-be-defined standard annotation includes: @WebService, @WebMethod, @WebParam, and @WebResult; The annotated class of the @WebService is set as a SOAP service for external publication; The annotated class of the @WebMethod is set as a method available for calling; The annotated classes of the @WebParam and the @WebResult are set as parameter names and result names; According to the SOAP service for external publication, the method available for calling, the parameter names, and the result names, the standard annotation is obtained.

6. The method of claim 1, wherein the WSDL-based service API automatic construction method is characterized by, The directly identifiable service class is dynamically compiled to obtain a dynamically deployed service, specifically including: The directly identifiable service class is written into a string structure in memory and is built through a compilation task to obtain a compilation task; The compilation task is executed, and a compilation product data is determined through a JavaFileManager; The compilation product data is monitored for exceptions to determine a correction field; According to the correction field, the dynamically deployed service is obtained through a ClassLoader.

7. The method of claim 1, wherein the WSDL-based service API automatic construction method is characterized by, After the directly identifiable service class is dynamically compiled to obtain the dynamically deployed service, the method further includes: The dynamically deployed service is extended through a dynamic code sandbox interface to obtain a security extension interface.

8. A WSDL-based service API auto-constructing device, characterized by, The device includes: At least one processor; and a memory connected in communication with the at least one processor; Wherein the memory stores instructions executable 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: Obtain a JSON data structure, and determine a type mapping rule according to 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; The Java data class file is analyzed for an exception state to determine a file exception resolution method; According to the Java data class file, a standard annotation is obtained through service class annotation marking; The standard annotation is subjected to service skeleton construction in conformity with the JAX-WS specification to determine a directly identifiable service class; The directly identifiable service class is subjected to dynamic compilation to obtain a dynamically deployed service; The standard annotation is subjected to service skeleton construction in conformity with the JAX-WS specification to determine a directly identifiable service class, specifically including: Based on the JSON data structure, core business words are determined through business semantic analysis; According to the core business words, to-be-annotated data is obtained through service class structure construction; wherein the service class structure construction includes service class naming and method construction; The standard annotation is added to the to-be-annotated data based on the JAX-WS specification to determine the directly identifiable service class.

9. A non-transitory computer storage medium storing computer-executable instructions that, based on a WSDL-based service-side API auto- build, cause a computer to perform steps comprising: The computer executable instructions are set to: Obtain a JSON data structure and determine a type mapping rule according to 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; An exception state analysis is performed on the Java data class file to determine a file exception solution method; According to the Java data class file, a standard annotation is obtained through service class annotation marking; The standard annotation is subjected to service skeleton construction in conformity with the JAX-WS specification to determine a directly identifiable service class; The directly identifiable service class is subjected to dynamic compilation to obtain a dynamically deployed service; The standard annotation is subjected to service skeleton construction in conformity with the JAX-WS specification to determine a directly identifiable service class, specifically including: Based on the JSON data structure, core business words are determined through business semantic analysis; According to the core business words, to-be-annotated data is obtained through service class structure construction; wherein the service class structure construction includes service class naming and method construction; The standard annotation is added to the to-be-annotated data based on the JAX-WS specification to determine the directly identifiable service class.

Citation Information

Patent Citations

  • 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