A method and device for message protocol conversion

By generating mapping templates and target fields based on message feature domains, the problem of long and poor expansion of message conversion in the existing technology is solved, low-code development and automated interface document generation is realized, and the universality of system interaction is improved. efficiency.

CN115103034BActive Publication Date: 2024-12-10JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 17 Cites 0 Cited by

Patent Information

Application Number
CN202210733438.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2024-12-10
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

In the prior art, the development cycle of message conversion is long, hard-coded, poor scalability, and lack of a unified protocol conversion solution, resulting in a large workload of interface document maintenance.

Method used

By determining the mapping template based on the feature domain in the message, generating the target field, and generating the corresponding target message based on the message style and message header in the service scenario, low-code development and automated interface document generation are realized.

Benefits of technology

It avoids hard-coded development, improves development efficiency, realizes message conversion in multiple business scenarios, simplifies interface document generation, and improves the universality and scalability of system interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115103034B_ABST
    Figure CN115103034B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for message protocol conversion, which relates to the field of computer technology. A specific implementation of the method includes: determining one or more feature domains from a first message, and determining mapping templates corresponding to the one or more feature domains; the feature domain indicates the business scenario corresponding to the first message; generating one or more target fields corresponding to the one or more feature domains according to the mapping template; determining the target message body or target message header to which the one or more target fields belong according to the message body and message header under the business scenario; generating a second message corresponding to the first message according to the target message body and target message header. This implementation can avoid hard coding and develop in a low-code manner to improve development efficiency. At the same time, it can automatically generate interface documents with one click without manual writing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for message protocol conversion. Background Art

[0002] At present, the application service systems of different institutions usually have differences in message formats and contents, which to some extent affects the system interaction between different institutions. In the prior art, the corresponding message conversion codes are often customized and developed in a hard-coded manner according to different access channels and different message formats.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: the hard-coded development cycle is long, code needs to be developed for each interface, and it is not easy to maintain and has poor scalability; there is no unified protocol conversion solution and it is not universal; the interface document needs to be manually written and maintained, which is a lot of work. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a method and device for message protocol conversion, which can achieve different mapping templates according to different business scenarios by determining one or more mapping templates corresponding to the first message according to one or more characteristic domains in the first message, and achieve targeted message conversion in different business scenarios; generate one or more target fields corresponding to one or more characteristic domains according to the mapping template, and determine the target message body or target message header to which the one or more target fields belong according to the message body and message header under the business scenario, and generate a second message corresponding to the first message according to the target message body and target message header, so that multiple target fields corresponding to multiple characteristic domains can be respectively attributed to the target message body or target message header, so as to achieve the purpose of merging different business scenarios in the first message into the second message. Through the above process, hard coding can be avoided, and development can be carried out in a low-code manner to improve development efficiency. At the same time, interface documents can be automatically generated with one click without manual writing.

[0005] To achieve the above objective, according to one aspect of an embodiment of the present invention, a method for message protocol conversion is provided.

[0006] A method for message protocol conversion in an embodiment of the present invention includes: determining one or more characteristic domains from a first message, and determining mapping templates corresponding to the one or more characteristic domains respectively; the characteristic domains indicate a business scenario corresponding to the first message; generating one or more target fields corresponding to the one or more characteristic domains according to the mapping template; determining a target message body or target message header to which the one or more target fields belong according to a message body and a message header under the business scenario; and generating a second message corresponding to the first message according to the target message body and the target message header.

[0007] Optionally, the mapping template is preconfigured according to a plurality of preset feature domains and a target field corresponding to each of the feature domains.

[0008] Optionally, the mapping template includes: field name, field type, parent field and field value.

[0009] Optionally, when the first message / the second message is in Fix protocol, the field value in the mapping template is in FixPath format.

[0010] Optionally, determining the target message body or target message header to which the one or more target fields belong includes: taking each of the target fields as the current field, and looping through the following steps until the target root node corresponding to the current field is determined: determining the parent field corresponding to the current field according to the tree structure corresponding to the business scenario, and taking the parent field as the current field; the root node of the tree structure is the message body and message header; and determining the target message body or target message header to which each of the target fields belongs according to the target root node.

[0011] Optionally, when a new business scenario is added, a new feature domain corresponding to the new business scenario is set; one or more corresponding new target fields are determined based on the new feature domain; and a new mapping template is configured based on the new feature domain and one or more new target fields.

[0012] Optionally, when there are multiple feature domains, the multiple feature domains respectively indicate the business scenario, and the business action under the business scenario; determining the mapping templates corresponding to the one or more feature domains respectively includes: determining the mapping templates corresponding to the business scenario and the business action respectively.

[0013] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for message protocol conversion is provided.

[0014] A device for message protocol conversion according to an embodiment of the present invention includes:

[0015] A template determination module, used to determine one or more feature domains from the first message, and determine mapping templates corresponding to the one or more feature domains; the feature domains indicate the business scenario corresponding to the first message;

[0016] A field generation module, configured to generate one or more target fields corresponding to the one or more feature domains according to the mapping template;

[0017] A message determination module, used to determine a target message body or a target message header to which the one or more target fields belong according to the message body and the message header in the business scenario;

[0018] A message generation module is used to generate a second message corresponding to the first message according to the target message body and the target message header.

[0019] Optionally, the device further comprises: a configuration module, configured to preconfigure the mapping template according to a plurality of preset feature domains and a target field corresponding to each of the feature domains.

[0020] Optionally, the mapping template includes: field name, field type, parent field and field value.

[0021] Optionally, when the first message / the second message is in Fix protocol, the field value in the mapping template is in FixPath format.

[0022] Optionally, the message determination module is further used to take each of the target fields as the current field, and loop through the following steps until a target root node corresponding to the current field is determined: determining a parent field corresponding to the current field according to a tree structure corresponding to the business scenario, and taking the parent field as the current field; the root nodes of the tree structure are the message body and the message header;

[0023] According to the target root node, the target message body or the target message header to which each of the target fields belongs is determined.

[0024] Optionally, the configuration module is also used to, when a new business scenario is added, set a new feature domain corresponding to the new business scenario; determine one or more corresponding new target fields based on the new feature domain; and configure a new mapping template based on the new feature domain and one or more new target fields.

[0025] Optionally, in the case where there are multiple feature domains, the multiple feature domains respectively indicate the business scenario and the business action under the business scenario;

[0026] The template determination module is further used to determine mapping templates corresponding to the business scenario and the business action respectively.

[0027] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device for storing blockchain data is provided.

[0028] An electronic device for storing blockchain data according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a method for storing blockchain data according to an embodiment of the present invention.

[0029] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided.

[0030] A computer-readable storage medium according to an embodiment of the present invention stores a computer program, which, when executed by a processor, implements a method for storing blockchain data according to an embodiment of the present invention.

[0031] An embodiment of the above invention has the following advantages or beneficial effects: by determining one or more mapping templates corresponding to the first message according to one or more characteristic domains in the first message, it is possible to obtain different mapping templates according to different business scenarios, and achieve targeted message conversion in different business scenarios; one or more target fields corresponding to one or more characteristic domains are generated according to the mapping template, and the target message body or target message header to which one or more target fields belong is determined according to the message body and message header under the business scenario, and a second message corresponding to the first message is generated according to the target message body and target message header, so that multiple target fields corresponding to multiple characteristic domains can be respectively attributed to the target message body or target message header, so as to achieve the purpose of merging different business scenarios in the first message into the second message. Through the above process, hard coding can be avoided, development can be carried out in a low-code manner, and development efficiency can be improved. At the same time, interface documents can be automatically generated with one click without manual writing.

[0032] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0034] Figure 1 is a schematic diagram of the main process of the method for message protocol conversion according to an embodiment of the present invention;

[0035] Figure 2 is a schematic diagram of the main process of configuring a mapping template according to an embodiment of the present invention;

[0036] Figure 3 is a schematic diagram of the main process when adding a new service scenario according to an embodiment of the present invention;

[0037] Figure 4It is a schematic diagram of a main process of determining a target message body or a target message header to which one or more target fields belong according to an embodiment of the present invention;

[0038] Figure 5 is a schematic diagram of main modules of a device for message protocol conversion according to an embodiment of the present invention;

[0039] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0040] Figure 7 It is a structural diagram of a computer system of a terminal device or a blockchain node suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0042] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.

[0043] Figure 1 It is a schematic diagram of the main process of the method for message protocol conversion according to an embodiment of the present invention.

[0044] like Figure 1 As shown, the method for message protocol conversion in an embodiment of the present invention mainly includes:

[0045] Step S101: determining one or more feature fields from a first message, and determining mapping templates corresponding to the one or more feature fields respectively; the feature fields indicate a business scenario corresponding to the first message;

[0046] Step S102: generating one or more target fields corresponding to one or more feature domains according to the mapping template;

[0047] Step S103: determining a target message body or target message header to which one or more target fields belong according to the message body and message header in the business scenario;

[0048] Step S104: Generate a second message corresponding to the first message according to the target message body and the target message header.

[0049] Among them, the first message and the second message are message protocols of different formats. The protocol format of the first message and the second message can be any one of FIX (Financial Information Exchange Protocol) message, XML (Extensible Markup Language) message, or JSON (JavaScript Object Notation, an open standard data exchange format based on a subset of JavaScript syntax) message.

[0050] It should be noted that the feature domain in the embodiment of the present invention is an identifier that can represent a business scenario (business type), including but not limited to digital codes, string codes, etc. The mapping template in the embodiment of the present invention defines the correspondence between the fields in the first message and the target fields in different feature domains, that is, after the feature domain is determined, one or more target fields corresponding to the feature domain can be generated according to the corresponding template.

[0051] The message protocol is usually composed of a message header and a message body. The message header is shown in Table 1 below and may include global fields such as the notification time, notification feedback address, service code, and notification type of the message.

[0052] Table 1 Message header structure

[0053] Serial number Fields type name 1 channel varchar(32) Trading Channel 2 action varchar(32) Business Code 3 notify_time varchar(32) Notification time 4 notify_type varchar(32) Notification Type 5 order_sn varchar(64) Order number 6 out_sn varchar(64) Commission No. 7 body JSON Object Push content 8 signature varchar(256) Message Signature 9 context varchar Context 10 receive_time number Receiving time 11 transact_time varchar(256) Business occurrence time 12 quote_id varchar(256) Quote Number 13 ext varchar(256) Extension Fields

[0054] The message body usually includes the specific content of the message. Taking the transaction type message as an example, as shown in Table 2 below, the message body may include the client code, transaction price, quotation amount, transaction account, order type, etc. Therefore, it is necessary to classify the one or more target fields obtained by the first message conversion to determine whether they specifically belong to the message header or the message body, and then obtain a complete second message.

[0055] Table 2 Message structure

[0056] Serial number Fields type name 1 cl_ord_id varchar(32) Customer Reference Number 2 quote_status int(3) Quote Status 3 quote_id varchar(32) Quote Number 4 transact_time datetime Business occurrence time 5 bond_id varchar(32) Bond Code 6 side varchar(2) Trading direction 7 maturity_yield numeric(7,4) Yield to Maturity 8 strike_yield numeric(7,4) Exercise yield 9 price numeric(7,4) Net Price 10 dirty_price numeric(7,4) Full price 11 accrued_interest_amt numeric(18,5) Accrued interest 12 order_qty int(11) Total par value 13 trade_cash_amt numeric(18,2) Transaction amount 14 accrued_interest_total_amt numeric(18,5) Total accrued interest 15 settl_curr_amt numeric(18,2) Settlement amount 16 settl_currency varchar(8) Settlement currency 17 settl_curr_fx_rate numeric(12,6) exchange rate 18 delivery_type int(3) Settlement Method 19 clearing_method int(3) Liquidation Type 20 settl_type int(1) Clearing speed 21 settl_date date Settlement Date 22 user_reference1 varchar(20) User reference data 1 23 user_reference2 varchar(20) User reference data 2 24 user_reference3 varchar(20) User reference data 3 25 user_reference4 varchar(20) User reference data 4 26 user_reference5 varchar(20) User reference data 5 27 user_reference6 varchar(20) User reference data 6 28 initiator_party_id varchar(32) 21-digit code of the sender's transaction account 29 initiator_person varchar(32) Sender trader ID 30 counter_party_id varchar(32) 21-digit code of the recipient's transaction account 31 counter_party_person varchar(32) Recipient trader ID

[0057] In an optional embodiment, the target fields contained in the mapping templates corresponding to different feature domains in the embodiments of the present invention are all different, that is, there will be no duplication of target fields. Exemplarily, when the feature domain is a digital code representing the sale of current securities, the corresponding template is a current securities sale template, and the target fields therein are all fields related to the sale of current securities, such as the current securities amount, current securities type, current securities settlement method, etc. When the feature domain is a digital code representing a pledged repurchase, the corresponding template is a pledged repurchase template, and the target fields therein are all fields related to the pledged repurchase, such as the pledged repurchase amount, pledged repurchase type, pledged repurchase settlement method, etc.

[0058] The embodiment of the present invention, through the above steps, first splits the messages of different business scenarios according to the characteristic domain in the first message, then obtains one or more target fields under each business scenario according to the mapping template corresponding to each characteristic domain, and finally determines the location (message body or message header) of the target field. This can realize the one-time conversion of the content of each business scenario in the first message into the second message, without the need to convert the message content of a certain business scenario separately each time.

[0059] In an optional embodiment, the mapping template is pre-configured according to a plurality of preset feature domains and a target field corresponding to each of the feature domains. Therefore, before step S101, it is necessary to pre-configure corresponding mapping templates according to different feature domains, such as Figure 2 As shown, it includes: step S201: determining the target field corresponding to each feature domain according to one or more preset feature domains; step S202: configuring one or more mapping templates according to the feature domains and the target fields corresponding to the feature domains; the mapping templates include multiple target fields.

[0060] In the actual application process, the characteristic domain is set according to the business scenario, the protocol format of the first message and the protocol format of the second message. For the first message of the same protocol format, each time a business scenario appears, a preset characteristic domain will be set accordingly, and the target field required to be included in the mapping template corresponding to the characteristic domain will be set at the same time. For first messages of different protocol formats, even if they are the same business scenarios, different characteristic domains will correspond. For example, when the protocol format of the first message is the Fix protocol, the protocol type of the second message to be converted is the JSON protocol, and the business scenario is the current bond trading, the corresponding characteristic domain is 10010. When the protocol format of the first message is the JSON protocol, the protocol type of the second message to be converted is the Fix protocol, and the business scenario is also the current bond trading, the corresponding characteristic domain is 10020. Therefore, according to the characteristic domain, the protocol type of the first message, the protocol type of the second message to be converted, and the corresponding business scenario can be determined.

[0061] When there is a new business scenario, it is necessary to set a new feature domain for the new business scenario. In an optional embodiment, Figure 3 As shown, including:

[0062] Step S301: when a new business scenario is added, a new feature domain corresponding to the new business scenario is set;

[0063] Step S302: determining one or more corresponding new target fields according to the new feature domain;

[0064] Step S303: configuring a new mapping template according to the new feature domain and one or more new target fields.

[0065] In a further optional embodiment, the mapping template may include: field name, field type, parent field and field value. When the first message / second message is in Fix protocol, the field value in the mapping template is in FixPath format.

[0066] The FixPath format is a code format written using the FixPath expression. The FixPath expression can quickly obtain the field value of the specified field from the message of the Fix protocol. The expression syntax format consists of N syntax blocks "{}", and different "{}" are connected by "." to represent the superior and subordinate relationship of the field, such as {A}.{B}.{C}...{N}. Exemplarily, as shown in Table 3 below, the following table is the Quote(S) message of the foreign exchange trading center, which is used to send, modify quotes, receive quotes and provide quote query feedback. In order to obtain the corresponding element value under a specific feature domain, when the FixPath expression is {453}.{802[{803}==135]}.{523}, the meaning of the corresponding specific code is to take the 802 domain field under the 453 domain, but there are multiple repeating groups under the 802 domain, and take the value of the 523 domain under the repeating group with the 803 domain value of 135. In a further optional embodiment, the FixPath expression can be parsed using antlr grammar rules.

[0067] Table 3 Quote(S) message of foreign exchange trading center

[0068]

[0069] Regarding the step of determining the target message body or target message header to which one or more target fields belong in step S103, in an optional embodiment, Figure 4 As shown, including:

[0070] Step S401: Take each target field as the current field, and loop through the following steps until the target root node corresponding to the current field is determined: determine the parent field corresponding to the current field according to the tree structure corresponding to the business scenario, and take the parent field as the current field; the root nodes of the tree structure are the message body and the message header;

[0071] Step S402: According to the target root node, determine the target message body or target message header to which each target field belongs.

[0072] Through the above step S401, the subordinate relationship between each target field can be determined according to the parent field corresponding to each target, and the relationship is associated layer by layer, and finally it is determined whether the position to which the target field belongs is the message body or the message header. After determining the position to which it belongs, the target message body or the target message header containing the target field is obtained according to the subordinate relationships at all levels.

[0073] In an optional embodiment of the present invention, in addition to setting different feature fields according to different business scenarios, different feature fields may also be set according to different business actions. Wherein, a business action is an operation representing the execution of a business, such as buy, sell, deposit, withdraw, etc. It should be noted that the feature field in the first message cannot only have a feature field representing a business action, but not a feature field representing a business scenario.

[0074] In an optional embodiment, when there are multiple feature domains, the multiple feature domains respectively indicate business scenarios, and business actions under the business scenarios; determining the mapping templates corresponding to the one or more feature domains respectively includes: determining the mapping templates corresponding to the business scenarios and business actions respectively.

[0075] Exemplarily, the characteristic domain of the business scenario of spot bond trading is 10010, the characteristic domain of the business action of buying is 11, and the characteristic domain of the business action of selling is 12. When the characteristic domain in the first message is 11-10010, it indicates that the specific business of the first message is buying spot bonds. When the characteristic domain in the first message is 12-10010, it indicates that the specific business of the first message is selling spot bonds.

[0076] The conversion of the first message and the second message is specifically described below, wherein the first message is a message in the JSON protocol format, and each field is recorded in the form of "field name": "field value", for example, "price": 2.25000 means that the price value is 2.2500, indicating that the net price is 2.2500. After conversion by the message protocol conversion method in the embodiment of the present invention, the second message is a message of the Fix protocol. It should be noted that in the second message, each field is recorded in the form of "field domain" = "field value", so "price": 2.2500 corresponds to 44 = 2.2500 after mapping, which means that the 44 domain is equal to 2.2500. Among them, the 44 domain corresponds to the net price.

[0077] According to the method of message protocol conversion of an embodiment of the present invention, by determining one or more mapping templates corresponding to the first message according to one or more characteristic domains in the first message, it is possible to obtain different mapping templates according to different business scenarios and implement targeted message conversion in different business scenarios; one or more target fields corresponding to one or more characteristic domains are generated according to the mapping templates, and the target message body or target message header to which the one or more target fields belong is determined according to the message body and message header under the business scenario, and a second message corresponding to the first message is generated according to the target message body and target message header, so that multiple target fields corresponding to multiple characteristic domains can be respectively attributed to the target message body or target message header, so as to achieve the purpose of merging different business scenarios in the first message into the second message. Through the above process, hard coding can be avoided, development can be carried out in a low-code manner, and development efficiency can be improved. At the same time, interface documents can be automatically generated with one click without manual writing.

[0078] Figure 5 It is a schematic diagram of main modules of the device for message protocol conversion according to an embodiment of the present invention.

[0079] like Figure 5 As shown, the device for message protocol conversion in an embodiment of the present invention includes:

[0080] The template determination module 501 is used to determine one or more feature fields from the first message, and determine mapping templates corresponding to the one or more feature fields respectively; the feature fields indicate the business scenario corresponding to the first message;

[0081] A field generation module 502 is used to generate one or more target fields corresponding to one or more feature domains according to a mapping template;

[0082] A message determination module 503, configured to determine a target message body or a target message header to which one or more target fields belong according to a message body and a message header in a business scenario;

[0083] The message generation module 504 is used to generate a second message corresponding to the first message according to the target message body and the target message header.

[0084] In an optional embodiment of the present invention, the device further includes: a configuration module, configured to preconfigure the mapping template according to a plurality of preset feature domains and a target field corresponding to each of the feature domains.

[0085] In an optional embodiment of the present invention, the mapping template includes: a field name, a field type, a parent field, and a field value.

[0086] In an optional embodiment of the present invention, when the first message / the second message is in Fix protocol, the field value in the mapping template is in FixPath format.

[0087] In an optional embodiment of the present invention, the message determination module 503 is also used to take each of the target fields as the current field, and loop through the following steps until the target root node corresponding to the current field is determined: determine the parent field corresponding to the current field according to the tree structure corresponding to the business scenario, and use the parent field as the current field; the root nodes of the tree structure are the message body and message header; and determine the target message body or target message header to which each of the target fields belongs according to the target root node.

[0088] In an optional embodiment of the present invention, the configuration module is also used to, when a new business scenario is added, set a new feature domain corresponding to the new business scenario; determine one or more corresponding new target fields based on the new feature domain; and configure a new mapping template based on the new feature domain and one or more new target fields.

[0089] In an optional embodiment of the present invention, when there are multiple feature domains, the multiple feature domains respectively indicate the business scenario and the business action under the business scenario;

[0090] The template determination module 501 is further used to determine mapping templates corresponding to the business scenario and the business action respectively.

[0091] According to the device for message protocol conversion of the embodiment of the present invention, by determining one or more mapping templates corresponding to the first message according to one or more characteristic domains in the first message, it is possible to obtain different mapping templates according to different business scenarios and implement targeted message conversion in different business scenarios; one or more target fields corresponding to one or more characteristic domains are generated according to the mapping templates, and the target message body or target message header to which the one or more target fields belong is determined according to the message body and message header under the business scenario, and a second message corresponding to the first message is generated according to the target message body and target message header, so that multiple target fields corresponding to multiple characteristic domains can be respectively attributed to the target message body or target message header, so as to achieve the purpose of merging different business scenarios in the first message into the second message. Through the above process, hard coding can be avoided, development can be carried out in a low-code manner, and development efficiency can be improved. At the same time, interface documents can be automatically generated with one click without manual writing.

[0092] Figure 6 An exemplary system architecture 600 is shown to which the method for message protocol conversion or the apparatus for message protocol conversion according to the embodiment of the present invention can be applied.

[0093] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0094] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 601, 602, 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0095] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0096] The server 605 may be a server that provides various services, such as a background management server that provides conversion for the first message sent by the user using the terminal devices 601, 602, and 603. The background management server may analyze and process the received first message and other data, and feed back the processing result (such as the second message corresponding to the first message obtained by conversion) to the terminal device.

[0097] It should be noted that the message protocol conversion method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the message protocol conversion device is generally arranged in the server 605 .

[0098] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0099] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0100] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0101] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0102] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0103] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0104] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0105] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be arranged in a processor, for example, they may be described as: a processor including a template determination module, a field generation module, a message determination module and a message generation module. The names of these modules do not constitute a limitation on the modules themselves in certain cases, for example, the template determination module may also be described as "a module for determining one or more feature domains from a first message, and determining mapping templates corresponding to the one or more feature domains".

[0106] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0107] Determine one or more characteristic domains from a first message, and determine mapping templates corresponding to the one or more characteristic domains respectively; the characteristic domains indicate a business scenario corresponding to the first message; generate one or more target fields corresponding to the one or more characteristic domains according to the mapping template; determine a target message body or target message header to which the one or more target fields belong according to a message body and a message header under the business scenario; and generate a second message corresponding to the first message according to the target message body and the target message header.

[0108] According to the technical solution of the embodiment of the present invention, by determining one or more mapping templates corresponding to the first message according to one or more characteristic domains in the first message, it is possible to obtain different mapping templates according to different business scenarios and implement targeted message conversion in different business scenarios; one or more target fields corresponding to one or more characteristic domains are generated according to the mapping template, and the target message body or target message header to which the one or more target fields belong is determined according to the message body and message header under the business scenario, and a second message corresponding to the first message is generated according to the target message body and target message header, so that multiple target fields corresponding to multiple characteristic domains can be respectively attributed to the target message body or target message header, so as to achieve the purpose of merging different business scenarios in the first message into the second message. Through the above process, hard coding can be avoided, development can be carried out in a low-code manner, and development efficiency can be improved. At the same time, interface documents can be automatically generated with one click without manual writing.

[0109] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for message protocol conversion, characterized in that: include: Determine one or more feature domains from the first message, and determine mapping templates corresponding to the one or more feature domains; in the case where there are multiple feature domains, the multiple feature domains respectively indicate the protocol format of the first message, the business scenario corresponding to the first message, the business action under the business scenario, and the protocol format of the second message; Determining the mapping templates corresponding to the one or more feature domains respectively includes: splitting the messages of different business scenarios according to the feature domains, and determining the mapping templates corresponding to the business scenarios and business actions corresponding to each feature domain; the mapping templates include: field name, field type, parent field and field value; generating one or more target fields corresponding to the one or more feature domains according to the mapping template; wherein the target fields included in the multiple mapping templates are all different; Determining the target message body or target message header to which the one or more target fields belong according to the message body and message header in the business scenario, including: taking each of the target fields as the current field, and looping through the following steps until the target root node corresponding to the current field is determined: determining the parent field corresponding to the current field according to the tree structure corresponding to the business scenario, and taking the parent field as the current field; the root node of the tree structure is the message body and message header; determining the target message body or target message header to which each of the target fields belongs according to the target root node; A second message corresponding to the first message is generated according to the target message body and the target message header.

2. The method according to claim 1, characterized in that The mapping template is pre-configured according to a plurality of preset feature domains and a target field corresponding to each of the feature domains.

3. The method according to claim 1, characterized in that Also includes: When the first message / the second message is in Fix protocol, the field value in the mapping template is in FixPath format.

4. The method according to claim 1, characterized in that: Also includes: When a new business scenario is added, a new feature domain corresponding to the new business scenario is set; Determine one or more corresponding new target fields according to the new feature domain; A new mapping template is configured according to the new feature domain and one or more new target fields.

5. A device for message protocol conversion, characterized in that: include: A template determination module, used to determine one or more feature domains from a first message, and determine mapping templates corresponding to the one or more feature domains; in the case where there are multiple feature domains, the multiple feature domains respectively indicate the protocol format of the first message, the business scenario corresponding to the first message, the business action under the business scenario, and the protocol format of the second message; Determining the mapping templates corresponding to the one or more feature domains respectively includes: splitting the messages of different business scenarios according to the feature domains, and determining the mapping templates corresponding to the business scenarios and business actions corresponding to each feature domain; the mapping templates include: field name, field type, parent field and field value; A field generation module, used to generate one or more target fields corresponding to the one or more feature domains according to the mapping template; wherein the target fields included in the multiple mapping templates are all different; A message determination module, used to determine the target message body or target message header to which the one or more target fields belong according to the message body and message header in the business scenario, including: taking each of the target fields as the current field, and looping through the following steps until the target root node corresponding to the current field is determined: determining the parent field corresponding to the current field according to the tree structure corresponding to the business scenario, and taking the parent field as the current field; the root node of the tree structure is the message body and message header; and determining the target message body or target message header to which each of the target fields belongs according to the target root node; A message generation module is used to generate a second message corresponding to the first message according to the target message body and the target message header.

6. An electronic device for message protocol conversion, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.

7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Interface message conversion method, device and system

    CA3128537A1

  • Integrated communication service acceptance method, device and equipment

    CN109302540A

  • Heterogeneous protocol conversion method and device based on flow table driving

    CN110225061A

  • Data processing method and related equipment

    CN110351325A

  • Data processing method and device, computer equipment and storage medium

    CN111552838A