Message receiving and sending method and device

文档序号:142216 发布日期:2021-10-22 浏览:6次 中文

阅读说明:本技术 一种报文收发方法和装置 (Message receiving and sending method and device ) 是由 黄权益 胡莹 江丽萍 赖俊宏 胡国威 于 2021-07-16 设计创作,主要内容包括:本发明提供一种报文收发方法和装置,该方法包括:对输入的接口进行识别,并自动生成接口报文;其中,接口报文包括固定数据段和内容数据段;固定数据段中的数据与接口对应;对接口报文中的内容数据段进行填充、得到待发送报文;将待发送报文发送至服务器;接收服务器响应的反馈报文;从而实现根据接口自动生成对应的报文,替代了人工组装报文的手工操作,节省工作量和开发成本。(The invention provides a message receiving and transmitting method and a device, wherein the method comprises the following steps: identifying an input interface and automatically generating an interface message; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data section corresponds to the interface; filling a content data segment in the interface message to obtain a message to be sent; sending a message to be sent to a server; receiving a feedback message responded by the server; therefore, the corresponding message is automatically generated according to the interface, manual operation of manually assembling the message is replaced, and workload and development cost are saved.)

1. A method for transmitting and receiving a message, comprising:

identifying an input interface and automatically generating an interface message; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data segment corresponds to the interface;

filling a content data segment in the interface message to obtain a message to be sent;

sending the message to be sent to a server;

and receiving a feedback message responded by the server.

2. The method for messaging according to claim 1, wherein identifying the input interface and automatically generating the interface message comprises:

extracting an interface field in the interface;

classifying the data type of the interface field;

automatically generating message data of the interface according to the selected data format; wherein the fixed data segment carries at least one of the data format and the data type.

3. The messaging method of claim 1, wherein before padding the content data segment in the message data, further comprising:

judging whether the interface message exists in a message database or not;

if the interface message exists, acquiring the interface message from a message database, and adding a message column to the interface message to obtain the message to be sent;

and if the data segment does not exist, filling the content data segment in the interface message to obtain a message to be sent.

4. The method for transceiving messages according to claim 3, wherein after the content data segment in the interface message is filled to obtain the message to be transmitted, the method further comprises:

and storing the message to be sent to a message database, and uploading and synchronizing the message to be sent to each server.

5. The messaging method of claim 1, further comprising, after receiving the feedback message in response from the server:

and performing message format identification, processing and treatment on the feedback message, and simulating page display of a client by performing rendering treatment.

6. The method for transceiving messages according to claim 1, wherein transmitting the message to be transmitted to a server comprises:

inputting the server identification at an address request field;

triggering a sending action.

7. A message transceiver, comprising:

the interface analysis module is used for identifying the input interface and automatically generating an interface message; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data segment corresponds to the interface; filling the content data segment in the interface message to obtain a message to be sent;

the message sending module is used for sending the message to be sent to a server;

and the message receiving module is used for receiving the feedback message responded by the server.

8. The message transceiver according to claim 7, wherein the interface parsing module is configured to, when identifying an input interface and automatically generating an interface message, specifically:

extracting an interface field in the interface;

classifying the data type of the interface field;

automatically generating message data of the interface according to the selected data format; wherein the fixed data segment carries at least one of the data format and the data type.

9. The messaging device of claim 7, wherein the interface parsing module is further configured to:

judging whether the interface message exists in a message database or not;

if the interface message exists, acquiring the interface message from a message database, and adding a message column to the interface message to obtain the message to be sent;

and if the data segment does not exist, filling the content data segment in the interface message to obtain a message to be sent.

10. The messaging device of claim 9, further comprising:

and the message synchronization module is used for storing the message to be sent to a message database and uploading and synchronizing the message to be sent to each server.

Technical Field

The present invention belongs to the field of message processing technologies, and in particular, to a method and an apparatus for transmitting and receiving a message.

Background

The current project design is increasingly complex, the systems are frequently coupled, the project is due to coordination problem of one or more resources and heavy assets are in short supply and short demand, when a network program and a webpage B/S (Browser/Server) mode program are developed or debugged in development and test, a message simulation test tool is needed to be used for simulating a client to realize message sending and receive, so that the request of the webpage is quickly tracked, and the progress of research and development or test is improved.

At present, a message simulation test tool in the market can only send a local group message by a single person, and the http request method of the message simulation test tool only uses a post method; that is, for the sending message of the interface, each development needs to be manually assembled by a single person locally according to the individual needs, and the manual assembly is difficult to avoid having differences and errors, thereby increasing the workload and the development cost.

Disclosure of Invention

In view of this, an object of the present invention is to provide a method and an apparatus for receiving and sending a message, which are used to automatically generate a message according to different interfaces, and save workload and development cost.

The first aspect of the present invention discloses a method for transmitting and receiving a message, which comprises:

identifying an input interface and automatically generating an interface message; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data segment corresponds to the interface;

filling a content data segment in the interface message to obtain a message to be sent;

sending the message to be sent to a server;

and receiving a feedback message responded by the server.

Optionally, identifying the input interface and automatically generating an interface message includes:

extracting an interface field in the interface;

classifying the data type of the interface field;

automatically generating message data of the interface according to the selected data format; wherein the fixed data segment carries at least one of the data format and the data type.

Optionally, before filling the content data segment in the message data, the method further includes:

judging whether the interface message exists in a message database or not;

if the interface message exists, acquiring the interface message from a message database, and adding a message column to the interface message to obtain the message to be sent;

and if the data segment does not exist, filling the content data segment in the interface message to obtain a message to be sent.

Optionally, after the content data segment in the interface message is filled to obtain the message to be sent, the method further includes:

and storing the message to be sent to a message database, and uploading and synchronizing the message to be sent to each server.

Optionally, after receiving the feedback packet responded by the server, the method further includes:

and performing message format identification, processing and treatment on the feedback message, and simulating page display of a client by performing rendering treatment.

Optionally, sending the message to be sent to a server includes:

inputting the server identification at an address request field;

triggering a sending action.

A second aspect of the present invention discloses a message transceiver, including:

the interface analysis module is used for identifying the input interface and automatically generating an interface message; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data segment corresponds to the interface; filling the content data segment in the interface message to obtain a message to be sent;

the message sending module is used for sending the message to be sent to a server;

and the message receiving module is used for receiving the feedback message responded by the server.

Optionally, the interface parsing module is configured to identify an input interface and automatically generate an interface packet, and is specifically configured to:

extracting an interface field in the interface;

classifying the data type of the interface field;

automatically generating message data of the interface according to the selected data format; wherein the fixed data segment carries at least one of the data format and the data type.

Optionally, the interface parsing module is further configured to:

judging whether the interface message exists in a message database or not;

if the interface message exists, acquiring the interface message from a message database, and adding a message column to the interface message to obtain the message to be sent;

and if the data segment does not exist, filling the content data segment in the interface message to obtain a message to be sent.

Optionally, the method further includes:

and the message synchronization module is used for storing the message to be sent to a message database and uploading and synchronizing the message to be sent to each server.

As can be seen from the foregoing technical solutions, a method for transmitting and receiving a message provided by the present invention includes: identifying an input interface and automatically generating an interface message; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data section corresponds to the interface; filling a content data segment in the interface message to obtain a message to be sent; sending a message to be sent to a server; receiving a feedback message responded by the server; therefore, the corresponding message is automatically generated according to the interface, manual operation of manually assembling the message is replaced, and workload and development cost are saved.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

Fig. 1 is a schematic diagram of a message transceiver provided in the prior art;

fig. 2 is a flowchart of a message transceiving method according to an embodiment of the present invention;

fig. 3 is a flowchart of another message transceiving method according to an embodiment of the present invention;

fig. 4 is a flowchart of another message transceiving method according to an embodiment of the present invention;

fig. 5 is a schematic diagram of a message transceiver according to an embodiment of the present invention.

Detailed Description

In order to make the objects, 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 drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but 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.

In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

It should be noted that the conventional message transceiver is composed of three basic fields, as shown in fig. 1. The system comprises an address request column, a send button and a message composition column. Sending the message to a corresponding server through a send button according to the url input by the address request column; the message data to be sent is defined in the message composition column. The defined message needs to be manually assembled, and one interface is manually assembled once; the manual assembly is inevitably different and wrong, and the workload and the development cost are increased.

Based on this, the embodiment of the present invention provides a message transceiving method, which is used to solve the problems in the prior art that manual assembly inevitably has differences and errors, and the workload and the development cost are increased.

Referring to fig. 2, the method for transmitting and receiving a message includes:

s101, identifying the input interface and automatically generating an interface message.

The interface message comprises a fixed data segment and a content data segment; the data in the fixed data segment corresponds to the interface.

Specifically, the input interface is identified, and interface information, such as interface type, is obtained; and generating an interface message corresponding to the interface information according to the interface information. The data of the fixed data segment in the interface message can be obtained according to the interface information, and the data of the content data segment needs to be filled.

A message is a data unit exchanged and transmitted in a network, i.e. a data block to be sent by a station at one time. The message is also a unit of network transmission, and is continuously encapsulated into packets, packets and frames for transmission in the transmission process, wherein the encapsulation mode is to add some information sections, namely data with message headers organized in a certain format.

S102, filling the content data segment in the interface message to obtain a message to be sent.

After the content data segment in the interface message is filled, a complete message, namely a message to be sent, is obtained.

The content of the specific filling is not specifically limited herein, and is within the protection scope of the present application as the case may be.

S103, sending the message to be sent to a server.

In practical application, the specific process of step S103 is: firstly, inputting a server identifier at an address request bar; then, a send action is triggered.

Specifically, the assembled message data is sent to the server, and url (Uniform Resource Locator) of the server may be maintained to implement user sharing.

And S104, receiving a feedback message responded by the server.

Receiving a message responded by the server, and forwarding the message to other servers, or acquiring data in the feedback message; of course, the data in the feedback message may also be processed, which is not specifically limited herein and is within the protection scope of the present application as the case may be.

In this embodiment, an input interface is identified, and an interface message is automatically generated; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data section corresponds to the interface; filling a content data segment in the interface message to obtain a message to be sent; sending a message to be sent to a server; receiving a feedback message responded by the server; therefore, the corresponding message is automatically generated according to the interface, manual operation of manually assembling the message is replaced, and workload and development cost are saved.

In practical applications, referring to fig. 3, the specific process of step S101 includes:

s201, extracting interface fields in the interface.

S202, classifying the data type of the interface field.

And S203, automatically generating message data of the interface according to the selected data format.

The fixed data segment carries at least one of a data format and a data type.

Specifically, the input interface is identified to extract fields in the interface, distinguish the data types of the interface fields, and automatically generate the message of the interface according to the selected data format.

It should be noted that, in the design process, developers need to consider the format of the interface, the inclusion relationship of the interface fields, and the type of field data, and on the basis of ensuring normal analysis of the interface, the adaptive interface analysis design of the device is realized, and the interfaces in various formats are accurately analyzed, so that the adaptability and fault tolerance of the device are expanded, the obstacle in the project development process is reduced, and the agility of the project is improved.

In this embodiment, the message is automatically generated through the parsing interface, so that the problem that manual message grouping takes labor and time is solved, and the possibility of errors of manual message grouping can be avoided.

In practical applications, referring to fig. 4, before step S102, the method further includes:

s105, judging whether the interface message exists in the message database.

Specifically, it may be determined whether the identifier of the interface packet exists in the packet database, and if so, it is determined that the interface packet exists in the packet database, and if not, it is determined that the interface packet does not exist in the packet database.

If yes, executing step S106; if not, step S102 is executed.

S106, obtaining the interface message from the message database, and adding a message column to the interface message to obtain a message to be sent.

In practical applications, after step S102, the method further includes:

and storing the message to be sent to a message database, and uploading and synchronizing the message to be sent to each server.

It should be noted that, for the messages sent through the same interface, each developer needs to manually assemble the messages locally by a single person according to personal needs, that is, the same messages need to be manually assembled repeatedly, so that it is difficult to form uniform management and configuration, a large amount of human resources and time are consumed, and workload and development cost are increased.

In this embodiment, after the message to be sent corresponding to the interface is generated, the message data can be synchronized to the server by storing, so that the message data can be shared, and the shared message data can be displayed to all users. By means of message data sharing, when multiple persons develop and test at the same time, the problems that messages are repeatedly assembled on the same interface, and workload and development cost are too high are solved, and the agility of projects is improved.

In any of the above embodiments, after step S104, the method further includes: and performing message format identification, processing and treatment on the feedback message, and simulating page display of the client by performing rendering treatment.

Specifically, message format recognition is carried out on the received feedback message, data processing and processing are carried out on the feedback message, page display of a client side is simulated through rendering processing, and the correctness and the adaptability of the result are visually confirmed.

It should be noted that, in the prior art, message data responded by the server is displayed in a message bar in a plain text format, so that the visualization effect is not good, the readability is poor, a visual page returned by the message cannot be visually seen, the correctness and the adaptability of the result are difficult to confirm, and the confirmation of the expected result is not visual.

In the embodiment, the rendering display of the data is responded, the returned data format is adaptively identified, the returned message data is automatically analyzed, the rendering simulation client display is carried out, and the visual verification of the expected result is realized.

Another embodiment of the present invention provides a message transceiver, referring to fig. 5, including: the interface analysis module 10, the message sending module 20 and the message receiving module 30.

The interface analysis module 10 is used for identifying an input interface and automatically generating an interface message; the interface message comprises a fixed data segment and a content data segment; the data in the fixed data section corresponds to the interface; and filling the content data segment in the interface message to obtain a message to be sent.

The message sending module 20 is configured to send a message to be sent to a server.

And the message receiving module 30 receives a feedback message responded by the server.

For details of the specific working processes of the interface analysis module 10, the message sending module 20, and the message receiving module 30, reference is made to the message receiving and sending method provided in any of the above embodiments, which is not described herein any more, and all of which are within the protection scope of the present application.

In practical application, the specific process of the interface parsing module 10 for identifying the input interface and automatically generating the interface message is as follows:

extracting an interface field in an interface; classifying the data type of the interface field; and automatically generating the message data of the interface according to the selected data format.

The fixed data segment carries at least one of a data format and a data type.

In practical applications, the interface parsing module 10 is further configured to:

and judging whether the interface message exists in the message database.

If the interface message exists, the interface message is obtained from the message database, and a message column is added to the interface message to obtain a message to be sent.

If not, the step of filling the content data segment in the interface message to obtain the message to be sent is executed.

In practical application, the message transceiver further includes: a message synchronization module 40.

And the message synchronization module 40 is configured to store the message to be sent to a message database, and upload and synchronize the message to be sent to each server.

Specifically, the following description is directed to the respective modules:

the interface analysis module 10: which is a module that identifies interfaces and automatically generates messages. The method is specifically used for identifying an input interface to extract fields in the interface, distinguishing data types of the fields of the interface, and automatically generating message data of the interface according to a selected data format; the interface recognition mechanism supports the self-adaptive recognition of the input interface, and can recognize interfaces with various formats. By means of the automatic message generation mode through the analysis interface, the problem that manual message grouping costs labor and time is solved, and the possibility of errors of manual message grouping can be avoided.

The message synchronization module 40: which is a module that stores messages and synchronizes to the server. The method is specifically used for storing the message data generated by the interface analysis module, uploading and synchronizing the message data to the server, and realizing the sharing of the message data. That is, the synchronous uploading mechanism supports all development tests to share the generated message data, one-time interface message generation and repeated use by multiple persons, improves the reuse rate of the same interface message, avoids the problem that the workload and the development cost are too high when the same interface repeatedly assembles the message when the multiple persons simultaneously develop and test, reduces the repeated manual message assembly operation, namely improves the development rate of the project, improves the agility of the project, and effectively reduces the workload and the development cost.

The message sending module 20: which is a module that sends messages to the server where the program is located. The method is specifically used for sending the assembled message data to a target server, and a URL (Uniform Resource Locator) of the target server can be maintained to realize user sharing.

The message receiving module 30: which is a module that receives the response server return data. The method is specifically used for receiving message data returned by a server where a program is located in response, then performing message format identification, processing and processing the data, simulating page display of a client by performing rendering processing, and visually confirming the correctness and the adaptability of a result; namely, the rendering display of the response data, the self-adaptive identification of the returned data format, the automatic analysis of the returned message data, the rendering simulation client display, and the realization of the visual verification of the expected result. The program is a program of the message transmitting and receiving device.

In the embodiment, the traditional manual message assembling mode is replaced by an interface identification mechanism, so that the accuracy of message data assembling is guaranteed, the difference generated by manually assembling messages is eliminated, and the forward development of project development is powerfully promoted; through a synchronous uploading mechanism, message data sharing is realized, unified management of configuration is formed, the accuracy and consistency of interface messages are guaranteed, the labor cost for repeatedly assembling the messages is effectively reduced, the method is suitable for complex scenes in which multiple persons develop and test are carried out simultaneously, and the project agility is favorably improved; the analysis processing of the message data in various formats is realized through a multi-format message rendering visualization mechanism, the message data are dynamically rendered and displayed, and the page is loaded at millisecond level and is adapted to the message data returned by various external systems; finally, the purposes of quickly debugging interfaces and effectively detecting expected results in a large project with multiple system associations and multiple groups of members developing simultaneously are achieved.

Features described in the embodiments in the present specification may be replaced with or combined with each other, and the same and similar portions among the embodiments may be referred to each other, and each embodiment is described with emphasis on differences from other embodiments. In particular, the system or system embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the descriptions of the method embodiments for related points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.

Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于区块链共享充电桩的互联互通系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类