CN114500690B - Interface data processing method and device, electronic equipment and storage medium - Google Patents

Interface data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114500690B
CN114500690B CN202210139655.1A CN202210139655A CN114500690B CN 114500690 B CN114500690 B CN 114500690B CN 202210139655 A CN202210139655 A CN 202210139655A CN 114500690 B CN114500690 B CN 114500690B
Authority
CN
China
Prior art keywords
message
interface
field
response
initial
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210139655.1A
Other languages
Chinese (zh)
Other versions
CN114500690A (en
Inventor
曾亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202210139655.1A priority Critical patent/CN114500690B/en
Publication of CN114500690A publication Critical patent/CN114500690A/en
Application granted granted Critical
Publication of CN114500690B publication Critical patent/CN114500690B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the application discloses an interface data processing method, an interface data processing device, electronic equipment and a storage medium, which are applied to the technical field of data processing. The method comprises the following steps: receiving a response interface message from a first interface, performing format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message, obtaining a field mapping relation between the first interface and a second interface, performing mapping processing on an initial field name and an initial field value included in each initial message parameter based on the field mapping relation to obtain a target message parameter set, and determining message information indicated by the response interface message according to the target message parameter set. By adopting the application, the analysis reliability of the interface message can be improved. The present application relates to blockchain techniques, such as obtaining field mappings from blockchains.

Description

Interface data processing method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to an interface data processing method, an apparatus, an electronic device, and a storage medium.
Background
Currently, when two interfaces communicate by sending encapsulated interface messages. For example, in a system interaction scenario, when an interface of a first system receives an interface message sent by an interface of a second system, the interface message can be parsed to obtain important message information transmitted by the second system. If the message formats of the two interfaces are defined differently, the parsing result of the interface message may be inaccurate. Therefore, how to improve the reliability of parsing the interface message is a urgent problem to be solved.
Disclosure of Invention
The embodiment of the application provides an interface data processing method, an interface data processing device, electronic equipment and a storage medium, which can improve the analysis reliability of an interface message.
In one aspect, an embodiment of the present application provides an interface data processing method, where the method includes:
receiving a response interface message from a first interface; the response interface message is obtained based on a request interface message, and the request interface message is generated based on a second interface in the electronic equipment;
performing format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; each initial message parameter in the initial message parameter set comprises an initial field name and an initial field value;
Acquiring a field mapping relation between the first interface and the second interface;
mapping the initial field names and the initial field values included in the initial message parameters based on the field mapping relation to obtain a target message parameter set; the target message parameter set comprises target message parameters obtained after mapping the initial message parameters;
and determining the message information indicated by the response interface message according to the target message parameter set.
In one aspect, an embodiment of the present application provides an interface data processing apparatus, including:
the receiving module is used for receiving a response interface message from the first interface; the response interface message is obtained based on a request interface message, and the request interface message is generated based on a second interface in the electronic equipment;
the processing module is used for carrying out format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; each initial message parameter in the initial message parameter set comprises an initial field name and an initial field value;
the acquisition module is used for acquiring a field mapping relation between the first interface and the second interface;
The processing module is further configured to map an initial field name and the initial field value included in each initial message parameter based on the field mapping relationship, so as to obtain a target message parameter set; the target message parameter set comprises target message parameters obtained after mapping the initial message parameters;
and the determining module is used for determining the message information indicated by the response interface message according to the target message parameter set.
In one aspect, an embodiment of the present application provides an electronic device including a processor and a memory, where the memory is configured to store a computer program including program instructions, and the processor is configured to invoke the program instructions to perform some or all of the steps in the above method.
In one aspect, embodiments of the present application provide a computer readable storage medium storing a computer program comprising program instructions for performing part or all of the steps of the above method when executed by a processor.
In the embodiment of the application, a response interface message from a first interface can be received, format analysis processing is carried out on the response interface message to obtain an initial message parameter set corresponding to the response interface message, a field mapping relation between the first interface and a second interface is obtained, mapping processing is carried out on initial field names and initial field values included in each initial message parameter based on the field mapping relation to obtain a target message parameter set, and message information indicated by the response interface message is determined according to the target message parameter set. By the method, the initial message parameters matched with the first interface can be analyzed and mapped to obtain the target message parameters matched with the second interface, the reliability of interface message analysis can be improved, the conversion of the interface message is realized, the verification of message format definition is not needed, and the analysis efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of an interface data processing method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating another method for processing interface data according to an embodiment of the present application;
FIG. 3 is a schematic structural diagram of an interface data processing device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
The interface data processing method provided by the embodiment of the application is implemented in the electronic equipment, and the electronic equipment can be terminal equipment or a server. The terminal equipment can be a smart phone, a tablet computer, a notebook computer, a desktop computer and the like. The server may be an independent server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligence platforms, but is not limited thereto. The application relates to a blockchain technology, and an electronic device can write related data such as field mapping relation and the like into a blockchain so that the electronic device can acquire required information on the blockchain, such as a target message parameter set corresponding to an initial message parameter set on the blockchain based on the field mapping relation and the like.
In some embodiments, the electronic device may execute the interface data processing method according to actual service requirements, so as to improve the parsing reliability of the interface packet. The technical scheme of the application can be applied to any interface interaction scene. For example, a communication interaction scenario between a first interface of a first system and a second interface of a second system. As another example, a communication interaction scenario between a first interface and a second interface within a system. If the first interface receives the request interface message sent by the second interface, when the second interface receives the response interface message returned by the first interface, format analysis processing can be performed on the response interface message to obtain an initial message parameter set, and a target message parameter set adapted to the second interface is obtained based on a field mapping relation between the first interface and the second interface and according to the initial message parameter set, so that message information indicated by the response interface message is further determined, and therefore analysis efficiency of the interface message and accuracy and efficiency of interface communication interaction are improved.
It can be understood that the above scenario is merely an example, and does not constitute a limitation on the application scenario of the technical solution provided by the embodiment of the present application, and the technical solution of the present application may also be applied to other scenarios. For example, as one of ordinary skill in the art can know, with the evolution of the system architecture and the appearance of new service scenarios, the technical solution provided by the embodiment of the present application is also applicable to similar technical problems.
Based on the above description, the embodiments of the present application provide an interface data processing method, which may be performed by the above-mentioned electronic device. As shown in fig. 1, the flow of the interface data processing method according to the embodiment of the present application may include the following:
s101, receiving a response interface message from the first interface.
The response interface message is obtained based on the request interface message, and the request interface message is generated based on a second interface in the electronic equipment.
In some embodiments, the first interface and the second interface may be any interface that can perform communication interactions. And the first interface and the second interface may be located in the same device (i.e. electronic device) and belong to different service systems; or the first interface and the second interface are positioned in the same equipment and belong to different service modules in the same service system; or the first interface and the second interface are located in different devices and the second interface is located in an electronic device. The second interface may generate and send a request interface message to the first interface to request for obtaining data, and the first interface may process the received request interface message to obtain the message information that needs to be returned, and encapsulate the message information into a response interface message to return to the electronic device. The first interface and the second interface can realize data interaction through interface messages (including request interface messages and response interface messages).
In some embodiments, there may be one or more first interfaces and second interfaces, where the first interface and the second interface are taken as one example, and the first interface and the second interface may each generate a request interface message and a response interface message. And the first interface is generated based on the message format definition for the first interface when generating the interface message, and the second interface is generated based on the message format definition for the second interface when generating the interface message. Wherein the message format definition for the first interface may be different from the message format definition for the second interface, and the first interface and the second interface typically parse the received interface message based on the respective message format definitions.
For example, the message format definition of the first interface includes: the character "<" is defined as a character representing field separation, if two fields exist in the generated interface message, the two fields are separated by using the character "<" separation; the message format definition of the second interface includes: the character "&" is defined as a character representing field separation, and if two fields exist in the generated interface message, the two fields are separated by using the character "&" separation.
S102, carrying out format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message.
Each initial message parameter in the initial message parameter set comprises an initial field name and an initial field value.
In some embodiments, the response interface message may include a plurality of initial fields, where the initial fields include an initial field name and an initial field value corresponding to the initial field name. Wherein the plurality of initial fields may include, but is not limited to: a field characterizing a response code (also known as a status code), a field characterizing response information, and a field characterizing response data. The response code is usually numerical, and can represent the response state of the first interface based on the request interface message, wherein the response state comprises a normal state and an abnormal state, the normal state represents that the first interface processes the request interface message without errors, and the abnormal state represents that the first interface processes the request interface message with errors; the response information represents specific meaning aiming at the response code, such as normal response or abnormal response, abnormal reason and the like; the response data represents data obtained by processing based on a request of the request interface message, for example, the request of the request interface message represents user data of the acquired user A, and the response data can be the user data.
Therefore, the response interface message may include a plurality of initial fields and a character for separating different initial fields, so that performing format parsing processing on the response interface message may be understood as transiting characters with special meanings from the response interface message, extracting all the initial fields, and determining initial field names and initial field values corresponding to all the initial fields, thereby obtaining an initial message parameter set.
In one possible implementation manner, the electronic device performs format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message, which may specifically be that a first message definition file of the first interface and a second message definition file of the second interface are obtained, a character to be converted is determined from the response interface message based on a message character defined in the first message definition file, the character to be converted is subjected to conversion processing based on the second message definition file, a target character is obtained, the character to be converted is converted into the target character in the response interface message, the target response interface message is obtained, and the initial message parameter set is obtained according to the target response interface message. The first message definition file comprises a message format definition of the first interface, and the second message definition file comprises a message format definition of the second interface. The first message definition file and the second message definition file can be set by related service personnel according to specific scenes. And the message definition file of the interface can be obtained in advance and stored in the local electronic equipment. In addition, the specific manner of obtaining the initial message parameter set according to the target response interface message can be referred to the related description of the following embodiments.
In some embodiments, the message characters defined in the first message definition file are characters having a special meaning, such as characters used as field breaks, beginning and ending of a string or tag, and the like. Different message formats are defined differently, and corresponding characteristic characters may be different, so that the electronic device can convert special characters in the response interface message into target characters adapted to the second interface to obtain a target response interface message, so that the target response interface message is analyzed in a mode of matching with the second interface to obtain a corresponding initial message parameter set, and the problem that if the message information of the response interface message contains characters to be converted, the electronic device cannot analyze the interface message correctly to obtain error message information is avoided.
Therefore, the electronic device may determine, from the response interface message, a special character that is a message character defined in the first message definition file, and use the special character of the response interface message as a character to be escaped, and perform an escape process on the character to be escaped based on the second message definition file, so as to obtain a target character. And the electronic equipment can convert the character to be escaped into the target character in the response interface message, thereby obtaining the target response interface message. In the target response interface message, the character with the special meaning belongs to the message character defined in the second message definition file. At this time, when the target response interface message is analyzed, the analysis mode matched with the second interface can be uniformly used, so that the analysis of the interface message is more convenient.
For example, when a character "<" is used to indicate field separation in a response interface message sent by the first interface, and the message information in the response interface message carries the character "<", if a message character defined by a second message definition file of the second interface includes the character "<" and the character indicates field separation, if the response interface message is directly parsed, the parsing result is wrong, so that the character "<" in the response interface message can be used as a character to be escaped, and the character to be escaped is escaped, namely, the character "<" is replaced by the character "<" (target character) in the response interface message, and the target response interface message is obtained.
S103, obtaining a field mapping relation between the first interface and the second interface.
In some embodiments, the electronic device may obtain the field mapping relationship between the first interface and the second interface based on the first message definition file of the first interface and the second message definition file of the second interface. The method specifically includes the steps of obtaining a first message field aiming at a first interface from a first message definition file, obtaining a second message field aiming at a second interface from a second message definition file, determining a corresponding relation between the first message field and the second message field, and constructing a field mapping relation between the first interface and the second interface based on the corresponding relation; the field mapping relationship includes a field information mapping relationship and a field format mapping relationship.
The first message field includes a plurality of fields included in a response interface message generated by the first interface, specifically may include a field of a required message format of the first interface when generating the response interface message, such as a response code, response information, response data, and the like, and a plurality of available data fields, where the plurality of data fields belong to response data when generating the response interface message. For example, in the case that the request interface message requests to obtain the user information (including name and address) of the user a from the first interface, the first interface processes the request interface message to obtain a response interface message, where the response interface message includes a message format field: response code, response information, response data, and the response data includes the processed data field: name, address.
In some embodiments, the second message field includes a field involved in the second interface when generating the response interface message, and the electronic device parses the response interface message based on the second message field, so that based on a correspondence between the first message field and the second message field, the field in the response interface message is converted into a field adapted to the second message field, thereby improving accuracy of the obtained parsing result.
In some embodiments, the correspondence between the first message field and the second message field includes a correspondence of field information and a correspondence of field format. The identification of the field name of the first message field and the field name of the second message field having the correspondence relationship may be different but indicate the same field meaning, and the format of the field value of the first message field and the field value of the second message field having the correspondence relationship may be different but indicate the same field content.
And therefore, a field mapping relation between the first interface and the second interface is constructed according to the corresponding relation between the first message field and the second message field, wherein the field mapping relation indicates the mapping relation (including the mapping of information and the mapping of formats) between each field in the first message field and each field in the second message field. The first message definition file defines the field identification, the field format and the represented field meaning of the first message field of the first interface, the second message definition file defines the field identification, the field format and the represented field meaning of the second message field of the second interface, and the electronic device can determine the second message field with the same field meaning as the first message field, determine the field information mapping relation according to the corresponding field identification and determine the field format mapping relation according to the corresponding field format so as to obtain the field mapping relation. Or, the related service personnel can construct the field mapping relation in advance according to the first message definition file and the second message definition file and send the field mapping relation to the electronic equipment.
S104, mapping the initial field names and the initial field values included in each initial message parameter based on the field mapping relation to obtain a target message parameter set.
The target message parameter set comprises target message parameters obtained after mapping each initial message parameter.
In some embodiments, the electronic device may perform mapping processing on the initial field name and the initial field value included in each initial message parameter based on the field information mapping relationship and the field format mapping relationship included in the field mapping relationship, so as to determine a target field name corresponding to the initial field name and a target field value corresponding to the initial field value included in each initial message parameter, and determine the target field name and the target field value obtained by the mapping of each initial message parameter as target message parameters obtained after the mapping of each initial message parameter, that is, the target message parameters corresponding to the initial message parameters include the target field name and the target field value, thereby obtaining the target message parameter set.
Wherein, based on the field information mapping relation, the meaning of the fields characterized by the initial field name and the target field name is the same, but the specific identification may be different, for example, in the field information mapping relation, the meaning of the fields characterized by the initial field name and the target field name is the name field in the user information, but the specific identification of the initial field name is the name, and the specific identification of the target field name is the name. And based on the field format mapping relationship, the field contents represented by the initial field value and the target field value are the same, but specific formats may be different, for example, in the field format mapping relationship, the field contents represented by the initial field name and the target field name are name information of the user a, but the specific format of the initial field name is format a, and the specific format of the target field name is format B.
S105, determining message information indicated by the response interface message according to the target message parameter set.
In some embodiments, the electronic device may determine the message information indicated by the response interface message according to the target field name and the target field value included in each target message parameter in the target message parameter set. The message information is a response result after the first interface processes the request interface message sent by the second interface. The specific manner of determining the message information can be referred to the following description of the embodiments. Optionally, the electronic device may generate the determined message information into an interface message log, and store the interface message log, and then may be checked by the terminal device corresponding to the user.
It can be understood that, since the interface generally parses the interface message based on its own message format definition when receiving the interface message, when the message format definitions between the first interface and the second interface are different, the result parsed by the second interface may be inconsistent with the message information that the first interface wants to transfer, thereby affecting interface interaction. However, the number of interfaces needing interaction is numerous, if the message format definitions of all interfaces are unified, the workload is large, and the efficiency is low, so that when the interface message sent by any interface is received, each initial message parameter in the received interface message can be converted into the target message parameter matched with the interface per se through the technical scheme of the application, the message format definition of each interface is not required to be checked and unified, and the interface interaction accuracy is improved. And, the technical scheme of the application can define different interface interaction scenes aiming at the message formats of a plurality of interfaces.
In the embodiment of the application, the electronic equipment can receive the response interface message from the first interface, perform format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message, acquire a field mapping relation between the first interface and the second interface, and perform mapping processing on an initial field name and an initial field value included in each initial message parameter based on the field mapping relation to obtain a target message parameter set, and determine the message information indicated by the response interface message according to the target message parameter set. By the method, the initial message parameters matched with the first interface can be analyzed and mapped to obtain the target message parameters matched with the second interface, the reliability of interface message analysis can be improved, the conversion of the interface message is realized, the verification of message format definition is not needed, and the analysis efficiency can be improved.
Referring to fig. 2, fig. 2 is a flowchart of an interface data processing method according to an embodiment of the present application, where the method may be performed by the above-mentioned electronic device. As shown in fig. 2, the flow of the interface data processing method in the embodiment of the present application may include the following steps:
S201, receiving a response interface message from the first interface.
The response interface message is obtained based on the request interface message, and the request interface message is generated based on a second interface in the electronic equipment.
The second interface may generate and send a request interface message to the first interface to request for obtaining data, and when the first interface receives the request interface message, the first interface may obtain the message information to be returned after processing based on the request interface message, and encapsulate the message information into a response interface message to return to the electronic device. The processing of the first interface based on the request interface message may be directly obtaining the target data according to the request of the request interface message, or the target data obtained after processing the specified data (such as the specified service processing). For example, the request interface message is used for requesting to acquire user data in the database, the first interface processes based on the request interface message to acquire target data (i.e., user data) from the database, and the processing process (i.e., the response process for the request interface message) obtains a corresponding response code, response information and response data (which may include the acquired target data), so as to obtain message information to be returned; or the request interface message is used for requesting the security test of the database, the first interface processes the security test of the database based on the request interface message to obtain a test result, and the processing process can obtain a corresponding response code, response information and response data (which can contain the obtained test result), thereby obtaining the message information needing to be returned. The specific type of request interface report is not limited herein.
In one possible implementation manner, after receiving a response interface message from a first interface, the electronic device may intercept the response interface message by using a tangent plane technology, and execute format parsing processing on the response interface message when a configuration file of a second interface is queried and it is determined that the configuration file is added with an annotation for indicating interface message processing, so as to obtain an initial message parameter set corresponding to the response interface message, where each interface for communication interaction in the electronic device has a corresponding configuration file configured with an execution method of the corresponding interface. The execution method is used for calling the corresponding interface to perform relevant processing, such as processing the data of the response interface message or the request interface message.
In some embodiments, the electronic device intercepting the response interface packet by using a slice technique may specifically be that the electronic device intercepts the response interface packet by using a predefined slice (including slice logic) when detecting the response interface packet. The section can be used for transversely intercepting the response interface message when detecting any response interface message; the section logic included in the section defines an interface message processing method for performing format analysis processing on the response interface message. It will be appreciated that the slice plane (including slice plane logic) represents a method performed by the electronic device on the response interface message before the electronic device performs corresponding processing according to the message information fed back by the response interface message. And in the tangent plane, after the method for defining the response interface message is executed, the response interface message is not changed at will, namely the message information related to the response interface message is not changed. The response interface message is intercepted by the section technology and format analysis processing is uniformly carried out in the section, so that the response interface message is not changed, and low coupling of a system is facilitated. And the electronic device can generate interface message logs from the data (such as original response interface message, target response interface message, initial message parameter set, target message parameter set and the like) involved in the process, and can be checked by the terminal device corresponding to the user later.
In some embodiments, the electronic device may create an annotation indicating processing of the interface message prior to receiving the response interface message from the first interface, add the annotation to a configuration file of each interface performing the data interaction operation for the interface to perform the communication interaction operation, that is, including generating and receiving the request interface message, and including generating and receiving the response interface message, to implement the tangent plane technique. The electronic equipment stores a plurality of interfaces, and the annotation can be added in the configuration file of the second interface which needs to execute the technical scheme of the application in the interfaces, so that the operation flexibility is improved.
It can be appreciated that the electronic device may intercept the response interface packet when receiving the response interface packet, and execute corresponding slice logic on the response interface packet using a slice technique. Or when receiving any interface message, intercepting the any interface message by using a tangent plane technology, determining the type of the any interface message, and if the type of the any interface message is a request interface message, releasing the request interface message according to a set link of the request interface message; and if the interface message is a response interface message, executing corresponding section logic on the response interface message. Intercepting the response interface message, inquiring a configuration file of a second interface indicated by the response interface message, and executing corresponding section logic on the response interface message if the annotation exists in the configuration file; and if not, releasing the response interface message according to the set link of the response interface message.
Optionally, in some embodiments, the electronic device may include a control layer and a service layer, and when the control layer detects a response interface packet (or an interface packet), the electronic device may intercept the response interface packet by using a tangent plane technology, so as to implement unified interception at the control layer and perform format parsing processing on the response interface packet. When the first interface returns a response interface message to the second interface, the setting link of the response interface message reaches the control layer at first, the electronic device can uniformly receive the response interface message through the control layer and then forward the response interface message to the service layer, the service layer is configured with the second interface and an execution method corresponding to the second interface, and the electronic device can call the second interface through the service layer to receive the response interface message (and generate a request interface message and the like).
S202, carrying out format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message.
In some embodiments, the electronic device performs format parsing processing on the response interface packet to obtain an initial packet parameter set corresponding to the response interface packet, which may specifically be that, according to a first packet definition file of the first interface and a second packet definition file of the second interface, a character to be escape is determined from the response interface packet, and the character to be escape is subjected to escape processing to obtain a target character, and in the response interface packet, a target response interface packet is obtained according to the target character, and an initial packet parameter set is obtained according to the target response interface packet. The specific ways of determining the target character and determining the target response interface message can be referred to the related description of the above embodiments.
In some embodiments, the target character may be a character having a special meaning, and the target character may include a field start character and a field end character that indicate a field separation, and the electronic device may obtain the initial set of message parameters according to the target response interface message, specifically, may extract, in the target response interface message, a plurality of field data based on the field start character and the field end character, where the field data includes an initial field name and an initial field value, and determine the plurality of field data as the initial set of message parameters. Wherein the field start character and the field end character representing the field separation may be the same or different, and one or more of the field start character and the field end character may be used.
In some embodiments, the electronic device traverses the target response interface message, extracts a string between the field start character and the field end character according to the traversed field start character and field end character, and obtains a plurality of field data according to the extracted string. The field start character and the field end character are used to separate field names and field values in sequence. The character strings sequentially extracted by the electronic equipment comprise character strings corresponding to field names and character strings corresponding to field values; the character strings corresponding to the field names and the character strings corresponding to the field values alternately appear in the target response interface message, so that the corresponding relation between the field names and the field values can be determined based on the alternately appearing sequence, and the field data can be obtained according to the corresponding relation.
For example, let the field start character be "<", the field end character be ">", let the contents of the target response interface message be: and < x1> < x2>, < x3> < x4>, so that the character strings extracted based on the field start character and the field end character are sequentially x1, x2, x3 and x4, and the field names and the field values in the target response interface message are sequentially alternated, the electronic device determines that x1 and x3 are field names, x2 and x4 are field values, the field name x1 has a corresponding relationship with the field value x2, the field name x3 has a corresponding relationship with the field value x4, namely, the field name x1 and the field value x2 are used as one field data, and the field name x3 and the field value x4 are used as one field data.
S203, acquiring a field mapping relation between the first interface and the second interface. The specific implementation of step S203 may be referred to the description of the above embodiment.
S204, mapping the initial field names and the initial field values included in the initial message parameters based on the field mapping relation to obtain a target message parameter set.
The target message parameter set comprises target message parameters obtained after mapping each initial message parameter.
In some embodiments, the field mappings may include field information mappings and field format mappings; the electronic device performs mapping processing on the initial field names and the initial field values included in each initial message parameter based on the field mapping relationship, so as to obtain a target message parameter set, which may specifically be to determine, based on the field information mapping relationship, intermediate field names corresponding to the initial field names and intermediate field values corresponding to the initial field values included in each initial message parameter, and perform format conversion processing on the intermediate field names and the intermediate field values obtained correspondingly based on the field format mapping relationship, so as to obtain target field names corresponding to the initial field names included in each initial message parameter and target field values corresponding to the initial field values, and determine the target field names and the target field values obtained correspondingly as target message parameters obtained after mapping of each initial message parameter, thereby obtaining the target message parameter set. The method comprises the steps that after an initial field name and an initial field value included in one initial message parameter are mapped through field information, an intermediate field name corresponding to the initial field name and an intermediate field value corresponding to the initial field value are obtained, after field format mapping (format conversion processing) is conducted on the intermediate field name and the intermediate field value, a target field name corresponding to the initial field name and a target field value corresponding to the initial field value are obtained, and the target field name and the target field value corresponding to the initial field value are used as target message parameters corresponding to the initial message parameter.
In some embodiments, the mapping process and the principle of the initial field name and the initial field value included in each initial message parameter are the same, and herein, the mapping process of one initial message parameter (set as a reference initial message parameter, including a reference initial field name and a reference initial field value) is taken as an example. The electronic equipment performs mapping processing on the reference initial field name based on the field information mapping relation to obtain a reference intermediate field name with the same meaning as the field represented by the reference initial field name, if the reference initial field name is a name and the reference intermediate field name is a name, the field where the reference initial field name is located and the field where the reference intermediate field name is located store data with the same meaning; and mapping the reference initial field value based on the field information mapping relation to obtain a reference intermediate field value with the same meaning as the data represented by the reference initial field value, wherein if the reference initial field value is 0, the represented data meaning is that the response state is an abnormal state, and the response state is that the response state is the abnormal state when the response code is 1 on the second interface, so that the reference intermediate field value obtained after the mapping is 1, and the reference initial field value and the reference intermediate field value have the same meaning. The field information mapping relation is determined according to the message definition file of the corresponding interface, and the field information mapping relation indicates the information mapping of the field name and the information mapping of the field value between the first interface and the second interface.
In some embodiments, the electronic device performs mapping processing on the reference intermediate field name based on the field format mapping relationship to obtain a reference target field name, where, for example, the format of the reference intermediate field name (i.e., the reference initial field name, the format corresponding to the reference intermediate field name is not changed based on the field information mapping relationship) is a first format, the format of the reference target field name is a second format, and the second format is a format adapted to the interface message parsing manner of the second interface. And mapping the reference intermediate field value based on the field format mapping relation to obtain a reference target field value, wherein if the format of the reference intermediate field value is a third format, the format of the reference target field value is a fourth format (such as generic type). The field format mapping relationship is determined according to the message definition file of the corresponding interface, and indicates the format mapping of the field name and the format mapping of the field value between the first interface and the second interface.
In some embodiments, the mapping process may be understood as a process that the electronic device maps the initial field (initial field name and initial field value) represented by the initial message parameter based on the field mapping relationship to obtain the target field (target field name and target field value) represented by the target message parameter. Optionally, when the electronic device maps the initial field, the obtained target message parameter may include one or more target fields, that is, one initial message parameter corresponds to one target message parameter, one initial message parameter includes one field data (initial field name and initial field value), and the corresponding one target message parameter may include one or more mapped field data (target field name and target field value). For example, the initial field is a field a, and based on the field information mapping relationship, there may be mapping with a field B and a field C in the second packet field of the second interface, that is, the mapped target field includes a field B and a field C, so the field information mapping relationship includes a mapping relationship between a field value corresponding to the field a and a field value corresponding to the target field (field B and field C) (field value corresponding to the field B and field value corresponding to the field C). The mapping relationship may be a processing manner for the field value corresponding to the field a to obtain the field value corresponding to the field B and the field value corresponding to the field C.
For example, the field information mapping relationship includes a mapping relationship of a field a to a field B and a field C, which indicates that the field name (initial field name) of the field a is mapped to obtain the field name (intermediate field name) of the field B and the field name (intermediate field name) of the field C, and the field value (intermediate field value) of the field B and the field value (intermediate field value) of the field C are obtained in the processing manner indicated by the mapping process of the field value (initial field value) of the field a. The processing method may be, for example, taking the field value of the field a as the field value of the field B, and performing calculation (such as summation) on the field value of the field a to obtain the field value of the field C; or may be that a first part of the field values of the field a is used as the field values of the field B, and a second part of the field values of the field a is used as the field values of the field C, etc., where the processing manner is not limited. And, the field format mapping relationship at this time indicates the format of the field name and the field value corresponding to the field B, and indicates the format of the field name and the field value corresponding to the field C.
S205, determining a plurality of field names and a plurality of field values which meet preset response conditions from all target message parameters of the target message parameter set.
In some embodiments, each target message parameter may include a field representing a response code, a field representing response information, and a field representing response data. Therefore, the electronic device determines, from each target message parameter in the target message parameter set, a plurality of field names and a plurality of field values that satisfy the preset response condition, and may specifically determine, from each target message parameter, a first field name that characterizes a response code of the response interface message and a first field value corresponding to the first field name, determine a second field name that characterizes response data of the response interface message and a second field value corresponding to the second field name, determine a third field name that characterizes response information of the response interface message and a third field value corresponding to the third field name, determine the first field name, the second field name, and the third field name as a plurality of field names that satisfy the preset response condition, and determine the first field value, the second field value, and the third field value as a plurality of field values that satisfy the preset response condition.
S206, determining the message information indicated by the response interface message according to the field names and the field values.
In some embodiments, the electronic device may determine the message information indicated by the response interface message according to the plurality of field names and the field value corresponding to each of the plurality of field names. For example, if a field value corresponding to a field name of the characterization response code is a first value set, one or more first values included in the first value set are set as abnormal response codes, which indicates that the response of the first interface to the request interface message is in an abnormal state based on the determination of the message information of the field value; if the field value corresponding to the field name of the characterization response code is the second value set, one or more second values included in the second value set are set as normal response codes, which means that the message information is determined to characterize that the response of the first interface to the request interface message is in a normal state based on the field value. As well as for example. If the field value corresponding to the field name of the characterization response information is a first information set, one or more pieces of first information included in the first information set are set as abnormal response information, and the method indicates that the message information is characterized as an abnormal reason of abnormal response based on the field value; if the field value corresponding to the field name of the characterization response code is the second information set, one or more pieces of second information included in the second information set are set as normal response information, and the fact that the message information is characterized as normal response based on the field value is indicated.
It can be understood that, there is an association relationship between the field value corresponding to each field name and the specific result represented by the message information (if the field value corresponding to the field name representing the response code is the first numerical value set, the specific result represented by the message information is the response in an abnormal state), and the association relationship can be determined by the message definition file of the corresponding interface, or can be set by the relevant service personnel according to the specific service scenario.
Thus, in some embodiments, the electronic device may determine the message information indicated by the response interface message based on the first field name, the second field name, and the third field name, and the first field value, the second field value, and the third field value. The first field name, the second field name and the third field name, and the first field value, the second field value and the third field value can be directly used as message information, and after the second interface in the electronic equipment obtains the message information, the response interface message can be processed. For example, the message information indicates that when the first interface processes the request interface message and the abnormality occurs to the response data (such as that the response data is not obtained or the obtained response data is incomplete, etc.), that is, the response state is an abnormal state, a third field value in the message information is obtained, and a cause of the abnormality is determined according to the response information indicated by the third field value (such as that the sent request response message is incorrect, etc.), and the electronic device or the related service personnel can perform abnormality processing according to the cause of the abnormality (such as resending the request response message, etc.). For another example, the message information indicates that the first interface is not abnormal when processing the message of the request interface, that is, the response state is in a normal state, and the obtained response data is normal, and the electronic device may acquire the second field value in the message information and process the response data according to the response data indicated by the second field value (for example, store the response data, or send the response data to the terminal device corresponding to the user, etc.).
In one possible implementation manner, the determining, by the electronic device, the message information may also be that, in each target message parameter of the target message parameter set, a first field name representing a response code of the response interface message is determined, and a first field value corresponding to the first field name is determined, if the response interface message is determined to be obtained under the first processing condition by the first interface based on the request message according to the first field value, a second field name representing response data of the response interface message is determined from each target message parameter of the target message parameter set, and a second field value corresponding to the second field name is used as the message information, and if the response interface message is determined to be obtained under the second processing condition by the first interface based on the request interface message according to the first field value, a third field name representing response information of the response interface message is determined from each target message parameter of the target message parameter set, and a third field value corresponding to the third field name is used as the message information.
The first processing condition indicates that the first interface is not abnormal when processing the request interface message, and the response state is a normal state; and the second processing condition indicates that the first interface is abnormal when processing the request interface message, and the response state is an abnormal state. Namely, when the electronic equipment determines that the received response interface message is in a normal state based on the first field value, acquiring a second field name representing response data, and taking a second field value (namely specific content of the response data) corresponding to the second field name as indicated message information to process based on the message information; and when the response interface message is in an abnormal state, acquiring a third field name representing the response information, and taking a third field value corresponding to the third field name (namely, specific content of the response information, which indicates an abnormal reason) as indicated message information to perform abnormal processing based on the message information. Alternatively, when the message is in an abnormal state, the second field value corresponding to the second field name and the third field value corresponding to the third field name may be used as the indicated message information.
In the embodiment of the application, the electronic equipment can receive the response interface message from the first interface, perform format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message, acquire a field mapping relation between the first interface and the second interface, perform mapping processing on an initial field name and an initial field value included in each initial message parameter based on the field mapping relation to obtain a target message parameter set, and perform mapping processing on the initial field name and the initial field value included in each initial message parameter based on the field mapping relation to obtain the target message parameter set, and determine message information indicated by the response interface message according to a plurality of field names and a plurality of field values. By the method, the initial message parameters matched with the first interface can be analyzed and mapped to obtain the target message parameters matched with the second interface, the reliability of interface message analysis can be improved, the conversion of the interface message is realized, the verification of message format definition is not needed, and the analysis efficiency can be improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an interface data processing device according to the present application. It should be noted that, the interface data processing apparatus shown in fig. 3 is used to execute the method of the embodiment shown in fig. 1 and 2, and for convenience of explanation, only the relevant parts of the embodiment of the present application are shown, and specific technical details are not disclosed, please refer to the embodiment shown in fig. 1 and 2 of the present application. The interface data processing apparatus 300 may include: a receiving module 301, a processing module 302, an obtaining module 303, and a determining module 304. Wherein:
A receiving module 301, configured to receive a response interface packet from the first interface; the response interface message is obtained based on a request interface message, and the request interface message is generated based on a second interface in the electronic equipment;
the processing module 302 is configured to perform format parsing processing on the response interface packet to obtain an initial packet parameter set corresponding to the response interface packet; each initial message parameter in the initial message parameter set comprises an initial field name and an initial field value;
an obtaining module 303, configured to obtain a field mapping relationship between the first interface and the second interface;
the processing module 302 is further configured to map an initial field name and the initial field value included in each initial message parameter based on the field mapping relationship, so as to obtain a target message parameter set; the target message parameter set comprises target message parameters obtained after mapping the initial message parameters;
a determining module 304, configured to determine, according to the target packet parameter set, packet information indicated by the response interface packet.
In one possible implementation manner, the processing module 302 is configured to, when configured to perform format parsing processing on the response interface packet, obtain an initial packet parameter set corresponding to the response interface packet, specifically:
Acquiring a first message definition file of the first interface and a second message definition file of the second interface;
determining a character to be escape from the response interface message based on the message character defined in the first message definition file;
performing escape processing on the character to be escape based on the second message definition file to obtain a target character;
converting the character to be converted into a target character in the response interface message to obtain a target response interface message;
and obtaining the initial message parameter set according to the target response interface message.
In one possible embodiment, the target character includes a field start character and a field end character representing a field separation;
the processing module 302 is configured to, when obtaining the initial packet parameter set according to the target response interface packet, specifically:
extracting a plurality of field data from the target response interface message based on the field start character and the field end character; the field data comprises an initial field name and an initial field value;
and determining the plurality of field data as the initial message parameter set.
In one possible implementation manner, the obtaining module 303 is specifically configured to, when configured to obtain a field mapping relationship between the first interface and the second interface:
acquiring a first message field aiming at the first interface from the first message definition file, and acquiring a second message field aiming at the second interface from the second message definition file;
determining a corresponding relation between the first message field and the second message field, and constructing a field mapping relation between the first interface and the second interface based on the corresponding relation; the field mapping relation comprises a field information mapping relation and a field format mapping relation;
the processing module 302 is configured to, when performing mapping processing on the initial field names and the initial field values included in the initial message parameters based on the field mapping relationship to obtain a target message parameter set, specifically:
based on the field information mapping relation, respectively determining an intermediate field name corresponding to the initial field name and an intermediate field value corresponding to the initial field value included in each initial message parameter;
based on the field format mapping relation, performing format conversion processing on the intermediate field names and the intermediate field values which are correspondingly obtained to obtain target field names corresponding to the initial field names and target field values corresponding to the initial field values which are included in the initial message parameters;
And determining the corresponding target field name and the target field value as target message parameters obtained after the mapping of the initial message parameters.
In one possible implementation manner, the determining module 304 is specifically configured to, when configured to determine, according to the target packet parameter set, the packet information indicated by the response interface packet:
determining a first field name of a response code representing the response interface message from each target message parameter of the target message parameter set, and determining a first field value corresponding to the first field name;
if the response interface message is determined to be the first interface message obtained based on the request interface message under the first processing condition according to the first field value, determining a second field name representing response data of the response interface message from each target message parameter of the target message parameter set, and taking a second field value corresponding to the second field name as the message information;
if the response interface message is determined to be the first interface message obtained under the second processing condition based on the request interface message according to the first field value, determining a third field name representing response information of the response interface message from all target message parameters of the target message parameter set, and taking a third field value corresponding to the third field name as the message information.
In one possible implementation manner, the receiving module 301 is further configured to, after receiving a response interface packet from the first interface:
intercepting the response interface message by using a tangent plane technology;
when the configuration file of the second interface is queried and the annotation for indicating the interface message processing is determined to be added in the configuration file, executing the format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; the configuration file is configured with an execution method of the corresponding interface.
In one possible implementation manner, the receiving module 301, before being configured to receive the response interface packet from the first interface, is further configured to:
creating an annotation for indicating interface message processing;
adding the notes in configuration files of the interfaces performing data interaction operation; the data interaction includes generating and receiving a request interface message, and includes generating and receiving a response interface message.
In the embodiment of the application, a receiving module receives a response interface message from a first interface; the processing module performs format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; the acquisition module acquires a field mapping relation between the first interface and the second interface; the processing module performs mapping processing on the initial field names and the initial field values included in each initial message parameter based on the field mapping relation to obtain a target message parameter set; the determining module determines message information indicated by the response interface message according to the target message parameter set. Through the scheme, the initial message parameters matched with the first interface can be analyzed and mapped to obtain the target message parameters matched with the second interface, the reliability of interface message analysis can be improved, the conversion of the interface message is realized, the verification of message format definition is not needed, and the analysis efficiency can be improved.
The functional modules in the embodiments of the present application may be integrated into one module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules, which is not limited by the present application.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 4, the electronic device 400 includes: at least one processor 401, a memory 402. Optionally, the electronic device may further comprise a network interface. The processor 401, the memory 402, and the network interface may exchange data, the network interface is controlled by the processor 401 to send and receive messages, the memory 402 is used for storing a computer program, the computer program includes program instructions, and the processor 401 is used for executing the program instructions stored in the memory 402. Wherein the processor 401 is configured to invoke said program instructions to perform the above method.
The memory 402 may include volatile memory (RAM), such as random-access memory (RAM); the memory 402 may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a Solid State Drive (SSD), etc.; the memory 402 may also include a combination of the above types of memory.
The processor 401 may be a central processing unit (central processing unit, CPU). In one embodiment, the processor 401 may also be a graphics processor (Graphics Processing Unit, GPU). The processor 401 may also be a combination of a CPU and a GPU.
In one possible implementation, the memory 402 is configured to store program instructions, and the processor 401 may call the program instructions to perform the following steps:
receiving a response interface message from a first interface; the response interface message is obtained based on a request interface message, and the request interface message is generated based on a second interface in the electronic equipment;
performing format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; each initial message parameter in the initial message parameter set comprises an initial field name and an initial field value;
acquiring a field mapping relation between the first interface and the second interface;
mapping the initial field names and the initial field values included in the initial message parameters based on the field mapping relation to obtain a target message parameter set; the target message parameter set comprises target message parameters obtained after mapping the initial message parameters;
And determining the message information indicated by the response interface message according to the target message parameter set.
In one possible implementation manner, when the processor 401 is configured to perform format parsing processing on the response interface packet to obtain an initial packet parameter set corresponding to the response interface packet, the processor is specifically configured to:
acquiring a first message definition file of the first interface and a second message definition file of the second interface;
determining a character to be escape from the response interface message based on the message character defined in the first message definition file;
performing escape processing on the character to be escape based on the second message definition file to obtain a target character;
converting the character to be converted into a target character in the response interface message to obtain a target response interface message;
and obtaining the initial message parameter set according to the target response interface message.
In one possible embodiment, the target character includes a field start character and a field end character representing a field separation;
the processor 401, when configured to obtain the initial packet parameter set according to the target response interface packet, is specifically configured to:
Extracting a plurality of field data from the target response interface message based on the field start character and the field end character; the field data comprises an initial field name and an initial field value;
and determining the plurality of field data as the initial message parameter set.
In a possible implementation manner, the processor 401 is specifically configured to, when configured to obtain a field mapping relationship between the first interface and the second interface:
acquiring a first message field aiming at the first interface from the first message definition file, and acquiring a second message field aiming at the second interface from the second message definition file;
determining a corresponding relation between the first message field and the second message field, and constructing a field mapping relation between the first interface and the second interface based on the corresponding relation; the field mapping relation comprises a field information mapping relation and a field format mapping relation;
the processor 401 is configured to, when performing mapping processing on the initial field names and the initial field values included in the initial message parameters based on the field mapping relationship to obtain a target message parameter set, specifically:
Based on the field information mapping relation, respectively determining an intermediate field name corresponding to the initial field name and an intermediate field value corresponding to the initial field value included in each initial message parameter;
based on the field format mapping relation, performing format conversion processing on the intermediate field names and the intermediate field values which are correspondingly obtained to obtain target field names corresponding to the initial field names and target field values corresponding to the initial field values which are included in the initial message parameters;
and determining the corresponding target field name and the target field value as target message parameters obtained after the mapping of the initial message parameters.
In one possible implementation manner, the processor 401 is specifically configured to, when configured to determine, according to the target packet parameter set, packet information indicated by the response interface packet:
determining a first field name of a response code representing the response interface message from each target message parameter of the target message parameter set, and determining a first field value corresponding to the first field name;
if the response interface message is determined to be the first interface message obtained based on the request interface message under the first processing condition according to the first field value, determining a second field name representing response data of the response interface message from each target message parameter of the target message parameter set, and taking a second field value corresponding to the second field name as the message information;
If the response interface message is determined to be the first interface message obtained under the second processing condition based on the request interface message according to the first field value, determining a third field name representing response information of the response interface message from all target message parameters of the target message parameter set, and taking a third field value corresponding to the third field name as the message information.
In one possible implementation, the processor 401, after being configured to receive a response interface packet from the first interface, is further configured to:
intercepting the response interface message by using a tangent plane technology;
when the configuration file of the second interface is queried and the annotation for indicating the interface message processing is determined to be added in the configuration file, executing the format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; the configuration file is configured with an execution method of the corresponding interface.
In one possible implementation, the processor 401, before being configured to receive a response interface packet from the first interface, is further configured to:
creating an annotation for indicating interface message processing;
Adding the notes in configuration files of the interfaces performing data interaction operation; the data interaction includes generating and receiving a request interface message, and includes generating and receiving a response interface message.
In a specific implementation, the apparatus, the processor 401, the memory 402, etc. described in the embodiments of the present application may perform the implementation described in the foregoing method embodiments, and may also perform the implementation described in the embodiments of the present application, which is not described herein again.
In an embodiment of the present application, there is also provided a computer (readable) storage medium storing a computer program, where the computer program includes program instructions, where the program instructions when executed by a processor cause the processor to perform some or all of the steps performed in the foregoing method embodiments. The computer storage medium may be volatile or nonvolatile. The computer readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created from the use of blockchain nodes, and the like.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Embodiments of the present application provide a computer program product, which may include a computer program, where the computer program when executed by a processor may implement some or all of the steps of the above method, and are not described herein.
References herein to "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
Those skilled in the art will appreciate that implementing all or part of the above-described embodiment methods may be accomplished by way of a computer program stored in a computer storage medium, which may be a computer-readable storage medium, which when executed, may comprise the steps of the above-described embodiment methods. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The above disclosure is only a few examples of the present application, and it is not intended to limit the scope of the present application, but it is understood by those skilled in the art that all or a part of the above embodiments may be implemented and equivalent changes may be made in the claims of the present application.

Claims (9)

1. A method of interface data processing, the method comprising:
receiving a response interface message from a first interface; the response interface message is obtained based on a request interface message, and the request interface message is generated based on a second interface in the electronic equipment;
Performing format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; each initial message parameter in the initial message parameter set comprises an initial field name and an initial field value;
acquiring a field mapping relation between the first interface and the second interface;
mapping the initial field names and the initial field values included in the initial message parameters based on the field mapping relation to obtain a target message parameter set; the target message parameter set comprises target message parameters obtained after mapping the initial message parameters;
determining a first field name of a response code representing the response interface message from each target message parameter of the target message parameter set, and determining a first field value corresponding to the first field name;
if the response interface message is determined to be the first interface message obtained under the first processing condition based on the request interface message according to the first field value, determining a second field name representing response data of the response interface message from all target message parameters of the target message parameter set, and taking a second field value corresponding to the second field name as message information; the first processing condition is used for indicating that the first interface is not abnormal when processing the request interface message;
If the response interface message is determined to be the first interface message obtained under the second processing condition based on the request interface message according to the first field value, determining a third field name representing response information of the response interface message from all target message parameters of the target message parameter set, and taking a third field value corresponding to the third field name as the message information; the second processing condition is used for indicating that the first interface is abnormal when the request interface message is processed.
2. The method of claim 1, wherein the performing format parsing on the response interface message to obtain an initial message parameter set corresponding to the response interface message includes:
acquiring a first message definition file of the first interface and a second message definition file of the second interface;
determining a character to be escape from the response interface message based on the message character defined in the first message definition file;
performing escape processing on the character to be escape based on the second message definition file to obtain a target character;
converting the character to be converted into the target character in the response interface message to obtain a target response interface message;
And obtaining the initial message parameter set according to the target response interface message.
3. The method of claim 2, wherein the target character comprises a field start character and a field end character representing a field separation;
the obtaining the initial message parameter set according to the target response interface message includes:
extracting a plurality of field data from the target response interface message based on the field start character and the field end character; the field data comprises an initial field name and an initial field value;
and determining the plurality of field data as the initial message parameter set.
4. The method of claim 2, wherein the obtaining a field mapping relationship between the first interface and the second interface comprises:
acquiring a first message field aiming at the first interface from the first message definition file, and acquiring a second message field aiming at the second interface from the second message definition file;
determining a corresponding relation between the first message field and the second message field, and constructing a field mapping relation between the first interface and the second interface based on the corresponding relation; the field mapping relation comprises a field information mapping relation and a field format mapping relation;
The mapping processing is performed on the initial field names and the initial field values included in the initial message parameters based on the field mapping relation to obtain a target message parameter set, including:
based on the field information mapping relation, respectively determining an intermediate field name corresponding to the initial field name and an intermediate field value corresponding to the initial field value included in each initial message parameter;
based on the field format mapping relation, performing format conversion processing on the intermediate field names and the intermediate field values which are correspondingly obtained to obtain target field names corresponding to the initial field names and target field values corresponding to the initial field values which are included in the initial message parameters;
and determining the corresponding target field name and the target field value as target message parameters obtained after the mapping of the initial message parameters.
5. The method of claim 1, wherein after receiving the response interface message from the first interface, the method further comprises:
intercepting the response interface message by using a tangent plane technology;
when the configuration file of the second interface is queried and the configuration file is determined to be added with comments for indicating interface message processing, executing format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; the configuration file is configured with an execution method of the corresponding interface.
6. The method of claim 5, wherein prior to receiving a response interface message from the first interface, the method further comprises:
creating the annotation for indicating interface message processing;
adding the notes in configuration files of the interfaces performing data interaction operation; the data interaction includes generating and receiving a request interface message, and includes generating and receiving a response interface message.
7. An interface data processing apparatus, the apparatus comprising:
the receiving module is used for receiving a response interface message from the first interface; the response interface message is obtained based on a request interface message, and the request interface message is generated based on a second interface in the electronic equipment;
the processing module is used for carrying out format analysis processing on the response interface message to obtain an initial message parameter set corresponding to the response interface message; each initial message parameter in the initial message parameter set comprises an initial field name and an initial field value;
the acquisition module is used for acquiring a field mapping relation between the first interface and the second interface;
The processing module is further configured to map an initial field name and the initial field value included in each initial message parameter based on the field mapping relationship, so as to obtain a target message parameter set; the target message parameter set comprises target message parameters obtained after mapping the initial message parameters;
the determining module is used for determining a first field name of a response code representing the response interface message from each target message parameter of the target message parameter set, and determining a first field value corresponding to the first field name;
the determining module is further configured to determine, if the response interface packet is determined, according to the first field value, that the first interface is obtained by the first interface based on the request interface packet under a first processing condition, a second field name of response data representing the response interface packet from each target packet parameter in the target packet parameter set, and use a second field value corresponding to the second field name as packet information; the first processing condition is used for indicating that the first interface is not abnormal when processing the request interface message;
The determining module is further configured to determine, if the response interface packet is determined according to the first field value to be the response information of the response interface packet, which is obtained by the first interface based on the request interface packet under a second processing condition, a third field name of response information representing the response interface packet from each target packet parameter in the target packet parameter set, and take a third field value corresponding to the third field name as the packet information; the second processing condition is used for indicating that the first interface is abnormal when the request interface message is processed.
8. An electronic device comprising a processor and a memory, wherein the memory is configured to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1-6.
9. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1-6.
CN202210139655.1A 2022-02-15 2022-02-15 Interface data processing method and device, electronic equipment and storage medium Active CN114500690B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210139655.1A CN114500690B (en) 2022-02-15 2022-02-15 Interface data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210139655.1A CN114500690B (en) 2022-02-15 2022-02-15 Interface data processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114500690A CN114500690A (en) 2022-05-13
CN114500690B true CN114500690B (en) 2023-08-18

Family

ID=81480676

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210139655.1A Active CN114500690B (en) 2022-02-15 2022-02-15 Interface data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114500690B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277882B (en) * 2022-06-22 2023-08-29 东风汽车集团股份有限公司 CAN message database establishment method and device, vehicle-mounted electronic equipment and storage medium
CN115103034A (en) * 2022-06-27 2022-09-23 京东科技信息技术有限公司 Message protocol conversion method and device
CN115314573B (en) * 2022-08-05 2024-02-23 中国银行股份有限公司 Dynamic loading method and device for message body, electronic equipment and storage medium
CN115291850B (en) * 2022-08-11 2023-03-07 广州芯德通信科技股份有限公司 Method, system and storage medium for managing custom interactive data based on java language
CN115866087B (en) * 2022-11-29 2023-11-17 广发银行股份有限公司 Message mapping and message conversion method, device and transmission system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2765756A1 (en) * 2011-11-04 2014-08-13 Huawei Technologies Co., Ltd. Service configuration method and device
CN109617646A (en) * 2018-10-22 2019-04-12 中国平安财产保险股份有限公司 Message forwarding method, device, computer equipment and computer readable storage medium
CN109802957A (en) * 2019-01-03 2019-05-24 深圳壹账通智能科技有限公司 Interface butt joint method, device, computer equipment and storage medium
CN109947994A (en) * 2018-08-10 2019-06-28 北京京东金融科技控股有限公司 Processing method, device, medium and the electronic equipment of payment process
CN112115190A (en) * 2020-08-20 2020-12-22 苏宁云计算有限公司 Method, device and system for converting interface message
CN112152924A (en) * 2019-06-29 2020-12-29 华为技术有限公司 Method and related device for forwarding message in data center network
CN113572858A (en) * 2021-09-24 2021-10-29 盛威时代科技集团有限公司 Data transmission method, device, equipment, medium and product
CN113918635A (en) * 2021-10-21 2022-01-11 城云科技(中国)有限公司 Interface data format conversion method and device
WO2022007861A1 (en) * 2020-07-09 2022-01-13 华为技术有限公司 Failure notification method and electronic device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2765756A1 (en) * 2011-11-04 2014-08-13 Huawei Technologies Co., Ltd. Service configuration method and device
CN109947994A (en) * 2018-08-10 2019-06-28 北京京东金融科技控股有限公司 Processing method, device, medium and the electronic equipment of payment process
CN109617646A (en) * 2018-10-22 2019-04-12 中国平安财产保险股份有限公司 Message forwarding method, device, computer equipment and computer readable storage medium
CN109802957A (en) * 2019-01-03 2019-05-24 深圳壹账通智能科技有限公司 Interface butt joint method, device, computer equipment and storage medium
CN112152924A (en) * 2019-06-29 2020-12-29 华为技术有限公司 Method and related device for forwarding message in data center network
WO2022007861A1 (en) * 2020-07-09 2022-01-13 华为技术有限公司 Failure notification method and electronic device
CN112115190A (en) * 2020-08-20 2020-12-22 苏宁云计算有限公司 Method, device and system for converting interface message
CN113572858A (en) * 2021-09-24 2021-10-29 盛威时代科技集团有限公司 Data transmission method, device, equipment, medium and product
CN113918635A (en) * 2021-10-21 2022-01-11 城云科技(中国)有限公司 Interface data format conversion method and device

Also Published As

Publication number Publication date
CN114500690A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
CN114500690B (en) Interface data processing method and device, electronic equipment and storage medium
CN111274157B (en) Test data simulation method and device, computer equipment and storage medium
CN109670081B (en) Method and device for processing service request
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
US10938565B2 (en) Method and apparatus for inter-blockchain transmission of authenticable message
CN110880146A (en) Block chain chaining method, device, electronic equipment and storage medium
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN109614327B (en) Method and apparatus for outputting information
CN116346961B (en) Financial message processing method and device, electronic equipment and storage medium
CN111327680B (en) Authentication data synchronization method, device, system, computer equipment and storage medium
CN113220481A (en) Request processing and feedback method and device, computer equipment and readable storage medium
CN111767161A (en) Remote calling depth recognition method and device, computer equipment and readable storage medium
CN113836145B (en) Method, device, electronic equipment and computer readable storage medium for requesting data
CN116360769A (en) Code generation method, device, equipment and storage medium
CN111324645A (en) Data processing method and device for block chain
CN114531289A (en) System interaction method based on artificial intelligence and related equipment
CN112804066A (en) Method and device for transferring message in cross-link mode based on relay equipment
CN113141366B (en) Message submitting method and device, storage medium and electronic equipment
CN117171800B (en) Sensitive data identification method and device based on zero trust protection system
CN114205276B (en) Performance test method and device for product management system and electronic equipment
CN114679466B (en) Consensus processing method, device, computer equipment and medium for block chain network
CN111459819B (en) Software testing method and device, electronic equipment and computer readable medium
CN115086191B (en) Automatic test method, device and equipment for bank card
CN115495341A (en) Test method of picture recognition interface, storage medium and electronic device
CN117763196A (en) XML business dynamic rule comparison method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant