CN107222461B - Communication processing method and device - Google Patents
Communication processing method and device Download PDFInfo
- Publication number
- CN107222461B CN107222461B CN201710308721.2A CN201710308721A CN107222461B CN 107222461 B CN107222461 B CN 107222461B CN 201710308721 A CN201710308721 A CN 201710308721A CN 107222461 B CN107222461 B CN 107222461B
- Authority
- CN
- China
- Prior art keywords
- data
- communication protocol
- server
- request
- node
- 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
Links
- 238000004891 communication Methods 0.000 title claims abstract description 164
- 238000003672 processing method Methods 0.000 title claims abstract description 16
- 238000013499 data model Methods 0.000 claims abstract description 87
- 230000004044 response Effects 0.000 claims abstract description 84
- 238000000034 method Methods 0.000 claims abstract description 18
- 238000012545 processing Methods 0.000 claims description 23
- 239000000284 extract Substances 0.000 claims description 15
- 238000006243 chemical reaction Methods 0.000 claims description 11
- 230000006978 adaptation Effects 0.000 abstract description 28
- 238000012986 modification Methods 0.000 abstract description 8
- 230000004048 modification Effects 0.000 abstract description 8
- 238000011161 development Methods 0.000 abstract description 7
- 238000010586 diagram Methods 0.000 description 9
- 230000009466 transformation Effects 0.000 description 6
- 238000013515 script Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/18—Multiprotocol handlers, e.g. single devices capable of handling multiple protocols
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Communication Control (AREA)
- Computer And Data Communications (AREA)
Abstract
本发明提供一种通信处理方法和装置,其中,该方法包括:接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据;将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;将符合服务器通信协议的请求数据发送给服务器,服务器根据符合服务器通信协议的请求数据确定数据响应信息。提供一种适用于各通信协议的协议适配方式,减少协议适配的部署次数、开发次数,提高了协议适配的效率,减少接口改造成本。
The present invention provides a communication processing method and device, wherein the method includes: receiving data request information sent by a terminal, extracting data carried in the data request information according to a communication protocol corresponding to the data request information; The data carried is parsed into the first general data model object of the tree structure, each node in the first general data model object of the tree structure has at least one child node, and each child node under one node is provided with a Sequence; convert the first general data model object of the tree structure into request data conforming to the server communication protocol; send the request data conforming to the server communication protocol to the server, and the server determines the data response information according to the request data conforming to the server communication protocol . A protocol adaptation method suitable for each communication protocol is provided, the deployment times and development times of protocol adaptation are reduced, the efficiency of protocol adaptation is improved, and the cost of interface modification is reduced.
Description
技术领域technical field
本发明涉及通信技术领域,尤其涉及一种通信处理方法和装置。The present invention relates to the field of communication technologies, and in particular, to a communication processing method and device.
背景技术Background technique
随着通信技术的发展,通信协议的类型也越来越多,通信协议包括了传输控制协议(Transmission Control Protocol,简称TCP)、超文本传输协议(HyperText TransferProtocol,简称HTTP)、扩展接口协议等等。从而采用了不同的通信协议的终端与服务器之间,需要进行协议适配之后才可以进行通信。With the development of communication technology, there are more and more types of communication protocols. Communication protocols include Transmission Control Protocol (TCP), HyperText Transfer Protocol (HTTP), extended interface protocol, etc. . Therefore, the communication between the terminal and the server using different communication protocols needs to be carried out after protocol adaptation.
现有技术中,终端与服务器通信的时候,需要对终端的通信协议与服务器的通信协议进行适配。最常用的协议适配是基于企业服务总线(Enterprise Service Bus,简称ESB)进行的协议适配。ESB将不同的服务端的协议,通过统一的标准适配成统一的协议;然后终端通过统一的入口和协议方式与服务器连接,进而终端进行服务调用。由于ESB提供了统一的服务入口和协议,从而减少了服务器进行协议适配的成本。In the prior art, when the terminal communicates with the server, it is necessary to adapt the communication protocol of the terminal and the communication protocol of the server. The most commonly used protocol adaptation is the protocol adaptation based on the Enterprise Service Bus (Enterprise Service Bus, ESB for short). The ESB adapts the protocols of different servers to a unified protocol through a unified standard; then the terminal connects with the server through a unified entry and protocol, and then the terminal makes a service call. Since the ESB provides a unified service entry and protocol, the cost of protocol adaptation by the server is reduced.
然而现有技术中,终端依然需要开发出与终端所依据的协议的接口,举例来说,若ESB统一使用简单对象访问协议(Simple Object Access Protocol,简称SOAP)方式进行接口发布,则所有的终端都需要开发出SOAP接口,进而增加了接口改造成本。However, in the prior art, the terminal still needs to develop an interface with the protocol on which the terminal is based. For example, if the ESB uniformly uses the Simple Object Access Protocol (SOAP) for interface publishing, all All need to develop a SOAP interface, thereby increasing the cost of interface transformation.
发明内容SUMMARY OF THE INVENTION
本发明提供一种通信处理方法和装置,用以解决现有技术中增加了接口改造成本的问题。The present invention provides a communication processing method and device to solve the problem of increasing the cost of interface modification in the prior art.
本发明的一方面是提供一种通信处理方法,包括:An aspect of the present invention is to provide a communication processing method, comprising:
接收终端发送的数据请求信息,根据与所述数据请求信息对应的通信协议,提取所述数据请求信息中所承载的数据;receiving the data request information sent by the terminal, and extracting the data carried in the data request information according to the communication protocol corresponding to the data request information;
将所述数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,所述树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;Parsing the data carried in the data request information into a first general data model object of a tree structure, wherein each node in the first general data model object of the tree structure has at least one child node, A sequence is set between the child nodes under a node;
将所述树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;Converting the first general data model object of the tree structure into request data conforming to the server communication protocol;
将符合服务器通信协议的请求数据发送给服务器,以使所述服务器根据符合服务器通信协议的请求数据确定数据响应信息。The request data conforming to the server communication protocol is sent to the server, so that the server determines data response information according to the request data conforming to the server communication protocol.
本发明的另一方面是提供一种通信处理装置,包括:Another aspect of the present invention is to provide a communication processing device, comprising:
第一接收模块,用于接收终端发送的数据请求信息,根据与所述数据请求信息对应的通信协议,提取所述数据请求信息中所承载的数据;a first receiving module, configured to receive the data request information sent by the terminal, and extract the data carried in the data request information according to the communication protocol corresponding to the data request information;
第一解析模块,用于将所述数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,所述树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;A first parsing module, configured to parse the data carried in the data request information into a first general data model object of a tree structure, wherein each node in the first general data model object of the tree structure There is at least one child node under one node, and each child node under one node is set in sequence;
第一转换模块,用于将所述树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;a first conversion module, configured to convert the first general data model object of the tree structure into request data conforming to the server communication protocol;
第一发送模块,用于将符合服务器通信协议的请求数据发送给服务器,以使所述服务器根据符合服务器通信协议的请求数据确定数据响应信息。The first sending module is configured to send the request data conforming to the server communication protocol to the server, so that the server determines data response information according to the request data conforming to the server communication protocol.
本发明的技术效果是:通过接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据;将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息。从而将信息中所承载的数据,放入到树形结构的通用数据模型对象中。将树形结构的通用数据模型对象,转换为符合服务器通信协议的请求数据,将符合服务器通信协议的请求数据发送给服务器。从而提供了一种适用于各通信协议的协议适配方式,减少了协议适配的部署次数、开发次数,提高了协议适配的效率,减少了接口改造成本,且屏蔽了各个基于不同通信协议的系统之间的协议差异。使用协议适配,可以避免客户端和服务端的接口改造,并能够提供统一的访问入口,通过标准数据模型的识别和数据转换,可以快速的生成各种协议的接口数据。The technical effect of the present invention is: by receiving the data request information sent by the terminal, according to the communication protocol corresponding to the data request information, the data carried in the data request information is extracted; the data carried in the data request information is parsed into a tree shape The first general data model object of the structure, wherein each node in the first general data model object of the tree structure has at least one child node, and each child node under one node is set in order; The first general data model object is converted into request data conforming to the server communication protocol; the request data conforming to the server communication protocol is sent to the server, so that the server determines data response information according to the request data conforming to the server communication protocol. Thus, the data carried in the information is put into the general data model object of the tree structure. Convert the tree-structured general data model object into request data conforming to the server communication protocol, and send the request data conforming to the server communication protocol to the server. Therefore, a protocol adaptation method suitable for each communication protocol is provided, which reduces the deployment times and development times of protocol adaptation, improves the efficiency of protocol adaptation, reduces the cost of interface modification, and shields each communication protocol based on different communication protocols. Protocol differences between systems. Using protocol adaptation can avoid interface transformation between client and server, and can provide a unified access entry. Through the identification of standard data models and data conversion, interface data of various protocols can be quickly generated.
附图说明Description of drawings
图1为本发明实施例一提供的通信处理方法的流程图;1 is a flowchart of a communication processing method provided by Embodiment 1 of the present invention;
图2为本发明实施例一提供的通信处理方法的第一通用数据模型对象的基本结构图一;2 is a basic structural diagram 1 of a first general data model object of a communication processing method provided by Embodiment 1 of the present invention;
图3为本发明实施例一提供的通信处理方法的第一通用数据模型对象的基本结构图二;3 is a basic structural diagram 2 of a first general data model object of the communication processing method provided in Embodiment 1 of the present invention;
图4为本发明实施例二提供的通信处理方法的流程图;4 is a flowchart of a communication processing method provided by Embodiment 2 of the present invention;
图5为本发明实施例三提供的通信处理装置的结构示意图;5 is a schematic structural diagram of a communication processing apparatus according to Embodiment 3 of the present invention;
图6为本发明实施例四提供的通信处理装置的结构示意图。FIG. 6 is a schematic structural diagram of a communication processing apparatus according to Embodiment 4 of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
图1为本发明实施例一提供的通信处理方法的流程图,如图1所示,本实施例的方法,包括:FIG. 1 is a flowchart of a communication processing method provided by Embodiment 1 of the present invention. As shown in FIG. 1 , the method of this embodiment includes:
步骤101、接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据。Step 101: Receive the data request information sent by the terminal, and extract the data carried in the data request information according to the communication protocol corresponding to the data request information.
在本实施例中,具体的,本实施例的执行主体为设置在终端与服务器之间的通信处理装置。在本实施例中,通信处理装置采用的接入协议默认支持HTTP和基于TCP的长连接协议,其他类型接口接入需要独立开发接入接口。本发明为扩展接入协议预留了接口,可以通过插件的方式进行扩展。In this embodiment, specifically, the execution subject of this embodiment is a communication processing device provided between the terminal and the server. In this embodiment, the access protocol adopted by the communication processing apparatus supports HTTP and TCP-based long connection protocols by default, and access interfaces of other types need to be independently developed for access. The invention reserves an interface for extending the access protocol, which can be extended by means of a plug-in.
在终端、服务器接入到通信处理装置中之后,终端向通信处理装置发送数据请求信息,从而通信处理装置根据与该数据请求信息对应的通信协议,去提取出数据请求信息中所承载的数据。After the terminal and the server are connected to the communication processing apparatus, the terminal sends data request information to the communication processing apparatus, so that the communication processing apparatus extracts the data carried in the data request information according to the communication protocol corresponding to the data request information.
步骤102、将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序。Step 102: Parse the data carried in the data request information into a first general data model object of a tree structure, wherein each node in the first general data model object of the tree structure has at least one child node, one The sub-nodes under the node are set in sequence.
其中,一个节点中包括了节点的属性、节点的值;一个节点具有多个属性,一个节点具有一个值。Among them, a node includes the attributes of the node and the value of the node; a node has multiple attributes, and a node has a value.
在本实施例中,具体的,通信处理装置将数据请求信息中所承载的数据,解析为一个第一通用数据模型对象,该第一通用数据模型对象为树形结构的第一通用数据模型对象,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序,即由一个根节点和多个子节点组成;每个节点由“属性”和“值”组成,并且其下可以包含若干子节点;同一个节点的多个子节点具有先后顺序;节点的属性是KEY/VALUE的形式,一个节点可以包含多个属性;每个节点只能有一个值,并且值的类型是JAVA Object。从而将数据请求信息中所承载的数据,放入到树形结构的第一通用数据模型对象中。其中,图2为本发明实施例一提供的通信处理方法的第一通用数据模型对象的基本结构图一,第一通用数据模型对象的基本结构如图2所示。In this embodiment, specifically, the communication processing apparatus parses the data carried in the data request information into a first general data model object, where the first general data model object is a tree-structured first general data model object , each node in the first general data model object of the tree structure has at least one child node, and each child node under a node is set in sequence, that is, it consists of a root node and a plurality of child nodes; each node It consists of "attributes" and "values", and can contain several child nodes under it; multiple child nodes of the same node have a sequence; the attributes of the node are in the form of KEY/VALUE, and a node can contain multiple attributes; each A node can only have one value, and the type of the value is JAVA Object. Therefore, the data carried in the data request information is put into the first general data model object of the tree structure. 2 is a basic structure diagram 1 of a first general data model object of a communication processing method according to Embodiment 1 of the present invention, and FIG. 2 shows a basic structure of the first general data model object.
具体来说,本步骤进行的是数据识别,数据识别由脚本语言访问JAVA的通用数据模型来实现,去将数据请求信息写入到JAVA的临时对象中。之后,脚本语言根据不同的接入协议,将数据解析为通用数据模型对象。用户需要针对不同的接入协议自定义解析脚本,自定义的脚本可以进行动态部署并发布。Specifically, in this step, data identification is performed, and the data identification is realized by accessing the general data model of JAVA by a scripting language to write the data request information into the temporary object of JAVA. After that, the scripting language parses the data into common data model objects according to different access protocols. Users need to customize the parsing scripts for different access protocols, and the customized scripts can be dynamically deployed and published.
举例来说,以JSON格式数据为例:For example, take JSON format data as an example:
通过以下脚本进行数据识别,得到树形结构的第一通用数据模型对象:Perform data identification through the following script to obtain the first general data model object of the tree structure:
input参数是数据获取后的字符串,通过数据识别最终形成modelObj对象。图3为本发明实施例一提供的通信处理方法的第一通用数据模型对象的基本结构图二,如图3所示,第一通用数据模型对象为树形图。The input parameter is the string after data acquisition, and the modelObj object is finally formed through data identification. FIG. 3 is a second basic structure diagram of a first general data model object of the communication processing method according to Embodiment 1 of the present invention. As shown in FIG. 3 , the first general data model object is a tree diagram.
步骤103、将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据。Step 103: Convert the tree-structured first general data model object into request data conforming to the server communication protocol.
在本实施例中,具体的,通信处理装置将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据。In this embodiment, specifically, the communication processing apparatus converts the tree-structured first general data model object into request data conforming to the server communication protocol.
步骤104、将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息。Step 104: Send the request data conforming to the server communication protocol to the server, so that the server determines data response information according to the request data conforming to the server communication protocol.
在本实施例中,具体的,通信处理装置将符合服务器通信协议的请求数据发送给服务器,然后服务器根据符合服务器通信协议的请求数据,确定出数据响应信息。In this embodiment, specifically, the communication processing apparatus sends the request data conforming to the server communication protocol to the server, and then the server determines the data response information according to the request data conforming to the server communication protocol.
举例来说,数据模型转换是通过一定的表达式模板将数据模型转换成具体数据格式的过程,以XML格式为例,目标接口数据格式如下:For example, data model conversion is the process of converting a data model into a specific data format through a certain expression template. Taking XML format as an example, the target interface data format is as follows:
采用如下的表达式模板可以生成最终的接口数据,即符合服务器通信协议的请求数据为:The following expression template can be used to generate the final interface data, that is, the request data conforming to the server communication protocol is:
生成的最终数据写入到服务器端的数据响应信息中,实现协议适配。The generated final data is written into the data response information of the server to implement protocol adaptation.
本实施例通过接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据;将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息。从而将信息中所承载的数据,放入到树形结构的通用数据模型对象中。将树形结构的通用数据模型对象,转换为符合服务器通信协议的请求数据,将符合服务器通信协议的请求数据发送给服务器。从而提供了一种适用于各通信协议的协议适配方式,减少了协议适配的部署次数、开发次数,提高了协议适配的效率,减少了接口改造成本,且屏蔽了各个基于不同通信协议的系统之间的协议差异。使用协议适配,可以避免客户端和服务端的接口改造,并能够提供统一的访问入口,通过标准数据模型的识别和数据转换,可以快速的生成各种协议的接口数据。In this embodiment, by receiving the data request information sent by the terminal, according to the communication protocol corresponding to the data request information, the data carried in the data request information is extracted; the data carried in the data request information is parsed into the first tree structure. A general data model object, wherein each node in the first general data model object of the tree structure has at least one child node, and each child node under one node is set in order; The data model object is converted into request data conforming to the server communication protocol; the request data conforming to the server communication protocol is sent to the server, so that the server determines the data response information according to the request data conforming to the server communication protocol. Thus, the data carried in the information is put into the general data model object of the tree structure. Convert the tree-structured general data model object into request data conforming to the server communication protocol, and send the request data conforming to the server communication protocol to the server. Therefore, a protocol adaptation method suitable for each communication protocol is provided, which reduces the deployment times and development times of protocol adaptation, improves the efficiency of protocol adaptation, reduces the cost of interface modification, and shields each communication protocol based on different communication protocols. Protocol differences between systems. Using protocol adaptation can avoid interface transformation between client and server, and can provide a unified access entry. Through the identification of standard data models and data conversion, interface data of various protocols can be quickly generated.
图4为本发明实施例二提供的通信处理方法的流程图,在实施例一的基础上,如图4所示,本实施例的方法,在步骤101之后,还包括:FIG. 4 is a flowchart of the communication processing method provided by the second embodiment of the present invention. On the basis of the first embodiment, as shown in FIG. 4 , the method of this embodiment, after
步骤201、将数据请求信息中所承载的数据,放入到临时存储区中;从临时存储区中读取数据请求信息中所承载的数据。Step 201: Put the data carried in the data request information into a temporary storage area; read the data carried in the data request information from the temporary storage area.
在本实施例中,具体的,通信处理装置将提取出的数据请求信息中所承载的数据,放入到临时存储区中,提取的最终数据以字符串形式进行临时存储;然后,通信处理装置从临时存储区中读取数据请求信息中所承载的数据。In this embodiment, specifically, the communication processing device puts the data carried in the extracted data request information into a temporary storage area, and the final data extracted is temporarily stored in the form of a character string; then, the communication processing device The data carried in the data request message is read from the temporary storage area.
在步骤104之后,还包括:After
步骤202、接收服务器发送的数据响应信息,根据与数据响应信息对应的通信协议,提取数据响应信息中所承载的数据。Step 202: Receive the data response information sent by the server, and extract the data carried in the data response information according to the communication protocol corresponding to the data response information.
在本实施例中,具体的,通信处理装置接收服务器发送的数据响应信息,根据与数据响应信息对应的通信协议,提取数据响应信息中所承载的数据。In this embodiment, specifically, the communication processing apparatus receives the data response information sent by the server, and extracts the data carried in the data response information according to the communication protocol corresponding to the data response information.
步骤203、将数据响应信息中所承载的数据,放入到临时存储区中;从临时存储区中读取数据响应信息中所承载的数据。Step 203: Put the data carried in the data response information into the temporary storage area; read the data carried in the data response information from the temporary storage area.
在本实施例中,具体的,通信处理装置将提取出的数据响应信息中所承载的数据,放入到临时存储区中;从临时存储区中读取数据响应信息中所承载的数据。In this embodiment, specifically, the communication processing apparatus puts the data carried in the extracted data response information into a temporary storage area; and reads the data carried in the data response information from the temporary storage area.
步骤204、将数据响应信息中所承载的数据,解析树形结构的第二通用数据模型对象。Step 204: Parse the data carried in the data response information into the second general data model object of the tree structure.
在本实施例中,具体的,通信处理装置将数据响应信息中所承载的数据,解析树形结构的第二通用数据模型对象,从而将数据响应信息中所承载的数据,放入到树形结构的第二通用数据模型对象中。In this embodiment, specifically, the communication processing apparatus parses the data carried in the data response information into the second general data model object of the tree structure, so as to put the data carried in the data response information into the tree structure structure in the second generic data model object.
在本实施例中,该第二通用数据模型对象为树形结构的第二通用数据模型对象,树形结构的第二通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序,即由一个根节点和多个子节点组成;每个节点由“属性”和“值”组成,并且其下可以包含若干子节点;同一个节点的多个子节点具有先后顺序;节点的属性是KEY/VALUE的形式,一个节点可以包含多个属性;每个节点只能有一个值,并且值的类型是JAVA Object。第二通用数据模型对象的基本结构也如图2所示。In this embodiment, the second general data model object is a tree-structured second general-purpose data model object, and each node in the tree-structured second general-purpose data model object has at least one child node, and each node under one node has at least one child node. There is an order between each child node, that is, it consists of a root node and multiple child nodes; each node consists of "attribute" and "value", and can contain several child nodes under it; multiple child nodes of the same node It has a sequence; the attributes of a node are in the form of KEY/VALUE, and a node can contain multiple attributes; each node can only have one value, and the value type is JAVA Object. The basic structure of the second general data model object is also shown in FIG. 2 .
步骤205、将树形结构的第二通用数据模型对象,转换为符合终端通信协议的响应数据。Step 205: Convert the second general data model object in the tree structure into response data conforming to the terminal communication protocol.
在本实施例中,具体的,通信处理装置将树形结构的第二通用数据模型对象,转换为符合终端通信协议的响应数据。In this embodiment, specifically, the communication processing apparatus converts the tree-structured second general data model object into response data conforming to the terminal communication protocol.
步骤206、将符合终端通信协议的响应数据发送给终端,以使终端接收符合终端通信协议的响应数据。Step 206: Send the response data conforming to the terminal communication protocol to the terminal, so that the terminal receives the response data conforming to the terminal communication protocol.
在本实施例中,具体的,通信处理装置将符合终端通信协议的响应数据发送给终端,以使终端接收符合终端通信协议的响应数据。In this embodiment, specifically, the communication processing apparatus sends the response data conforming to the terminal communication protocol to the terminal, so that the terminal receives the response data conforming to the terminal communication protocol.
本实施例的步骤202-206的执行过程,与步骤101-104、以及步骤201原理相同。The execution process of steps 202-206 in this embodiment is the same as that of steps 101-104 and
本实施例通过接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据;将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息。接收服务器发送的数据响应信息,根据与数据响应信息对应的通信协议,提取数据响应信息中所承载的数据;将数据响应信息中所承载的数据,解析树形结构的第二通用数据模型对象;将树形结构的第二通用数据模型对象,转换为符合终端通信协议的响应数据;将符合终端通信协议的响应数据发送给终端,以使终端接收符合终端通信协议的响应数据。从而将信息中所承载的数据,放入到树形结构的通用数据模型对象中。将树形结构的通用数据模型对象,转换为符合服务器通信协议的请求数据/符合终端通信协议的响应数据,将符合服务器通信协议的请求数据发送给服务器/将符合终端通信协议的响应数据发送给终端。从而提供了一种适用于各通信协议的协议适配方式,减少了协议适配的部署次数、开发次数,提高了协议适配的效率,减少了接口改造成本,且屏蔽了各个基于不同通信协议的系统之间的协议差异。使用协议适配,可以避免客户端和服务端的接口改造,并能够提供统一的访问入口,通过标准数据模型的识别和数据转换,可以快速的生成各种协议的接口数据。In this embodiment, by receiving the data request information sent by the terminal, according to the communication protocol corresponding to the data request information, the data carried in the data request information is extracted; the data carried in the data request information is parsed into the first tree structure. A general data model object, wherein each node in the first general data model object of the tree structure has at least one child node, and each child node under one node is set in order; The data model object is converted into request data conforming to the server communication protocol; the request data conforming to the server communication protocol is sent to the server, so that the server determines the data response information according to the request data conforming to the server communication protocol. Receive the data response information sent by the server, extract the data carried in the data response information according to the communication protocol corresponding to the data response information; parse the data carried in the data response information into the second general data model object of the tree structure; Convert the tree-structured second general data model object into response data conforming to the terminal communication protocol; send the response data conforming to the terminal communication protocol to the terminal, so that the terminal receives the response data conforming to the terminal communication protocol. Thus, the data carried in the information is put into the general data model object of the tree structure. Convert the tree-structured general data model object into request data conforming to the server communication protocol/response data conforming to the terminal communication protocol, and send the request data conforming to the server communication protocol to the server/send the response data conforming to the terminal communication protocol to the terminal. Therefore, a protocol adaptation method suitable for each communication protocol is provided, which reduces the deployment times and development times of protocol adaptation, improves the efficiency of protocol adaptation, reduces the cost of interface modification, and shields each communication protocol based on different communication protocols. Protocol differences between systems. Using protocol adaptation can avoid interface transformation between client and server, and can provide a unified access entry. Through the identification of standard data models and data conversion, interface data of various protocols can be quickly generated.
图5为本发明实施例三提供的通信处理装置的结构示意图,如图5所示,本实施例的装置,包括:FIG. 5 is a schematic structural diagram of a communication processing apparatus according to Embodiment 3 of the present invention. As shown in FIG. 5 , the apparatus of this embodiment includes:
第一接收模块31,用于接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据;The
第一解析模块32,用于将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;The
第一转换模块33,用于将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;The
第一发送模块34,用于将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息。The
其中,一个节点中包括了节点的属性、节点的值;一个节点具有多个属性,一个节点具有一个值。Among them, a node includes the attributes of the node and the value of the node; a node has multiple attributes, and a node has a value.
本实施例的通信处理装置可执行本发明实施例一提供的通信处理方法,其实现原理相类似,此处不再赘述。The communication processing apparatus in this embodiment can execute the communication processing method provided in Embodiment 1 of the present invention, and the implementation principle thereof is similar, and details are not described herein again.
本实施例通过接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据;将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息。从而将信息中所承载的数据,放入到树形结构的通用数据模型对象中。将树形结构的通用数据模型对象,转换为符合服务器通信协议的请求数据,将符合服务器通信协议的请求数据发送给服务器。从而提供了一种适用于各通信协议的协议适配方式,减少了协议适配的部署次数、开发次数,提高了协议适配的效率,减少了接口改造成本,且屏蔽了各个基于不同通信协议的系统之间的协议差异。使用协议适配,可以避免客户端和服务端的接口改造,并能够提供统一的访问入口,通过标准数据模型的识别和数据转换,可以快速的生成各种协议的接口数据。In this embodiment, by receiving the data request information sent by the terminal, according to the communication protocol corresponding to the data request information, the data carried in the data request information is extracted; the data carried in the data request information is parsed into the first tree structure. A general data model object, wherein each node in the first general data model object of the tree structure has at least one child node, and each child node under one node is set in order; The data model object is converted into request data conforming to the server communication protocol; the request data conforming to the server communication protocol is sent to the server, so that the server determines the data response information according to the request data conforming to the server communication protocol. Thus, the data carried in the information is put into the general data model object of the tree structure. Convert the tree-structured general data model object into request data conforming to the server communication protocol, and send the request data conforming to the server communication protocol to the server. Therefore, a protocol adaptation method suitable for each communication protocol is provided, which reduces the deployment times and development times of protocol adaptation, improves the efficiency of protocol adaptation, reduces the cost of interface modification, and shields each communication protocol based on different communication protocols. Protocol differences between systems. Using protocol adaptation can avoid interface transformation between client and server, and can provide a unified access entry. Through the identification of standard data models and data conversion, interface data of various protocols can be quickly generated.
图6为本发明实施例四提供的通信处理装置的结构示意图,在实施例三的基础上,如图6所示,本实施例的装置,还包括:FIG. 6 is a schematic structural diagram of a communication processing apparatus according to Embodiment 4 of the present invention. On the basis of Embodiment 3, as shown in FIG. 6 , the apparatus of this embodiment further includes:
第一存储模块41,用于在第一接收模块31提取数据请求信息中所承载的数据之后,将数据请求信息中所承载的数据,放入到临时存储区中;从临时存储区中读取数据请求信息中所承载的数据。The
第二接收模块42,用于在第一发送模块34将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息之后,接收服务器发送的数据响应信息,根据与数据响应信息对应的通信协议,提取数据响应信息中所承载的数据;The
第二解析模块43,用于将数据响应信息中所承载的数据,解析树形结构的第二通用数据模型对象;The
第二转换模块44,用于将树形结构的第二通用数据模型对象,转换为符合终端通信协议的响应数据;The
第二发送模块45,用于将符合终端通信协议的响应数据发送给终端,以使终端接收符合终端通信协议的响应数据。The
第二存储模块46,用于在第二接收模块42提取数据响应信息中所承载的数据之后,将数据响应信息中所承载的数据,放入到临时存储区中;从临时存储区中读取数据响应信息中所承载的数据。The
本实施例的通信处理装置可执行本发明实施例二提供的通信处理方法,其实现原理相类似,此处不再赘述。The communication processing apparatus in this embodiment can execute the communication processing method provided in Embodiment 2 of the present invention, and the implementation principle thereof is similar, and details are not described herein again.
本实施例通过接收终端发送的数据请求信息,根据与数据请求信息对应的通信协议,提取数据请求信息中所承载的数据;将数据请求信息中所承载的数据,解析为树形结构的第一通用数据模型对象,其中,树形结构的第一通用数据模型对象中的各节点下具有至少一个子节点,一个节点下的各子节点之间设置有先后次序;将树形结构的第一通用数据模型对象,转换为符合服务器通信协议的请求数据;将符合服务器通信协议的请求数据发送给服务器,以使服务器根据符合服务器通信协议的请求数据确定数据响应信息。接收服务器发送的数据响应信息,根据与数据响应信息对应的通信协议,提取数据响应信息中所承载的数据;将数据响应信息中所承载的数据,解析树形结构的第二通用数据模型对象;将树形结构的第二通用数据模型对象,转换为符合终端通信协议的响应数据;将符合终端通信协议的响应数据发送给终端,以使终端接收符合终端通信协议的响应数据。从而将信息中所承载的数据,放入到树形结构的通用数据模型对象中。将树形结构的通用数据模型对象,转换为符合服务器通信协议的请求数据/符合终端通信协议的响应数据,将符合服务器通信协议的请求数据发送给服务器/将符合终端通信协议的响应数据发送给终端。从而提供了一种适用于各通信协议的协议适配方式,减少了协议适配的部署次数、开发次数,提高了协议适配的效率,减少了接口改造成本,且屏蔽了各个基于不同通信协议的系统之间的协议差异。使用协议适配,可以避免客户端和服务端的接口改造,并能够提供统一的访问入口,通过标准数据模型的识别和数据转换,可以快速的生成各种协议的接口数据。In this embodiment, by receiving the data request information sent by the terminal, according to the communication protocol corresponding to the data request information, the data carried in the data request information is extracted; the data carried in the data request information is parsed into the first tree structure. A general data model object, wherein each node in the first general data model object of the tree structure has at least one child node, and each child node under one node is set in order; The data model object is converted into request data conforming to the server communication protocol; the request data conforming to the server communication protocol is sent to the server, so that the server determines the data response information according to the request data conforming to the server communication protocol. Receive the data response information sent by the server, extract the data carried in the data response information according to the communication protocol corresponding to the data response information; parse the data carried in the data response information into the second general data model object of the tree structure; Convert the tree-structured second general data model object into response data conforming to the terminal communication protocol; send the response data conforming to the terminal communication protocol to the terminal, so that the terminal receives the response data conforming to the terminal communication protocol. Thus, the data carried in the information is put into the general data model object of the tree structure. Convert the tree-structured general data model object into request data conforming to the server communication protocol/response data conforming to the terminal communication protocol, and send the request data conforming to the server communication protocol to the server/send the response data conforming to the terminal communication protocol to the terminal. Therefore, a protocol adaptation method suitable for each communication protocol is provided, which reduces the deployment times and development times of protocol adaptation, improves the efficiency of protocol adaptation, reduces the cost of interface modification, and shields each communication protocol based on different communication protocols. Protocol differences between systems. Using protocol adaptation can avoid interface transformation between client and server, and can provide a unified access entry. Through the identification of standard data models and data conversion, interface data of various protocols can be quickly generated.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still be The technical solutions described in the foregoing embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710308721.2A CN107222461B (en) | 2017-05-04 | 2017-05-04 | Communication processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710308721.2A CN107222461B (en) | 2017-05-04 | 2017-05-04 | Communication processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107222461A CN107222461A (en) | 2017-09-29 |
CN107222461B true CN107222461B (en) | 2020-03-13 |
Family
ID=59943782
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710308721.2A Active CN107222461B (en) | 2017-05-04 | 2017-05-04 | Communication processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107222461B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111294320B (en) * | 2018-12-07 | 2022-08-16 | 杭州海康威视系统技术有限公司 | Data conversion method and device |
CN110519254A (en) * | 2019-08-21 | 2019-11-29 | 科大国创软件股份有限公司 | A kind of interactive interfacing protocol fitting method and its system based on script |
CN112217805B (en) * | 2020-09-22 | 2023-05-02 | 江苏方天电力技术有限公司 | Multi-mode protocol adaptation method for power distribution Internet of things |
CN113765872B (en) * | 2020-10-14 | 2023-10-24 | 天翼数字生活科技有限公司 | Method and system for converting and adapting self-adaptive data format |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101499922A (en) * | 2008-02-02 | 2009-08-05 | 华为技术有限公司 | Data conversion method, apparatus, terminal and server |
CN103544154A (en) * | 2012-07-11 | 2014-01-29 | 神州数码信息系统有限公司 | Data format conversion method |
CN104270257A (en) * | 2014-09-10 | 2015-01-07 | 烽火通信科技股份有限公司 | Network element level network management service configuration adaptation system and method based on PB and XPATH |
CN104660547A (en) * | 2013-11-18 | 2015-05-27 | 北京四维图新科技股份有限公司 | Service platform for realizing telecommunications |
CN105139053A (en) * | 2015-10-15 | 2015-12-09 | 江苏本能科技有限公司 | Radio frequency identification reader-writer interface protocol debugging device and method |
-
2017
- 2017-05-04 CN CN201710308721.2A patent/CN107222461B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101499922A (en) * | 2008-02-02 | 2009-08-05 | 华为技术有限公司 | Data conversion method, apparatus, terminal and server |
CN103544154A (en) * | 2012-07-11 | 2014-01-29 | 神州数码信息系统有限公司 | Data format conversion method |
CN104660547A (en) * | 2013-11-18 | 2015-05-27 | 北京四维图新科技股份有限公司 | Service platform for realizing telecommunications |
CN104270257A (en) * | 2014-09-10 | 2015-01-07 | 烽火通信科技股份有限公司 | Network element level network management service configuration adaptation system and method based on PB and XPATH |
CN105139053A (en) * | 2015-10-15 | 2015-12-09 | 江苏本能科技有限公司 | Radio frequency identification reader-writer interface protocol debugging device and method |
Also Published As
Publication number | Publication date |
---|---|
CN107222461A (en) | 2017-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108306877B (en) | NODE JS-based user identity information verification method and device and storage medium | |
CN107222461B (en) | Communication processing method and device | |
US7934252B2 (en) | Filtering technique for processing security measures in web service messages | |
CN100586109C (en) | General business data communication method and system based on custom template | |
CN108337236A (en) | A kind of gRPC call methods and device based on Protobuf and HTTP/1.1 | |
CN112988409B (en) | Interface calling method and device, computer equipment and storage medium | |
CN109274773B (en) | Method, device and system for realizing remote service calling | |
CN108763534B (en) | Method and device for processing information | |
CN105763619B (en) | The method and device that client and server-side are communicated | |
CN110704200B (en) | Method and device for converting calling interface | |
US11330035B2 (en) | Method and server for HTTP protocol-based data request | |
CN111200523A (en) | Middle station system configuration method, device, equipment and storage medium | |
CN102255914A (en) | Android network application program information verification method | |
CN103034700A (en) | Rich text content processing method and system | |
CN115426416A (en) | Protocol conversion method and device, electronic equipment and storage medium | |
CN105955790A (en) | Data processing method and apparatus | |
CN114040018A (en) | Data receiving and transmitting method and device based on JSON data format | |
CN112883088B (en) | Data processing method, device, equipment and storage medium | |
AU2018390863B2 (en) | Computer system and method for extracting dynamic content from websites | |
CN116156012B (en) | Universal heterogeneous Internet of things equipment standardized access and data analysis system and method | |
JP2009265718A (en) | Network device transmitting only difference data of network management information, server, program and method | |
CN111143310B (en) | Log recording method and device and readable storage medium | |
CN113765872B (en) | Method and system for converting and adapting self-adaptive data format | |
CN105791346B (en) | Cross-platform solutions and services for realizing SOAP interface, network equipment | |
CN116483479A (en) | Method, device, equipment and medium for multi-dimension calling interface |
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 |