Software interface design method capable of switching data formats
By designing a software interface method that can switch data formats, using context data structures and preset conversion modules to automatically convert data formats, the low development efficiency and maintenance problems of software when providing different data formats to multiple services are solved, and efficient Data format conversion and scalability.
Patent Information
- Application Number
- CN202411226444.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-03
AI Technical Summary
In the prior art, when software needs to provide different data formats for multiple services, multiple combinations of encodings are required, resulting in large development workloads and difficulty in coding and maintenance, which is not conducive to expanding new data formats.
Design a software interface method that can switch data formats, construct the context data structure of the requested data, and convert the data into target data strings using preset conversion modules, including JSON, XML, HTML conversion modules, based on data requests and formats The difference activates the corresponding conversion module to realize automatic conversion of data formats.
By separating the service processing and data format conversion process, coupling is eliminated, development efficiency is improved, multiple services are allowed to share the data format conversion module, reducing redundant development work, and facilitating the expansion of new data formats.
Smart Images

Figure CN119201047A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of data format switching, and in particular to a software interface design method capable of switching data formats. Background Art
[0002] With the continuous development of information technology, the requirements for the interactive interfaces of software systems are becoming higher and higher. The same interface will have different requirements for different clients or in different operating environments, such as the need to return data in a specified format.
[0003] At present, existing inventions generally solve this problem by designing different service interfaces. For example, the software performs specific encoding for specific services to provide services in JSON data format. Similarly, specific encoding is also required to provide XML data format.
[0004] Based on the existing technology, if multiple services of the software need to provide different data formats to the outside world, multiple combinations of encoding must be performed, which will cause problems such as large development workload, difficult coding maintenance, and inconvenience in expanding new data formats. Summary of the invention
[0005] The present invention is used to solve the problem in the prior art that if multiple services of software need to provide different data formats to the outside, multiple combinations of encodings must be performed, which will cause a large development workload, difficult coding maintenance, and is not conducive to the expansion of new data formats.
[0006] In a first aspect, the present invention provides a software interface design method capable of switching data formats, comprising:
[0007] When receiving a data request from a client, construct a context data structure for the request data;
[0008] According to the context data structure, the request data is converted into a target data string through a preset conversion module;
[0009] Returns the target data string to the client.
[0010] In combination with the first aspect, the context data structure is also used to temporarily store the request data and perform attribute marking on the request data, wherein:
[0011] Attribute tags include: success tags, prompt tags and result tags;
[0012] The success flag is used to determine whether the current client's data request is successful. When the data request is successful, a true flag or a false flag is generated;
[0013] The prompt tag is used to generate storage prompts and exception information prompts when data requests fail;
[0014] The result data is used to store the result data of the data request when the data request is successful. The result data is represented by a key-value pair. When there are multiple result data, each result data corresponds to a key-value pair.
[0015] In combination with the first aspect, the constructing the context data structure of the request data further includes:
[0016] According to the context data structure, the request data is assigned according to the string weights to determine the weight value of each group of strings in the request data;
[0017] Determine whether there is a string group with the same weight value and the same string prefix, where:
[0018] If it exists, the corresponding string group is used as the verification string of the target data string, and the verification string is used to determine whether the target data string has a format conversion abnormality after conversion, and if the format conversion is abnormal, the abnormal data is uploaded to the client;
[0019] If it does not exist, the strings are arranged according to the weight values of each group of strings to generate an initial weight sequence, and it is determined whether the target weight sequence and the initial weight sequence of the target data string are the same. If they are not the same, the format conversion exception information is output to the client.
[0020] In combination with the first aspect, the preset conversion module includes: a JSON conversion module, an XML conversion module, and an HTML conversion module.
[0021] In combination with the first aspect, converting the request data into a target data string through a preset conversion module includes:
[0022] Determine the initial data format according to the request data, and determine the target format of the target data string to be converted;
[0023] Determine a first format parameter of the request data according to the initial data format;
[0024] Determine a second format parameter of the request data according to the target format;
[0025] According to the format difference between the first format parameter and the second format parameter, determining the activation interval of the preset conversion module to which the format difference interval belongs, and activating the corresponding preset conversion module;
[0026] The activation interval is a response interval of the preset conversion module. When it is sensed that there is a format difference within the response interval, a mapping relationship between an initial data format corresponding to the first format parameter and a target format corresponding to the second format parameter is determined, and based on the mapping relationship, an activated preset conversion module is determined.
[0027] In combination with the first aspect, the converting the request data into a target data string by a preset conversion module further includes:
[0028] Determine identification parameters of the software interface according to the data request;
[0029] According to the identification parameters, determining whether there is a target conversion module that meets the identification parameters in the preset conversion modules;
[0030] When included, the request data is imported into the target conversion module according to the data request, and the format conversion is performed according to the preset rules of the target conversion module.
[0031] In combination with the first aspect, the converting the request data into a target data string by a preset conversion module further includes:
[0032] According to the structural features and feature relevance of the upper and lower data structures of the request data, a format conversion component corresponding to both the structural conversion and the relevance conversion in the target conversion module is obtained as a target calling component;
[0033] According to the target calling component, a conversion path is determined, and a target conversion direction is determined in which the target conversion module converts the request data through the corresponding structure conversion component and the association conversion component;
[0034] According to the target conversion direction and the context structure, the target context structure of the target data string after the request data is converted is determined.
[0035] In combination with the first aspect, after returning the target data string to the client, the method further includes:
[0036] Determining, according to the context data structure, the number of first data packets in the conversion process of the request data;
[0037] Determining the number of second data packets of the requested data after conversion according to the target data character string;
[0038] Determine whether the number of the first data message is consistent with the number of the second data message, wherein:
[0039] When the number of the first data packets is consistent with the number of the second data packets, and there is no duplicate data packet in the second data packet, the identification request data conversion is normal;
[0040] When the number of the first data packets is inconsistent with the number of the second data packets or there are duplicate data packets in the second data packets, a format conversion error is fed back to the client.
[0041] In combination with the first aspect, returning the target data string to the client further includes:
[0042] Determine, according to the context data structure, a data bit sequence of an initial character string of the request data;
[0043] According to the data bit sequence, when the target data string is generated, it is determined whether the data content of the same data bit before and after the conversion is consistent, and when the data bits are consistent, the target data string corresponding to the data bit in the target data string is returned to the client.
[0044] In combination with the first aspect, returning the target data string to the client further includes:
[0045] A custom registration database of preset conversion modules is configured in the client, and when an update request is received, it is determined whether the conversion module to be loaded in the update request is in the custom registration database, and the conversion module to be loaded is loaded in the custom registration database.
[0046] The beneficial effects of the present invention are:
[0047] The present invention separates the two processes of service processing and data format conversion through the designed data context, eliminates the coupling between them, and focuses on the corresponding coding development without being disturbed by other factors, so the development efficiency is higher. The data format conversion module is oriented to the data context. Since the data context is a universal data structure that is unrelated to the specific service, it can be shared by multiple services in the software, reducing redundant development work, and can also easily expand new data formats.
[0048] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description and the accompanying drawings.
[0049] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0051] Figure 1 A method flow chart of a method for designing a software interface capable of switching data formats in an embodiment of the present invention;
[0052] Figure 2 A conversion exception determination flow chart for constructing a context data structure of request data in an embodiment of the present invention;
[0053] Figure 3This is a diagram of a conversion process of converting request data into a target data string through a preset conversion module in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0055] Terminology Note:
[0056] Service: The logical processing performed by the software to complete a specified job, including transforming, combining, calculating, and associating input parameters to obtain processing results.
[0057] Software interface: The way software provides services to the outside world. It mainly refers to what kind of parameters the software receives and what kind of data it returns when using the software's services.
[0058] Data format: The data parsing specification or pattern agreed upon by both parties, such as XML format, JSON format, web page format, key-value pair format, etc.
[0059] like Figure 1 As shown, this embodiment provides a software interface design method capable of switching data formats, including:
[0060] When receiving a data request from a client, construct a context data structure for the request data;
[0061] According to the context data structure, the request data is converted into a target data string through a preset conversion module;
[0062] Returns the target data string to the client.
[0063] The principle of the above technical solution is:
[0064] In the present invention, the design data context of the request data is first determined. The data context is a data structure used for temporary storage of result data in the service processing process. It includes at least the following key attributes:
[0065] Success flag: whether the processing is successful, the value is true or false;
[0066] Prompt information: If the processing is not successful, the prompt or exception information is stored.
[0067] Result data: If the processing is successful, the result data of the service is stored. The result data processed by the service is represented by a set of general key-value pairs. Multiple sets of result data are multiple sets of key-value pairs.
[0068] Design data format conversion module.
[0069] The conversion module is used to convert the data context into a specified data format. Different conversion modules should be designed for different formats, such as JSON conversion module, XML conversion module, and HTML conversion module.
[0070] Design process control module.
[0071] When the process control module first receives the client request, it constructs a data context and passes the data context to the service processing. After the service processing is completed, the processing result is stored in the data context. Then the process control module passes the data context to the data format conversion module, especially converting it into a specific data format. The type of data format conversion module depends on the parameters of the client request. After the data format conversion module completes its work, it obtains the specified data string, and the process control module returns the final data string to the client.
[0072] The beneficial effects of the above technical solution are:
[0073] The present invention separates the two processes of service processing and data format conversion through the designed data context, eliminates the coupling between them, and focuses on the corresponding coding development without being disturbed by other factors, so the development efficiency is higher. The data format conversion module is oriented to the data context. Since the data context is a universal data structure that is unrelated to the specific service, it can be shared by multiple services in the software, reducing redundant development work, and can also easily expand new data formats.
[0074] As an embodiment of the present invention: the context data structure is also used to temporarily store request data and perform attribute marking on the request data, wherein:
[0075] Attribute tags include: success tags, prompt tags and result tags;
[0076] The success flag is used to determine whether the current client's data request is successful. When the data request is successful, a true flag or a false flag is generated;
[0077] The prompt tag is used to generate storage prompts and exception information prompts when data requests fail;
[0078] The result data is used to store the result data of the data request when the data request is successful. The result data is represented by a key-value pair. When there are multiple result data, each result data corresponds to a key-value pair.
[0079] The principle of the above technical solution is:
[0080] The software interface design method of the present invention is applicable to a variety of application scenarios. For example, it can realize the saving and reading of game character status in electronic games; it can also realize the reading and modification of commodity information in e-commerce systems; it can also realize the reading and modification of files in file systems, etc.
[0081] The context data structure is also used to temporarily store request data and to attribute the request data. Therefore, when processing request data, the context data structure can be used to temporarily store the request data and add corresponding attribute tags to the request data, thereby facilitating subsequent processing and use.
[0082] Specifically, when processing request data, different attribute tags can be set according to different business needs and processing logic. For example, when processing the status of a game character, a success tag can be set to determine whether the request is successful, and a prompt tag can be used to display error information; when processing product information, a success tag can be set to determine whether the request is successful, and a result tag can be used to return product information, etc.
[0083] At the same time, in order to ensure the reliability and consistency of the data, timestamps or other control information can be added to the request data so that problems can be quickly located and solved when they occur. In addition, in order to improve the performance and efficiency of the system, it is possible to consider merging request data with the same attributes together for processing, thereby reducing repeated calculations or unnecessary data transmission.
[0084] As an embodiment of the present invention: Figure 2 As shown, the context data structure for constructing the request data further includes:
[0085] According to the context data structure, the request data is assigned according to the string weights to determine the weight value of each group of strings in the request data;
[0086] Determine whether there is a string group with the same weight value and the same string prefix, where:
[0087] If it exists, the corresponding string group is used as the verification string of the target data string, and the verification string is used to determine whether the target data string has a format conversion abnormality after conversion, and if the format conversion is abnormal, the abnormal data is uploaded to the client;
[0088] If it does not exist, the strings are arranged according to the weight values of each group of strings to generate an initial weight sequence, and it is determined whether the target weight sequence and the initial weight sequence of the target data string are the same. If they are not the same, the format conversion exception information is output to the client.
[0089] The principle of the above technical solution is:
[0090] The present invention defines a group of strings as weight strings according to business requirements, and uses them as weight sequences. For each request data, all the strings are arranged in the order of weight strings to obtain a weight sequence. In the weight sequence, all strings with the same weight value are found to form a string group. The found string group is checked to determine whether there is a situation where the string prefix is the same. If so, these string groups are used as verification strings of the target data string. The target data string is converted, and the converted result is compared with the corresponding verification string. If the converted result matches the corresponding verification string, it means that the format conversion is correct, otherwise it means that the format conversion is wrong. If an error occurs during the conversion process, the error information is uploaded to the client, and the client performs corresponding processing. If there is no string group with the same weight value and the same string prefix, all the strings in the request data are assigned according to the weight, and an initial weight sequence is generated. Then, the target data string is converted and compared with the generated initial weight sequence. If the converted result is different from the initial weight sequence, the format conversion exception information is output to the client.
[0091] As an embodiment of the present invention: the preset conversion module includes: a JSON conversion module, an XML conversion module, and an HTML conversion module.
[0092] The principle of the above technical solution is:
[0093] The present invention pre-sets multiple data formats in order to achieve more flexible data exchange and parsing in different application environments. For example, in some scenarios, it may be necessary to use the JSON format for data exchange, while in other scenarios, it may be necessary to use the XML or HTML format. By pre-setting these data formats and providing a dedicated conversion module for them, the software interface can work normally in different application environments.
[0094] In the present invention, JSON (JavaScript Object Notation): This is a lightweight data exchange format that is easy to read and write. It organizes data in the form of objects / arrays and supports various data types (such as text, numbers, Boolean values, objects, arrays, etc.). Data in JSON format is very easy to parse and generate, so it has built-in support in many programming languages.
[0095] XML (Extensible Markup Language): This is a custom data format that is mainly used to describe data structures and relationships. XML files are separated by pairs of start and end tags ' / >', and there is content between the start and end tags of each element. The advantage of XML is that it provides a good structured data representation, which is easy to understand and check the integrity of the data. However, its disadvantage is that it is expensive to write and parse.
[0096] HTML (Hypertext Markup Language): This is a standard markup language used to build web pages. The main function of HTML is to create a structured framework for web pages and define the content of the web page through various tags and attributes. The advantage of HTML is that it is easy to learn and use and can run on any device, but its main problem is that it is not a real data exchange format. Data exchange and parsing usually need to be completed on the server side.
[0097] As an embodiment of the present invention: the step of converting the request data into a target data string through a preset conversion module includes:
[0098] Determine the initial data format according to the request data, and determine the target format of the target data string to be converted;
[0099] Determine a first format parameter of the request data according to the initial data format;
[0100] Determine a second format parameter of the request data according to the target format;
[0101] According to the format difference between the first format parameter and the second format parameter, determining the activation interval of the preset conversion module to which the format difference interval belongs, and activating the corresponding preset conversion module;
[0102] The activation interval is a response interval of the preset conversion module. When it is sensed that there is a format difference within the response interval, a mapping relationship between an initial data format corresponding to the first format parameter and a target format corresponding to the second format parameter is determined, and based on the mapping relationship, an activated preset conversion module is determined.
[0103] The principle of the above technical solution is:
[0104] First, according to the request data, it is necessary to determine the initial data format and the target format of the target data string corresponding to this data format.
[0105] Secondly, according to the target format, it is necessary to determine the first format parameter of the request data, that is, under this target format, which data format needs to be used to represent the original request data.
[0106] Then, according to the target format, the second format parameter of the request data needs to be determined, which is the method needed to further process and display the request data under this target format.
[0107] Next, according to the format difference between the first format parameter and the second format parameter, the activation interval of the preset conversion module to which they belong is determined, and the corresponding preset conversion module is activated.
[0108] Finally, when it is detected that there is a format difference within the response interval, a mapping relationship between the initial data format corresponding to the first format parameter and the target format corresponding to the second format parameter is determined, and based on the mapping relationship, an activated preset conversion module is determined.
[0109] As an embodiment of the present invention: the converting the request data into a target data string by a preset conversion module further includes:
[0110] Determine identification parameters of the software interface according to the data request;
[0111] According to the identification parameters, determining whether there is a target conversion module that meets the identification parameters in the preset conversion modules;
[0112] When included, the request data is imported into the target conversion module according to the data request, and the format conversion is performed according to the preset rules of the target conversion module.
[0113] The principle of the above technical solution is:
[0114] First, according to the data request, the identification parameters of the software interface need to be determined. These parameters are usually defined according to business needs and specific application scenarios, such as user name, order number, etc.
[0115] Next, the target conversion module that meets the requested target is searched in the preset conversion module according to these identification parameters. If a conversion module that meets the conditions is found, the next step can be continued. If a conversion module that meets the conditions is not found, the identification parameters need to be redefined or adjusted.
[0116] If a conversion module that meets the conditions is found, the request data can be imported into the target conversion module according to the content of the request data. In this process, the format conversion needs to be performed according to the preset rules of the target conversion module.
[0117] After the format conversion is completed, the result data needs to be checked and verified to ensure the correctness and consistency of the conversion results. If any errors or problems are found, it is necessary to go back to the previous step and reprocess them.
[0118] As an embodiment of the present invention: Figure 3As shown, the converting of the request data into a target data string through a preset conversion module also includes:
[0119] According to the structural features and feature relevance of the upper and lower data structures of the request data, a format conversion component corresponding to both the structural conversion and the relevance conversion in the target conversion module is obtained as a target calling component;
[0120] According to the target calling component, a conversion path is determined, and a target conversion direction is determined in which the target conversion module converts the request data through the corresponding structure conversion component and the association conversion component;
[0121] According to the target conversion direction and the context structure, the target context structure of the target data string after the request data is converted is determined.
[0122] The principle of the above technical solution is:
[0123] The present invention mainly obtains the format conversion components corresponding to the structure conversion and relevance conversion in the target conversion module as the target calling components according to the structure and feature relevance of the context data structure of the request data. Then, the conversion path is determined based on these target calling components, and the target conversion direction in which the target conversion module converts the request data through the corresponding structure conversion components and relevance conversion components is determined. Finally, based on the target conversion direction and the context structure, the target context structure of the target data string after the request data is converted is determined. Such a design can make the software interface more intelligent and can better adapt to different data structures and business requirements.
[0124] As an embodiment of the present invention: after returning the target data string to the client, the method further includes:
[0125] Determining, according to the context data structure, the number of first data packets in the conversion process of the request data;
[0126] Determining the number of second data packets of the requested data after conversion according to the target data character string;
[0127] Determine whether the number of the first data message is consistent with the number of the second data message, wherein:
[0128] When the number of the first data packets is consistent with the number of the second data packets, and there is no duplicate data packet in the second data packet, the identification request data conversion is normal;
[0129] When the number of the first data packets is inconsistent with the number of the second data packets or there are duplicate data packets in the second data packets, a format conversion error is fed back to the client.
[0130] The principle of the above technical solution is:
[0131] The main purpose of the present invention is to ensure the correctness and integrity of the data conversion process. By checking the number of data messages generated at each stage of the data conversion process and the content of the data messages generated at each stage, possible errors can be discovered and corrected in a timely manner. If an error is found, the format conversion error can be fed back to the client so that the client can understand the type and location of the error and take corresponding measures to correct it.
[0132] As an embodiment of the present invention: the step of returning the target data string to the client further includes:
[0133] Determine, according to the context data structure, a data bit sequence of an initial character string of the request data;
[0134] According to the data bit sequence, when the target data string is generated, it is determined whether the data content of the same data bit before and after the conversion is consistent, and when the data bits are consistent, the target data string corresponding to the data bit in the target data string is returned to the client.
[0135] The principle of the above technical solution is:
[0136] The present invention determines the information of the corresponding data bits in the target data string based on the data bit sequence of the initial string of the request data. This step mainly relies on the attribute tags stored in the context data structure and the associated information of the request data. Then, in the process of generating the target data string, the corresponding data bits before and after the conversion are checked. If an error is found, the conversion is stopped immediately and the error is fed back to the client.
[0137] Secondly, since the data in the target data string is in binary form, and the data in the request data may be in other forms, such as hexadecimal, ASCII, etc. Therefore, this method also needs to parse the target data string bit by bit and convert it into the data format required by the client according to the corresponding attribute tag in the context data structure.
[0138] As an embodiment of the present invention, the step of returning the target data string to the client further includes:
[0139] A custom registration database of preset conversion modules is configured in the client, and when an update request is received, it is determined whether the conversion module to be loaded in the update request is in the custom registration database, and the conversion module to be loaded is loaded in the custom registration database.
[0140] The principle of the above technical solution is:
[0141] The present invention requires configuring a custom registration database in the client, which records all registered conversion modules and their properties and other information. When receiving an update request, the server will first search the custom registration database to see whether the conversion module to be updated exists. If not, it will convert it according to the specified format in the request and return the result to the client. If the conversion module already exists in the database, the server will extract the module to be updated in the request, load the corresponding conversion module from the database for conversion, and then return the result to the client.
[0142] In this way, the client can flexibly select and load the preset conversion modules according to its own needs and actual situation to achieve more efficient and intelligent data conversion. At the same time, since all conversion modules have been preset and saved on the server side, conversion errors caused by software vulnerabilities and other reasons can be avoided, thus ensuring the security and stability of data conversion.
[0143] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for designing a software interface capable of switching data formats, characterized in that: include: When receiving a data request from a client, construct a context data structure for the request data; According to the context data structure, the request data is converted into a target data string through a preset conversion module; Returns the target data string to the client.
2. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: The context data structure is also used to temporarily store request data and perform attribute marking on the request data, wherein: Attribute tags include: success tags, prompt tags and result tags; The success flag is used to determine whether the current client's data request is successful. When the data request is successful, a true flag or a false flag is generated; The prompt tag is used to generate storage prompts and exception information prompts when data requests fail; The result data is used to store the result data of the data request when the data request is successful. The result data is represented by a key-value pair. When there are multiple result data, each result data corresponds to a key-value pair.
3. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: The context data structure for constructing the request data further includes: According to the context data structure, the request data is assigned according to the string weights to determine the weight value of each group of strings in the request data; Determine whether there is a string group with the same weight value and the same string prefix, where: If it exists, the corresponding string group is used as the verification string of the target data string, and the verification string is used to determine whether the target data string has a format conversion abnormality after conversion, and if the format conversion is abnormal, the abnormal data is uploaded to the client; If it does not exist, the strings are arranged according to the weight values of each group of strings to generate an initial weight sequence, and it is determined whether the target weight sequence and the initial weight sequence of the target data string are the same. If they are not the same, the format conversion exception information is output to the client.
4. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: The preset conversion modules include: a JSON conversion module, an XML conversion module, and an HTML conversion module.
5. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: The step of converting the request data into a target data string by a preset conversion module includes: Determine the initial data format according to the request data, and determine the target format of the target data string to be converted; Determine a first format parameter of the request data according to the initial data format; Determine a second format parameter of the request data according to the target format; According to the format difference between the first format parameter and the second format parameter, determining the activation interval of the preset conversion module to which the format difference interval belongs, and activating the corresponding preset conversion module; The activation interval is a response interval of the preset conversion module. When it is sensed that there is a format difference within the response interval, a mapping relationship between an initial data format corresponding to the first format parameter and a target format corresponding to the second format parameter is determined, and based on the mapping relationship, an activated preset conversion module is determined.
6. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: The step of converting the request data into a target data string through a preset conversion module further includes: Determine identification parameters of the software interface according to the data request; According to the identification parameters, determining whether there is a target conversion module that meets the identification parameters in the preset conversion modules; When included, the request data is imported into the target conversion module according to the data request, and the format conversion is performed according to the preset rules of the target conversion module.
7. A method for designing a software interface capable of switching data formats as claimed in claim 6, characterized in that: The step of converting the request data into a target data string through a preset conversion module further includes: According to the structural features and feature relevance of the upper and lower data structures of the request data, a format conversion component corresponding to both the structural conversion and the relevance conversion in the target conversion module is obtained as a target calling component; According to the target calling component, a conversion path is determined, and a target conversion direction is determined in which the target conversion module converts the request data through the corresponding structure conversion component and the association conversion component; According to the target conversion direction and the context structure, the target context structure of the target data string after the request data is converted is determined.
8. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: After returning the target data string to the client, the following steps are also included: Determining, according to the context data structure, the number of first data packets in the conversion process of the request data; Determining the number of second data packets of the requested data after conversion according to the target data character string; Determine whether the number of the first data message is consistent with the number of the second data message, wherein: When the number of the first data packets is consistent with the number of the second data packets, and there is no duplicate data packet in the second data packet, the identification request data conversion is normal; When the number of the first data packets is inconsistent with the number of the second data packets or there are duplicate data packets in the second data packets, a format conversion error is fed back to the client.
9. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: The step of returning the target data string to the client further includes: Determine, according to the context data structure, a data bit sequence of an initial character string of the request data; According to the data bit sequence, when the target data string is generated, it is determined whether the data content of the same data bit before and after the conversion is consistent, and when the data bits are consistent, the target data string corresponding to the data bit in the target data string is returned to the client.
10. A method for designing a software interface capable of switching data formats as claimed in claim 1, characterized in that: The step of returning the target data string to the client further includes: A custom registration database of preset conversion modules is configured in the client, and when an update request is received, it is determined whether the conversion module to be loaded in the update request is in the custom registration database, and the conversion module to be loaded is loaded in the custom registration database.
Citation Information
Patent Citations
Method and device used for service requesting and server
CN107872437A
Http open interface calling method based on embedded equipment
CN107911435A
Method and system for realizing service orchestration data context sharing and management control under micro-service architecture
CN111309454A
Data processing method and device and storage medium
CN111858368A
Service protocol conversion method and device
CN115567616A