Message checking method and device, equipment, storage medium and program product

By implementing a message checking method in the WEB server, determining the target field for the fields to be checked or generating inspection rules is solved, the problem of low packet inspection efficiency in traditional technology is solved, and more efficient compliance checks are achieved.

CN119544836AActive Publication Date: 2025-02-28CHINA CONSTRUCTION BANK +1
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411574084.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-02-28
Estimated Expiration
2044-11-06

AI Technical Summary

Technical Problem

In traditional technology, when WEB server conducts compliance checks on request packets sent by the front-end, the inspection efficiency is low and different inspection codes are needed for different packets.

Method used

Provide a message checking method, in response to the message to be checked, determine whether there is a matching target field in the regular field set for each field to be checked. If present, use the inspection rules for the target field to perform compliance checks; if not, generate the inspection rules for the fields to be checked and perform the checks.

Benefits of technology

Improves the efficiency of compliance checking messages, shortens inspection time, and avoids the steps that require the generation of inspection rules for each inspection field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544836A_ABST
    Figure CN119544836A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and particularly discloses a message checking method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: in response to a to-be-checked message, for each to-be-checked field in the to-be-checked message, determining whether a target field matched with the to-be-checked field exists in a conventional field set; the conventional field set comprises a plurality of conventional fields and a check rule corresponding to each conventional field; under the condition that the target field exists, performing compliance check on the to-be-checked field according to a check rule corresponding to the target field; and under the condition that the target field does not exist, generating an inspection rule of the to-be-inspected field according to each inspection rule in the conventional field set, and performing compliance inspection on the to-be-inspected field by utilizing the generated inspection rule. By adopting the method, the checking efficiency of checking the compliance of the message can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a message inspection method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] In the scenario where the WEB server interacts with the front end, the WEB server can receive the request message sent by the front end, where the request message includes information such as the request line, request header, message body, status line, response header, message body, etc. The WEB server needs to check the compliance of each information in the request message, for example, it needs to check the content and format of the message to ensure that the message meets the corresponding processing specifications.

[0003] In traditional technology, since the front-end processes different businesses, the messages sent to the WEB server are also different. The WEB server needs to generate different inspection codes for different messages, and then use different inspection codes to perform compliance checks on different messages.

[0004] Therefore, there is a problem of low efficiency in the compliance check of messages in the traditional technology. Summary of the invention

[0005] Based on this, it is necessary to provide a message inspection method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the efficiency of compliance inspection of messages in response to the above technical problems.

[0006] In a first aspect, the present application provides a message inspection method, comprising:

[0007] In response to a message to be checked, for each field to be checked in the message to be checked, determining whether there is a target field matching the field to be checked in a regular field set; the regular field set includes a plurality of regular fields and a check rule corresponding to each regular field;

[0008] In the case where the target field exists, performing compliance check on the field to be checked according to the check rule corresponding to the target field;

[0009] In the case that the target field does not exist, the check rules for the field to be checked are generated according to the check rules in the conventional field set, and the compliance check is performed on the field to be checked using the generated check rules.

[0010] In one embodiment, performing compliance check on the field to be checked according to the check rule corresponding to the target field includes:

[0011] Determining whether there is annotation information in the inspection rule;

[0012] In the case where the annotation information exists, performing compliance check on the field to be checked according to the annotation information;

[0013] In the absence of the annotation information, the compliance check is not performed, and the field to be checked is determined to be a compliant field.

[0014] In one embodiment, the annotation information includes a regular expression and a value range of a field value, and the compliance check of the field to be checked according to the annotation information includes:

[0015] Obtaining a check value from the field to be checked;

[0016] When the size of the check value is within the value range, performing the compliance check on the check value according to the regular expression;

[0017] When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

[0018] In one embodiment, the annotation information also includes a default value, and the method further includes:

[0019] If the check value is a null value, the check value is assigned a value using the default value.

[0020] In one embodiment, performing the compliance check on the check value according to the regular expression includes:

[0021] Obtain a first string type corresponding to the regular expression and a second string type corresponding to the check value;

[0022] In a case where the first character string type and the second character string type are consistent, determining that the field to be checked is a compliant field;

[0023] When the first character string type and the second character string type are inconsistent, it is determined that the field to be checked is an incompatible field.

[0024] In one embodiment, the method further comprises:

[0025] If the field to be checked is a non-compliant field, an exception indication is generated, where the exception indication includes an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

[0026] In a second aspect, the present application also provides a message inspection device, including:

[0027] A determination module, configured to determine, in response to a message to be checked, for each field to be checked in the message to be checked, whether there is a target field in a regular field set that matches the field to be checked; the regular field set includes a plurality of regular fields and a check rule corresponding to each regular field;

[0028] A first checking module, configured to, when the target field exists, perform a compliance check on the field to be checked according to a check rule corresponding to the target field;

[0029] The second checking module is used to generate the checking rules of the field to be checked according to each checking rule in the conventional field set when the target field does not exist, and perform compliance checking on the field to be checked by using the generated checking rules.

[0030] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the methods described in the first aspect when executing the computer program.

[0031] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements any of the methods described in the first aspect above.

[0032] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the methods described in the first aspect.

[0033] In the above-mentioned message inspection method, apparatus, computer equipment, computer-readable storage medium and computer program product, the server responds to the message to be inspected, and for each field to be inspected in the message to be inspected, determines whether there is a target field matching the field to be inspected in the regular field set, wherein the regular field set includes multiple regular fields and inspection rules corresponding to each regular field. Then, in the case where the target field exists, the field to be inspected is subjected to a compliance check according to the inspection rule corresponding to the target field. Since the inspection rule of the field to be inspected can be quickly determined from the regular field set, there is no need to generate inspection rules for the inspection field, thereby improving the inspection efficiency of the inspection field and shortening the inspection time; and in the case where the target field does not exist, the inspection rules for the field to be inspected are generated according to each inspection rule in the regular field set, and the compliance check is performed on the field to be inspected using the generated inspection rules. Since each inspection rule in the regular field set is pre-generated, each inspection rule can be used to quickly generate the inspection rules for the field to be inspected, thereby improving the efficiency of generating the inspection rules and shortening the time of generating the inspection rules, thereby improving the inspection efficiency of all fields to be inspected in the message to be inspected. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0035] FIG1 is an application environment diagram of a message inspection method in one embodiment;

[0036] FIG2 is a schematic diagram of a flow chart of a message inspection method in an embodiment;

[0037] FIG3 is a schematic diagram of a flow chart of step 202 in one embodiment;

[0038] FIG4 is a schematic diagram of a flow chart of step 302 in one embodiment;

[0039] FIG5 is a schematic diagram of a flow chart of step 402 in one embodiment;

[0040] FIG6 is a structural block diagram of a message inspection device in one embodiment;

[0041] FIG. 7 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It should be noted that in the embodiments of the present application, certain software, groups, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0043] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations. The acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with relevant provisions of national laws and regulations.

[0044] In the conventional technology, in the scenario where a web server interacts with a front-end, each time the front-end device processes a new service, it will send a new request message to the web server. The web server needs to develop a check code for the new request message, and then use the corresponding check code to perform a compliance check on the new request message, thereby causing a low check efficiency when performing compliance checks on the message. In view of this, the present application proposes a message check method that can improve the check efficiency of compliance checks on messages.

[0045] The message inspection method provided in the embodiment of the present application can be applied in the application environment shown in FIG. 1. Among them, the server 102 communicates with the front-end device 104 through the network. The data storage system can store the data that the server 102 needs to process. The data storage system can be integrated on the server 102, or it can be placed on the cloud or other network servers. In response to the message to be inspected, the server 102 determines whether there is a target field matching the field to be inspected in the conventional field set for each field to be inspected in the message to be inspected. The conventional field set includes multiple conventional fields and inspection rules corresponding to each conventional field. In the case of the presence of the target field, the compliance check is performed on the field to be inspected according to the inspection rule corresponding to the target field. In the case of the absence of the target field, the inspection rule of the field to be inspected is generated according to each inspection rule in the conventional field set, and the compliance check is performed on the field to be inspected using the generated inspection rule. Among them, the front-end device 104 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head mounted device may be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 102 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.

[0046] In an exemplary embodiment, as shown in FIG2 , a message inspection method is provided, which is described by taking the method applied to the server in FIG1 as an example, and includes the following steps:

[0047] Step 201, in response to a message to be checked, for each field to be checked in the message to be checked, determine whether there is a target field matching the field to be checked in a regular field set; the regular field set includes multiple regular fields and a check rule corresponding to each regular field.

[0048] Among them, the message to be checked is an HTTP request message sent by the front-end device to the server, which contains the request information of the front-end device to the server. The server can respond to the message to be checked and perform the operation corresponding to the message to be checked. Among them, the field to be checked refers to the field used to carry information in the message to be checked. The server can determine whether the content of the message to be checked meets the identification requirements and processing requirements of the server by performing a compliance check on the field to be checked. It should be noted that the message to be checked may include multiple fields to be checked, and the server can perform compliance checks on each field to be checked separately. Exemplarily, the message checking method provided in the embodiment of the present application can be applied to a stock trading scenario, wherein, if the message to be checked is sent by a user to a server through a front-end device such as a laptop computer or a smart phone to instruct the server to perform a stock entry operation, then the field to be checked can be the stock name, or the field to be checked can also be the number of stocks to be entered.

[0049] Among them, the regular field refers to the field determined in advance by the server based on the field in the historical message received within the historical time period. It is understandable that the server can determine the fields that need to be checked for compliance based on the compliance check records of the fields in the historical message, and then determine these fields as regular fields, and establish a regular field set based on the inspection rules and regular fields for the compliance check of each regular field. In this embodiment, for each field to be checked, the server can determine the field in the regular field set that matches the field to be checked as the target field, so as to perform a compliance check on the target field.

[0050] In this embodiment, the server can receive the message to be checked sent by the front-end device through the network, and then respond to the message to be checked. Optionally, taking a field to be checked in the message to be checked as an example, the server can search for a field with the same field name from multiple regular fields in a regular field set based on the field name of the field to be checked, and determine the regular field with the same field name as the field to be checked as the target field; or, the server can also search for a field with the same field type from multiple regular fields in a regular field set based on the field type of the field to be checked, and determine the regular field with the same field type as the field to be checked as the target field.

[0051] Step 202: If the target field exists, a compliance check is performed on the field to be checked according to the check rule corresponding to the target field.

[0052] Among them, the inspection rule corresponding to the target field is the inspection rule related to the target field by the server. The inspection rule refers to the rule for compliance check on the field. For example, the inspection rule may be to check the field, or the inspection rule may be not to check the field; or, the inspection rule may be to check whether the value of the field is greater than a threshold; or, the inspection rule may be to check the string type of the field. The above are only some exemplary explanations of the inspection rules in this embodiment, and this embodiment does not limit the content of the inspection rules.

[0053] In this embodiment, if the target field exists in the regular field set, the server can directly obtain the check rule corresponding to the target field from the regular field set, and use the check rule corresponding to the target field to perform compliance check on the field to be checked. Exemplarily, if the data information in the field to be checked complies with the check rule, the field to be checked can be determined to be a compliant field, or if the data information in the field to be checked does not comply with the check rule, the field to be checked can be determined to be a non-compliant field.

[0054] Step 203 : if the target field does not exist, generate a check rule for the field to be checked according to each check rule in the regular field set, and perform compliance check on the field to be checked using the generated check rule.

[0055] It should be noted that if the field to be checked is a newly set field in the message to be checked, a regular field matching the field to be checked cannot be found in the regular field set, and compliance check cannot be performed on the field to be checked. Therefore, a check rule matching the field to be checked can be generated, so that compliance check can be performed on the field to be checked using the generated check rule.

[0056] In this embodiment, if the target field does not exist in the regular field set, the server can search for the physical meaning, string type, and numerical range represented by the field to be checked from each check rule in the regular field set, and then generate a check rule for the field to be checked based on the found check rule, and use the check rule to perform a compliance check on the field to be checked. Optionally, if the result of the compliance check is passed, the field to be checked is a compliant field, or, if the result of the compliance check is not passed, the field to be checked is a non-compliant field.

[0057] In the above-mentioned message inspection method, the server responds to the message to be inspected, and for each field to be inspected in the message to be inspected, determines whether there is a target field matching the field to be inspected in the regular field set, the regular field set including multiple regular fields and inspection rules corresponding to each regular field. Then, if the target field exists, the compliance check is performed on the field to be inspected according to the inspection rule corresponding to the target field. Since the inspection rule of the field to be inspected can be quickly determined from the regular field set, there is no need to generate inspection rules for the inspection field, which improves the inspection efficiency of the inspection field and shortens the inspection time; and if the target field does not exist, the inspection rules for the field to be inspected are generated according to each inspection rule in the regular field set, and the compliance check is performed on the field to be inspected using the generated inspection rules. Since each inspection rule in the regular field set is pre-generated, each inspection rule can be used to quickly generate the inspection rules for the field to be inspected, thereby improving the efficiency of generating the inspection rules and shortening the time of generating the inspection rules, thereby improving the inspection efficiency of all fields to be inspected in the message to be inspected.

[0058] In the above-mentioned compliance check of the to-be-checked field according to the check rule corresponding to the target field, the compliance check of the to-be-checked field can be performed according to the annotation information in the check rule. In an exemplary embodiment, as shown in FIG3 , step 202 includes step 301 and step 302. Among them:

[0059] Step 301, determine whether there is annotation information in the inspection rule.

[0060] The annotation information refers to the compliance check information corresponding to the target field. For example, the annotation information may include information such as the check items, the value of each check item, and the format of each check item.

[0061] It should be noted that the server needs to check a large number of general fields. In order to improve processing efficiency, some general fields can be divided into fields that need to be checked for compliance, and some general fields can be divided into fields that do not need to be checked for compliance, according to the security level and priority level of each general field. Therefore, for general fields that do not need to be checked for compliance, there is no annotation information in the inspection rules of the general fields, and for general fields that need to be checked for compliance, there is annotation information in the inspection rules of the general fields.

[0062] In this embodiment, the server may obtain the inspection rule corresponding to the target field from the regular field set, identify the content included in the inspection rule, and determine whether the inspection rule includes annotation information according to the identification result.

[0063] Step 302: If annotation information exists, a compliance check is performed on the field to be checked according to the annotation information.

[0064] It is understandable that, when the check rule includes annotation information, it indicates that compliance check needs to be performed on the field to be checked. In this embodiment, the server can perform compliance check on the field to be checked according to the annotation information.

[0065] Exemplarily, if the annotation information includes parameter types, the parameter type in the field to be checked can be checked. If the parameter type in the field to be checked is consistent with the parameter type in the annotation information, the field to be checked can be determined to be a qualified field; if the parameter type in the field to be checked is inconsistent with the parameter type in the annotation information, the field to be checked can be determined to be an unqualified field.

[0066] In this embodiment, the server may compare the annotation information with the content of the field to be checked one by one, and determine the result of the compliance check according to the comparison result.

[0067] Step 303: If no annotation information exists, no compliance check is performed, and the field to be checked is determined to be a compliant field.

[0068] It is understandable that if there is no annotation information in the check rule, it means that there is no need to perform a compliance check on the field to be checked, and the field to be checked can be assumed to be a compliant field. In this embodiment, the server may not perform a compliance check on the field to be checked if there is no annotation information, and determine that the field to be checked is a compliant field.

[0069] In this embodiment, the server determines whether there is annotation information in the inspection rule. If the annotation information exists, the server can perform a compliance check on the field to be inspected according to the annotation information. If the annotation information does not exist, the server does not perform a compliance check and determines that the field to be inspected is a compliant field. Since the fields to be inspected that do not need to be inspected for compliance can be filtered out based on whether there is annotation information, the number of fields that need to be checked in the message to be inspected is reduced, thereby shortening the inspection time of the message to be inspected and improving the inspection efficiency of the message to be inspected.

[0070] In the above scenario of performing compliance check on the field to be checked based on the annotation information, the annotation information includes a regular expression and a value range of the field value, and the regular expression and the value range can be used to perform compliance check on the field to be checked. In an exemplary embodiment, as shown in FIG4 , step 302 includes step 401 and step 402, wherein:

[0071] Step 401, obtaining a check value from a field to be checked.

[0072] The check value refers to the value of the attribute or feature in the field to be checked. For example, if the field to be checked is the number of stocks to be warehoused, the check value can be 0, 10, 20, etc. In this embodiment, the server can obtain the numerical information from the information corresponding to the field to be checked and use the numerical information as the check value.

[0073] Step 402: When the size of the check value is within the value range, a compliance check is performed on the check value according to a regular expression.

[0074] The field value refers to the value of the attribute or feature of each regular field, and the value range of the field value refers to the maximum and minimum values ​​of the numerical value in the field to be checked. It can be understood that if the size of the check value is within the value range, the server can normally identify the field value of the field to be checked, and thus can normally respond to the message to be checked.

[0075] Among them, regular expression is a processing method for filtering strings by matching strings with specific patterns. For example, regular expression can be used to check whether a string contains a string of a certain rule. In this embodiment, regular expression can be set in advance according to the regular rules supported by the server.

[0076] In this embodiment, the server can compare the check value with the value range. If the check value is greater than or equal to the minimum value in the value range and less than or equal to the maximum value in the value range, the server can continue to perform a compliance check on the check value based on the regular expression to see whether the check value satisfies the regular rules supported by the server.

[0077] Step 403: When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

[0078] It is understandable that if the size of the check value is not within the value range, the server cannot normally identify the field value of the field to be checked, and thus cannot normally respond to the message to be checked.

[0079] In this embodiment, the server may compare the check value with the value range. If the check value is smaller than the minimum value in the value range and larger than the maximum value in the value range, it may be determined that the compliance check has failed.

[0080] In a possible implementation, the annotation information also includes a default value. If the check value is a null value, the default value is used to assign a value to the check value.

[0081] The default value refers to a value that the server can normally respond to the field to be checked. For example, if the field to be checked is the number of stocks to be warehoused, the default value can be any integer greater than 0 and less than 100. For example, it can be 10, 20, 30, etc. It is understandable that if the field to be checked does not include a check value, the server may not be able to normally identify the field value in the field to be checked, and cannot respond to the message to be checked.

[0082] In this implementation, when the server obtains the check value, if it cannot obtain the check value in the field to be checked, it can determine that the check value in the field to be checked is empty, and assign the check value with a default value.

[0083] In this embodiment, the server obtains a check value from the field to be checked, and when the size of the check value is within the value range, the server performs a compliance check on the check value according to a regular expression. Since the process of determining the comparison result of the check value and the value range is relatively simple, the comparison result of the check value and the value range can be quickly determined, thereby improving the efficiency of the compliance check on the check value according to the regular expression. At the same time, when the size of the check value is not within the value range, the field to be checked is determined to be a non-compliant field, which can reduce the ineffective work of performing compliance checks on the check value according to the regular expression, thereby improving the inspection efficiency of the compliance check.

[0084] The specific process of checking the compliance of the check value according to the regular expression is described in detail below. In an exemplary embodiment, as shown in FIG5 , step 402 includes step 501 and step 502, wherein:

[0085] Step 501: Obtain a first string type corresponding to a regular expression and a second string type corresponding to a check value.

[0086] It should be noted that a string is a data type used to represent a series of characters. String types can include character strings, integer strings, floating-point strings, Boolean strings, etc. If the string type of the check value is different from the string type supported by the server by default, the server will not be able to recognize the check value. Therefore, you can determine whether the compliance check passes based on whether the string type of the check value is consistent with the string type of the regular expression.

[0087] The first string type refers to the string type corresponding to the regular rule in the regular expression, and the second string type refers to the string type corresponding to the check value.

[0088] In this embodiment, the server can obtain the first string type from the relevant information of the target field in the storage space, or directly identify the string type corresponding to the regular rule and obtain the first string type according to the identification result, and the server can identify the string type corresponding to the check value and obtain the second string type according to the identification result.

[0089] Step 502: When the first character string type and the second character string type are consistent, determine that the field to be checked is a compliant field.

[0090] In this embodiment, the server may compare the first string type and the second string type, determine whether the first string type and the second string type are consistent according to the comparison result, and determine that the compliance check passes and the field to be checked is a compliant field when the first string type and the second string type are consistent.

[0091] Step 502: When the first character string type and the second character string type are inconsistent, determine that the field to be checked is an incompatible field.

[0092] In this embodiment, the server may compare the first string type and the second string type, determine whether the first string type and the second string type are consistent according to the comparison result, and when the first string type and the second string type are inconsistent, determine that the compliance check fails and determine that the field to be checked is a non-compliant field.

[0093] In this embodiment, the server obtains the first string type corresponding to the regular expression and the second string type corresponding to the check value, and can determine that the field to be checked is a non-compliant field when the first string type and the second string type are consistent, and can determine that the field to be checked is a non-compliant field when the first string type and the second string type are inconsistent. Since the process of determining whether the first string type is consistent with the second string type is relatively simple, the comparison result can be determined quickly, and then whether the compliance check is passed can be quickly determined based on the comparison result.

[0094] In an exemplary embodiment, the method further includes: if the field to be checked is a non-compliant field, generating an exception indication, the exception indication including an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

[0095] It is understandable that if the field to be checked is a non-compliant field, it can be determined that the compliance check of the field to be checked has not passed, and the exception indication refers to the indication information generated by the server based on the abnormal reason for failure when the compliance check has not passed. Among them, the exception code is an identification code set by the server according to different abnormal reasons, and the exception code corresponds to the abnormal reason one by one. Therefore, in the case of compliance failure, the corresponding exception code can be quickly determined to improve the efficiency of generating abnormal indications.

[0096] In this embodiment, when the field to be checked is a non-compliant field, the server may generate an exception indication including an exception code according to the corresponding exception reason for failing the compliance check.

[0097] As a possible implementation, after generating the exception indication including the exception code, the server may also return the exception indication to the front-end device corresponding to the message to be checked, so as to notify the front-end device to modify the message to be checked based on the cause of the exception.

[0098] In this embodiment, when the field to be checked is a non-compliant field, the server can generate an exception indication of an exception code based on the reason for the non-compliance, and can provide the reason for the non-compliance of the field to be checked to the operation and maintenance personnel so that the operation and maintenance personnel can modify the field to be checked.

[0099] To facilitate understanding by those skilled in the art, the message inspection method provided by the present application is described in detail below. The method may include:

[0100] S1, in response to a message to be checked, for each field to be checked in the message to be checked, determining whether there is a target field matching the field to be checked in a regular field set.

[0101] S2: If the target field exists, determine whether there is annotation information in the inspection rule corresponding to the target field.

[0102] S3, if there is annotation information, obtain the check value from the field to be checked.

[0103] S4, when the size of the check value is within the value range, obtain a first string type corresponding to the regular expression and a second string type corresponding to the check value.

[0104] S5: When the first character string type and the second character string type are consistent, determine that the field to be checked is a compliant field.

[0105] S6: When the first character string type and the second character string type are inconsistent, determine that the field to be checked is an incompatible field.

[0106] S7: When the size of the check value is not within the value range, determine that the field to be checked is a non-compliant field.

[0107] S8, if the check value is a null value, assign a default value to the check value.

[0108] S9: In the absence of annotation information, compliance check is not performed, and the field to be checked is determined to be a compliant field.

[0109] S10: In the case where the target field does not exist, generating a check rule for the field to be checked according to each check rule in the conventional field set, and performing a compliance check on the field to be checked using the generated check rule.

[0110] It should be noted that for the description in the above S1-S10, reference may be made to the relevant description in the above embodiment, and the effects are similar, which will not be repeated in this embodiment.

[0111] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0112] Based on the same inventive concept, the embodiment of the present application also provides a message inspection device for implementing the message inspection method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more message inspection device embodiments provided below can refer to the limitations on the message inspection method above, and will not be repeated here.

[0113] In an exemplary embodiment, as shown in FIG6 , a message inspection device is provided, including: a determination module 601, a first inspection module 602, and a second inspection module 603, wherein:

[0114] The determination module 601 is used to determine, in response to the message to be checked, for each field to be checked in the message to be checked, whether there is a target field in the regular field set that matches the field to be checked; the regular field set includes multiple regular fields and a check rule corresponding to each regular field;

[0115] A first checking module 602 is used to perform compliance checking on the field to be checked according to the checking rule corresponding to the target field when the target field exists;

[0116] The second checking module 603 is used to generate a checking rule for the field to be checked according to each checking rule in the regular field set when there is no target field, and perform compliance check on the field to be checked using the generated checking rule.

[0117] The message inspection device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0118] In one embodiment, the first inspection module includes:

[0119] A first determining unit, used to determine whether there is annotation information in the inspection rule;

[0120] A checking unit, used for performing compliance checking on the field to be checked according to the annotation information when there is annotation information;

[0121] The second determining unit is used for not performing compliance check when no annotation information exists, and determining that the field to be checked is a compliant field.

[0122] The message inspection device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0123] In one embodiment, the annotation information includes a regular expression and a value range of a field value, and the checking unit is specifically used to:

[0124] Get the check value from the field to be checked;

[0125] When the size of the check value is within the value range, the check value is checked for compliance according to the regular expression;

[0126] When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

[0127] The message inspection device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0128] In one embodiment, the annotation information further includes a default value, and the apparatus further includes:

[0129] The assignment module is used to assign a default value to the check value if the check value is a null value.

[0130] The message inspection device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0131] In one embodiment, the inspection unit is specifically configured to:

[0132] Get the first string type corresponding to the regular expression and the second string type corresponding to the check value;

[0133] When the first character string type and the second character string type are consistent, determining that the field to be checked is a compliant field;

[0134] When the first character string type and the second character string type are inconsistent, the field to be checked is determined to be an incompatible field.

[0135] In one embodiment, the above device further comprises:

[0136] The generation module is used to generate an exception indication if the field to be checked is a non-compliant field. The exception indication includes an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

[0137] The message inspection device provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0138] Each module in the above-mentioned message inspection device can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0139] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG7. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store inspection messages and regular field data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external front-end device through a network connection. When the computer program is executed by the processor, a message inspection method is implemented.

[0140] Those skilled in the art will understand that the structure shown in FIG. 7 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0141] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0142] In response to the message to be checked, for each field to be checked in the message to be checked, determining whether there is a target field matching the field to be checked in a regular field set; the regular field set includes multiple regular fields and a check rule corresponding to each regular field;

[0143] If the target field exists, the compliance check is performed on the field to be checked according to the check rule corresponding to the target field;

[0144] In the case that the target field does not exist, the check rules for the field to be checked are generated according to each check rule in the general field set, and the compliance check is performed on the field to be checked using the generated check rules.

[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0146] Determine whether annotation information exists in the inspection rule;

[0147] If annotation information exists, compliance check is performed on the fields to be checked according to the annotation information;

[0148] In the absence of annotation information, compliance checking is not performed, and the field to be checked is determined to be a compliant field.

[0149] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0150] Get the check value from the field to be checked;

[0151] When the size of the check value is within the value range, the check value is checked for compliance according to the regular expression;

[0152] When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

[0153] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0154] If the check value is null, the default value is used to assign the check value.

[0155] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0156] Get the first string type corresponding to the regular expression and the second string type corresponding to the check value;

[0157] When the first character string type and the second character string type are consistent, determining that the field to be checked is a compliant field;

[0158] When the first character string type and the second character string type are inconsistent, the field to be checked is determined to be an incompatible field.

[0159] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0160] If the field to be checked is a non-compliant field, an exception indication is generated, and the exception indication includes an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

[0161] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0162] In response to the message to be checked, for each field to be checked in the message to be checked, determining whether there is a target field matching the field to be checked in a regular field set; the regular field set includes multiple regular fields and a check rule corresponding to each regular field;

[0163] If the target field exists, the compliance check is performed on the field to be checked according to the check rule corresponding to the target field;

[0164] In the case that the target field does not exist, the check rules for the field to be checked are generated according to each check rule in the general field set, and the compliance check is performed on the field to be checked using the generated check rules.

[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0166] Determine whether annotation information exists in the inspection rule;

[0167] If annotation information exists, compliance check is performed on the fields to be checked according to the annotation information;

[0168] In the absence of annotation information, compliance checking is not performed, and the field to be checked is determined to be a compliant field.

[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0170] Get the check value from the field to be checked;

[0171] When the size of the check value is within the value range, the check value is checked for compliance according to the regular expression;

[0172] When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

[0173] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0174] If the check value is null, the default value is used to assign the check value.

[0175] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0176] Get the first string type corresponding to the regular expression and the second string type corresponding to the check value;

[0177] When the first character string type and the second character string type are consistent, determining that the field to be checked is a compliant field;

[0178] When the first character string type and the second character string type are inconsistent, the field to be checked is determined to be an incompatible field.

[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0180] If the field to be checked is a non-compliant field, an exception indication is generated, and the exception indication includes an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

[0181] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0182] In response to the message to be checked, for each field to be checked in the message to be checked, determining whether there is a target field matching the field to be checked in a regular field set; the regular field set includes multiple regular fields and a check rule corresponding to each regular field;

[0183] If the target field exists, the compliance check is performed on the field to be checked according to the check rule corresponding to the target field;

[0184] In the case that the target field does not exist, the check rules for the field to be checked are generated according to each check rule in the general field set, and the compliance check is performed on the field to be checked using the generated check rules.

[0185] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0186] Determine whether annotation information exists in the inspection rule;

[0187] If annotation information exists, compliance check is performed on the fields to be checked according to the annotation information;

[0188] In the absence of annotation information, compliance checking is not performed, and the field to be checked is determined to be a compliant field.

[0189] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0190] Get the check value from the field to be checked;

[0191] When the size of the check value is within the value range, the check value is checked for compliance according to the regular expression;

[0192] When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

[0193] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0194] If the check value is null, the default value is used to assign the check value.

[0195] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0196] Get the first string type corresponding to the regular expression and the second string type corresponding to the check value;

[0197] When the first character string type and the second character string type are consistent, determining that the field to be checked is a compliant field;

[0198] When the first character string type and the second character string type are inconsistent, the field to be checked is determined to be an incompatible field.

[0199] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0200] If the field to be checked is a non-compliant field, an exception indication is generated, and the exception indication includes an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

[0201] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0202] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0203] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A message inspection method, characterized in that: The method comprises: In response to a message to be checked, for each field to be checked in the message to be checked, determining whether there is a target field matching the field to be checked in a regular field set; the regular field set includes a plurality of regular fields and a check rule corresponding to each regular field; In the case where the target field exists, performing compliance check on the field to be checked according to the check rule corresponding to the target field; In the case that the target field does not exist, the check rules for the field to be checked are generated according to the check rules in the conventional field set, and the compliance check is performed on the field to be checked using the generated check rules.

2. The method according to claim 1, characterized in that The step of performing compliance check on the field to be checked according to the check rule corresponding to the target field includes: Determining whether there is annotation information in the inspection rule; In the case where the annotation information exists, performing compliance check on the field to be checked according to the annotation information; In the absence of the annotation information, the compliance check is not performed, and the field to be checked is determined to be a compliant field.

3. The method according to claim 2, characterized in that The annotation information includes a regular expression and a value range of a field value, and the compliance check of the field to be checked according to the annotation information includes: Obtaining a check value from the field to be checked; When the size of the check value is within the value range, performing the compliance check on the check value according to the regular expression; When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

4. The method according to claim 3, characterized in that The annotation information also includes a default value, and the method further includes: If the check value is a null value, the check value is assigned a value using the default value.

5. The method according to claim 3, characterized in that: The performing the compliance check on the check value according to the regular expression includes: Obtain a first string type corresponding to the regular expression and a second string type corresponding to the check value; In a case where the first character string type and the second character string type are consistent, determining that the field to be checked is a compliant field; When the first character string type and the second character string type are inconsistent, it is determined that the field to be checked is an incompatible field.

6. The method according to claim 5, characterized in that The method further comprises: If the field to be checked is a non-compliant field, an exception indication is generated, where the exception indication includes an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

7. A message inspection device, characterized in that: The device comprises: A determination module, configured to determine, in response to a message to be checked, for each field to be checked in the message to be checked, whether there is a target field in a regular field set that matches the field to be checked; the regular field set includes a plurality of regular fields and a check rule corresponding to each regular field; A first checking module, configured to, when the target field exists, perform a compliance check on the field to be checked according to a check rule corresponding to the target field; The second checking module is used to generate the checking rules of the field to be checked according to each checking rule in the conventional field set when the target field does not exist, and perform compliance checking on the field to be checked by using the generated checking rules.

8. The device according to claim 7, characterized in that The first inspection module comprises: A first determining unit, configured to determine whether annotation information exists in the inspection rule; a checking unit, configured to perform compliance checking on the field to be checked according to the annotation information when the annotation information exists; The second determining unit is configured to, if the annotation information does not exist, not perform the compliance check and determine that the field to be checked is a compliant field.

9. The device according to claim 8, characterized in that The annotation information includes a regular expression and a value range of a field value, and the checking unit is specifically used to: Obtaining a check value from the field to be checked; When the size of the check value is within the value range, performing the compliance check on the check value according to the regular expression; When the size of the check value is not within the value range, it is determined that the field to be checked is a non-compliant field.

10. The device according to claim 9, characterized in that The annotation information also includes a default value, and the device also includes: The assignment module is used to assign a value to the check value using the default value if the check value is a null value.

11. The device according to claim 9, characterized in that The inspection unit is specifically used for: Obtain a first string type corresponding to the regular expression and a second string type corresponding to the check value; In a case where the first character string type and the second character string type are consistent, determining that the field to be checked is a compliant field; When the first character string type and the second character string type are inconsistent, it is determined that the field to be checked is an incompatible field.

12. The device according to claim 11, characterized in that The device also includes: A generating module is used to generate an exception indication if the field to be checked is a non-compliant field, wherein the exception indication includes an exception code, and the exception code is used to determine the non-compliant reason corresponding to the field to be checked.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method and device for verifying interface packet

    CN109510824A

  • Data modification method and device, computer equipment and storage medium

    CN115357598A

  • Configuration library information normalization checking method, device and equipment and storage medium

    CN115729609A

  • Data quality index checking method and device and electronic equipment

    CN116975028A

  • Field information checking method and apparatus

    WO2020259147A1