CN113242221A - Protocol conversion method and protocol conversion device based on http micro-service gateway - Google Patents

Protocol conversion method and protocol conversion device based on http micro-service gateway Download PDF

Info

Publication number
CN113242221A
CN113242221A CN202110472605.0A CN202110472605A CN113242221A CN 113242221 A CN113242221 A CN 113242221A CN 202110472605 A CN202110472605 A CN 202110472605A CN 113242221 A CN113242221 A CN 113242221A
Authority
CN
China
Prior art keywords
protocol
http
information
service gateway
dubbo
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110472605.0A
Other languages
Chinese (zh)
Other versions
CN113242221B (en
Inventor
潘建波
吴红
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan MgtvCom Interactive Entertainment Media Co Ltd
Original Assignee
Hunan MgtvCom Interactive Entertainment Media Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan MgtvCom Interactive Entertainment Media Co Ltd filed Critical Hunan MgtvCom Interactive Entertainment Media Co Ltd
Priority to CN202110472605.0A priority Critical patent/CN113242221B/en
Publication of CN113242221A publication Critical patent/CN113242221A/en
Application granted granted Critical
Publication of CN113242221B publication Critical patent/CN113242221B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a protocol conversion method and a protocol conversion device based on an http micro-service gateway, comprising the following steps: a, a micro service gateway acquires and caches registered dubbo metadata information; b, after receiving the http protocol request in the json format, the micro service gateway finds corresponding dubbo metadata information according to parameter information in the http protocol request; c, the micro service gateway analyzes json object information to byte buffer binary stream of session 2 protocol of java basic data type according to found dubbo metadata information and json object in http protocol request; d, the micro service gateway acquires provider registered by the registration information, and analyzes the received byte buffer binary stream information of the session 2 protocol into character strings in a json format; and E, returning the character string in the json format of the http protocol. The invention can effectively improve the calling universality between the front end and the back end and among various services and among languages, quickly provide the service protocol to the front end and the service calling party, and effectively solve the calling problem among multiple languages.

Description

Protocol conversion method and protocol conversion device based on http micro-service gateway
Technical Field
The invention particularly relates to a protocol conversion method and a protocol conversion device based on an http micro-service gateway.
Background
At present, services of various companies at home and abroad are started to be micro-serviced for quick iterative effective iterative services, wherein the most important part is a micro-service gateway and various open-source micro-service gateways exist, but at present, protocol conversion is mainly based on interface support of the micro-service and generic protocol calling.
At present, a common mode of front-end application (APP, WEB pages, H5 and various applets) and back-end interaction of the application is to carry out data interaction by a json format http protocol, most back-end services adopt a micro-service architecture, a business service part adopts the dubbo micro-service architecture in the process of technical transformation, and the dubbo micro-service architecture adopts a proprietary dubbo protocol to carry out interprocess communication. However, when cross-language and cross-platform calls are involved, the dubbo protocol cannot be supported or the supporting difficulty is high, so that the problem that the dubbo protocol cannot be used occurs.
A schematic diagram of the conventional micro-service gateway-based conversion of the dubbo protocol into the http protocol is shown in fig. 1. The existing conventional method for solving the conversion of the dubbo protocol by the micro service gateway mainly comprises two methods: one is an interface for directly outputting an http protocol at mvc in an application layer, and in such a case, each provided dubbo interface must provide a corresponding provider interface to provide an interface of the http protocol; the other method is to adopt generalized calling to convert the json character string into map, strictly transmit according to the pojo attribute, serially call the remote service, deserialize the remote service again, analyze the remote service into map, analyze the remote service into javabean, call the method, return the javabean, convert the method into map, serialize the method and return the gateway, deserialize the gateway, analyze the gateway into map, and return the json character string. In calling, because a large amount of temporary objects are needed, the memory requirement is large, the performance is difficult to achieve the best, and meanwhile, the server side adds a layer of map → pojo conversion to the generalization request and sacrifices the original performance of the dubbo.
Disclosure of Invention
The invention aims to provide a protocol conversion method and a protocol conversion device based on an http micro service gateway, aiming at the defects of the prior art, and the method and the device are used for solving the problem of unified and commonalization of a protocol so as to rapidly issue a service and solve the problem of protocol unsupported when the service is called; the invention can effectively improve the calling universality between the front end and the back end and among various services and among languages, quickly provides the service protocol which cannot be quickly exposed originally to the front end and the service party calling party, and effectively solves the calling problem among multiple languages.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
a protocol conversion method based on an http micro-service gateway is characterized by comprising the following steps:
a, a micro service gateway acquires and caches registered dubbo metadata information;
b, after receiving the http protocol request in the json format, the micro service gateway finds corresponding dubbo metadata information according to parameter information in the http protocol request;
step C, the micro service gateway analyzes json object information to byte buffer binary stream of session 2 protocol of java basic data type according to found dubbo metadata information and json object in http protocol request;
step D, the micro service gateway acquires provider registered by the registration information, and analyzes the received byte buffer binary stream information of the session 2 protocol into character strings in json format;
and E, returning the character string in the json format of the http protocol by the micro service gateway.
Preferably, in step a, the dubbo metadata information includes provider of the dubbo service and data storage information of a basic K/V of the provider.
Preferably, the data storage information of the basic K/V of the consumer includes the interface address information of the request, the request type, the dubbo version, the version, and the return object information.
Based on the same inventive concept, the invention also provides a protocol conversion device based on the http micro service gateway, which is characterized in that the micro service gateway is configured to execute the steps of the protocol conversion method.
Compared with the prior art, the method and the device have the advantages that the registered dubbo metadata information is acquired from the metadata center, the mapping relation between the json object and the metadata is analyzed in a stepwise analysis mode, the final session 2 serialized buffer is assembled, the corresponding provider is requested, the received session 2 serialized byte buffer is analyzed into a json character string, and the character string returned to the json format is finally output. The invention can effectively improve the calling universality between the front end and the back end and among various services and among languages, quickly provides the service protocol which cannot be quickly exposed originally to the front end and the service party calling party, and effectively solves the calling problem among multiple languages.
Drawings
Fig. 1 is a schematic diagram of a conventional micro-service gateway-based protocol for converting a dubbo protocol into an http protocol.
Fig. 2 is a schematic diagram illustrating the principle of the http microservice gateway-based protocol conversion method of the present invention.
Detailed Description
As shown in fig. 2, the protocol conversion method based on the http microservice gateway includes the following steps:
a, a micro service gateway acquires and caches registered dubbo metadata information; the dubbo metadata information comprises provider of the dubbo service and data storage information of basic K/V of a provider. The data storage information of the basic K/V of the consumer comprises the interface address information of the request, the request type, the dubbo version, the return object information and the like.
And step B, the micro service gateway receives the http protocol request in the json format. The request body comprises interface information, version information and a json character string of the request. And finding corresponding dubbo metadata interface information through the interface version and other related information in the http protocol request. Parameter information such as interface version and the like can be respectively agreed in url connection, and the json object of the dubbo request can be sent in body.
And step C, the micro service gateway performs protocol conversion according to the found dubbo metadata information and the json object in the http protocol request, and analyzes the json object information to byte buffer binary stream of the session 2 protocol of the java basic data type. And traversing and reading the whole json character string, acquiring the type of each read json fragment through metadata, and writing the json fragment into the buffer in detail by using the session 2 protocol. And requesting a corresponding remote service from the byte buffer of the session 2 protocol, converting the remote service into a corresponding javabean, requesting a corresponding method, returning the corresponding javabean, and converting the javabean into the byte buffer to be sent to the micro service gateway.
Step D, the micro service gateway acquires provider registered by the registration information, and analyzes the received byte buffer binary stream information of the session 2 protocol into character strings in json format;
and E, returning the character string in the json format by the micro service gateway through the http protocol.
The invention also provides a protocol conversion device based on the http micro service gateway, wherein the micro service gateway is configured to execute the steps of the protocol conversion method.
The core function of the invention is to convert the dubbo protocol to the http protocol in json format. The method comprises the steps of carrying out protocol conversion on an http micro-service gateway, based on the universality of java services, depending on metadata to convert a json format request into a dubbo protocol of a java basic data type, carrying out dubbo service calling, returning returned dubbo protocol information to the json format protocol, forming a json format http protocol request → dubbo protocol back-end service → dubbo protocol return data → json file through the http micro-service gateway, and forming a front-end and service-related friendly calling chain.
The invention is applied to the project of 'audio-visual media microservice key technology research and application' (the project number is 2019YFB1405900), and specifically comprises the following steps:
1. defining the parameters related to the general micro service request information and the json object of body and request. The main parameters are as follows: interface information, method, version, and group.
2. And the micro service gateway receives the http request and finds corresponding metadata information according to the parameter information.
3. And the micro service gateway analyzes the json object information to byte buffer binary stream of the session 2 protocol of java basic data type according to the found metadata information and the json object of the request.
4. The micro service gateway takes the provider registered by the registration information, and the load balancing request is sent to a specific example.
5. The micro service gateway correspondingly analyzes the type to a basic type according to the byte buffer binary stream information returned by the provider and according to the method of the metadata, and then to the json object.
6. And finally returning the json format character string of the http protocol by the microservice gateway.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (4)

1. A protocol conversion method based on an http micro-service gateway is characterized by comprising the following steps:
a, a micro service gateway acquires and caches registered dubbo metadata information;
b, after receiving the http protocol request in the json format, the micro service gateway finds corresponding dubbo metadata information according to parameter information in the http protocol request;
step C, the micro service gateway analyzes json object information to byte buffer binary stream of session 2 protocol of java basic data type according to found dubbo metadata information and json object in http protocol request;
step D, the micro service gateway acquires provider registered by the registration information, and analyzes the received byte buffer binary stream information of the session 2 protocol into character strings in json format;
and E, returning the character string in the json format of the http protocol by the micro service gateway.
2. The http micro-service gateway based protocol conversion method as claimed in claim 1, wherein in the step a, the dubbo metadata information includes data storage information of provider of the dubbo service and basic K/V of a provider.
3. The http microservices gateway based protocol conversion method of claim 2, wherein the consumer base K/V data storage information includes requested interface address information, request type, dubbo version, return object information.
4. A protocol conversion device based on an http microservice gateway, characterized in that the microservice gateway is configured for performing the steps of the method of one of claims 1 to 3.
CN202110472605.0A 2021-04-29 2021-04-29 Protocol conversion method and protocol conversion device based on http micro-service gateway Active CN113242221B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110472605.0A CN113242221B (en) 2021-04-29 2021-04-29 Protocol conversion method and protocol conversion device based on http micro-service gateway

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110472605.0A CN113242221B (en) 2021-04-29 2021-04-29 Protocol conversion method and protocol conversion device based on http micro-service gateway

Publications (2)

Publication Number Publication Date
CN113242221A true CN113242221A (en) 2021-08-10
CN113242221B CN113242221B (en) 2022-08-23

Family

ID=77131472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110472605.0A Active CN113242221B (en) 2021-04-29 2021-04-29 Protocol conversion method and protocol conversion device based on http micro-service gateway

Country Status (1)

Country Link
CN (1) CN113242221B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726869A (en) * 2021-08-26 2021-11-30 阿里巴巴(中国)有限公司 Communication method, gateway and electronic equipment
CN114205191A (en) * 2021-12-13 2022-03-18 四川启睿克科技有限公司 API gateway system and operation method
CN114942856A (en) * 2022-07-22 2022-08-26 浙江中控技术股份有限公司 Data processing method and device of micro-service system and electronic equipment
CN115604333A (en) * 2022-10-12 2023-01-13 江苏赛融科技股份有限公司(Cn) Distributed big data analysis service scheduling method and system based on dubbo
CN116192933A (en) * 2022-12-12 2023-05-30 北京领雁科技股份有限公司 Method and system for dynamically expanding non-HTTP protocol based on micro-service gateway

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108255615A (en) * 2017-11-30 2018-07-06 平安科技(深圳)有限公司 Across language call method, server and storage medium
US20190197148A1 (en) * 2017-12-21 2019-06-27 Adobe Inc. Reducing frontend complexity for multiple microservices with consistent updates
CN110780950A (en) * 2019-10-24 2020-02-11 深圳前海环融联易信息科技服务有限公司 Interface metadata management method and device, computer equipment and storage medium
CN110990047A (en) * 2019-11-06 2020-04-10 北京云思畅想科技有限公司 Fusion method and device for multiple microservice architectures
CN112256246A (en) * 2020-09-18 2021-01-22 许继集团有限公司 Micro-service integration framework for supporting cross-language calling in power system
CN112685193A (en) * 2020-12-18 2021-04-20 易久批信息技术有限公司 Micro-service gateway interface exposure and aggregation method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108255615A (en) * 2017-11-30 2018-07-06 平安科技(深圳)有限公司 Across language call method, server and storage medium
US20190197148A1 (en) * 2017-12-21 2019-06-27 Adobe Inc. Reducing frontend complexity for multiple microservices with consistent updates
CN110780950A (en) * 2019-10-24 2020-02-11 深圳前海环融联易信息科技服务有限公司 Interface metadata management method and device, computer equipment and storage medium
CN110990047A (en) * 2019-11-06 2020-04-10 北京云思畅想科技有限公司 Fusion method and device for multiple microservice architectures
CN112256246A (en) * 2020-09-18 2021-01-22 许继集团有限公司 Micro-service integration framework for supporting cross-language calling in power system
CN112685193A (en) * 2020-12-18 2021-04-20 易久批信息技术有限公司 Micro-service gateway interface exposure and aggregation method

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726869A (en) * 2021-08-26 2021-11-30 阿里巴巴(中国)有限公司 Communication method, gateway and electronic equipment
CN114205191A (en) * 2021-12-13 2022-03-18 四川启睿克科技有限公司 API gateway system and operation method
CN114205191B (en) * 2021-12-13 2023-09-15 四川启睿克科技有限公司 API gateway system and operation method
CN114942856A (en) * 2022-07-22 2022-08-26 浙江中控技术股份有限公司 Data processing method and device of micro-service system and electronic equipment
CN115604333A (en) * 2022-10-12 2023-01-13 江苏赛融科技股份有限公司(Cn) Distributed big data analysis service scheduling method and system based on dubbo
CN115604333B (en) * 2022-10-12 2023-09-12 江苏赛融科技股份有限公司 Distributed big data analysis service scheduling method and system based on dubbo
CN116192933A (en) * 2022-12-12 2023-05-30 北京领雁科技股份有限公司 Method and system for dynamically expanding non-HTTP protocol based on micro-service gateway
CN116192933B (en) * 2022-12-12 2023-09-19 北京领雁科技股份有限公司 Method and system for dynamically expanding non-HTTP protocol based on micro-service gateway

Also Published As

Publication number Publication date
CN113242221B (en) 2022-08-23

Similar Documents

Publication Publication Date Title
CN113242221B (en) Protocol conversion method and protocol conversion device based on http micro-service gateway
US8069451B2 (en) System and method of compact messaging in network communications by removing tags and utilizing predefined message definitions
US6779154B1 (en) Arrangement for reversibly converting extensible markup language documents to hypertext markup language documents
US7761586B2 (en) Accessing and manipulating data in a data flow graph
CN101609415B (en) Universal service calling system and method based on middleware
CN108989356A (en) A kind of method that API gateway realizes protocol conversion
CN107256206B (en) Method and device for converting character stream format
US7904111B2 (en) Mobile exchange infrastructure
US20080263187A1 (en) Interoperability of Network Applications in a Communications Environment
CN112511591B (en) Method, device, equipment and medium for realizing hospital interface data interaction
US20050060431A1 (en) System, apparatus, and method for using reduced web service messages
CN109831466B (en) Micro-service business processing method and nginx server
CN101500145A (en) Digital household public transportation enquiry system based on bi-directional set-top box
CN111431746B (en) API gateway migration method and system
CN103002047B (en) A kind of RPC formulas web server architecture method
CN111443946B (en) Interaction method, system, server and storage medium of IOS system and page
CN109005163B (en) HTTP dynamic request service calling method
CN102946423A (en) Data mapping and pushing system and method based on distributed system architecture
CN106506672B (en) The non-assembly access method of browser intelligent key disk
CN111125207B (en) Data acquisition method and device, connector and presto engine
CN115617924A (en) Financial data processing method, device, equipment and storage medium
US20040019633A1 (en) MIME encoding of values for web procedure calls
CN105224319A (en) The method of XBRL instance document preview is realized based on dom4j
CN102314406A (en) The method and system that is used for the lazy data sequenceization of compunication
US7743385B2 (en) System and method for simplification of data structure in wireless communications

Legal Events

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