CN111371823B - Method for client to access micro-service in non-WEB scene - Google Patents

Method for client to access micro-service in non-WEB scene Download PDF

Info

Publication number
CN111371823B
CN111371823B CN201811600673.5A CN201811600673A CN111371823B CN 111371823 B CN111371823 B CN 111371823B CN 201811600673 A CN201811600673 A CN 201811600673A CN 111371823 B CN111371823 B CN 111371823B
Authority
CN
China
Prior art keywords
micro
service
access
client
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811600673.5A
Other languages
Chinese (zh)
Other versions
CN111371823A (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.)
Chengdu TD Tech Ltd
Original Assignee
Chengdu TD Tech 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 Chengdu TD Tech Ltd filed Critical Chengdu TD Tech Ltd
Priority to CN201811600673.5A priority Critical patent/CN111371823B/en
Publication of CN111371823A publication Critical patent/CN111371823A/en
Application granted granted Critical
Publication of CN111371823B publication Critical patent/CN111371823B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/1066Session management
    • H04L65/1073Registration or de-registration

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a method for a client to access micro-services in a non-WEB scene, which comprises the following steps: a micro-service access frame of a client side searches a micro-service address from a micro-service center through a micro-service name in a non-WEB scene; the micro-service access framework receives a micro-service address returned by the micro-service center and obtains a corresponding URL address capable of accessing the RESTFUL interface according to the micro-service address; the micro-service access framework receives json format data which is obtained by converting JAVA object data and is injected by a client foreground; and the micro-service access framework sends an access request to a RESTFUL interface of a corresponding server according to the URL address and the data in the json format. By applying the technical scheme disclosed by the application, the non-WEB client can call the RESTFUL interface of the server to realize the access to the micro service.

Description

Method for client to access micro service in non-WEB scene
Technical Field
The application relates to the technical field of network management, in particular to a method for a client to access micro-services in a non-WEB scene.
Background
The existing network management system is based on a client/server (C/S) framework, the interaction of data interfaces of a client and a server is carried out through a Remote Method Invocation (RMI) protocol, and the data of the front end and the back end need strict serialization and deserialization.
Meanwhile, after the network management system experiences several large R versions, the background module services are too cross-coupled, so the network management background services need to be split and refined into micro-services for the application invocation of a server, a client or a third party. The interface interaction of the micro-service is based on Representational State Transfer (RESTFUL), and has better support and work in a WEB scene.
In the existing network management system, a non-WEB client cannot directly and well call the RESTFUL interface of a server, so that how the non-WEB client calls the RESTFUL interface of the server is a technical problem to be solved urgently.
In addition, in the existing network management system, data interaction between the server and the client is complex JAVA objects, and how to ensure that the complex JAVA objects at the foreground and the background do not lose data in the RESTFUL interface interaction escaping process is also a technical problem that must be solved.
Disclosure of Invention
The application provides a method for a client to access micro-services in a non-WEB scene, so that the non-WEB client can call the RESTFUL interface of the server to realize access to the micro-services.
The application discloses a method for a client to access micro-services in a non-WEB scene, which comprises the following steps:
a micro-service access framework of a client side searches a micro-service address for a micro-service center through a micro-service name in a non-WEB scene;
the micro-service access framework receives a micro-service address returned by the micro-service center and obtains a corresponding URL address capable of accessing the RESTFUL interface according to the micro-service address;
the micro-service access framework receives json format data which is obtained by converting JAVA object data and is injected by a client foreground;
and the micro-service access framework sends an access request to a RESTFUL interface of a corresponding server according to the URL address and the data in the json format.
Preferably, the method further comprises:
after the request access is successful, acquiring data in a json format from the server;
and the microservice access framework converts the acquired data in the json format into JAVA object data required by the client foreground and provides the JAVA object data for the client foreground.
Preferably, the micro-service address is an access IP or domain name address of a micro-service corresponding to the micro-service name.
Preferably, the method further comprises:
after each service is on line, the micro service center initiates registration, and the micro service center stores relevant information of the service, including: and maintaining the corresponding relation between the micro service name and the micro service address.
Preferably, the obtaining a corresponding URL address accessible to the RESTFUL interface according to the micro service address includes: and assembling a URL address capable of accessing the RESTFUL interface according to the micro-service address, the name of the sub-module provided by the client and the name of the specific access interface.
The present application also discloses a non-transitory computer readable storage medium storing instructions that, when executed by a processor, cause the processor to perform the steps of the method for a client to access a microservice in a non-WEB scenario as described above.
The application also discloses an electronic device comprising the non-volatile computer-readable storage medium as described above, and the processor having access to the non-volatile computer-readable storage medium.
According to the technical scheme, the method for the client to access the micro service in the non-WEB scene has the advantages that the micro service access framework of the client searches the micro service address from the micro service center through the micro service name in the non-WEB scene, the corresponding URL address capable of accessing the RESTFUL interface is obtained according to the obtained micro service address, and then the access request is sent to the corresponding URL address, so that the non-WEB client calls the RESTFUL interface of the server, and the non-WEB client accesses the micro service.
In addition, the method and the device realize the escape transmission of the complex JAVA object data of the client and the server by converting the JAVA data under the non-WEB scene into the json format, thereby ensuring that the complex JAVA objects of the foreground and the background do not lose data in the RESTFUL interface interactive escape process.
Drawings
FIG. 1 is a schematic flow chart illustrating a method for a client to access a microservice in a non-WEB scenario according to the present invention;
fig. 2 is a schematic flow chart illustrating a process of accessing a microservice by a client in a non-WEB scenario according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is further described in detail below with reference to the accompanying drawings and examples.
In order to be compatible with the existing network management system and enable a non-WEB client to call an RESTFUL interface of a micro service, the application provides a method for the client to access the micro service under a non-WEB scene, and the flow of the method is shown in figure 1 and comprises the following steps:
step 101: and the micro-service access framework of the client side searches a micro-service address for the micro-service center through the micro-service name under the non-WEB scene.
Wherein the micro-service address is an access IP or domain name address of the micro-service corresponding to the micro-service name.
After each service is on line, registration is initiated to the micro-service center, so that the micro-service center maintains the corresponding relation between the micro-service name and the micro-service address.
The micro service access framework may be an SDK package issued in jar, and in the following embodiment, the "micro service client SDK" will be used to represent the "micro service access framework", that is to say: the function of the "microservice client SDK" in an embodiment is a microservice access framework.
Step 102: and the micro-service access framework receives the micro-service address returned by the micro-service center and obtains a corresponding URL address capable of accessing the RESTFUL interface according to the micro-service address.
Specifically, the URL address which can access the RESTFUL interface is assembled according to the micro-service address, the name of the sub-module provided by the client and the name of the specific access interface. The assembly rule of the URL address of the RESTFUL interface is: https:// IP: port/submodule name/interface name, IP and port are obtained from the registry service center by microservice name, and submodule name and interface are provided by specific service operation of the client.
Step 103: the client foreground converts the self-defined JAVA object data into json format data and automatically injects the json format data into the micro-service access framework.
Step 104: and the micro-service access framework sends an access request to the RESTFUL interface of the corresponding server according to the URL address capable of accessing the RESTFUL interface and the injected data in the json format.
And 105, after the request access is successful, the client background acquires data in the json format from the server.
Step 106: the microservice access framework converts the json format data acquired by the background into JAVA object data required by the client foreground, and provides the JAVA object data for the client foreground to carry out data reprocessing processing, so that the requirements of the client are met.
Fig. 2 is a schematic flow chart illustrating a process of accessing a microservice by a client in a non-WEB scenario according to an embodiment of the present invention. Referring to fig. 2:
firstly, after the service A and the service B are on line, registration is initiated to the micro-service center, and the related information is sent to the micro-service center, so that the micro-service center can obtain the related information of each service. The micro service center acquires the micro service provided by each service and the corresponding relation between the micro service name and the micro service address.
When a client needs to call a certain micro-service, a micro-service client software framework package (SDK) searches a corresponding micro-service address from a micro-service center according to a micro-service name, and the micro-service center returns the address of the micro-service to the SDK of the micro-service client. In this embodiment, the micro service client SDK corresponds to the micro service access framework described above.
After obtaining the address of the micro-service, the micro-service client SDK assembles an access request according to the address, function, interface parameter, and other information of the micro-service, and sends the access request to the corresponding micro-service (in this embodiment, service B is taken as an example). Wherein, assembling the access request specifically comprises: according to the name of the sub-module and the name of the specific access interface provided by the client, combining the micro-service address to assemble a URL address capable of accessing the RESTFUL interface; and assembling the access request together with the URL address according to the json format data which is injected by the client foreground and is converted from the JAVA object data.
And then, the micro-service in the service B returns data in the json format to the micro-service client SDK, and the micro-service client SDK is used for transferring the data in the json format into corresponding JAVA object data and providing the data to the client.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (7)

1. A method for a client to access micro-services in a non-WEB scene is characterized by comprising the following steps:
a micro-service access frame of a client side searches a micro-service address from a micro-service center through a micro-service name in a non-WEB scene; the micro service access framework is an SDK packet issued in jar mode;
the micro-service access framework receives a micro-service address returned by the micro-service center and obtains a corresponding URL address capable of accessing the RESTFUL interface according to the micro-service address;
the micro-service access framework receives json format data which is obtained by converting JAVA object data and is injected by a client foreground;
and the micro-service access framework sends an access request to a RESTFUL interface of a corresponding server according to the URL address and the data in the json format.
2. The method of claim 1, further comprising:
after the request access is successful, acquiring data in a json format from the server;
and the microservice access framework converts the acquired data in the json format into JAVA object data required by the client foreground and provides the JAVA object data for the client foreground.
3. The method according to claim 1 or 2, characterized in that:
the microservice address is an access IP or domain name address of a microservice corresponding to the microservice name.
4. The method of claim 3, further comprising:
after each service is on line, the micro service center initiates registration, and the micro service center stores relevant information of the service, including: and maintaining the corresponding relation between the micro service name and the micro service address.
5. The method according to claim 1 or 2, characterized in that:
the obtaining of the corresponding URL address accessible to the RESTFUL interface according to the micro-service address includes: and assembling a URL address capable of accessing the RESTFUL interface according to the micro-service address, the name of the sub-module provided by the client and the name of the specific access interface.
6. A non-transitory computer readable storage medium storing instructions which, when executed by a processor, cause the processor to perform the steps of the method for a client to access a microservice in a non-WEB scenario as claimed in any of claims 1 to 5.
7. An electronic device comprising the non-volatile computer-readable storage medium of claim 6, and the processor having access to the non-volatile computer-readable storage medium.
CN201811600673.5A 2018-12-26 2018-12-26 Method for client to access micro-service in non-WEB scene Active CN111371823B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811600673.5A CN111371823B (en) 2018-12-26 2018-12-26 Method for client to access micro-service in non-WEB scene

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811600673.5A CN111371823B (en) 2018-12-26 2018-12-26 Method for client to access micro-service in non-WEB scene

Publications (2)

Publication Number Publication Date
CN111371823A CN111371823A (en) 2020-07-03
CN111371823B true CN111371823B (en) 2022-09-16

Family

ID=71206039

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811600673.5A Active CN111371823B (en) 2018-12-26 2018-12-26 Method for client to access micro-service in non-WEB scene

Country Status (1)

Country Link
CN (1) CN111371823B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116208668A (en) * 2023-05-05 2023-06-02 北京零壹视界科技有限公司 Data caching method, device, equipment and medium based on content distribution network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2704461A1 (en) * 2009-05-22 2010-11-22 Comcast Interactive Media, Llc Web service system and method
CN107612955A (en) * 2016-07-12 2018-01-19 深圳市远行科技股份有限公司 Micro services provide method, apparatus and system
CN107643927A (en) * 2016-07-20 2018-01-30 中兴通讯股份有限公司 A kind of united portal method, apparatus and system
CN108809956A (en) * 2018-05-23 2018-11-13 广州虎牙信息科技有限公司 Method for authenticating, access request retransmission method based on micro services and device, system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10489275B2 (en) * 2016-10-20 2019-11-26 Cisco Technology, Inc. Agentless distributed monitoring of microservices through a virtual switch

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2704461A1 (en) * 2009-05-22 2010-11-22 Comcast Interactive Media, Llc Web service system and method
CN107612955A (en) * 2016-07-12 2018-01-19 深圳市远行科技股份有限公司 Micro services provide method, apparatus and system
CN107643927A (en) * 2016-07-20 2018-01-30 中兴通讯股份有限公司 A kind of united portal method, apparatus and system
CN108809956A (en) * 2018-05-23 2018-11-13 广州虎牙信息科技有限公司 Method for authenticating, access request retransmission method based on micro services and device, system

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"面向微服务的公共事业信息服务开放平台的设计与实现";李从磊;《中国优秀硕士学位论文全文数据库 信息科技》;20180131;全文 *
Arne Koschel,Irina Astrova,Jeremias Dötterl."Making the move to microservice architecture".《2017 International Conference on Information Society (i-Society)》.2018, *
基于微服务的数据服务框架设计;欧阳荣彬等;《华中科技大学学报(自然科学版)》;20161015;全文 *

Also Published As

Publication number Publication date
CN111371823A (en) 2020-07-03

Similar Documents

Publication Publication Date Title
EP3399715B1 (en) Protocol conversion method, platform, and protocol conversion gateway
US11108653B2 (en) Network service management method, related apparatus, and system
EP2106647B1 (en) Web services and telecom network management unification
EP2487874A1 (en) Mobile broadband device and method for manageing mobile broadband device
CN109862051A (en) The realization method and system of multi-tenant under a kind of micro services framework
CN111917737B (en) Cross-network RPC calling system and method
CN109451014B (en) WebService agent system and transparent agent method thereof
KR102080230B1 (en) System and method for multiway call processing of rest api service
EP2760250B1 (en) M2m platform cloud system and m2m service processing method thereof
CN112262613B (en) Method and apparatus for operating a network gateway service in a service-based telecommunications system
CN111294235A (en) Data processing method, device, gateway and readable storage medium
CN111245918A (en) Service request transmission method and device
JP6169662B2 (en) API conversion adapter, API conversion system, and API conversion program
CN106357713B (en) Method for realizing remote procedure call, client device and server device
CN106357654B (en) Remote procedure calling method, device and communication system
CN111371823B (en) Method for client to access micro-service in non-WEB scene
CN104486330A (en) Two-way communication system based on remote procedure calls (RPCs)
CN103002047A (en) RPC (Remote Procedure Call) type WEB SOA (Service-Oriented Architecture) method
WO2021093671A1 (en) Task processing method, system, apparatus and device, and computer readable storage medium
EP1863239A1 (en) Method for realizing the notification service, distributed web manage system and notification sending service device
WO2019201111A1 (en) Information processing method, apparatus and device, and computer-readable storage medium
CN109525539B (en) Capability calling method, call receipt method, information processing method and system
CN113783936B (en) Webservice protocol unified interface implementation method based on enterprise service bus
CN102684924A (en) Network management workstation and debugging method of network management software
EP2247077A1 (en) Method and apparatus for network 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