CN114500690A - 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
CN114500690A
CN114500690A CN202210139655.1A CN202210139655A CN114500690A CN 114500690 A CN114500690 A CN 114500690A CN 202210139655 A CN202210139655 A CN 202210139655A CN 114500690 A CN114500690 A CN 114500690A
Authority
CN
China
Prior art keywords
message
field
interface
initial
response
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.)
Granted
Application number
CN202210139655.1A
Other languages
Chinese (zh)
Other versions
CN114500690B (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

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • User Interface Of Digital Computer (AREA)
  • Communication Control (AREA)

Abstract

The embodiment of the application discloses an interface data processing method and device, electronic equipment and a storage medium, and is applied to the technical field of data processing. The method comprises the following steps: receiving a response interface message from the 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 the 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 the method and the device, the analysis reliability of the interface message can be improved. The application relates to blockchain techniques, such as field mapping relationships may be obtained 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 and apparatus, an electronic device, and a storage medium.
Background
Currently, communication between two interfaces is achieved 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 may be analyzed to obtain important message information transmitted by the second system. If the message formats of the two interfaces are defined differently, the result of parsing the interface message may be inaccurate. Therefore, how to improve the parsing reliability of the interface message becomes an urgent problem to be solved.
Disclosure of Invention
The embodiment of the application provides an interface data processing method and device, electronic equipment and a storage medium, which can improve the analysis reliability of interface messages.
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;
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;
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 each initial message parameter;
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, where the apparatus includes:
a receiving module, configured to receive 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;
an obtaining module, configured to obtain a field mapping relationship between the first interface and the second interface;
the processing module is further configured to map, based on the field mapping relationship, an initial field name and the initial field value included in each initial packet parameter to obtain a target packet parameter set; the target message parameter set comprises target message parameters obtained after mapping each initial message parameter;
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, which includes a processor and a memory, where the memory is used to store a computer program, and the computer program includes program instructions, and the processor is configured to call the program instructions to execute some or all of the steps in the method.
In one aspect, the present application provides a computer-readable storage medium, which stores a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, are used to perform some or all of the steps of the above method.
In the embodiment of the application, a response interface message from a first interface may be received, format parsing processing may be performed on the response interface message to obtain an initial message parameter set corresponding to the response interface message, a field mapping relationship between the first interface and a second interface is obtained, an initial field name and an initial field value included in each initial message parameter are mapped based on the field mapping relationship 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 parameter adaptive to the first interface can be analyzed and mapped to obtain the target message parameter adaptive to the second interface, the reliability of the interface message analysis can be improved, the conversion of the interface message is realized, the checking of the message format definition is not required, 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 needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of an interface data processing method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another interface data processing method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an interface data processing apparatus 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 drawings in the embodiments of the present application.
The interface data processing method provided by the embodiment of the application is implemented in electronic equipment, and the electronic equipment can be terminal equipment or a server. The terminal device 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 basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, but is not limited thereto. The present application relates to a block chain technology, and an electronic device may write related data, such as a field mapping relationship, into a block chain, so that the electronic device may obtain required information on the block chain, such as a target packet parameter set corresponding to an initial packet parameter set on the block chain based on the field mapping relationship.
In some embodiments, the electronic device may execute the interface data processing method according to an actual service requirement, so as to improve the analysis 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. The first interface is arranged to receive a request interface message sent by the second interface, and when receiving a response interface message returned by the first interface, the second interface can perform format analysis processing 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 according to the initial message parameter set based on a field mapping relation between the first interface and the second interface, so as to further determine message information indicated by the response interface message, thereby improving the analysis efficiency of the interface message and the accuracy and efficiency of interface communication interaction.
It should be understood that the foregoing scenarios are only examples, and do not constitute a limitation on application scenarios of the technical solutions provided in the embodiments of the present application, and the technical solutions of the present application may also be applied to other scenarios. For example, as can be known by those skilled in the art, with the evolution of system architecture and the emergence of new service scenarios, the technical solution provided in the embodiments of the present application is also applicable to similar technical problems.
Based on the above description, the present application provides an interface data processing method, which may be executed by the above-mentioned electronic device. As shown in fig. 1, a flow of an interface data processing method according to an embodiment of the present application may include the following steps:
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 device.
In some embodiments, the first interface and the second interface may be any interfaces through which communication interaction may occur. And the first interface and the second interface may be located in the same device (i.e. electronic device) and belong to different business systems; or the first interface and the second interface are positioned in the same device 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 the electronic device. The second interface can generate and send a request interface message to the first interface to request for obtaining data, and the first interface can process the received request interface message to obtain message information needing to be returned, and package the message information into a response interface message to return to the electronic equipment. Data interaction between the first interface and the second interface can be realized through interface messages (including a request interface message and a response interface message).
In some embodiments, there may be one or more of the first interface and the second interface, and the first interface and the second interface are taken as an example, and the first interface and the second interface may 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. 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 generally 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 for representing field separation, and 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 comprises: the character "&" is defined as a character indicating field separation, and if two fields exist, the two fields are separated using the character "&" separation in the generated interface message.
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, a plurality of initial fields may be included in the response interface message, and the initial fields include initial field names and initial field values corresponding to the initial field names. Wherein the plurality of initial fields may include, but are not limited to: a field characterizing the response code (also known as a status code), a field characterizing the response information, and a field characterizing the response data. The response code is usually numerical and can represent the response state of the first interface based on the request interface message, 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 indicates specific meanings aiming at the response code, such as response normal or response abnormity and abnormal reasons; the response data represents data obtained by processing based on the request of the request interface message, for example, the request of the request interface message represents obtaining user data of the user a, and the response data may 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 analysis processing on the response interface message may understand that the character has special transitional meaning from the response interface message, extract all the initial fields, and determine the initial field names and the initial field values corresponding to all the initial fields, thereby obtaining an initial message parameter set.
In a possible implementation manner, the electronic device performs format parsing on the response interface message to obtain an initial message parameter set corresponding to the response interface message 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 escape is determined from the response interface message based on a message character defined in the first message definition file, a target character is obtained by performing escape processing on the character to be escape based on the second message definition file, the character to be escape is converted into the target character in the response interface message to obtain a target response interface message, 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 acquired in advance and stored locally in the electronic equipment. In addition, the specific manner of obtaining the initial message parameter set according to the target response interface message may refer to the following description of the embodiments.
In some embodiments, the message characters defined in the first message definition file are characters having special meaning, such as characters used as field separations, the start and end 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 may convert a special character in a response interface message into a target character adapted to the second interface to obtain a target response interface message, and analyze the target response interface message in a manner matching with the second interface to obtain a corresponding initial message parameter set, thereby avoiding that the electronic device may not correctly analyze the interface message to obtain error message information if the message information of the response interface message contains a character to be escape.
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 escape, and perform escape processing on the character to be escape based on the second message definition file, to obtain a target character, specifically, determine, from the message character defined in the second message definition file, a conversion character having the same special meaning as the character to be escape, and determine the conversion character as the target character corresponding to the character to be escape. And the electronic equipment can convert the character to be escape into the target character in the response interface message, so as to obtain the target response interface message. In the target response interface message, the characters with special meanings belong to the message characters 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, a character "<" is used in a response interface message sent by the first interface to represent field separation, and the message information in the response interface message carries a character "&", if a message character defined by the second message definition file of the second interface includes the character "&" and the character represents field separation, if the response interface message is directly analyzed, an analysis result is wrong, so that the character "<" in the response interface message can be used as a character to be escape, and the character to be escaped is subjected to escape processing, that is, the character "<" in the response interface message is replaced by the character "&" (target character), so that a target response interface message is obtained.
S103, acquiring 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 a first message definition file of the first interface and a second message definition file of the second interface. Specifically, a first message field for a first interface is obtained from a first message definition file, a second message field for a second interface is obtained from a second message definition file, a corresponding relationship between the first message field and the second message field is determined, and a field mapping relationship between the first interface and the second interface is established based on the corresponding relationship; the field mapping relationship comprises 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, and specifically may include a message format field required by 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 data fields that can be acquired, where the plurality of data fields belong to response data when generating the response interface message. For example, if the request interface message is a request for the first interface to acquire user information (including a name and an address) of the user a, 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 including the processed data field in the response data: name, address.
In some embodiments, the second message field includes a field related to the second interface when the second interface generates the response interface message, and the electronic device performs parsing based on the second message field when parsing the response interface message, so that the field in the response interface message is converted into a field adapted to the second message field based on a corresponding relationship between the first message field and the second message field, thereby improving accuracy of an obtained parsing result.
In some embodiments, the correspondence between the first packet field and the second packet field includes a correspondence of field information and a correspondence of field format. The field names of the first and second packet fields having a correspondence may be different in identification but represent the same field meaning, and the field values of the first and second packet fields having a correspondence may be different in format but represent the same field content.
Therefore, a field mapping relationship between the first interface and the second interface is constructed according to a corresponding relationship between the first packet field and the second packet field, and the field mapping relationship indicates a mapping relationship (including mapping of information and mapping of format) between each field in the first packet field and each field in the second packet field. The field identification, the field format and the field meaning of the representation of the first message field of the first interface are defined in the first message definition file, the field identification, the field format and the field meaning of the representation of the second message field of the second interface are defined in the second message definition file, and the electronic equipment 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 to obtain the field mapping relation. Or, the field mapping relationship may be constructed in advance by the relevant service person according to the first message definition file and the second message definition file, and sent to the electronic device.
And S104, mapping the initial field name and the initial field value included by 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 an initial field name and an initial field value included in each initial packet parameter respectively based on a field information mapping relationship and a 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 packet parameter, and determine the corresponding target field name and target field value as the target packet parameter obtained after mapping each initial packet parameter respectively, that is, the target packet parameter corresponding to the initial packet parameter includes the target field name and the target field value, thereby obtaining the target packet parameter set.
Based on the field information mapping relationship, the field meanings represented by the initial field name and the target field name are the same, but the specific identifications may be different, for example, in the field information mapping relationship, the field meanings represented by the initial field name and the target field name are name fields in the user information, but the specific identification of the initial field name is "name", and the specific identification of the target field name is "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 the 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.
And S105, determining the 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 a target field name and a target field value included in each target message parameter in the set of target message parameters. The message information is also the response result of the first interface after processing the request interface message sent by the second interface. The specific manner of determining the message information may be referred to in the following description of embodiments. Optionally, the electronic device may generate an interface message log from the determined message information, store the interface message log, and subsequently view the interface message log by a terminal device corresponding to the user.
It can be understood that, because the interface receives the interface packet and usually parses the interface packet based on its own packet format definition, when the packet format definitions between the first interface and the second interface are different, the result parsed by the second interface may not be consistent with the packet information that the first interface wants to transmit, thereby affecting interface interaction. However, the number of interfaces to be interacted is large, and if the message format definitions of all the interfaces are unified, the workload is large, the efficiency is low, so when an interface message sent by any interface is received, each initial message parameter in the received interface message can be converted into a target message parameter adapted to the interface of the user through the technical scheme of the application, the message format definitions of each interface do not need to be checked and unified, and the interface interaction accuracy is improved. According to the technical scheme, different interface interaction scenes can be defined according to the message formats of the interfaces.
In the embodiment of the application, the electronic device may receive a response interface message from the first interface, perform format parsing on the response interface message to obtain an initial message parameter set corresponding to the response interface message, obtain a field mapping relationship 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 relationship to obtain a target message parameter set, and determine message information indicated by the response interface message according to the target message parameter set. By the method, the initial message parameter adaptive to the first interface can be analyzed and mapped to obtain the target message parameter adaptive to the second interface, the reliability of the interface message analysis can be improved, the conversion of the interface message is realized, the checking of the message format definition is not required, and the analysis efficiency can be improved.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating an interface data processing method according to an embodiment of the present application, where the method can be executed 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 device.
The second interface may generate and send a request interface message to the first interface to request for obtaining data, and when receiving the request interface message, the first interface may perform processing based on the request interface message to obtain message information to be returned, and package the message information as 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 target data according to a request of the request interface message, or obtaining target data after processing specified data (such as specified service processing). For example, the request interface message is used to request to acquire user data in the database, the first interface performs processing based on the request interface message, that is, acquires target data (i.e., user data) from the database, and the processing procedure (i.e., the response procedure 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 to request a security test on the database, and the processing performed by the first interface based on the request interface message is to perform a security test on the database to obtain a test result, where the processing procedure obtains a corresponding response code, response information, and response data (which may include the obtained test result), so as to obtain message information that needs to be returned. The specific type of the request interface message is not limited herein.
In a possible embodiment, after receiving a response interface message from a first interface, an electronic device may intercept the response interface message using a tangent plane technology, and when querying a configuration file of a second interface and determining that an annotation indicating to perform interface message processing is added to the configuration file, perform format parsing on the response interface message to obtain an initial message parameter set corresponding to the response interface message, where each interface used for communication interaction in the electronic device has a corresponding configuration file, and the configuration file is configured with an execution method corresponding to the interface. The execution method is used for calling the corresponding interface to perform relevant processing, such as processing data of a response interface message or processing a request interface message.
In some embodiments, the intercepting, by the electronic device, the response interface message using the tangent plane technology may specifically be that, when the electronic device detects the response interface message, the electronic device realizes the intercepting of the response interface message through a predefined tangent plane (including tangent plane logic). The section can be used for transversely intercepting the response interface message when any response interface message is detected; the section logic included in the section defines an interface message processing method for analyzing and processing the format of the response interface message. It can be understood that the section (including the section logic) represents a method executed by the electronic device on the response interface message before performing corresponding processing according to the message information fed back by the response interface message. And in the section, the message information related to the response interface message is not changed after the method for defining the response interface message is executed. The response interface message is intercepted through the section technology and is uniformly subjected to format analysis processing in the section, so that the response interface message is not changed, and low coupling of the system can be facilitated. The electronic device can generate an interface message log from the data (such as an original response interface message, a target response interface message, an initial message parameter set, a target message parameter set, and the like) involved in the process, and the interface message log can be subsequently checked by the terminal device corresponding to the user.
In some embodiments, before receiving a response interface message from the first interface, the electronic device may create an annotation indicating that interface message processing is performed, and add the annotation to a configuration file of each interface performing a data interaction operation to implement a tangent plane technique, where the data interaction operation is an operation in which the interfaces perform communication interaction, that is, including generating and receiving a request interface message and including generating and receiving a response interface message. The electronic equipment stores a plurality of interfaces, and the annotation can be added to a configuration file of a second interface in the plurality of interfaces, which is required to execute the technical scheme of the application, so that the operation flexibility is improved.
It can be understood that, when receiving a response interface message, the electronic device may intercept the response interface message using a tangent plane technology, and execute corresponding tangent plane logic on the response interface message. Or intercepting any interface message by using a tangent plane technology when receiving the interface message, determining the type of the interface message, and if the interface message is a request interface message, releasing the request interface message according to a set link of the request interface message; if the interface message is a response interface message, corresponding section logic is executed 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 if the annotation exists in the configuration file, executing corresponding section logic on the response interface message; if not, the response interface message is released 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 uniform interception at the control layer and perform format parsing on the response interface packet. When the first interface returns a response interface message to the second interface, the set link of the response interface message is that the response interface message firstly reaches the control layer, the electronic device can uniformly receive the response interface message through the control layer, then the response interface message is forwarded 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 on the response interface message to obtain an initial message parameter set corresponding to the response interface message, which may specifically be that a character to be escape is determined from the response interface message according to a first message definition file of the first interface and a second message definition file of the second interface, and the character to be escape is subjected to escape processing to obtain a target character, in the response interface message, a target response interface message is obtained according to the target character, and the initial message parameter set is obtained according to the target response interface message. The specific manner of determining the target character and determining the target response interface message may refer to the related description of the above embodiments.
In some embodiments, the target character is a character with a special meaning, and the target character may include a field start character and a field end character indicating field separation, and the obtaining, by the electronic device, the initial message parameter set according to the target response interface message may specifically be that, based on the field start character and the field end character, a plurality of field data are extracted from the target response interface message, where the field data include an initial field name and an initial field value, and the plurality of field data are determined as the initial message parameter set. The field start character and the field end character representing the field separation may be the same or different, and there may be one or more of the field start character and the field end character.
In some embodiments, the electronic device traverses the target response interface message, extracts a character string between a field start character and a 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 character string. The field start character and the field end character are used to separate field names and field values in sequence. The method comprises the steps that character strings extracted in sequence 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, setting the field start character as "<", the field end character as ">", and setting the content of the target response interface message as: < x1> < x2> < x3> < x4>, so that the character strings extracted based on the field start character and the field end character are x1, x2, x3, x4 in order, and the field names and field values in the object response interface message are alternated in order, so that the electronic device determines that x1 and x3 are field names, x2 and x4 are field values, and 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, i.e., the field name x1 and the field value x2 are used as field data, and the field name x3 and the field value x4 are used as field data.
S203, acquiring a field mapping relation between the first interface and the second interface. For a specific implementation of step S203, reference may be made to the related description of the above embodiments.
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 mapping relationship may include a field information mapping relationship and a field format mapping relationship; therefore, the electronic device performs 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 the target message parameter set, specifically, based on the field information mapping relationship, determining intermediate field names corresponding to the initial field names and intermediate field values corresponding to the initial field values included in the initial message parameters respectively, performing format conversion processing on the intermediate field names and intermediate field values obtained correspondingly based on the field format mapping relationship to obtain target field names corresponding to the initial field names and target field values corresponding to the initial field values included in the initial message parameters, and determining the target field names and the target field values obtained correspondingly as the target message parameters obtained after mapping of the initial message parameters, thereby obtaining the target message parameter set. That is, an initial field name and an initial field value included in an initial packet parameter are mapped by field information to obtain an intermediate field name corresponding to the initial field name and an intermediate field value corresponding to the initial field value, and the intermediate field name and the intermediate field value are mapped by a field format (format conversion process) to obtain a target field name corresponding to the initial field name and a target field value corresponding to the initial field value, so as to serve as a target packet parameter corresponding to the initial packet parameter.
In some embodiments, the mapping process for the initial field name and the initial field value included in each initial packet parameter is the same in principle, and here, the mapping process for one initial packet parameter (set as the reference initial packet parameter, including the reference initial field name and the reference initial field value) is taken as an example. The electronic equipment carries out mapping processing on the reference initial field name based on the field information mapping relation to obtain a reference intermediate field name which has the same meaning as the field represented by the reference initial field name, wherein if the reference initial field name is 'name', the reference intermediate field name is 'name', and data which indicates the same meaning are stored in the field where the reference initial field name is located and the field where the reference intermediate field name is located; and mapping the reference initial field value based on the field information mapping relation to obtain a reference intermediate field value which has the same meaning as the data represented by the reference initial field value, wherein if the reference initial field value is '0', the data meaning is that the response state is an abnormal state, and if the response code is 1, the response state is an abnormal state, so that the reference intermediate field value obtained after 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 a format of the reference intermediate field name (i.e., the reference initial field name, and a corresponding format is not changed based on the field information mapping relationship) is a first format, and a format of the reference target field name is a second format, and the second format is a format adapted to an interface message parsing manner of the second interface. And mapping the reference intermediate field value based on the field format mapping relationship to obtain a reference target field value, wherein the reference intermediate field value is in a third format and the reference target field value is in a fourth format (for example, a generalized format). The field format mapping relation is determined according to the message definition file of the corresponding interface, and the field format mapping relation 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 in which the electronic device maps the initial fields (the initial field name and the initial field value) represented by the initial packet parameters based on the field mapping relationship to obtain the destination fields (the destination field name and the destination field value) represented by the destination packet parameters. Optionally, when the electronic device maps the initial field, the obtained target packet parameter may include one or more target fields, that is, one initial packet parameter corresponds to one target packet parameter, one initial packet parameter includes one field data (an initial field name and an initial field value), and one corresponding target packet parameter may include one or more mapped field data (a target field name and a target field value). For example, the initial field is field a, and based on the field information mapping relationship, there may be mapping with field B and field C in the second packet field of the second interface, that is, the target field obtained by mapping includes field B and field C, so the field information mapping relationship includes a mapping relationship between a field value corresponding to field a and a field value corresponding to the target field (field B and field C) (field value corresponding to field B and field C). The mapping relationship may be a processing manner for a field value corresponding to the field a to obtain a field value corresponding to the field B and a 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, the mapping relationship indicating that a field name (initial field name) of the field a is subjected to mapping processing, a field name (middle field name) of the field B and a field name (middle field name) of the field C are obtained, and a field value (middle field value) of the field B and a field value (middle field value) of the field C are obtained by a processing manner indicated by the mapping processing of the field value (initial field value) of the field a. For example, the field value of the field a may be used as the field value of the field B, and the field value of the field a is subjected to calculation (e.g., summation) to obtain the field value of the field C; or the first part of the field value of the field a may be the field value of the field B, the second part of the field value of the field a may be the field value of the field C, and so on, and the processing manner is not limited here. And the field format mapping relationship at this time indicates the field name and the field value format corresponding to the field B and indicates the field name and the field value format corresponding to the field C.
S205, determining a plurality of field names and a plurality of field values which meet preset response conditions from each target message parameter 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 packet parameter in the set of target packet parameters, a plurality of field names and a plurality of field values that satisfy the preset response condition, specifically, determining, from each target packet parameter, a first field name that represents a response code of the response interface packet and a first field value corresponding to the first field name, and determining a second field name of response data representing the response interface message and determining a second field value corresponding to the second field name, and determining a third field name of response information representing the response interface message and determining a third field value corresponding to the third field name, and determines the first field name, the second field name and the third field name as a plurality of field names satisfying a preset response condition, and determining the first field value, the second field value, and the third field value as a plurality of field values satisfying a 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 field values corresponding to each of the plurality of field names and the plurality of field names. For example, if a field value corresponding to a field name characterizing a response code is a first value set, and one or more first values included in the first value set are set as abnormal response codes, it indicates that the message information characterizes that a response of the first interface to a request interface message is in an abnormal state based on the field value; if the field value corresponding to the field name representing the response code is the second numerical value set, one or more second numerical values included in the second numerical value set are set as normal response codes, and it is determined that the message information represents that the response of the first interface to the request interface message is in a normal state based on the field value. As another example. If the field value corresponding to the field name representing the 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 fact that the message information represents an abnormal reason of abnormal response is determined based on the field value; if the field value corresponding to the field name of the characterization response code is a second information set, one or more pieces of second information included in the second information set are set as normal response information, and it is indicated that the message information is characterized as a normal response based on the field value.
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 (for example, when the field value corresponding to the field name representing the response code is the first value set, the specific result represented by the message information is that the response is in an abnormal state), and the association relationship may be determined by the message definition file of the corresponding interface, or may 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 according to 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. That is, the first field name, the second field name, the third field name, and the first field value, the second field value, and the third field value may be directly used as message information, and after the second interface in the electronic device obtains the message information, the second interface may process a response interface message. For example, when the message information indicates that the first interface is in an abnormal state when the first interface processes a request interface message and causes an abnormality in response data (for example, the response data is not obtained, or the obtained response data is incomplete), that is, the response state is in an abnormal state, a third field value in the message information is obtained, and a reason for the occurrence of the abnormality (for example, an error occurs in a sent request response message) is determined according to the response information indicated by the third field value, and the electronic device or a related service person may perform an abnormality processing or the like (for example, resending the request response message or the like) according to the abnormality reason. For another example, the message information indicates that the first interface is not abnormal when processing the request interface message, that is, the response state is a normal state, and the obtained response data is normal, the electronic device may obtain the second field value in the message information, and perform processing 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, or the like).
In one possible embodiment, the electronic device may determine the message information, and determine, in each target message parameter of the target message parameter set, a first field name characterizing a response code of the response interface message, and determine a first field value corresponding to the first field name, if it is determined, according to the first field value, that the response interface message is obtained by the first interface based on the request message under the first processing condition, determine, from each target message parameter of the target message parameter set, a second field name characterizing response data of the response interface message, and use the second field value corresponding to the second field name as the message information, if it is determined, according to the first field value, that the response interface message is obtained by the first interface based on the request interface message under the second processing condition, determine, from each target message parameter of the target message parameter set, a third field name characterizing response information of the response interface message, and using the third field value corresponding to the third field name as 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. That is, when the electronic device determines that the received response interface message is in a normal state at this time based on the first field value, the electronic device obtains a second field name representing response data, and uses the second field value (i.e., the specific content of the response data) corresponding to the second field name as the indicated message information to perform processing based on the message information; and when the received response interface message is in an abnormal state, acquiring a third field name representing response information, and taking a third field value corresponding to the third field name (namely the specific content of the response information, wherein the specific content indicates an abnormal reason) as the indicated message information so as to perform abnormal processing based on the message information. Optionally, when the status is abnormal, both 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 this embodiment, the electronic device may receive a response interface message from the first interface, perform format parsing on the response interface message, obtain an initial message parameter set corresponding to the response interface message, obtain a field mapping relationship 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 relationship, obtain a target message parameter set, perform mapping processing on the initial field name and the initial field value included in each initial message parameter based on the field mapping relationship, obtain the target message parameter set, and determine message information indicated by the response interface message according to the plurality of field names and the plurality of field values. By the method, the initial message parameter adaptive to the first interface can be analyzed and mapped to obtain the target message parameter adaptive to the second interface, the reliability of the interface message analysis can be improved, the conversion of the interface message is realized, the checking of the message format definition is not required, and the analysis efficiency can be improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an interface data processing apparatus provided in the present application. It should be noted that, the interface data processing apparatus shown in fig. 3 is used for executing the method of the embodiment shown in fig. 1 and fig. 2 of the present application, and for convenience of description, only the portion related to the embodiment of the present application is shown, and details of the specific technology are not disclosed, please refer to the embodiment shown in fig. 1 and fig. 2 of the present application. The interface data processing apparatus 300 may include: the device comprises 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 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;
a processing module 302, configured to perform format parsing 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, based on the field mapping relationship, an initial field name and the initial field value included in each initial packet parameter to obtain a target packet parameter set; the target message parameter set comprises target message parameters obtained after mapping each initial message parameter;
a determining module 304, configured to determine, according to the target packet parameter set, packet information indicated by the response interface packet.
In a possible implementation manner, when 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, specifically, the processing module is configured to:
acquiring a first message definition file of the first interface and a second message definition file of the second interface;
determining characters to be escape from the response interface message based on the message characters defined in the first message definition file;
performing escape processing on the character to be escaped based on the second message definition file to obtain a target character;
in the response interface message, converting the character to be escape into a target character 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 field separation;
when the processing module 302 is configured to obtain the initial packet parameter set according to the target response interface packet, specifically, the processing module is configured to:
extracting a plurality of field data from the target response interface message based on the field starting character and the field ending 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 embodiment, when the obtaining module 303 is configured to obtain the field mapping relationship between the first interface and the second interface, specifically, to:
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;
when the processing module 302 is configured to map the initial field name and the initial field value included in each initial packet parameter based on the field mapping relationship to obtain a target packet parameter, specifically, the processing module is configured to:
respectively determining intermediate field names corresponding to the initial field names and intermediate field values corresponding to the initial field values, wherein the intermediate field names are included in the initial message parameters, based on the field information mapping relation;
based on the field format mapping relationship, carrying out format conversion processing on the intermediate field names and the intermediate field values which are obtained correspondingly 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 the target message parameter obtained after mapping each initial message parameter.
In a possible implementation manner, when the determining module 304 is configured to determine, according to the target packet parameter set, the packet information indicated by the response interface packet, specifically configured to:
determining a first field name representing a response code of 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 obtained by the first interface 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 the second field value corresponding to the second field name as the message information;
if the response interface message is determined to be obtained by the first interface based on the request interface message under the second processing condition according to the first field value, determining a third field name representing response information of the response interface message from each target message parameter of the target message parameter set, and taking the third field value corresponding to the third field name as the message information.
In a possible implementation manner, after the receiving module 301 is configured to receive the response interface message from the first interface, the receiving module is further configured to:
intercepting the response interface message by using a tangent plane technology;
when the configuration file of the second interface is inquired and the comment for indicating the interface message processing is added to the configuration file is determined, executing the step of carrying out 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 a corresponding interface.
In a possible implementation manner, before the receiving module 301 is configured to receive the response interface message from the first interface, the receiving module is further configured to:
creating an annotation for indicating to process the interface message;
adding the annotations to configuration files of all interfaces for data interaction operation; the data interaction operation comprises generating and receiving a request interface message and 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 carries out 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 a first interface and a second interface; the processing module maps the initial field name and the initial field value included by each initial message parameter based on the field mapping relation to obtain a target message parameter set; and the determining module determines the message information indicated by the response interface message according to the target message parameter set. By the scheme, the initial message parameter adaptive to the first interface can be analyzed and mapped to obtain the target message parameter adaptive to the second interface, the reliability of interface message analysis can be improved, the conversion of the interface message is realized, the checking of the message format definition is not required, and the analysis efficiency can be improved.
Each functional module 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 are integrated into one module. The integrated module may be implemented in a form of hardware, or may be implemented in a form of software functional module, which is not limited in this application.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 4, the electronic device 400 includes: at least one processor 401, memory 402. Optionally, the electronic device may further include a network interface. Wherein data can be exchanged between the processor 401, the memory 402 and a network interface, the network interface is controlled by the processor 401 for transceiving messages, the memory 402 is used for storing a computer program, the computer program comprises 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 call the program instructions to perform the above-mentioned method.
The memory 402 may include volatile memory (volatile memory), 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 comprise a combination of memories of the kind described above.
The processor 401 may be a Central Processing Unit (CPU). In one embodiment, the processor 401 may also be a Graphics Processing Unit (GPU). The processor 401 may also be a combination of a CPU and a GPU.
In one possible embodiment, the memory 402 is used for storing program instructions, which the processor 401 can call to execute 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;
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;
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 each initial message parameter;
and determining the message information indicated by the response interface message according to the target message parameter set.
In a 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 characters to be escape from the response interface message based on the message characters defined in the first message definition file;
performing escape processing on the character to be escaped based on the second message definition file to obtain a target character;
in the response interface message, converting the character to be escape into a target character 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 field separation;
when the processor 401 is configured to obtain the initial packet parameter set according to the target response interface packet, specifically, the processor is configured to:
extracting a plurality of field data from the target response interface message based on the field starting character and the field ending 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 embodiment, when the processor 401 is configured to obtain the field mapping relationship between the first interface and the second interface, specifically, to:
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;
when the processor 401 is configured to map the initial field name and the initial field value included in each initial packet parameter based on the field mapping relationship to obtain a target packet parameter, specifically, the processor is configured to:
respectively determining intermediate field names corresponding to the initial field names and intermediate field values corresponding to the initial field values, wherein the intermediate field names are included in the initial message parameters, based on the field information mapping relation;
based on the field format mapping relationship, carrying out format conversion processing on the intermediate field names and the intermediate field values which are obtained correspondingly 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 the target message parameter obtained after mapping each initial message parameter.
In a possible implementation manner, when the processor 401 is configured to determine, according to the target packet parameter set, the packet information indicated by the response interface packet, specifically configured to:
determining a first field name representing a response code of 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 obtained by the first interface 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 obtained by the first interface based on the request interface message under the second processing condition according to the first field value, determining a third field name representing response information of the response interface message from each target message parameter of the target message parameter set, and taking the third field value corresponding to the third field name as the message information.
In a possible implementation, the processor 401, after being configured to receive a response interface message 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 inquired and the comment for indicating the interface message processing is added to the configuration file is determined, executing the step of carrying out 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 a corresponding interface.
In one possible implementation, before the processor 401 is configured to receive a response interface message from the first interface, the processor is further configured to:
creating an annotation for indicating to process the interface message;
adding the annotation in the configuration file of each interface for data interaction operation; the data interaction operation comprises generating and receiving request interface messages and generating and receiving response interface messages.
In a specific implementation, the apparatus, the processor 401, the memory 402, and the like described in this embodiment of the application may perform the implementation described in the above method embodiment, and may also perform the implementation described in this embodiment of the application, which is not described herein again.
Also provided in embodiments of the present application is a computer (readable) storage medium storing a computer program comprising program instructions that, when executed by a processor, cause the processor to perform some or all of the steps performed in the above-described method embodiments. Alternatively, the computer storage media 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 according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Embodiments of the present application provide a computer program product, which may include a computer program, and when the computer program is executed by a processor, part or all of the steps in the method may be implemented, which is not described herein again.
Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which may be stored in a computer storage medium, and the computer storage medium may be a computer readable storage medium, and when executed, the programs may include the processes of the above embodiments of the methods. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the present disclosure has been described with reference to particular embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present disclosure.

Claims (10)

1. An interface data processing method, characterized in that the method comprises:
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;
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;
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 each initial message parameter;
and determining the message information indicated by the response interface message according to the target message parameter set.
2. The method according to claim 1, wherein the performing format parsing processing on the response interface packet to obtain an initial packet parameter set corresponding to the response interface packet includes:
acquiring a first message definition file of the first interface and a second message definition file of the second interface;
determining characters to be escape from the response interface message based on the message characters defined in the first message definition file;
performing escape processing on the character to be escaped based on the second message definition file to obtain a target character;
in the response interface message, converting the character to be escape into a target character 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 characters include a field start character and a field end character representing 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 starting character and the field ending 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 obtaining the 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 relationship to obtain a target message parameter set, and the method comprises the following steps:
respectively determining intermediate field names corresponding to the initial field names and intermediate field values corresponding to the initial field values, wherein the intermediate field names are included in the initial message parameters, based on the field information mapping relation;
based on the field format mapping relationship, carrying out format conversion processing on the intermediate field names and the intermediate field values which are obtained correspondingly 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 the target message parameter obtained after mapping each initial message parameter.
5. The method of claim 1, wherein the determining the message information indicated by the response interface message according to the target message parameter set comprises:
determining a first field name representing a response code of 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 obtained by the first interface 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 the second field value corresponding to the second field name as the message information;
if the response interface message is determined to be obtained by the first interface based on the request interface message under the second processing condition according to the first field value, determining a third field name representing response information of the response interface message from each target message parameter of the target message parameter set, and taking the third field value corresponding to the third field name as the message information.
6. 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 inquired and the comment for indicating the interface message processing is added to the configuration file is determined, executing the step of carrying out 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 a corresponding interface.
7. The method of claim 1, wherein prior to receiving the response interface message from the first interface, the method further comprises:
creating an annotation for indicating to process the interface message;
adding the annotation in the configuration file of each interface for data interaction operation; the data interaction operation comprises generating and receiving request interface messages and generating and receiving response interface messages.
8. An interface data processing apparatus, characterized in that the apparatus comprises:
a receiving module, configured to receive 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;
an obtaining module, configured to obtain a field mapping relationship between the first interface and the second interface;
the processing module is further configured to map, based on the field mapping relationship, an initial field name and the initial field value included in each initial packet parameter to obtain a target packet parameter set; the target message parameter set comprises target message parameters obtained after mapping each initial message parameter;
and the determining module is used for determining the message information indicated by the response interface message according to the target message parameter set.
9. An electronic device comprising a processor and a memory, wherein the memory is configured to store a computer program comprising program instructions, and wherein the processor is configured to invoke the program instructions to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
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 true CN114500690A (en) 2022-05-13
CN114500690B 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)

Cited By (5)

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

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

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277882A (en) * 2022-06-22 2022-11-01 东风汽车集团股份有限公司 CAN message database establishing method and device, vehicle-mounted electronic equipment and storage medium
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
CN115314573A (en) * 2022-08-05 2022-11-08 中国银行股份有限公司 Dynamic loading method and device for message body, electronic equipment and storage medium
CN115314573B (en) * 2022-08-05 2024-02-23 中国银行股份有限公司 Dynamic loading method and device for message body, electronic equipment and storage medium
CN115291850A (en) * 2022-08-11 2022-11-04 广州芯德通信科技股份有限公司 Method, system and storage medium for managing customized interactive data based on java language
CN115866087A (en) * 2022-11-29 2023-03-28 广发银行股份有限公司 Message mapping and HTTP request message conversion method and device
CN115866087B (en) * 2022-11-29 2023-11-17 广发银行股份有限公司 Message mapping and message conversion method, device and transmission system

Also Published As

Publication number Publication date
CN114500690B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
CN114500690B (en) Interface data processing method and device, electronic equipment and storage medium
CN110765102B (en) Service data processing method and device, computer equipment and storage medium
CN111274157B (en) Test data simulation method and device, computer equipment and storage medium
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
CN110688828A (en) File processing method and device, file processing system and computer equipment
CN112822260B (en) File transmission method and device, electronic equipment and storage medium
CN109614327B (en) Method and apparatus for outputting information
CN113867732A (en) Message information processing method, system and storage medium
CN114185808A (en) Automatic testing method and device, electronic equipment and computer readable storage medium
CN111752820B (en) gRPC interface pressure test method, computer equipment and storage medium
CN111427796A (en) System testing method and device and electronic equipment
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
CN111324645B (en) Block chain data processing method and device
CN111158716B (en) Version upgrade calling method and device, computer system and readable storage medium
CN115314319A (en) Network asset identification method and device, electronic equipment and storage medium
CN115033451A (en) Data generation method, data processing device, electronic device, and medium
CN114531289A (en) System interaction method based on artificial intelligence and related equipment
CN112788078B (en) Data transmission method, receiving device, sending device and computer equipment
CN114492324A (en) Component data statistical method and device
CN113676521A (en) Service request response method and device and electronic equipment
CN112804066A (en) Method and device for transferring message in cross-link mode based on relay equipment
CN114205276B (en) Performance test method and device for product management system and electronic equipment
US8799351B1 (en) Communicating multiple files in markup language documents
CN114679466B (en) Consensus processing method, device, computer equipment and medium for block chain network

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