Data processing method based on user-defined message model and related equipment thereof

Through the data processing method based on the custom message model, the problems of low performance and poor scalability of traditional API request and response data transmission during large-scale data transmission and high concurrent access are solved, and efficient data processing and compatibility management are achieved.

CN119324912APending Publication Date: 2025-01-17PING AN BANK CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411340547.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-17

AI Technical Summary

Technical Problem

Traditional API request and response data transmission has low performance, poor scalability, and compatibility and version management problems during large-scale data transmission and high concurrent access.

Method used

Using a data processing method based on a custom message model, by defining data transmission objects and selecting appropriate data transmission formats, using a preset custom message model for structured assembly and parsing of API requests, encrypted transmission, and on the client side Serialization and deserialization are performed between the backend server.

Benefits of technology

It significantly improves the processing performance of API requests and responses, reduces serialization and deserialization overhead, enhances the scalability and backward compatibility of interfaces, simplifies version management, and reduces compatibility issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119324912A_ABST
    Figure CN119324912A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method based on a custom message model and related equipment thereof, and belongs to the technical field of big data. Firstly, a client defines a data transmission object and selects a proper data transmission format; then, the client performs structured assembly of the AP I request by using a preset self-defined message model to form a standard-format AP I request, and sends the standard-format AP I request to a back-end server; then, the back-end server receives an AP I request, analyzes the request by using a user-defined message model, and extracts a data transmission object; and then, the back-end server processes the field to be processed. And then, the back-end server serializes the processing result according to the response volume data structure to form a serialized object, and returns the serialized object to the client through the AP I gateway. And the client receives the serialization object sent by the rear end, deserializes the serialization object, and finally obtains a data processing result. According to the invention, the processing performance of the AP I request and response is improved, and the expansibility and backward compatibility of the interface are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of big data technology, and specifically relates to a data processing method based on a custom message model and related equipment. Background Art

[0002] The data transmission and structured message model of API requests and responses in financial business systems is an important solution technology in the field of information technology. It is used to describe, store and transmit structured data and is widely used for data transmission between Web applications. Data elements can be defined using key-value pairs and tags, and multi-layer nested structures are supported.

[0003] There are some commonly used technologies and products in the industry. For example, OpenAPI is a specification for describing and defining RESTful APIs. OpenAPI uses JSON or YAML format to define API metadata, including paths, parameters, request / response modes, and security requirements. It can automatically generate client code and documents to promote API interactivity.

[0004] Although traditional technologies and products are widely used in data transmission of API requests and responses, there are still some potential problems or deficiencies. For example, poor processing performance and poor scalability. Some structured solutions have low performance when large-scale data transmission and high concurrent access involve serialization / deserialization overhead, network usage, and data compression. In addition, as business needs grow, traditional solutions lack good scalability in terms of interface changes, backward compatibility, and the introduction of new features. When performing API communication between multiple systems, compatibility and version management issues will be encountered. Summary of the invention

[0005] The purpose of the embodiments of the present application is to propose a data processing method, device, computer equipment and storage medium based on a custom message model to solve the technical problems of poor processing performance and poor scalability of data transmission of API requests and responses of financial business systems and structured solutions of structured message models.

[0006] In order to solve the above technical problems, the embodiment of the present application provides a data processing method based on a custom message model, which adopts the following technical solution:

[0007] A data processing method based on a custom message model, comprising:

[0008] According to the requirements of the API interface document, define the data transmission object, where the data transmission object includes the fields to be processed, the data processing class method, the request body data structure and the response body data structure;

[0009] Select the matching data transmission format according to business needs;

[0010] Based on the data transmission object and data transmission format, the API request is structured and assembled using the preset custom message model to obtain the standard format API request;

[0011] Send standard format API request to the backend server through the API gateway;

[0012] Receive the serialized response data object returned by the back-end server through the API gateway, and deserialize the serialized response data object to obtain the data processing result.

[0013] Further, based on the data transmission object and the data transmission format, the structured assembly of the API request is performed using a preset custom message model to obtain the step of obtaining the standard format API request, specifically including:

[0014] Initialize the API request body structure, create an HTTP request object, and set the request method and target URL;

[0015] Use a custom message model to convert data transfer objects into a standard request body format;

[0016] Insert the data transfer object in the standard request body format into the API request body structure;

[0017] A matching request header is selected for the API request body structure according to the data transmission format to obtain a standard format API request.

[0018] Furthermore, before the step of sending the standard format API request to the back-end server through the API gateway, the method further includes:

[0019] generating a first encryption key;

[0020] Using the first encryption key to encrypt data on the standard format API request to obtain request encrypted data;

[0021] The step of sending the standard format API request to the back-end server through the API gateway specifically includes:

[0022] Send the encrypted request data to the backend server through the API gateway;

[0023] The step of receiving the serialized response data object sent back by the back-end server through the API gateway specifically includes:

[0024] Receive the encrypted response data sent back by the back-end server through the API gateway;

[0025] The response encrypted data is decrypted using the second encryption key distributed by the backend server to obtain a serialized response data object.

[0026] In order to solve the above technical problems, the embodiment of the present application provides a data processing method based on a custom message model, which adopts the following technical solution:

[0027] A data processing method based on a custom message model, comprising:

[0028] Receive standard format API requests uploaded by the client through the API gateway;

[0029] Use the preset custom message model to parse the standard format API request and obtain the data transfer object in the standard format API request;

[0030] Identify the fields to be processed and the data processing class methods in the data transmission object, and use the data processing class methods to perform class processing on the fields to be processed to obtain data processing results;

[0031] Identify the response body data structure in the data transmission object, and serialize the data processing result based on the response body data structure to obtain a serialized response data object;

[0032] The serialized response data object is transmitted to the client through the API gateway.

[0033] Further, the step of parsing the standard format API request using a preset custom message model to obtain the data transmission object in the standard format API request specifically includes:

[0034] Identify the request header and body structure of the standard format API request;

[0035] Divide the request header and API request body structure;

[0036] Identify the data transfer object from the API request body structure.

[0037] Further, the step of receiving a standard format API request uploaded by the client through the API gateway specifically includes:

[0038] Receive encrypted data requested by the client via the API gateway;

[0039] Decrypt the request encrypted data using the first encryption key distributed by the client to obtain a standard format API request;

[0040] Before the step of transmitting the serialized response data object to the client through the API gateway, the step further includes:

[0041] generating a second encryption key;

[0042] Use the second encryption key to encrypt the serialized response data object to obtain encrypted response data;

[0043] The steps of transmitting the serialized response data object to the client through the API gateway specifically include:

[0044] The response encrypted data is transmitted to the client through the API gateway.

[0045] In order to solve the above technical problems, the embodiment of the present application further provides a data processing device based on a custom message model, which adopts the following technical solution:

[0046] A data processing device based on a custom message model, comprising:

[0047] The object definition module is used to define the data transmission object according to the requirements of the API interface document, wherein the data transmission object includes the fields to be processed, the data processing class methods, the request body data structure and the response body data structure;

[0048] The transmission format module is used to select a matching data transmission format according to business requirements;

[0049] A request encapsulation module is used to perform structured assembly of API requests based on data transmission objects and data transmission formats using a preset custom message model to obtain a standard format API request;

[0050] A request sending module, used to send a standard format API request to a backend server through an API gateway;

[0051] The deserialization module is used to receive the serialized response data object sent back by the back-end server through the API gateway, and deserialize the serialized response data object to obtain the data processing result.

[0052] In order to solve the above technical problems, the embodiment of the present application further provides a data processing device based on a custom message model, which adopts the following technical solution:

[0053] A data processing device based on a custom message model, comprising:

[0054] A request receiving module is used to receive a standard format API request uploaded by a client through an API gateway;

[0055] A request parsing module, used to parse the standard format API request using a preset custom message model, and obtain the data transmission object in the standard format API request;

[0056] The class processing module is used to identify the fields to be processed and the data processing class methods in the data transmission object, and use the data processing class methods to perform class processing on the fields to be processed to obtain data processing results;

[0057] A serialization module is used to identify the response body data structure in the data transmission object, and serialize the data processing result based on the response body data structure to obtain a serialized response data object;

[0058] The data return module is used to transmit the serialized response data object to the client through the API gateway.

[0059] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0060] A computer device comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the data processing method based on a custom message model as described in any one of the above items are implemented.

[0061] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0062] A computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the steps of the data processing method based on a custom message model as described in any one of the above are implemented.

[0063] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0064] The present application discloses a data processing method based on a custom message model and related equipment, belonging to the field of big data technology. First, the client defines a data transmission object and selects a suitable data transmission format. Then, the client uses a preset custom message model to perform structured assembly of an API request, forms a standard format API request, and sends it to a back-end server. Then, the back-end server receives the API request, parses the request using the custom message model, and extracts the data transmission object. Then, the back-end server processes the field to be processed. Then, the back-end server serializes the processing result according to the response body data structure to form a serialized object, and returns it to the client through an API gateway. The client receives the serialized object sent by the back-end, deserializes it, and finally obtains the data processing result. The present application significantly improves the processing performance of API requests and responses, reduces the overhead of serialization and deserialization, ensures that a good response speed is still maintained in high concurrency and large-scale data transmission, and enhances the scalability and backward compatibility of the interface through flexible data transmission object design, simplifies version management, and reduces compatibility issues. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0066] Figure 1 An exemplary system architecture diagram is shown in which the present application can be applied;

[0067] Figure 2 A flowchart of an embodiment of a data processing method based on a custom message model according to the present application is shown;

[0068] Figure 3 A flowchart showing another embodiment of a data processing method based on a custom message model according to the present application is shown;

[0069] Figure 4 A structural schematic diagram of an embodiment of a data processing device based on a custom message model according to the present application is shown;

[0070] Figure 5 A schematic structural diagram of an embodiment of a computer device according to the present application is shown. DETAILED DESCRIPTION

[0071] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0072] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0073] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0074] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables.

[0075] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0076] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing. In addition to the laptop computer 1011, the tablet computer 1012 or the mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer and a desktop computer, etc.

[0077] The server 103 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal device 101 .

[0078] It should be noted that the data processing method based on the custom message model provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the data processing device based on the custom message model is generally set in the server / terminal device.

[0079] It should be understood that Figure 1 The numbers of terminal devices, networks and servers in the embodiment are merely illustrative. The above system may have any number of terminal devices, networks and servers according to implementation requirements.

[0080] In this embodiment, the present application discloses a data processing method based on a custom message model, which is applied to a data processing system, wherein the data system includes a client, an API gateway, and a server, and is intended to improve the communication efficiency and flexibility between the client, the API gateway, and the back-end server in the data processing system. By using a custom message model, the data transmission of API requests and responses is optimized, and the performance and scalability of the system in high-concurrency and large-scale data transmission scenarios are improved.

[0081] In this data processing system, the client is responsible for initiating API requests, processing response data, and interacting with users. The API gateway acts as an intermediary between the client and the backend service, handling request routing, security authentication, load balancing, and other functions. The backend server is responsible for receiving and processing API requests, executing business logic, generating response data, and returning it to the client.

[0082] The custom message model defines standard data transfer objects and their structures, mainly including data transfer objects, serialization and deserialization methods. Data transfer objects include fields to be processed, data processing class methods, request bodies, and response bodies. Object definitions should meet business requirements and ensure that all necessary information is included. Serialization and deserialization methods are used to convert data transfer objects into standard formats (such as JSON or XML) and parse the standard formats back into data transfer objects when receiving.

[0083] Embodiment 1:

[0084] Please refer to Figure 2 , shows a flow chart of an embodiment of a method for data processing based on a custom message model according to the present application, which is applied to a client. The method for data processing based on a custom message model comprises the following steps:

[0085] S201, defining a data transmission object according to the requirements of the API interface document, wherein the data transmission object includes a field to be processed, a data processing class method, a request body data structure, and a response body data structure.

[0086] Specifically, according to the requirements of the API interface document, developers first need to define a data transfer object (DTO). The data transfer object will serve as the carrier of requests and responses, and contains information such as fields to be processed, data processing methods, request body data structure, and response body data structure. The fields to be processed are the core part of DTO, which are the input data required for business logic processing, usually involving user input, system-generated parameters, etc. The data processing methods are the operation logic related to the fields to be processed, defining how to process these data, such as validation, conversion, calculation, etc. The request body data structure defines the format and structure required when sending a request, including the name of the field, data type, and whether it is required; the response body data structure describes the data format returned by the server, including the response structure of success and failure, as well as possible error information.

[0087] S202: Select a matching data transmission format according to business requirements.

[0088] Specifically, when choosing a data transmission format, it is necessary to comprehensively consider the business requirements and the characteristics of the system architecture. Common data transmission formats include JSON, XML, and ProtocolBuffers. Among them, JSON is widely popular for its light weight and readability, while XML is more suitable for scenarios that require complex structures and metadata. Choosing an appropriate format also requires considering the serialization and deserialization performance of the data, network transmission efficiency, and compatibility with other systems. For example, if the system needs to interact with a third-party service, it may need to follow the format supported by the other party. In addition, future scalability must also be considered, such as whether there may be a need to support new formats.

[0089] S203: Based on the data transmission object and the data transmission format, a preset custom message model is used to perform structured assembly of the API request to obtain a standard format API request.

[0090] Specifically, based on the defined data transfer object and the selected data transfer format, the system will use the preset custom message model to perform structured assembly of the API request. This process usually includes multiple steps: first, the fields of the data transfer object are mapped to the corresponding data format through the custom message model; then, serialization is performed according to the selected format to form an API request in a standard format. This stage also requires processing the setting of request header information, such as Content-Type and Authorization, to ensure that the request meets the requirements of the API. Special attention should be paid to the conversion of data types during serialization, such as converting a date object into a string format. Finally, the assembled standard format API request will be prepared to be sent as a complete HTTP request. Through this structured assembly, the integrity and consistency of the request can be guaranteed, the complexity of back-end processing can be reduced, and the back-end can be ensured to correctly parse the request.

[0091] S204, sending the standard format API request to the backend server through the API gateway.

[0092] Specifically, after the structured assembly is completed, the API request in the standard format will be sent to the back-end server through the API gateway. As an intermediary between the client and the back end, the API gateway is responsible for the forwarding, load balancing, security authentication and traffic management of the request. In this process, the API gateway will perform necessary verification on the request, such as checking the validity of the request, user identity authentication and permission control, etc., to ensure that only qualified requests are allowed to enter the back-end system. Then, the API gateway forwards the request to the corresponding server application according to the predefined routing rules. Through the API gateway, the monitoring and management of the traffic can be realized, which helps to improve the security and stability of the system.

[0093] S205, receiving the serialized response data object sent back by the back-end server through the API gateway, and deserializing the serialized response data object to obtain a data processing result.

[0094] Specifically, after the client receives the serialized response data object sent back by the back-end server through the API gateway, it first needs to perform deserialization processing. This process converts the standard format response data obtained from the server into a data transfer object that the client can process. In this step, the client will use the previously defined custom message model to map the structure of the response data with the data transfer object through the deserialization method. According to the response body data structure, the developer needs to handle different situations of successful response and error response, such as extracting the returned business data or error information. By deserializing the response data, the client can obtain clear business processing results.

[0095] In the above embodiment, the data processing method based on the custom message model significantly improves the efficiency and flexibility of API requests and responses. Through the clear design of data transmission objects, errors caused by inconsistent data formats are reduced, ensuring efficient data processing.

[0096] Further, based on the data transmission object and the data transmission format, the structured assembly of the API request is performed using a preset custom message model to obtain the step of obtaining the standard format API request, specifically including:

[0097] Initialize the API request body structure, create an HTTP request object, and set the request method and target URL;

[0098] Use a custom message model to convert data transfer objects into a standard request body format;

[0099] Insert the data transfer object in the standard request body format into the API request body structure;

[0100] A matching request header is selected for the API request body structure according to the data transmission format to obtain a standard format API request.

[0101] In this embodiment, the API request body structure is first initialized, and a basic framework of JSON or XML is defined to ensure that all necessary fields are reserved and in the correct format. When creating an HTTP request object, the request method (such as GET, POST, etc.) needs to be set. The setting of the request method depends on the functional requirements of the API and the nature of data transmission. In addition, the target URL is set, and the target URL must accurately point to the interface address of the back-end service to ensure that the request can be correctly routed. Then, the data transmission object is converted into a standard format request body format using a custom message model to ensure that the data structure and type meet the expected API specifications. The converted standard format request body is inserted into the initialized API request body structure to make it a complete request. Finally, according to the selected data transmission format, a suitable request header is selected for the API request body structure, such as Content-Type and Authorization, so that the back end can identify and process the request.

[0102] Through the above steps, the efficiency and accuracy of API request construction are significantly improved, the consistency and integrity of data during transmission are ensured, the performance of the system in high-concurrency scenarios is optimized, and it is easy to expand and maintain in the future, so that it can adapt to changing business needs.

[0103] Furthermore, before the step of sending the standard format API request to the back-end server through the API gateway, the method further includes:

[0104] generating a first encryption key;

[0105] Using the first encryption key to encrypt data on the standard format API request to obtain request encrypted data;

[0106] The step of sending the standard format API request to the back-end server through the API gateway specifically includes:

[0107] The encrypted request data is sent to the back-end server through the API gateway.

[0108] In this embodiment, a first encryption key is first generated, and a secure random number generator is used to ensure the strength of the key. Next, the first encryption key is used to encrypt the data of the standard format API request to ensure the security of the request content during transmission. At this time, a symmetric encryption algorithm (such as AES) is used to encrypt the data in the request body to generate request encrypted data. Encryption not only protects sensitive information and prevents data from being stolen or tampered with during transmission, but also ensures the integrity and confidentiality of the data.

[0109] In this phase, the API gateway is used to send the encrypted data of the request to the backend server. The API gateway not only handles the routing and load balancing of the request, but also performs the necessary security verification. After the request passes through the API gateway, it can ensure that the backend service only receives encrypted and verified data. After receiving the encrypted request, the backend server will use the corresponding secret key to decrypt it in order to correctly process the request and generate the corresponding response.

[0110] Through the above steps, the security of API requests and the confidentiality of data transmission are improved to ensure that sensitive information is not leaked. The introduction of encryption mechanism not only enhances the security protection of the system, but also provides support for compliance requirements, reduces potential risks, and makes the system more reliable.

[0111] Further, the step of receiving the serialized response data object returned by the back-end server through the API gateway specifically includes:

[0112] Receive the encrypted response data sent back by the back-end server through the API gateway;

[0113] The response encrypted data is decrypted using the second encryption key distributed by the backend server to obtain a serialized response data object.

[0114] In this embodiment, first, the client receives the response encrypted data transmitted back by the back-end server through the API gateway. These encrypted data are usually for the protection of the response content to ensure that they are not eavesdropped or tampered with during the transmission process. Next, the client needs to use the second encryption key distributed by the back-end server to decrypt these response encrypted data.

[0115] The decryption process converts the response encrypted data into a serialized response data object. This object should contain the actual business data generated by the backend server after processing the request. After decryption is completed, the client can further process the serialized response data according to the predefined data transmission format, such as converting it into a user-usable form or updating the user interface.

[0116] Through the above steps, the security of response data is improved, ensuring that the client can safely and reliably receive and process sensitive information from the backend.

[0117] Embodiment 2:

[0118] Please refer to Figure 3 , shows a flow chart of another embodiment of a method for data processing based on a custom message model according to the present application, which is applied to a backend server. The method for data processing based on a custom message model comprises the following steps:

[0119] S301, receiving a standard format API request uploaded by a client through an API gateway.

[0120] Specifically, first, the backend server receives a standard format API request from the client through the API gateway. This request usually contains authenticated user information, the requested business type, and the required data. In the process of receiving the request, the API gateway will perform preliminary verification, such as checking the validity of the request, whether the format meets the expectations, and the user's identity verification. After successfully passing the verification, the request will be forwarded to the backend processing system. The backend service is configured to handle multiple types of requests to accurately identify the path, method (such as GET, POST, etc.) and parameters of the request.

[0121] S302: parse the standard format API request using a preset custom message model to obtain a data transmission object in the standard format API request.

[0122] Specifically, the backend server parses the standard format API request using a pre-set custom message model. This process involves mapping the data structure in the request to a defined data transfer object. The custom message model ensures that the various fields and contents of the request can be accurately extracted, and the data is converted into the corresponding data type during parsing for subsequent business processing. For example, the request body may contain user input information, request parameters, etc. The system needs to ensure that this information is correctly parsed into the corresponding data format. During the parsing process, the backend needs to perform error handling. If some required fields in the request are missing or the format is incorrect, the system should be able to promptly feedback error information to the client.

[0123] S303, identifying the fields to be processed and the data processing class methods in the data transmission object, and using the data processing class methods to perform class processing on the fields to be processed to obtain data processing results.

[0124] Specifically, after parsing the standard format API request, the backend will identify the fields to be processed and the corresponding data processing methods in the data transfer object. The fields to be processed usually include information entered by the user, request parameters, etc., and the data processing methods define the specific logic of how to process these fields. For example, operations such as verification, format conversion, or calculation may be required for a certain field. After identifying this information, the backend server will call the corresponding data processing methods to process the fields to be processed. This process usually involves checking the legitimacy of the data, such as verifying the type and range of the input data, and executing the necessary business logic. The data processing result will be processed business data, which may be used to update the database, generate reports, or conduct further data analysis.

[0125] S304, identifying a response body data structure in the data transmission object, and serializing the data processing result based on the response body data structure to obtain a serialized response data object.

[0126] Specifically, after identifying the response body data structure in the data transfer object, the backend will serialize the data processing results based on the structure. Serialization is the process of converting data into a specific format (such as JSON or XML) so that it can be transmitted over the network. This process not only includes converting the business processing results into the expected format, but also ensures that the structure of the data is consistent with the response body data structure, so that the client can accurately parse and use the returned data. During the serialization process, the backend system needs to pay special attention to the matching of data types, such as the formatting of date objects, the precision of numbers, etc. After serialization is completed, the generated response data object is used as the return content of the API.

[0127] S305: Transmit the serialized response data object to the client through the API gateway.

[0128] Specifically, the back-end server transmits the serialized response data object to the client through the API gateway. In this process, the API gateway plays a key intermediary role and is responsible for necessary processing of the returned response, such as setting the correct HTTP status code, response header, etc., to ensure that the client can correctly identify and parse the response content. For example, the returned status code may be 200 (success), 400 (request error) or 500 (server error), and these information can help the client to make corresponding processing. At the same time, the API gateway may compress the response data to improve transmission efficiency. After the sent response is transmitted to the client through the network, the client will deserialize it according to the predefined protocol and data format to obtain available data. Through this process of the API gateway, the data interaction between the client and the server can be effectively managed and optimized, and the performance and user experience of the overall system can be improved.

[0129] In the above embodiment, the data processing method based on the custom message model significantly improves the efficiency of parsing and processing API requests. Through standardized request and response structures, errors caused by inconsistent data formats are reduced, ensuring the accuracy and integrity of data transmission. In a high-concurrency environment, the system can flexibly respond to various business needs and quickly identify and process fields to be processed. At the same time, the use of serialization and API gateway mechanisms enhances the security and reliability of data transmission and improves the interactive performance between the client and the back-end server.

[0130] Further, the step of parsing the standard format API request using a preset custom message model to obtain the data transmission object in the standard format API request specifically includes:

[0131] Identify the request header and body structure of the standard format API request;

[0132] Divide the request header and API request body structure;

[0133] Identify the data transfer object from the API request body structure.

[0134] In this embodiment, first, the backend server needs to identify the request header and API request body structure in the standard format API request. The request header usually contains metadata such as authentication information and content type, while the request body contains actual data. Next, the request header and API request body structure are divided to ensure that these information can be clearly distinguished. Then, the data transmission object is identified from the API request body structure, that is, the specific business data is extracted.

[0135] Through the above steps, the system can efficiently parse API requests and ensure the accuracy and consistency of data transmission. By clearly dividing the request header and request body, confusion in the data processing process is reduced, and the response speed and system stability are improved.

[0136] Further, the step of receiving a standard format API request uploaded by the client through the API gateway specifically includes:

[0137] Receive encrypted data requested by the client via the API gateway;

[0138] The first encryption key distributed by the client is used to decrypt the request encrypted data to obtain a standard format API request.

[0139] In this embodiment, the back-end server first receives the request encrypted data uploaded by the client through the API gateway. At this time, the data is still in an encrypted state to ensure that it is not stolen or tampered with during the transmission process. Then, the first encryption key distributed by the client is used to decrypt these request encrypted data. After decryption, the back-end can obtain a standard format API request, which contains the specific business information required by the client.

[0140] Through the above steps, the security and reliability of data transmission are significantly improved, ensuring the protection of sensitive information throughout the entire interaction process.

[0141] Before the step of transmitting the serialized response data object to the client through the API gateway, the step further includes:

[0142] generating a second encryption key;

[0143] Use the second encryption key to encrypt the serialized response data object to obtain encrypted response data;

[0144] The steps of transmitting the serialized response data object to the client through the API gateway specifically include:

[0145] The response encrypted data is transmitted to the client through the API gateway.

[0146] In this embodiment, a second encryption key is first generated, and the second encryption key is used to encrypt the serialized response data processed by the backend server to ensure the security of sensitive information during transmission. The generation process usually relies on a secure random number generation algorithm to prevent the key from being guessed or exposed. Next, the serialized response data object is encrypted using the second encryption key to generate response encrypted data. Through encryption, the response data has been protected before being transmitted to the client.

[0147] Finally, the backend server transmits the response encrypted data to the client through the API gateway. The API gateway is not only responsible for routing requests, but also provides traffic management and security monitoring functions to ensure that only authenticated requests can obtain data. During this process, the API gateway can also set appropriate response headers so that the client can correctly parse and process the encrypted data.

[0148] Through the above steps, the security of response data is significantly improved, ensuring the protection of sensitive information during transmission. The introduction of encryption mechanism reduces the risk of data leakage, enhances the compliance and reliability of the system, and makes it more suitable for industry environments that require strict data protection.

[0149] In this embodiment, the data processing method based on the custom message model runs on the electronic device (for example Figure 1 The server shown in the figure can receive instructions or obtain data through a wired connection or a wireless connection. It should be noted that the above wireless connection method may include but is not limited to 3G / 4G connection, Wi-Fi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (Ultra Wi-Fi Band) connection, and other wireless connection methods currently known or to be developed in the future.

[0150] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned data transmission object information, the above-mentioned data transmission object information can also be stored in a node of a blockchain.

[0151] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0152] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0153] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0154] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0155] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0156] Embodiment 3:

[0157] Further references Figure 4 , as a response to the above Figure 2 The present application provides an embodiment of a data processing device based on a custom message model. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0158] like Figure 4 As shown, the data processing device 400 based on the custom message model described in this embodiment includes:

[0159] The object definition module 401 is used to define the data transmission object according to the requirements of the API interface document, wherein the data transmission object includes a field to be processed, a data processing class method, a request body data structure, and a response body data structure;

[0160] The transmission format module 402 is used to select a matching data transmission format according to business requirements;

[0161] The request encapsulation module 403 is used to perform structured assembly of the API request based on the data transmission object and the data transmission format using a preset custom message model to obtain a standard format API request;

[0162] The request sending module 404 is used to send the standard format API request to the back-end server through the API gateway;

[0163] The deserialization module 405 is used to receive the serialized response data object sent back by the back-end server through the API gateway, and deserialize the serialized response data object to obtain a data processing result.

[0164] Furthermore, the request encapsulation module 403 is specifically used for:

[0165] Initialize the API request body structure, create an HTTP request object, and set the request method and target URL; use a custom message model to convert the data transfer object into the standard request body format; insert the data transfer object in the standard request body format into the API request body structure; select a matching request header for the API request body structure according to the data transfer format to obtain a standard API request.

[0166] Furthermore, the data processing device 400 based on the custom message model further includes a first encryption module, which is specifically used for:

[0167] Generate a first encryption key; use the first encryption key to encrypt data in the standard format API request to obtain request encrypted data.

[0168] Furthermore, the request sending module 404 is specifically used for:

[0169] The encrypted request data is sent to the back-end server through the API gateway.

[0170] Furthermore, the deserialization module 405 is specifically used for:

[0171] Receive the response encrypted data sent back by the back-end server through the API gateway; use the second encryption key distributed by the back-end server to decrypt the response encrypted data to obtain a serialized response data object.

[0172] In the above embodiment, the data processing method based on the custom message model significantly improves the efficiency and flexibility of API requests and responses. Through the clear design of data transmission objects, errors caused by inconsistent data formats are reduced, ensuring efficient data processing.

[0173] Please continue to refer to Figure 4 , as a response to the above Figure 3 The present application provides an embodiment of a data processing device based on a custom message model. Figure 3 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0174] like Figure 4 As shown, the data processing device 400 based on the custom message model described in this embodiment further includes:

[0175] Request receiving module 406, used to receive a standard format API request uploaded by the client through the API gateway;

[0176] The request parsing module 407 is used to parse the standard format API request using a preset custom message model to obtain the data transmission object in the standard format API request;

[0177] The class processing module 408 is used to identify the fields to be processed and the data processing class methods in the data transmission object, and use the data processing class methods to perform class processing on the fields to be processed to obtain data processing results;

[0178] The serialization module 409 is used to identify the response body data structure in the data transmission object, and serialize the data processing result based on the response body data structure to obtain a serialized response data object;

[0179] The data return module 410 is used to transmit the serialized response data object to the client through the API gateway.

[0180] Furthermore, the request parsing module 407 is specifically used for:

[0181] Identify the request header and the API request body structure of the standard format API request; divide the request header and the API request body structure; and identify the data transmission object from the API request body structure.

[0182] Further, the request receiving module 406 is specifically used for:

[0183] Receive encrypted data requested by the client via the API gateway;

[0184] The first encryption key distributed by the client is used to decrypt the request encrypted data to obtain a standard format API request.

[0185] Furthermore, the data processing device 400 based on the custom message model further includes a second encryption module, which is specifically used for:

[0186] Generate a second encryption key; use the second encryption key to encrypt the serialized response data object to obtain encrypted response data.

[0187] Furthermore, the data return module 410 is specifically used for:

[0188] The response encrypted data is transmitted to the client through the API gateway.

[0189] In the above embodiment, the data processing method based on the custom message model significantly improves the efficiency of parsing and processing API requests. Through standardized request and response structures, errors caused by inconsistent data formats are reduced, ensuring the accuracy and integrity of data transmission. In a high-concurrency environment, the system can flexibly respond to various business needs and quickly identify and process fields to be processed. At the same time, the use of serialization and API gateway mechanisms enhances the security and reliability of data transmission and improves the interactive performance between the client and the back-end server.

[0190] In the above embodiment, the present application discloses a data processing device based on a custom message model, which belongs to the field of big data technology. First, the client defines a data transmission object and selects a suitable data transmission format. Then, the client uses a preset custom message model to perform structured assembly of an API request, forms a standard format API request, and sends it to a back-end server. Then, the back-end server receives the API request, parses the request using the custom message model, and extracts the data transmission object. Then, the back-end server processes the field to be processed. Then, the back-end server serializes the processing result according to the response body data structure to form a serialized object, and returns it to the client through the API gateway. The client receives the serialized object sent by the back-end, deserializes it, and finally obtains the data processing result. The present application significantly improves the processing performance of API requests and responses, reduces the overhead of serialization and deserialization, ensures that a good response speed is still maintained in high concurrency and large-scale data transmission, and enhances the scalability and backward compatibility of the interface through flexible data transmission object design, simplifies version management, and reduces compatibility issues.

[0191] To solve the above technical problems, the present application also provides a computer device. Figure 5 , Figure 5 This is a basic structural block diagram of the computer device in this embodiment.

[0192] The computer device 5 includes a memory 51, a processor 52, and a network interface 53 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 5 having a memory 51, a processor 52, and a network interface 53, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital processor (DSP), an embedded device, etc.

[0193] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0194] The memory 51 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 51 can be an internal storage unit of the computer device 5, such as a hard disk or memory of the computer device 5. In other embodiments, the memory 51 can also be an external storage device of the computer device 5, such as a plug-in hard disk equipped on the computer device 5, a smart memory card (Smart Med ia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 51 can also include both the internal storage unit of the computer device 5 and its external storage device. In this embodiment, the memory 51 is generally used to store the operating system and various application software installed on the computer device 5, such as computer-readable instructions of a data processing method based on a custom message model, etc. In addition, the memory 51 can also be used to temporarily store various types of data that have been output or are to be output.

[0195] The processor 52 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 52 is generally used to control the overall operation of the computer device 5. In this embodiment, the processor 52 is used to run the computer-readable instructions stored in the memory 51 or process data, such as running the computer-readable instructions of the data processing method based on the custom message model.

[0196] The network interface 53 may include a wireless network interface or a wired network interface. The network interface 53 is generally used to establish a communication connection between the computer device 5 and other electronic devices.

[0197] The present application discloses a computer device, belonging to the field of big data technology. First, the client defines a data transmission object and selects a suitable data transmission format. Then, the client uses a preset custom message model to perform structured assembly of an API request, forms a standard format API request, and sends it to a back-end server. Then, the back-end server receives the API request, parses the request using the custom message model, and extracts the data transmission object. Then, the back-end server processes the fields to be processed. Then, the back-end server serializes the processing result according to the response body data structure to form a serialized object, and returns it to the client through an API gateway. The client receives the serialized object sent by the back-end, deserializes it, and finally obtains the data processing result. The present application significantly improves the processing performance of API requests and responses, reduces the overhead of serialization and deserialization, ensures that a good response speed is still maintained in high concurrency and large-scale data transmission, and enhances the scalability and backward compatibility of the interface through flexible data transmission object design, simplifies version management, and reduces compatibility issues.

[0198] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the data processing method based on the custom message model as described above.

[0199] The present application discloses a computer-readable storage medium, which belongs to the field of big data technology. First, the client defines a data transmission object and selects a suitable data transmission format. Then, the client uses a preset custom message model to perform structured assembly of an API request, forms a standard format API request, and sends it to a back-end server. Then, the back-end server receives the API request, parses the request using the custom message model, and extracts the data transmission object. Then, the back-end server processes the field to be processed. Then, the back-end server serializes the processing result according to the response body data structure to form a serialized object, and returns it to the client through the API gateway. The client receives the serialized object sent by the back-end, deserializes it, and finally obtains the data processing result. The present application significantly improves the processing performance of API requests and responses, reduces the overhead of serialization and deserialization, ensures that a good response speed is still maintained in high concurrency and large-scale data transmission, and enhances the scalability and backward compatibility of the interface through flexible data transmission object design, simplifies version management, and reduces compatibility issues.

[0200] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0201] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0202] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A data processing method based on a custom message model, characterized in that: include: According to the requirements of the API interface document, define the data transmission object, wherein the data transmission object includes the fields to be processed, the data processing class method, the request body data structure and the response body data structure; Select the matching data transmission format according to business needs; Based on the data transmission object and the data transmission format, a pre-set custom message model is used to perform structured assembly of the API request to obtain a standard format API request; Sending the standard format API request to the back-end server through the API gateway; Receive the serialized response data object returned by the back-end server through the API gateway, and deserialize the serialized response data object to obtain a data processing result.

2. The data processing method based on the custom message model according to claim 1, characterized in that: The step of performing structured assembly of the API request based on the data transmission object and the data transmission format using a preset custom message model to obtain a standard format API request specifically includes: Initialize the API request body structure, create an HTTP request object, and set the request method and target URL; Use a custom message model to convert data transfer objects into a standard request body format; Inserting the data transfer object in the standard request body format into the API request body structure; A matching request header is selected for the API request body structure according to the data transmission format to obtain the standard format API request.

3. The data processing method based on the custom message model according to claim 1, characterized in that: Before the step of sending the standard format API request to the back-end server through the API gateway, the method further includes: generating a first encryption key; Using the first encryption key to encrypt data of the standard format API request to obtain encrypted request data; The step of sending the standard format API request to the back-end server through the API gateway specifically includes: Sending the encrypted request data to the back-end server through the API gateway; The step of receiving the serialized response data object returned by the back-end server through the API gateway specifically includes: Receiving the encrypted response data transmitted back by the back-end server through the API gateway; The response encrypted data is decrypted using the second encryption key distributed by the backend server to obtain the serialized response data object.

4. A data processing method based on a custom message model, characterized in that: include: Receive standard format API requests uploaded by the client through the API gateway; Parsing the standard format API request using a preset custom message model to obtain a data transmission object in the standard format API request; Identify the fields to be processed and the data processing class method in the data transmission object, and use the data processing class method to perform class processing on the fields to be processed to obtain a data processing result; Identify a response body data structure in the data transmission object, and serialize the data processing result based on the response body data structure to obtain a serialized response data object; The serialized response data object is transmitted to the client through the API gateway.

5. The data processing method based on the custom message model according to claim 1, characterized in that: The step of using a preset custom message model to parse the standard format API request to obtain the data transmission object in the standard format API request specifically includes: Identify the request header and the API request body structure of the standard format API request; Dividing the request header and the API request body structure; The data transfer object is identified from the API request body structure.

6. The data processing method based on the custom message model according to claim 1, characterized in that: The step of receiving a standard format API request uploaded by a client through an API gateway specifically includes: Receive encrypted data requested by the client via the API gateway; Decrypt the request encrypted data using the first encryption key distributed by the client to obtain the standard format API request; Before the step of transmitting the serialized response data object to the client through the API gateway, the method further includes: generating a second encryption key; Using the second encryption key to encrypt the serialized response data object, to obtain encrypted response data; The step of transmitting the serialized response data object to the client through the API gateway specifically includes: The response encrypted data is transmitted to the client through the API gateway.

7. A data processing device based on a custom message model, characterized in that: include: An object definition module, used to define a data transmission object according to the requirements of the API interface document, wherein the data transmission object includes a field to be processed, a data processing class method, a request body data structure, and a response body data structure; The transmission format module is used to select a matching data transmission format according to business requirements; A request encapsulation module, used to perform structured assembly of an API request using a preset custom message model based on the data transmission object and the data transmission format to obtain a standard format API request; A request sending module, used to send the standard format API request to the back-end server through the API gateway; The deserialization module is used to receive the serialized response data object sent back by the back-end server through the API gateway, and deserialize the serialized response data object to obtain a data processing result.

8. A data processing device based on a custom message model, characterized in that: include: A request receiving module is used to receive a standard format API request uploaded by a client through an API gateway; A request parsing module, used to parse the standard format API request using a preset custom message model to obtain a data transmission object in the standard format API request; A class processing module, used for identifying the fields to be processed and the data processing class method in the data transmission object, and performing class processing on the fields to be processed using the data processing class method to obtain a data processing result; A serialization module, used for identifying a response body data structure in the data transmission object, and serializing the data processing result based on the response body data structure to obtain a serialized response data object; A data return module is used to transmit the serialized response data object to the client through the API gateway.

9. A computer device, characterized in that: It includes a memory and a processor, the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, it implements the steps of the data processing method based on the custom message model as described in any one of claims 1 to 3 or the data processing method based on the custom message model as described in any one of claims 4 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the data processing method based on a custom message model as described in any one of claims 1 to 3 or the data processing method based on a custom message model as described in any one of claims 4 to 6.

Citation Information

Cited By

  • File data analysis platform

    CN121636449A