Nothing Special   »   [go: up one dir, main page]

CN110351325B - Data processing method and related equipment - Google Patents

Data processing method and related equipment Download PDF

Info

Publication number
CN110351325B
CN110351325B CN201810306728.5A CN201810306728A CN110351325B CN 110351325 B CN110351325 B CN 110351325B CN 201810306728 A CN201810306728 A CN 201810306728A CN 110351325 B CN110351325 B CN 110351325B
Authority
CN
China
Prior art keywords
data
protocol
template
communication interface
data conversion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810306728.5A
Other languages
Chinese (zh)
Other versions
CN110351325A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810306728.5A priority Critical patent/CN110351325B/en
Publication of CN110351325A publication Critical patent/CN110351325A/en
Application granted granted Critical
Publication of CN110351325B publication Critical patent/CN110351325B/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Communication Control (AREA)

Abstract

The embodiment of the invention discloses a data processing method and related equipment, which comprises the following steps: acquiring called protocol data; determining a communication interface called by the protocol data; searching a data conversion template corresponding to the communication interface from template configuration information, wherein the template configuration information comprises a mapping relation between the communication interface and the data conversion template; processing the protocol data according to the data conversion template to obtain message data; and sending a service request carrying the message data to external equipment through the communication interface. By adopting the embodiment of the invention, more complex and personalized interfaces can be supported, dynamic expansion is supported, and more service requirements are met.

Description

Data processing method and related equipment
Technical Field
The present invention relates to the field of background services, and in particular, to a data processing method and related device.
Background
After the system calls the protocol data, the protocol data needs to be assembled into message data, and then the assembled message data is sent to the external device through the communication interface. As shown in fig. 1, fig. 1 is a schematic diagram of a data processing method provided in the prior art, and includes: firstly, a protocol template is configured, a template conversion plug-in loads the protocol template, then data in a JavaScript Object Notation (JSON) format is obtained, the data in the JSON format is processed through the loaded protocol template, and finally the processed data in the JSON format is output, and only a protocol in a single format and a single interface requirement are supported in the data processing process. However, with the increase of processing services, the number of communication interfaces will increase, the difference of interface protocol formats will become larger, and the interface calls personalized logic will be more complicated, so the prior art scheme cannot meet the requirements of supporting more complicated and personalized interfaces, cannot support dynamic expansion, and can meet more service requirements.
Disclosure of Invention
The embodiment of the invention provides a data processing method and related equipment. More complex and personalized interfaces can be supported, dynamic expansion is supported, and more service requirements are met.
The embodiment of the invention provides a data processing method, which comprises the following steps:
acquiring called protocol data;
determining a communication interface called by the protocol data;
searching a data conversion template corresponding to the communication interface from template configuration information, wherein the template configuration information comprises a mapping relation between the communication interface and the data conversion template;
processing the protocol data according to the data conversion template to obtain message data;
and sending a service request carrying the message data to external equipment through the communication interface.
After acquiring the called protocol data, the method further includes:
determining a data format of the protocol data;
searching whether a protocol analyzer matched with the data format exists in the system;
and if the protocol data exists, analyzing the protocol data by using the searched protocol analyzer.
After the searching system determines whether a protocol parser matching the data format exists, the method further includes:
if the protocol parser does not exist, displaying prompt information, wherein the prompt information is used for prompting a user that the system does not support the data format and the protocol parser needs to be expanded;
and analyzing the protocol data by using the expanded protocol analyzer.
Before acquiring the called protocol data, the method further includes:
receiving a management command sent by a configuration center;
and loading the template configuration information according to the management command.
Wherein, after sending the service request carrying the message data to the external device through the communication interface, the method further comprises:
receiving return data sent by the external equipment through the communication interface;
and processing the returned data according to the data conversion template.
Wherein the data transformation templates comprise a first data transformation template and a second data transformation template;
the assembling the protocol data to obtain the message data according to the data conversion template comprises:
processing the protocol data according to the first data conversion template to obtain message data;
the processing the return data according to the data conversion template comprises:
and processing the returned data according to the second data conversion template.
Wherein the data transformation template comprises at least one of a variable, a function, and a logic.
Accordingly, an embodiment of the present invention provides a data processing apparatus, including:
the acquisition module is used for acquiring the called protocol data;
the processing module is used for determining a communication interface called by the protocol data;
the processing module is further configured to search a data conversion template corresponding to the communication interface from template configuration information, where the template configuration information includes a mapping relationship between the communication interface and the data conversion template;
the processing module is further configured to process the protocol data according to the data conversion template to obtain message data;
and the sending module is used for sending the service request carrying the message data to the external equipment through the communication interface.
The processing module is further configured to determine a data format of the protocol data; searching whether a protocol analyzer matched with the data format exists in the system; and if the protocol data exists, analyzing the protocol data by using the searched protocol analyzer.
The processing module is further configured to display a prompt message if the protocol parser does not exist, where the prompt message is used to prompt a user that the system does not support the data format and the protocol parser needs to be extended; and analyzing the protocol data by using the expanded protocol analyzer.
The processing module is further configured to receive a management command sent by a configuration center; and loading the template configuration information according to the management command.
The device further comprises a receiving module, wherein the receiving module is used for receiving the return data sent by the external equipment through the communication interface; and the processing module is also used for processing the return data according to the data conversion template.
Wherein the data transformation templates comprise a first data transformation template and a second data transformation template;
the processing module is specifically configured to:
processing the protocol data according to the first data conversion template to obtain message data;
and processing the returned data according to the second data conversion template.
Wherein the data transformation template comprises at least one of a variable, a function, and a logic.
In a third aspect, the present invention provides a data processing apparatus comprising: the data processing method comprises a processor, a memory and a communication bus, wherein the communication bus is used for realizing connection communication between the processor and the memory, and the processor executes a program stored in the memory for realizing the steps in the data processing method provided by the first aspect.
In one possible design, the data processing device provided by the invention may comprise corresponding modules for executing the method. The modules may be software and/or hardware.
Yet another aspect of the present invention provides a computer-readable storage medium having stored thereon a plurality of instructions adapted to be loaded by a processor and to perform the method of the above-described aspects.
Yet another aspect of the present invention provides a computer program product containing instructions which, when run on a computer, cause the computer to perform the method of the above aspects.
The embodiment of the invention is implemented by firstly acquiring the called protocol data; determining a communication interface called by protocol data; then searching a data conversion template corresponding to the communication interface from the template configuration information, wherein the template configuration information comprises a mapping relation between the communication interface and the data conversion template; processing the protocol data according to the data conversion template to obtain message data; and finally, sending a service request carrying the message data to the external equipment through the communication interface. The template configuration information can be dynamically expanded and loaded, so that the system supports more complex and personalized interfaces and meets more service requirements.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, 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 invention, 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 diagram of a data processing method provided in the prior art;
fig. 2 is a schematic structural diagram of an interface call template system supporting multiple protocols according to an embodiment of the present invention;
FIG. 3 is a flow chart of a data processing method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an interface call template system according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a data transformation template according to an embodiment of the present invention;
FIG. 6 is a flow chart illustrating a data processing method according to another embodiment of the present invention;
FIG. 7 is a block diagram of a data processing apparatus according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 2, fig. 2 is a schematic structural diagram of an interface call template system supporting multiple protocols according to an embodiment of the present invention. The system comprises a calling system, a logic service, an interface calling template system, a configuration center and a plurality of communication interfaces (communication interface 1, communication interface 2, communication interface 3, … …), wherein the calling system is used for generating protocol data required by external equipment; the logic service is used for carrying out logic processing on the protocol data, and the logic processing comprises writing into a database table, log processing, logic judgment and the like; the interface calling template system is used for determining a communication interface called by the protocol data and processing the protocol data according to the corresponding data conversion template. The configuration center may be used to manage the interface call template system, for example, the extended data conversion template may be loaded into the interface call template system, or the data conversion template may be modified or deleted, etc. Under the condition of a plurality of communication interfaces, the management configuration is uniformly carried out through a configuration center, and the interface calls a template system to dynamically acquire a data conversion template. Based on the system, the embodiment of the invention provides the following technical scheme.
As shown in fig. 3, fig. 3 is a schematic flow chart of a data processing method according to an embodiment of the present invention. As shown in the figure, the method in the embodiment of the present invention includes:
s301, acquiring the called protocol data. The protocol data may be internal data obtained by processing a request command sent by a user, or internal data obtained by processing running data of an application.
Optionally, after acquiring the called protocol data, the data format of the protocol data may be determined; searching whether a protocol analyzer matched with the data format exists in the system; and if the protocol data exists, analyzing the protocol data by using the searched protocol analyzer. If the protocol parser does not exist, displaying prompt information, wherein the prompt information is used for prompting a user that the system does not support the data format and the protocol parser needs to be expanded; and analyzing the protocol data by using the expanded protocol analyzer. It should be noted that more formats of protocols can be supported by dynamically extending the protocol parser.
As shown in fig. 4, the interface calling template system includes a plurality of protocol parsers, a data splicer, and a template parser, wherein the template parser is configured to determine a data conversion template corresponding to the communication interface after loading template configuration information from the configuration center, analyze keywords such as variables, functions, logic, and the like in the data conversion template, and store the keywords using a data structure, so as to assemble a message subsequently. The protocol parser is used for parsing protocol data into the memory or parsing external data into the memory, supports dynamic expansion, and must be completely decoupled from the data conversion template so as to reduce the workload of reconfiguration. The data splicer can be used for assembling the protocol data or the external data analyzed in the memory according to the keywords of variables, functions, logics and the like analyzed by the template grammar analyzer. As shown, the plurality of protocol parsers include a JSON parser, an Extensible Markup Language (XML) parser, and a & & parser, wherein the & & parser may be used to process a data message of a HyperText Markup Language (HTML) form protocol. When the data format of the protocol data is JSON, a JSON analyzer can be used for analyzing the protocol data; when the data format of the protocol data is XML, an XML parser can be used for parsing the protocol data; when the data format of the protocol data is & & the parser may be used to parse the protocol data, and finally, the parsed protocol data is output to the data splicer.
S302, determining a communication interface called by the protocol data.
In a specific implementation, an interface address of a communication interface called by the protocol data may be obtained, and the communication interface called by the protocol data may be determined according to the interface address.
S303, searching a data conversion template corresponding to the communication interface from template configuration information, wherein the template configuration information comprises a plurality of mapping relations between the communication interface and the data conversion template.
Firstly, before acquiring called protocol data, a management command sent by a configuration center can be received; and loading the template configuration information according to the management command. The template configuration information may include a plurality of mapping relationships between the data conversion templates and the communication interfaces, and each communication interface corresponds to one data conversion template. The configuration center can load the data conversion template into the interface calling template system, expand the data conversion template, or modify, delete, etc. the data conversion template. Through the dynamic management configuration of the configuration center, the more complex and personalized interface requirements can be met.
Then, after determining a communication interface called by the protocol data, a data conversion template corresponding to the communication interface may be searched from the template configuration information, where the data conversion template includes at least one of a variable, a function, and a logic.
As shown in table 1, table 1 is used for performing different processing on protocol data through different variables, for example, defining $ { name }, which means taking a value of a field name of a first layer of protocol data; define $ { req } $ { col1}, represent take the value of the protocol data second layer field col1, and so on.
TABLE 1 variables
Variables of Means of
${name} Taking the value of the name of the first layer field of the protocol data
${req}.${col1} Take the value of the protocol data second layer field col1
${req}.${body}.${col1} Take the value of the protocol data layer three field col1
$[list](${name}) Take the name field value of each element of the array list
As also shown in table 2, table 2 shows different processing of protocol data by different logic. For example,% IF $ { name } -, indicates that the value of field name is hello, yes is returned, and no is else.
TABLE 2 logic
Logical name Means of
%IF${name}==hello yes no% The value of field name is hello, yes is returned, otherwise no
As also shown in table 3, table 3 shows different processing of protocol data by different functions. For example, the definition @ NONCE32@ denotes taking a 32-bit random number; the definition @ Add @ (a, b), represents the sum of the computational variables a and b, and so on.
TABLE 3 function
Function name Means of
@NONCE32@() Taking 32-bit random numbers
@NONCE64@() Taking 64-bit random numbers
@Add@(a,b) Calculating the sum of variables a and b
@Minus@(a,b) Calculating the difference between variables a and b
@Append@(a,b,c,d) Splicing character strings a, b, c and d
@Upper@(a) Converting character string a into capital
It should be noted that the variables, functions, or logics in the embodiments of the present invention include, but are not limited to, the above meanings, and the configuration center may dynamically expand the variables, functions, and logics, so as to meet the requirement of supporting complex and variable service systems.
S304, processing the protocol data according to the data conversion template to obtain message data.
In the specific implementation, after the protocol data is parsed to the memory by the protocol parser, the variable in the data conversion template is searched first, and if the variable is not searched, the execution is finished. If the variable is found, the protocol data is processed through the variable, and the function in the data conversion template is continuously executed. Secondly, searching the function in the data conversion template, if the function is not searched, finishing the execution, and prompting the system not to support the function. If the function is found, the function is called, a return value is obtained, and the logic is continuously executed. Then, searching the corresponding logic processing unit, if the logic processing unit is not searched, finishing the execution and prompting that the system does not support the logic. And if the logical processing unit is found, executing the logical processing unit. And finally, replacing the variable string, the function string and the logic string in the data conversion template with the data subjected to variable, function and logic processing, and further finally obtaining message data.
For example, as shown in fig. 4, the template parser parses keywords such as variables, functions, and logics in the data conversion template, processes the protocol data through the keywords such as variables, functions, and logics, respectively, and transmits the processed data to the data splicer, and the data splicer replaces the original variable string, function string, and logic string in the data conversion template with the processed data, and assembles the replaced data, thereby finally obtaining the message data.
S305, sending a service request carrying the message data to an external device through the communication interface. The service request may be a hypertext Transfer Protocol over Secure Socket Layer (HTTPS) request or a hypertext Transfer Protocol (HTTP) request.
For example, as shown in fig. 5, the left side of the upper part of fig. 5 is protocol data, the right side of the upper part is message data, and the lower part is a data conversion template. First, protocol data is acquired, and the protocol data is parsed using a JSON parser because the protocol data is in JSON format. In the protocol data, id is 1000, job is teacher, detail includes firstname is John, and lastname is Smith, age is 30. Secondly, a communication interface used by the protocol data is determined, and a data conversion template corresponding to the communication interface is determined. In the data conversion template, $ { id } represents the direct output id; @ Append @ represents the concatenation of the character strings of firstname and lastname, @ Add @ represents the increase of age by 10, adaptor represents the conversion of teacher into a teacher or student into a student. And then, processing the protocol data according to the data conversion template to obtain message data, wherein in the assembled message data, id is 1000, name is John Smith, age is 40, job is a teacher, and finally, sending a service request carrying the message data to external equipment.
In the embodiment of the invention, firstly, the called protocol data is obtained; determining a communication interface called by protocol data; then searching a data conversion template corresponding to the communication interface from the template configuration information, wherein the template configuration information comprises a mapping relation between the communication interface and the data conversion template; processing the protocol data according to the data conversion template to obtain message data; and finally, sending a service request carrying the message data to the external equipment through the communication interface. The template configuration information can be dynamically expanded and loaded, so that the system supports more complex and personalized interfaces, supports dynamic expansion and meets more service requirements.
As shown in fig. 6, fig. 6 is a schematic flow chart of a data processing method according to another embodiment of the present invention. As shown in the figure, the method in the embodiment of the present invention includes:
s601, the server acquires the called protocol data. This step is the same as S301 in the above embodiment, and details are not repeated in the embodiment of the present invention.
S602, the server determines the communication interface called by the protocol data. This step is the same as S302 in the above embodiment, and details are not repeated in the embodiment of the present invention.
S603, the server searches a data conversion template corresponding to the communication interface from template configuration information, wherein the template configuration information comprises a plurality of mapping relations between the communication interface and the data conversion template. This step is the same as S303 in the above embodiment, and details are not repeated in the embodiment of the present invention.
S604, the server processes the protocol data according to the data conversion template to obtain message data.
In a specific implementation, the data conversion templates corresponding to the same communication interface include a first data conversion template and a second data conversion template, where the first data conversion template is used for processing the transmitted data, and the second data conversion template is used for processing the received data. In this step, the protocol data may be processed according to the first data conversion template to obtain message data. The specific steps are the same as S304 in the above embodiment, and are not described again in the embodiments of the present invention.
S605, the server sends the service request carrying the message data to the external device through the communication interface. The service request may be a hypertext Transfer Protocol over Secure Socket Layer (HTTPS) request or a hypertext Transfer Protocol (HTTP) request.
Optionally, a web backend service may be deployed on the server, binding the web backend service to a local network address, which may include IP (e.g., 10.2.2.2) and port (443). The server may send a service request carrying the network address to the external device, and after receiving the service request, the external device may send return data to the server through the IP and the port.
S606, the external device sends the return data to the server. Wherein, the server can receive the return data sent by the external device through the same communication interface.
And S607, the server processes the return data according to the data conversion template.
In a specific implementation, the data conversion templates corresponding to the same communication interface may include a first data conversion template and a second data conversion template, where the first data conversion template is used to process the transmitted data, and the second data conversion template is used to process the received data. In this step, the protocol data may be processed according to the second data conversion template to obtain message data.
Further, the data format of the return data may be determined first; and searching a protocol analyzer matched with the data format in the system, and analyzing the returned data by using the protocol analyzer. And after the returned data are analyzed to the memory, searching the variable in the data conversion template, and if the variable is not searched, ending the execution. If the variable is found, the returned data is processed through the variable, and the function in the data conversion template is continuously executed. Secondly, searching the function in the data conversion template, if the function is not searched, finishing the execution, and prompting the system not to support the function. If the function is found, the function is called, a return value is obtained, and the logic is continuously executed. Then, searching the corresponding logic processing unit, if the logic processing unit is not searched, finishing the execution and prompting that the system does not support the logic. And if the logical processing unit is found, executing the logical processing unit. And finally, replacing the variable string, the function string and the logic string in the data conversion template with the data subjected to variable, function and logic processing, and further finally obtaining the data required by the server.
As shown in fig. 7, fig. 7 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present invention. As shown in the figure, the apparatus in the embodiment of the present invention includes an obtaining module 701, a processing module 702, and a sending module 703, where:
an obtaining module 701, configured to obtain called protocol data. The protocol data may be internal data obtained by processing a request command sent by a user, or internal data obtained by processing running data of an application.
Optionally, after acquiring the called protocol data, the data format of the protocol data may be determined; searching whether a protocol analyzer matched with the data format exists in the system; and if the protocol data exists, analyzing the protocol data by using the searched protocol analyzer. If the protocol parser does not exist, displaying prompt information, wherein the prompt information is used for prompting a user that the system does not support the data format and the protocol parser needs to be expanded; and analyzing the protocol data by using the expanded protocol analyzer. By dynamically extending the protocol resolver, more formats of protocols are supported.
As shown in fig. 4, the interface calling template system includes a plurality of protocol parsers, a data splicer, and a template parser, wherein the template parser is configured to determine a data conversion template corresponding to the communication interface after loading template configuration information from the configuration center, analyze keywords such as variables, functions, logic, and the like in the data conversion template, and store the keywords using a data structure, so as to assemble a message subsequently. The protocol parser is used for parsing protocol data into the memory or parsing external data into the memory, supports dynamic expansion, and must be completely decoupled from the data conversion template so as to reduce the workload of reconfiguration. The data splicer can be used for assembling the protocol data or the external data analyzed in the memory according to the keywords of variables, functions, logics and the like analyzed by the template grammar analyzer. As shown, the plurality of protocol parsers include a JSON parser, an XML parser, and & & parser, and when the data format of the protocol data is JSON, the protocol data may be parsed using the JSON parser; when the data format of the protocol data is XML, an XML parser can be used for parsing the protocol data; when the data format of the protocol data is & & the parser may be used to parse the protocol data, and finally, the parsed protocol data is output to the data splicer.
A processing module 702, configured to determine a communication interface called by the protocol data.
In a specific implementation, an interface address of a communication interface called by the protocol data may be obtained, and the communication interface called by the protocol data may be determined according to the interface address.
The processing module 702 is further configured to search a data conversion template corresponding to the communication interface from template configuration information, where the template configuration information includes a plurality of mapping relationships between the communication interface and the data conversion template.
Firstly, before acquiring called protocol data, a management command sent by a configuration center can be received; and loading the template configuration information according to the management command. The template configuration information may include a plurality of mapping relationships between the data conversion templates and the communication interfaces, and each communication interface corresponds to one data conversion template. The configuration center can load the data conversion template into the interface calling template system, expand the data conversion template, or modify, delete, etc. the data conversion template. Through the dynamic management configuration of the configuration center, the more complex and personalized interface requirements can be met.
Then, after determining a communication interface called by the protocol data, a data conversion template corresponding to the communication interface may be searched from the template configuration information, where the data conversion template includes at least one of a variable, a function, and a logic.
The processing module 702 is further configured to process the protocol data according to the data conversion template to obtain message data.
In a specific implementation, the data conversion templates corresponding to the same communication interface include a first data conversion template and a second data conversion template, where the first data conversion template is used for processing the transmitted data, and the second data conversion template is used for processing the received data. In this step, the protocol data may be processed according to the first data conversion template to obtain message data.
Further, after the protocol data is analyzed to the memory by the protocol analyzer, the variable in the data conversion template is searched first, and if the variable is not searched, the execution is finished. If the variable is found, the protocol data is processed through the variable, and the function in the data conversion template is continuously executed. Secondly, searching the function in the data conversion template, if the function is not searched, finishing the execution, and prompting the system not to support the function. If the function is found, the function is called, a return value is obtained, and the logic is continuously executed. Then, searching the corresponding logic processing unit, if the logic processing unit is not searched, finishing the execution and prompting that the system does not support the logic. And if the logical processing unit is found, executing the logical processing unit. And finally, replacing the variable string, the function string and the logic string in the data conversion template with the data subjected to variable, function and logic processing, and further finally obtaining message data.
For example, as shown in fig. 4, the template parser parses keywords such as variables, functions, and logics in the data conversion template, processes the protocol data through the keywords such as variables, functions, and logics, respectively, and transmits the processed data to the data splicer, and the data splicer replaces the original variable string, function string, and logic string in the data conversion template with the processed data, and assembles the replaced data, thereby finally obtaining the message data.
A sending module 703, configured to send a service request carrying the packet data to an external device through the communication interface. The service request may be a hypertext Transfer Protocol over Secure Socket Layer (HTTPS) request or a hypertext Transfer Protocol (HTTP) request.
For example, as shown in fig. 5, the left side of the upper part of fig. 5 is protocol data, the right side of the upper part is message data, and the lower part is a data conversion template. First, protocol data is acquired, and the protocol data is parsed using a JSON parser because the protocol data is in JSON format. In the protocol data, id is 1000, job is teacher, detail includes firstname is John, lastname is Smith, age is 30. Secondly, a communication interface used by the protocol data is determined, and a data conversion template corresponding to the communication interface is determined. In the data conversion template, $ { id } represents the direct output id; @ Append @ represents the concatenation of the character strings of firstname and lastname, @ Add @ represents the increase of age by 10, adaptor represents the conversion of teacher into a teacher or student into a student. And then, processing the protocol data according to the data conversion template to obtain message data, wherein in the message data, id is 1000, name is John Smith, age is 40, job is a teacher, and finally, sending a service request carrying the message data to external equipment.
Optionally, a web backend service may be deployed on the server, binding the web backend service to a local network address, which may include IP (e.g., 10.2.2.2) and port (443). The server may send a service request carrying the network address to the external device, and after receiving the service request, the external device may send return data to the server through the IP and the port.
Optionally, the apparatus may further include a receiving module 704, where:
a receiving module 704, configured to receive, through the communication interface, return data sent by the external device.
The processing module 702 is further configured to process the returned data according to the data conversion template.
In a specific implementation, the data conversion templates corresponding to the same communication interface may include a first data conversion template and a second data conversion template, where the first data conversion template is used to process the transmitted data, and the second data conversion template is used to process the received data. In this step, the protocol data may be processed according to the second data conversion template to obtain message data.
Further, the data format of the return data may be determined first; and searching a protocol analyzer matched with the data format in the system, and analyzing the returned data by using the protocol analyzer. And after the returned data are analyzed to the memory, searching the variable in the data conversion template, and if the variable is not searched, ending the execution. If the variable is found, the returned data is processed through the variable, and the function in the data conversion template is continuously executed. Secondly, searching the function in the data conversion template, if the function is not searched, finishing the execution, and prompting the system not to support the function. If the function is found, the function is called, a return value is obtained, and the logic is continuously executed. Then, searching the corresponding logic processing unit, if the logic processing unit is not searched, finishing the execution and prompting that the system does not support the logic. And if the logical processing unit is found, executing the logical processing unit. And finally, replacing the variable string, the function string and the logic string in the data conversion template with the data subjected to variable, function and logic processing, and further finally obtaining the data required by the server.
In the embodiment of the invention, firstly, the called protocol data is obtained; determining a communication interface called by protocol data; then searching a data conversion template corresponding to the communication interface from the template configuration information, wherein the template configuration information comprises a mapping relation between the communication interface and the data conversion template; processing the protocol data according to the data conversion template to obtain message data; and finally, sending a service request carrying the message data to the external equipment through the communication interface. The template configuration information can be dynamically expanded and loaded, so that the system supports more complex and personalized interfaces, supports dynamic expansion and meets more service requirements.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a server according to an embodiment of the present invention. As shown, the server may include: at least one processor 801, at least one communication interface 802, at least one memory 803, and at least one communication bus 804.
The processor 801 may be, among other things, a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, transistor logic, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor may also be a combination of computing functions, e.g., comprising one or more microprocessors, a digital signal processor and a microprocessor, or the like. The communication bus 804 may be a peripheral component interconnect standard PCI bus or an extended industry standard architecture EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 8, but this is not intended to represent only one bus or type of bus. A communication bus 804 is used to enable communications among the components. The communication interface 802 of the device in the embodiment of the present invention is used for performing signaling or data communication with other node devices. The Memory 803 may include a volatile Memory, such as a Nonvolatile dynamic Random Access Memory (NVRAM), a Phase Change Random Access Memory (PRAM), a Magnetoresistive Random Access Memory (MRAM), and the like, and may further include a Nonvolatile Memory, such as at least one magnetic Disk Memory device, an Electrically Erasable Programmable Read-Only Memory (EEPROM), a flash Memory device, such as a NOR flash Memory or a NAND flash Memory, a semiconductor device, such as a Solid State Disk (SSD), and the like. The memory 803 may optionally be at least one memory device located remotely from the processor 801 as previously described. A set of program codes is stored in the memory 803 and the processor 801 executes the programs in the memory 803.
Acquiring called protocol data;
determining a communication interface called by the protocol data;
searching a data conversion template corresponding to the communication interface from template configuration information, wherein the template configuration information comprises a plurality of mapping relations between the communication interface and the data conversion template;
processing the protocol data according to the data conversion template to obtain message data;
and sending a service request carrying the message data to external equipment through the communication interface.
Optionally, the processor 801 is further configured to perform the following operation steps:
determining a data format of the protocol data;
searching whether a protocol analyzer matched with the data format exists in the system;
and if the protocol data exists, analyzing the protocol data by using the searched protocol analyzer.
Optionally, the processor 801 is further configured to perform the following operation steps:
if the protocol parser does not exist, displaying prompt information, wherein the prompt information is used for prompting a user that the system does not support the data format and the protocol parser needs to be expanded;
and analyzing the protocol data by using the expanded protocol analyzer.
Optionally, the processor 801 is further configured to perform the following operation steps:
receiving a management command sent by a configuration center;
and loading the template configuration information according to the management command.
Optionally, the processor 801 is further configured to perform the following operation steps:
receiving return data sent by the external equipment through the communication interface;
and processing the returned data according to the data conversion template.
Wherein the data transformation templates comprise a first data transformation template and a second data transformation template;
optionally, the processor 801 is further configured to perform the following operation steps:
processing the protocol data according to the first data conversion template to obtain message data;
and processing the returned data according to the second data conversion template.
Further, the processor may cooperate with the memory and the communication interface to perform the operations of the client in the above-described embodiments of the invention.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
The above-mentioned embodiments further explain the objects, technical solutions and advantages of the present invention in detail. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (13)

1. A method of data processing, the method comprising:
acquiring called protocol data;
determining a data format of the protocol data;
searching whether a protocol analyzer matched with the data format exists in the system;
if the protocol data exists, the searched protocol analyzer is used for analyzing the protocol data;
determining a communication interface called by the protocol data;
searching a data conversion template corresponding to the communication interface from template configuration information, wherein the template configuration information comprises a plurality of mapping relations between the communication interface and the data conversion template, each communication interface corresponds to one data conversion template, the data conversion template supports dynamic expansion, modification or deletion, and the data conversion template and the protocol analyzer are completely decoupled;
processing the protocol data according to the data conversion template to obtain message data;
and sending a service request carrying the message data to external equipment through the communication interface.
2. The method of claim 1, wherein after finding whether a protocol parser matching the data format exists in the system, further comprising:
if the protocol parser does not exist, displaying prompt information, wherein the prompt information is used for prompting a user that the system does not support the data format and the protocol parser needs to be expanded;
and analyzing the protocol data by using the expanded protocol analyzer.
3. The method of claim 1, wherein said obtaining the called protocol data is preceded by:
receiving a management command sent by a configuration center;
and loading the template configuration information according to the management command.
4. The method according to claim 1, wherein after sending the service request carrying the message data to the external device through the communication interface, the method further comprises:
receiving return data sent by the external equipment through the communication interface;
and processing the returned data according to the data conversion template.
5. The method of claim 4, wherein the data transformation template comprises a first data transformation template and a second data transformation template;
the assembling the protocol data to obtain the message data according to the data conversion template comprises:
processing the protocol data according to the first data conversion template to obtain message data;
the processing the return data according to the data conversion template comprises:
and processing the returned data according to the second data conversion template.
6. The method of any of claims 1-5, wherein the data transformation template comprises at least one of a variable, a function, and a logic.
7. A data processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring the called protocol data;
the processing module is used for determining the data format of the protocol data; searching whether a protocol analyzer matched with the data format exists in the system; if the protocol data exists, the searched protocol analyzer is used for analyzing the protocol data; and a communication interface for determining the protocol data to invoke;
the processing module is further configured to search a data conversion template corresponding to the communication interface from template configuration information, where the template configuration information includes a plurality of mapping relationships between the communication interface and the data conversion template, each communication interface corresponds to one data conversion template, the data conversion template supports dynamic expansion, modification, or deletion, and the data conversion template is completely decoupled from the protocol parser;
the processing module is further configured to process the protocol data according to the data conversion template to obtain message data;
and the sending module is used for sending the service request carrying the message data to the external equipment through the communication interface.
8. The apparatus of claim 7,
the processing module is further configured to display a prompt message if the protocol parser does not exist, where the prompt message is used to prompt a user that the system does not support the data format and the protocol parser needs to be expanded; and analyzing the protocol data by using the expanded protocol analyzer.
9. The apparatus of claim 7,
the processing module is also used for receiving a management command sent by the configuration center; and loading the template configuration information according to the management command.
10. The apparatus of claim 7, wherein the apparatus further comprises a receiving module,
the receiving module is used for receiving the return data sent by the external equipment through the communication interface;
and the processing module is also used for processing the return data according to the data conversion template.
11. The apparatus of claim 10, wherein the data transformation template comprises a first data transformation template and a second data transformation template;
the processing module is specifically configured to:
processing the protocol data according to the first data conversion template to obtain message data;
and processing the returned data according to the second data conversion template.
12. The apparatus of any of claims 7-11, wherein the data transformation template comprises at least one of a variable, a function, and a logic.
13. A computer-readable storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the method according to any one of claims 1 to 6.
CN201810306728.5A 2018-04-08 2018-04-08 Data processing method and related equipment Active CN110351325B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810306728.5A CN110351325B (en) 2018-04-08 2018-04-08 Data processing method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810306728.5A CN110351325B (en) 2018-04-08 2018-04-08 Data processing method and related equipment

Publications (2)

Publication Number Publication Date
CN110351325A CN110351325A (en) 2019-10-18
CN110351325B true CN110351325B (en) 2022-04-29

Family

ID=68173250

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810306728.5A Active CN110351325B (en) 2018-04-08 2018-04-08 Data processing method and related equipment

Country Status (1)

Country Link
CN (1) CN110351325B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113051202A (en) * 2019-12-27 2021-06-29 中国移动通信集团湖南有限公司 Interface adaptation method, device, electronic equipment and computer readable storage medium
CN111314467A (en) * 2020-02-19 2020-06-19 杭州涂鸦信息技术有限公司 Communication method and system for production and measurement upper computer and Internet of things equipment
CN111552838B (en) * 2020-03-26 2023-02-03 深圳平安医疗健康科技服务有限公司 Data processing method and device, computer equipment and storage medium
CN113315842A (en) * 2021-05-31 2021-08-27 中国民航信息网络股份有限公司 Information interaction method and related equipment
CN113268285B (en) * 2021-06-08 2024-02-02 上海云从企业发展有限公司 Service processing method, system, medium and equipment based on service platform
CN115103034A (en) * 2022-06-27 2022-09-23 京东科技信息技术有限公司 Message protocol conversion method and device
CN115499518A (en) * 2022-07-29 2022-12-20 天翼云科技有限公司 Micro service protocol conversion method and device and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101188561A (en) * 2007-12-20 2008-05-28 北京大学 Communication method and system for universal service data based on self-defined template
CN101547156A (en) * 2009-05-04 2009-09-30 华为技术有限公司 Message parsing method and device
CN102413057A (en) * 2011-12-22 2012-04-11 北京新媒传信科技有限公司 Method and system for providing service application in internet
CN102891796A (en) * 2012-11-02 2013-01-23 中国科学院自动化研究所 Mining intelligent transmission gateway
CN104243172A (en) * 2013-06-07 2014-12-24 国家电网公司 Expanded input/output device of decentralized control system, and method thereof
CN106230826A (en) * 2016-08-02 2016-12-14 哈尔滨工业大学 Application system interface protocol automatic analyzer

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7904595B2 (en) * 2001-01-18 2011-03-08 Sdl International America Incorporated Globalization management system and method therefor

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101188561A (en) * 2007-12-20 2008-05-28 北京大学 Communication method and system for universal service data based on self-defined template
CN101547156A (en) * 2009-05-04 2009-09-30 华为技术有限公司 Message parsing method and device
CN102413057A (en) * 2011-12-22 2012-04-11 北京新媒传信科技有限公司 Method and system for providing service application in internet
CN102891796A (en) * 2012-11-02 2013-01-23 中国科学院自动化研究所 Mining intelligent transmission gateway
CN104243172A (en) * 2013-06-07 2014-12-24 国家电网公司 Expanded input/output device of decentralized control system, and method thereof
CN106230826A (en) * 2016-08-02 2016-12-14 哈尔滨工业大学 Application system interface protocol automatic analyzer

Also Published As

Publication number Publication date
CN110351325A (en) 2019-10-18

Similar Documents

Publication Publication Date Title
CN110351325B (en) Data processing method and related equipment
CN104866383B (en) Interface calling method and device and terminal
CN110333863B (en) Method and device for generating and displaying applet page
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
CN110276074B (en) Distributed training method, device, equipment and storage medium for natural language processing
CN111309593A (en) JSON interface verification method, device and equipment and computer readable storage medium
CN113626223A (en) Interface calling method and device
CN114064601B (en) Storage process conversion method, device, equipment and storage medium
CN113761588A (en) Data verification method and device, terminal equipment and storage medium
CN111984262A (en) WeChat cascading style sheet file processing method, device, equipment and storage medium
CN113434098B (en) Printing function realization method, device, electronic equipment, system and storage medium
CN105094787B (en) Method and device for processing enterprise internet application
CN110968339B (en) Method and device for front-end building tool and electronic equipment
CN116737535A (en) Interface test method, device, computer equipment and storage medium
CN112579312A (en) Parameter mapping method and device, storage medium, interface calling platform and service system
CN112671565B (en) 5G core network topology discovery method and device based on signaling link
CN115048359A (en) Universal data processing architecture design method for multi-type access data sources
CN111367500A (en) Data processing method and device
CN110471708B (en) Method and device for acquiring configuration items based on reusable components
CN112711602B (en) Method and device for running stored procedure, database system and storage medium
CN114219643A (en) Transaction calling method, device, equipment and storage medium
CN112671567A (en) 5G core network topology discovery method and device based on service interface
CN113098961A (en) Component uploading method, device and system, computer equipment and readable storage medium
CN112068899A (en) Plug-in loading method and device, electronic equipment and storage medium

Legal Events

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