A service calling method, apparatus, device, system and storage medium

CN117527908BActive Publication Date: 2026-10-27ANHUI IFLYTEK INTELLIGENT SYST
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311554935.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-17
Publication Date
2026-10-27
Estimated Expiration
2043-11-17

AI Technical Summary

Technical Problem

[0003]但是,无论是直接调用还是通过网关间接调用,在服务请求方每次申请调用新的服务组件时,现有技术都需要与新的服务组件或者新的服务组件的网关进行对接适配,随着服务组件的增多,无疑会增加适配工作量,且任何一个服务组件的服务地址或者网关地址发生变化,也需要服务请求方重新进行适配对接,服务调用的效率低下

Benefits of technology

[0013]上述方案,接收请求设备对目标服务的调用请求,并基于目标网关的属地信息,确定目标网关为本地网关或异地网关,响应于目标网关为本地网关,转发调用请求至运行目标服务的属地服务器,响应于目标网关为异地网关,基于路由规则,确定目标网关的网络地址作为目标地址,并按照目标地址发送调用请求至目标网关,以由目标网关转发调用请求至运行目标服务的属地服务器,其中,调用请求至少包括目标网关的属地信息,目标服务发布于目标网关,路由规则包括本地网关所在目标区域内各地网关的路由地址,且路由地址至少包括网关设备的属地信息和网络地址。也就是说,无论是本地网关还是异地网关的属地信息和网络地址,都处于一个统一的路由规则之下;且可以根据本地网关与异地网关作为目标网关的不同情况,采用不同的服务调用策略,即在目标网关为本地网关的情况下,本地网关直接转发调用请求至运行目标服务的属地服务器,不涉及网关间的对接;在目标网关为异地网关的情况下,基于统一的路由规则确定出目标地址后,基于目标地址实现调用请求在本地网关与异地网关之间的转发,不需要进行网关间的多次对接适配;故能够减轻网关在服务调用过程中的工作量,进而能够提升服务调用效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117527908B_ABST
    Figure CN117527908B_ABST
Patent Text Reader

Abstract

The application discloses a service calling method, device, equipment, system and storage medium, wherein the service calling method comprises the following steps: receiving a calling request of a target service by a request equipment; wherein the calling request at least comprises the native information of a target gateway, and the target service is published on the target gateway; determining whether the target gateway is a local gateway or a remote gateway based on the native information of the target gateway; forwarding the calling request to a native server running the target service in response to the target gateway being the local gateway; determining the network address of the target gateway as a target address based on a routing rule in response to the target gateway being the remote gateway, and sending the calling request to the target gateway according to the target address, so that the calling request is forwarded to the native server running the target service by the target gateway. The above scheme can improve the service calling efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of service invocation technology, and in particular to a service invocation method, apparatus, device, system and storage medium. Background Technology

[0002] Currently, when implementing service calls, the service requester can directly connect and call the service component of the service provider through protocols such as HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure). Alternatively, the service requester can indirectly call the service component of the service provider through a gateway.

[0003] However, whether it is a direct call or an indirect call through a gateway, the existing technology needs to interface and adapt with the new service component or the gateway of the new service component every time the service requester requests to call a new service component. As the number of service components increases, the workload of adaptation will undoubtedly increase. Moreover, if the service address or gateway address of any service component changes, the service requester also needs to re-adapt and interface, resulting in low efficiency of service calls.

[0004] Therefore, improving the efficiency of service calls has become an urgent problem to be solved. Summary of the Invention

[0005] The main technical problem addressed by this application is to provide a service invocation method, apparatus, device, and storage medium that can improve service invocation efficiency.

[0006] To address the aforementioned technical problems, the first aspect of this application provides a service invocation method, comprising: receiving a request from a requesting device for invoking a target service; wherein the invocation request includes at least the location information of the target gateway, and the target service is published on the target gateway; determining, based on the location information of the target gateway, whether the target gateway is a local gateway or a remote gateway; in response to the target gateway being a local gateway, forwarding the invocation request to the local server running the target service; in response to the target gateway being a remote gateway, determining, based on routing rules, the network address of the target gateway as the target address, and sending the invocation request to the target gateway according to the target address, so that the target gateway forwards the invocation request to the local server running the target service; wherein the routing rules include the routing addresses of gateways in various locations within the target area where the local gateway is located, and the routing address includes at least the location information and network address of the gateway device.

[0007] To address the aforementioned technical problems, a second aspect of this application provides a service invocation method. The method includes: generating an invocation request for a target service; wherein the invocation request includes at least the location information of the target gateway, and the target service is published on the target gateway; sending the invocation request to a local gateway; wherein the invocation request is directly forwarded by the local gateway to the local server running the target service if the target gateway is a local gateway, or sent by the local gateway to the target gateway according to the target address if the target gateway is a remote gateway, so that the target gateway forwards it to the local server running the target service. The local gateway's location (local or remote) is determined by the local gateway based on the target gateway's location information. The target address is the network address of the target gateway determined by the local gateway based on routing rules. The routing rules include the routing addresses of gateways in various locations within the target area where the local gateway is located, and the routing address includes at least the location information and network address of the gateway device.

[0008] To address the aforementioned technical problems, a third aspect of this application provides a service invocation apparatus, comprising a first receiving module, a determining module, a first response module, and a second response module. The first receiving module receives a request from a requesting device to invoke a target service, wherein the invocation request includes at least the location information of the target gateway, and the target service is published on the target gateway. The determining module determines whether the target gateway is a local gateway or a remote gateway based on the location information of the target gateway. The first response module forwards the invocation request to the local server running the target service in response to the target gateway being a local gateway. The second response module determines the network address of the target gateway as the target address based on routing rules in response to the target gateway being a remote gateway, and sends the invocation request to the target gateway according to the target address, so that the target gateway forwards the invocation request to the local server running the target service. The routing rules include the routing addresses of gateways in various locations within the target area where the local gateway is located, and the routing address includes at least the location information and network address of the gateway device.

[0009] To address the aforementioned technical problems, a fourth aspect of this application provides a service invocation apparatus, comprising a generation module and a sending module. The generation module generates an invocation request for a target service, wherein the invocation request includes at least the location information of the target gateway, and the target service is published on the target gateway. The sending module sends the invocation request to a local gateway, wherein the invocation request is directly forwarded by the local gateway to the local server running the target service if the target gateway is a local gateway, or sent by the local gateway to the target gateway according to the target address if the target gateway is a remote gateway, so that the target gateway forwards it to the local server running the target service. The target gateway being a local gateway or a remote gateway is determined by the local gateway based on the location information of the target gateway, and the target address is the network address of the target gateway determined by the local gateway based on routing rules. The routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located, and the routing address includes at least the location information and network address of the gateway device.

[0010] To address the aforementioned technical problems, the fifth aspect of this application provides an electronic device, including a communication circuit, a memory, and a processor. The communication circuit and the memory are respectively coupled to the processor, which executes program instructions stored in the memory to implement the service invocation method described in the first or second aspect.

[0011] To address the aforementioned technical problems, a sixth aspect of this application provides a service system, which includes at least gateway devices distributed in various locations and request devices that are communicatively connected to the gateway devices. The gateway devices are used to execute the service invocation method in the first aspect, and the request devices are used to execute the service invocation method in the first aspect.

[0012] To address the aforementioned technical problems, a seventh aspect of this application provides a computer-readable storage medium storing program instructions thereon, which, when executed by a processor, implement the service invocation method described in the first or second aspect above.

[0013] The above scheme receives a request from a requesting device to call a target service. Based on the location information of the target gateway, it determines whether the target gateway is a local gateway or a remote gateway. If the target gateway is a local gateway, it forwards the call request to the local server running the target service. If the target gateway is a remote gateway, it determines the network address of the target gateway as the target address based on routing rules and sends the call request to the target gateway according to the target address. The target gateway then forwards the call request to the local server running the target service. The call request includes at least the location information of the target gateway, the target service is published on the target gateway, and the routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located. The routing address includes at least the location information and network address of the gateway device. In other words, the location information and network address of both local and remote gateways are under a unified routing rule. Furthermore, different service invocation strategies can be adopted depending on whether the target gateway is local or remote. When the target gateway is local, the local gateway directly forwards the invocation request to the local server running the target service, without involving inter-gateway integration. When the target gateway is remote, after determining the target address based on the unified routing rule, the invocation request is forwarded between the local and remote gateways based on the target address, eliminating the need for multiple inter-gateway integrations and adaptations. Therefore, this reduces the workload of the gateway during the service invocation process, thereby improving service invocation efficiency. Attached Figure Description

[0014] Figure 1 This is a schematic diagram of the framework of an embodiment of the service system of this application;

[0015] Figure 2 Based on Figure 1 A diagram illustrating the service call process of a service system.

[0016] Figure 3 This is a flowchart illustrating one embodiment of the service invocation method of this application;

[0017] Figure 4 This is a flowchart illustrating another embodiment of the service invocation method of this application;

[0018] Figure 5 This is a schematic diagram of a framework of an embodiment of the service invocation device of this application;

[0019] Figure 6 This is a schematic diagram of another embodiment of the service invocation device of this application;

[0020] Figure 7 This is a schematic diagram of the framework of an embodiment of the electronic device of this application;

[0021] Figure 8This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium of this application. Detailed Implementation

[0022] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0023] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.

[0024] In this document, "more" means two or more. Additionally, the term "at least one" means any combination of at least two of any one or more of a plurality of elements, for example, including at least one of A, B, and C, and can mean including any one or more elements selected from the set consisting of A, B, and C.

[0025] Please see Figure 1 , Figure 1 This is a schematic diagram of the framework of an embodiment of the service system 10 of this application. The service system 10 includes gateway devices distributed in various locations and request devices 12 that are communicatively connected to the gateway devices. The gateway devices in various locations include a local gateway 111 and a remote gateway 112. The local gateway 111 is communicatively connected to a first local server 131, and the remote gateway 112 is communicatively connected to a second local server 132. The service system 10 also includes a service management platform 14 and a routing management platform 15. The service management platform 14 is communicatively connected to the request device 12, the local gateway 111, and the remote gateway 112, respectively, and the routing management platform 15 is communicatively connected to the local gateway 111 and the remote gateway 112, respectively.

[0026] It should be noted that the local gateway 111 and the remote gateway 112 are defined based on the location of the requesting device 12. In this embodiment of the disclosure, the gateway device that communicates with the requesting device 12 is the local gateway 111. That is to say, the local gateway 111 can be a remote gateway of another requesting device 12, and the remote gateway 112 can be a local gateway of another requesting device 12.

[0027] In one implementation scenario, the routing management platform 15 communicates with gateway devices distributed across various locations to receive device information from these devices. Within a target area, the routing management platform 15 can generate routing rules based on the gateway device information from various locations within the target area, and then synchronize the generated routing rules to the gateway devices in each location. The gateway device information may include, but is not limited to, location information and network addresses. The location information may include, but is not limited to, administrative regions, network regions, and data center identifiers. The target area can be a provincial-level administrative region or a municipal-level administrative region. For example, the gateways in each location within the target area can be gateway devices from various cities within a province.

[0028] In one implementation scenario, after publishing a local service, the gateway device generates the service address of the local service. Then, based on the routing rules generated by the aforementioned routing management platform 15, it concatenates the service address with the gateway device's location information to obtain the service information of the local service. The local service may include, but is not limited to, government services, enterprise services, etc.

[0029] In a specific implementation scenario, a gateway device can publish multiple local services.

[0030] In a specific implementation scenario, the gateway device can publish services in the form of an API interface, which is used to communicate with local servers such as the first local server 131 or the second local server 132.

[0031] In one implementation scenario, the gateway device synchronizes the published local services to the service management platform 14 for the requesting device 12 to select. The service selected by the requesting device 12 is the target service, and the gateway device that publishes the target service is the target gateway.

[0032] In one implementation scenario, the service management platform 14 communicates with the requesting device 12 and the gateway devices distributed in various locations to receive service information of local services published by the gateway devices and to allow the requesting device 12 to select a target service to generate a call request.

[0033] In one implementation scenario, the service system also includes a local server running the target service. The local server may include, but is not limited to, a first local server 131, a second local server 132, etc. The local server is used to receive the call request sent by the requesting device 12, process the call request of the target service to obtain the response result, and then send the response result to the gateway device, which forwards the response result to the requesting device 12.

[0034] Please see Figure 2 , Figure 2 Based on Figure 1 This diagram illustrates the service call process of the service system, involving the interactions between various modules within the system, specifically including:

[0035] (1) Request device 12 obtains service information of the target service from service management platform 14; (2) Request device 12 generates a call request for the target service; (3) Sends the call request for the target service to the local gateway 111 corresponding to request device 12; (4) Based on the location information of the target gateway included in the call request, the local gateway 111 determines whether the target gateway is the local gateway 111 or the remote gateway 112; (5) If the target gateway is the local gateway 111, the local gateway 111 directly forwards the call request to the first local server 131 that is connected to the local gateway 111; (6) The first local server 131 performs service response processing on the call request and obtains the response result; (7) The first local server 131 sends the response result to the local gateway 111; (8) The local gateway 111 then... Gateway 111 forwards the response result to requesting device 12; (9) If the target gateway is remote gateway 112, local gateway 111 further determines the network address of remote gateway 112 as the target address based on routing rules, and forwards the call request to remote gateway 112 as the target gateway based on the target address; (10) Remote gateway 112 then forwards the call request to the second local server 132 that is connected to remote gateway 112; (11) Second local server 132 performs service response processing on the call request and obtains the response result; (12) Second local server 132 sends the response result to remote gateway 112; (13) Remote gateway 112 forwards the response result to local gateway 111; (14) Local gateway 111 then forwards the response result to requesting device 12.

[0036] Please see Figure 3 , Figure 3 This is a flowchart illustrating an embodiment of the service invocation method of this application. In this embodiment, the execution entity of the service invocation method is a gateway device, and specifically includes the following steps:

[0037] S11: Receive the request from the requesting device to invoke the target service; wherein the invocation request includes at least the location information of the target gateway, and the target service is published on the target gateway.

[0038] In one implementation scenario, before the gateway device executes the request to receive the requesting device 12 to call the target service, it can first send the device information of the local gateway 111 or the remote gateway 112 to the routing management platform 15. The device information includes the location information and network address, so that the routing management platform 15 can generate routing rules based on the location information and network address of the gateways in the target area where the local gateway 111 or the remote gateway 112 is located, and receive the routing rules sent by the routing management platform 15.

[0039] In a specific implementation scenario, the routing rules include the routing addresses of gateways in various locations within the target area where local gateway 111 is located, and each gateway device corresponds to at least one routing address. In any routing address, the location information and the network address correspond. That is to say, the routing address includes at least the location information and network address of the gateway device, and the corresponding network address can be found based on the location information.

[0040] For example, the routing address of a gateway device includes location information 3401 / zwww / dxjf and network address IP1. Based on the location information of a gateway device being 3401 / zwww / dxjf, the network address of the gateway device can be obtained as IP1.

[0041] In a specific implementation scenario, the routing rules include the location information and network address of each gateway in the target area where the local gateway 111 is located. For newly added gateway devices in the target area, the newly added gateway devices can send their own location information and network address to the routing management platform 15. After receiving the location information and network address of the newly added gateway devices, the routing management platform 15 generates new routing rules and synchronizes them to each gateway device in the target area.

[0042] In one implementation scenario, before the gateway device executes the request to receive the requesting device 12 to call the target service, it can first publish the service on the local gateway 111 or the remote gateway 112. The service information of the service is obtained by concatenating the service address of the service with the location information of the local gateway 111 or the remote gateway 112, and the service information of the service is synchronized to the service management platform 14 so that the requesting device 12 can select the target service from the service management platform 14.

[0043] In a specific implementation scenario, location information is used as a prefix identifier and concatenated with the service address to obtain service information. For example, if the location information of the target gateway is 3401 / zwww / dxjf and the service address is IP2, the service information can be 3401 / zwww / dxjf / IP2.

[0044] In one implementation scenario, local gateway 111 receives a request from requesting device 12 to invoke a target service. The request includes at least the location information of the target gateway.

[0045] In a specific implementation scenario, the call request may also include the network address of the local gateway 111. The requesting device 12 can send the call request to the local gateway 111 according to the network address of the local gateway 111. For example, the network address of the local gateway 111 is IP1, the location information of the target gateway is 3401 / zwww / dxjf, the service address of the target service is IP2, and the call request can be IP1 / 3401 / zwww / dxjf / IP2.

[0046] S12: Based on the location information of the target gateway, determine whether the target gateway is a local gateway or a remote gateway.

[0047] In one implementation scenario, the local gateway 111 determines whether the target gateway is the local gateway 111 or the remote gateway 112 based on the location information contained in the call request. The location information includes at least the administrative region, network area, and data center identifier of the gateway device's location. The administrative region may include, but is not limited to, provincial administrative codes, municipal administrative codes, etc., and the network area may include, but is not limited to, the government extranet, the Internet, etc. For example, if the gateway device is located in a data center in City A, the administrative code of City A is 3401, the network area where the gateway device is located is the government extranet, and the data center identifier is dxjf, then the location information of the gateway device can be represented as 3401 / zwww / dxjf.

[0048] In a specific implementation scenario, the local gateway 111 detects whether the location information contained in the call request is completely consistent with the location information of the local gateway 111. If the location information contained in the call request is completely consistent with the location information of the local gateway 111, the local gateway 111 determines that the target gateway is the local gateway 111. If the location information contained in the call request is not completely consistent with or completely inconsistent with the location information of the local gateway 111, the target gateway is determined to be the remote gateway 112.

[0049] For example, if the location information contained in the call request is 3401 / hlw / dxjf, and the location information of the local gateway 111 is 3402 / hlw / ltjf, then the location information contained in the call request is completely inconsistent with the location information of the local gateway 111, and the target gateway is the remote gateway 112, not the local gateway 111.

[0050] For example, if the location information contained in the call request is 3401 / hlw / dxjf, and the location information of the local gateway 111 is 3401 / zwww / dxjf, then although the administrative region code of the target gateway in the call request is consistent with the administrative code and data center identifier of the local gateway 111, the network regions are not consistent. Therefore, the location information contained in the call request is not completely consistent with the location information of the local gateway 111, and the target gateway is the remote gateway 112, not the local gateway 111.

[0051] S13: In response that the target gateway is the local gateway, forward the call request to the local server running the target service.

[0052] In one implementation scenario, when the local gateway 111 determines that the target gateway is itself, it directly forwards the call request to the local server that is connected to the local gateway 111. The local server is used to run the target service. After receiving the call request, the local server performs service response processing to obtain the response result and sends the response result to the local gateway 111. The local gateway 111 then forwards the response result to the requesting device 12.

[0053] S14: In response to the target gateway being a remote gateway, based on routing rules, determine the network address of the target gateway as the target address, and send a call request to the target gateway according to the target address, so that the target gateway can forward the call request to the local server running the target service; wherein, the routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located, and the routing address includes at least the local information and network address of the gateway device.

[0054] In one implementation scenario, when local gateway 111 determines that the target gateway is remote gateway 112, it can determine the routing address corresponding to remote gateway 112 as the target gateway based on routing rules. Then, based on the correspondence between the target gateway's location information and the gateway address contained in the routing address, it determines the target gateway's network address and uses this network address as the target address. For example, the routing address of the target gateway determined based on routing rules includes location information 3403 / zwww / dxjf and network address IP3. Based on the target gateway's location information 3403 / zwww / dxjf, the target gateway's network address can be obtained as IP3, and IP3 can be used as the target address.

[0055] In one implementation scenario, when the target gateway is a remote gateway 112, the local gateway 111 sends a call request to the target gateway according to the target address. The target gateway then forwards the call request to a local server connected to it. The local server runs the target service and, upon receiving the call request from the target gateway, processes it to obtain a service response. The local server then sends the response to the target gateway. The target gateway, following the original path from the local gateway 111 to the target gateway, returns the response to the local gateway 111, which then forwards the response to the requesting device 12. It should be noted that when the target gateway returns the response to the local gateway 111 following the original path from the local gateway 111 to the target gateway, the "original path" only refers to the nodes along the communication link between the local gateway 111 and the target gateway being the same; the direction is not the same, and is actually opposite to the original path.

[0056] Please see Figure 4 , Figure 4 This is a flowchart illustrating another embodiment of the service invocation method of this application. In this embodiment, the execution subject of the service invocation method is the requesting device. This embodiment mainly describes the differences from the foregoing embodiments. For the parts that are the same as those in the foregoing embodiments, such as the target service, the invocation request, and the location information, they will not be described in detail in this embodiment. Specifically, this embodiment includes the following steps:

[0057] S21: Generate a call request to the target service; wherein the call request includes at least the location information of the target gateway, and the target service is published on the target gateway.

[0058] In one implementation scenario, before generating a call request for the target service, the requesting device 12 can first select the target service from the service management platform 14 and determine the location information of the target gateway. In this scenario, after publishing the local service, the gateway device concatenates the service address of the local service and the location information of the local gateway 111 as the service information of the local service, and synchronizes the service information to the service management platform 14.

[0059] In a specific implementation scenario, the request to invoke the target service is generated by the requesting device 12 based on the service information of the target service.

[0060] S22: Send a call request to the local gateway; wherein, the call request is directly forwarded by the local gateway to the local server running the target service if the target gateway is the local gateway, or sent by the local gateway to the target gateway according to the target address if the target gateway is a remote gateway, so that the target gateway forwards it to the local server running the target service. The target gateway is determined by the local gateway based on the location information of the target gateway. The target address is the network address of the target gateway determined by the local gateway based on the routing rules. The routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located, and the routing address includes at least the location information and network address of the gateway device.

[0061] In one implementation scenario, after sending a call request to the local gateway 111, the requesting device 12 can further receive a response result forwarded by the local gateway 111 if the target gateway is the local gateway 111.

[0062] In one implementation scenario, after sending a call request to the local gateway 111, the requesting device 12 can further receive a response result forwarded by the target gateway to the local gateway 111 and then forwarded by the local gateway 111 if the target gateway is a remote gateway 112. The forwarding path from the target gateway to the local gateway 111 is the original path from which the local gateway 111 sent the call request to the target gateway. It should also be noted that the "original path" here only refers to the communication link between the local gateway 111 and the target gateway, where the nodes are the same, but the directions are different; the direction is actually opposite to the original path.

[0063] Please see Figure 5 , Figure 5 This is a schematic diagram of the framework of an embodiment of the service invocation device of this application. The service invocation device 50 includes a first receiving module 51, a determining module 52, a first response module 53, and a second response module 54. The first receiving module 51 is used to receive the invocation request of the requesting device 12 for the target service, wherein the invocation request includes at least the location information of the target gateway, and the target service is published on the target gateway. The determining module 52 is used to determine whether the target gateway is a local gateway 111 or a remote gateway 112 based on the location information of the target gateway. The first response module 53 is used to forward the invocation request to the local server running the target service in response to the target gateway being a local gateway 111. The second response module 54 is used to determine the network address of the target gateway as the target address based on routing rules in response to the target gateway being a remote gateway 112, and send the invocation request to the target gateway according to the target address, so that the target gateway forwards the invocation request to the local server running the target service. The routing rules include the routing addresses of gateways in various regions within the target area where the local gateway 111 is located, and the routing address includes at least the location information and network address of the gateway device.

[0064] In the above scheme, the service invocation device 50 receives the invocation request for the target service from the requesting device 12, and determines whether the target gateway is a local gateway 111 or a remote gateway 112 based on the location information of the target gateway. In response to the target gateway being a local gateway 111, the invocation request is forwarded to the local server running the target service. In response to the target gateway being a remote gateway 112, the network address of the target gateway is determined as the target address based on the routing rules, and the invocation request is sent to the target gateway according to the target address, so that the target gateway forwards the invocation request to the local server running the target service. The invocation request includes at least the location information of the target gateway, the target service is published on the target gateway, the routing rules include the routing addresses of gateways in various regions within the target area where the local gateway 111 is located, and the routing address includes at least the location information and network address of the gateway device. In other words, the location information and network address of both local gateway 111 and remote gateway 112 are under a unified routing rule. Furthermore, different service invocation strategies can be adopted depending on whether local gateway 111 or remote gateway 112 is the target gateway. When the target gateway is local gateway 111, local gateway 111 directly forwards the invocation request to the local server running the target service, without involving inter-gateway integration. When the target gateway is remote gateway 112, after determining the target address based on the unified routing rule, the invocation request is forwarded between local gateway 111 and remote gateway 112 based on the target address, without requiring multiple inter-gateway integrations. Therefore, this reduces the workload of the gateways during the service invocation process, thereby improving service invocation efficiency.

[0065] In some disclosed embodiments, the location information includes at least the administrative region, network region, and data center identifier of the gateway device's location. The determination module is specifically used to detect whether the location information contained in the call request is completely consistent with the location information of the local gateway 111; in response to the location information contained in the call request being completely consistent with the location information of the local gateway 111, the target gateway is determined to be the local gateway 111; in response to the location information contained in the call request being not completely consistent with or completely inconsistent with the location information of the local gateway 111, the target gateway is determined to be the remote gateway 112.

[0066] Therefore, the location information includes the administrative region, network area, and data center identifier of the gateway device. It can be used as an identifier to determine whether the location information contained in the call request is completely consistent with the location information of the local gateway 111, and then determine whether the target gateway is the local gateway 111 or the remote gateway 112. In other words, the three can limit the target area to a specific range, which can improve the accuracy of service calls in determining the target gateway in the target area.

[0067] In some disclosed embodiments, the service invocation device further includes a second sending module and a second receiving module; the second sending module is used to send the location information and network address of the local gateway 111 to the routing management platform 15, so that the management platform can generate routing rules based on the location information and network addresses of gateways in various regions within the target area where the local gateway 111 is located; the second receiving module is used to receive the routing rules sent by the routing management platform 15.

[0068] Therefore, by aggregating the location information of gateway devices and network devices in various regions within the target area, a unified routing rule is generated. Each gateway can make service calls based on this unified routing rule, which can reduce the need for inter-gateway integration and improve service call efficiency.

[0069] In some disclosed embodiments, the service invocation device further includes a publishing module and a synchronization module; the publishing module is used to publish the local service on the local gateway 111 before receiving the requesting device 12 to invoke the target service; the synchronization module is used to concatenate the service address of the local service and the location information of the local gateway 111 to obtain the service information of the local service, and synchronize the service information of the local service to the service management platform 14, wherein the requesting device 12 selects the target service to be invoked from the service management platform 14 and determines the location information of the target gateway.

[0070] Therefore, by publishing services and aggregating them to the service management platform 14 for the requesting device 12 to choose from, the communication between the requesting device 12 and each gateway can be reduced. The requesting device 12 only needs to go to one service application platform to obtain the service information of the target service and generate a call request, which can reduce the workload of the target service acquisition process and thus improve the overall service call efficiency.

[0071] In some disclosed embodiments, the service invocation device further includes a third receiving module and a third sending module. The third receiving module is used to send an invocation request to the target gateway according to the target address when the target gateway is a remote gateway 112, so that the target gateway forwards the invocation request to the local server running the target service, and then receives the response result forwarded by the target gateway. The forwarding path of the response result is the original path from the local gateway 111 to the target gateway, and the response result is obtained by the local server running the target service based on the invocation request, and the local server forwards the response result to the target gateway. The third sending module sends the response result of the third receiving module to the requesting device 12.

[0072] Therefore, for service call processes that need to be forwarded from local gateway 111 to remote gateway 112, local gateway 111 only needs to determine the target address of the target gateway according to the unified routing rules, and forward the call request to the target gateway according to the target address. Compared with the existing communication forwarding through one-to-one connection between gateways, this can reduce the number of gateway connections and help reduce the data burden in the service call process.

[0073] Please see Figure 6 , Figure 6 This is a schematic diagram of another embodiment of the service invocation device of this application. The service invocation device 60 includes a generation module 61 and a sending module 62. The generation module 61 is used to generate an invocation request for a target service, wherein the invocation request includes at least the location information of the target gateway, and the target service is published on the target gateway. The sending module 62 is used to send the invocation request to the local gateway 111, wherein the invocation request is directly forwarded by the local gateway 111 to the local server running the target service when the target gateway is the local gateway 111, or sent by the local gateway 111 to the target gateway according to the target address when the target gateway is a remote gateway 112, so that the target gateway forwards it to the local server running the target service. The target gateway is determined by the local gateway 111 based on the location information of the target gateway. The target address is the network address of the target gateway determined by the local gateway 111 based on the routing rules. The routing rules include the routing addresses of gateways in various regions within the target area where the local gateway 111 is located, and the routing address includes at least the location information and network address of the gateway device.

[0074] In the above scheme, the service invocation device 60 generates an invocation request for the target service and sends the invocation request to the local gateway 111. The invocation request includes at least the location information of the target gateway. The target service is published on the target gateway. The invocation request is directly forwarded by the local gateway 111 to the local server running the target service if the target gateway is the local gateway 111. Alternatively, if the target gateway is a remote gateway 112, the local gateway 111 sends the request to the target gateway according to the target address, so that the target gateway forwards it to the local server running the target service. The target gateway is determined by the local gateway 111 based on the location information of the target gateway. The target address is the network address of the target gateway determined by the local gateway 111 based on the routing rules. The routing rules include the routing addresses of gateways in various regions within the target area where the local gateway 111 is located. The routing address includes at least the location information and network address of the gateway device. In other words, the location information and network address of both local gateway 111 and remote gateway 112 are under a unified routing rule. Furthermore, different service invocation strategies can be adopted depending on whether local gateway 111 or remote gateway 112 is the target gateway. When the target gateway is local gateway 111, local gateway 111 directly forwards the invocation request to the local server running the target service, without involving inter-gateway integration. When the target gateway is remote gateway 112, after determining the target address based on the unified routing rule, the invocation request is forwarded between local gateway 111 and remote gateway 112 based on the target address, without requiring multiple inter-gateway integrations. Therefore, this reduces the workload of the gateways during the service invocation process, thereby improving service invocation efficiency.

[0075] In some disclosed embodiments, the service invocation apparatus further includes a receiving module, which is used to receive, after sending an invocation request to the local gateway 111, a response result forwarded by the local gateway 111 when the target gateway is the local gateway 111; or, to receive a response result forwarded by the target gateway to the local gateway 111 and then forwarded by the local gateway 111 when the target gateway is a remote gateway 112; wherein the response result is obtained by the local server running the target service based on the invocation request, and when the target gateway is a remote gateway 112, the forwarding path of the target gateway forwarding the response result to the local gateway 111 is the original path from which the local gateway 111 sent the invocation request to the target gateway.

[0076] Therefore, for service call processes that need to be forwarded from local gateway 111 to remote gateway 112, local gateway 111 only needs to determine the target address of the target gateway according to the unified routing rules, and forward the call request to the target gateway according to the target address. This communication forwarding through the existing gateway-to-gateway connection can reduce the number of gateway connections and help reduce the data burden in the service call process.

[0077] In some disclosed embodiments, the service invocation device further includes a selection module, which is used to select a target service from the service management platform 14 and determine the location information of the target gateway before generating an invocation request for the target service. The gateway device concatenates the service address of the local service and the location information of the local gateway 111 as the service information of the local service after publishing the local service, and synchronizes the service information to the service management platform 14. The generation module is also specifically used to generate an invocation request based on the service information of the target service.

[0078] Therefore, by publishing services and aggregating them to the service management platform 14 for the requesting device 12 to choose from, the communication between the requesting device 12 and each gateway can be reduced. The requesting device 12 only needs to go to one service application platform to obtain the service information of the target service and generate a call request, which can reduce the workload of the target service acquisition process and thus improve the overall service call efficiency.

[0079] Please see Figure 7 , Figure 7 This is a schematic diagram of a framework of an embodiment of the electronic device of this application. The electronic device 70 includes a communication circuit 71, a memory 72, and a processor 73. The communication circuit 71 and the memory 72 are respectively coupled to the processor 73. The processor 73 is used to execute program instructions stored in the memory 72 to implement the steps in any of the above-described service invocation method embodiments. Specifically, the electronic device 70 may include, but is not limited to, a microcomputer, a server, a translator, a notebook, etc., and is not limited thereto.

[0080] Specifically, processor 73 controls itself, as well as communication circuit 71 and memory 72, to implement the steps of any of the above-described service invocation method embodiments. Processor 73 may also be referred to as a CPU (Central Processing Unit). Processor 73 may be an integrated circuit chip with signal processing capabilities. Processor 73 may also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. A general-purpose processor may be a microprocessor or any conventional processor. Furthermore, processor 73 may be implemented using integrated circuit chips.

[0081] In the above scheme, electronic device 70 receives a request from requesting device 12 to call a target service, and determines whether the target gateway is a local gateway 111 or a remote gateway 112 based on the location information of the target gateway. In response to the target gateway being a local gateway 111, it forwards the call request to the local server running the target service. In response to the target gateway being a remote gateway 112, it determines the network address of the target gateway as the target address based on routing rules, and sends the call request to the target gateway according to the target address, so that the target gateway forwards the call request to the local server running the target service. The call request includes at least the location information of the target gateway, the target service is published on the target gateway, and the routing rules include the routing addresses of gateways in various regions within the target area where the local gateway 111 is located. The routing address includes at least the location information and network address of the gateway device. In other words, the location information and network address of both local gateway 111 and remote gateway 112 are under a unified routing rule. Furthermore, different service invocation strategies can be adopted depending on whether local gateway 111 or remote gateway 112 is the target gateway. When the target gateway is local gateway 111, local gateway 111 directly forwards the invocation request to the local server running the target service, without involving inter-gateway integration. When the target gateway is remote gateway 112, after determining the target address based on the unified routing rule, the invocation request is forwarded between local gateway 111 and remote gateway 112 based on the target address, without requiring multiple inter-gateway integrations. Therefore, this reduces the workload of the gateways during the service invocation process, thereby improving service invocation efficiency.

[0082] Please see Figure 8 , Figure 8This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium of this application. The computer-readable storage medium 80 stores program instructions 81 that can be executed by a processor. The program instructions 81 are used to implement the steps of the above-described service invocation method embodiment.

[0083] In the above scheme, the computer-readable storage medium 80 receives the requesting device 12 to call the target service, and determines the target gateway as a local gateway 111 or a remote gateway 112 based on the location information of the target gateway. In response to the target gateway being a local gateway 111, the call request is forwarded to the local server running the target service. In response to the target gateway being a remote gateway 112, the network address of the target gateway is determined as the target address based on routing rules, and the call request is sent to the target gateway according to the target address, so that the target gateway forwards the call request to the local server running the target service. The call request includes at least the location information of the target gateway, the target service is published on the target gateway, the routing rules include the routing addresses of gateways in various regions within the target area where the local gateway 111 is located, and the routing address includes at least the location information and network address of the gateway device. In other words, the location information and network address of both local gateway 111 and remote gateway 112 are under a unified routing rule. Furthermore, different service invocation strategies can be adopted depending on whether local gateway 111 or remote gateway 112 is the target gateway. When the target gateway is local gateway 111, local gateway 111 directly forwards the invocation request to the local server running the target service, without involving inter-gateway integration. When the target gateway is remote gateway 112, after determining the target address based on the unified routing rule, the invocation request is forwarded between local gateway 111 and remote gateway 112 based on the target address, without requiring multiple inter-gateway integrations. Therefore, this reduces the workload of the gateways during the service invocation process, thereby improving service invocation efficiency.

[0084] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0085] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.

[0086] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0087] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0088] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A service invocation method, characterized in that, The method includes: Receive a request from a requesting device to invoke a target service; wherein the request includes at least the location information of the target gateway, and the target service is published on the target gateway; Based on the location information of the target gateway, the target gateway is determined to be either a local gateway or a remote gateway; If the target gateway is the local gateway, the call request is forwarded to the local server running the target service; In response to the fact that the target gateway is the remote gateway, based on routing rules, the network address of the target gateway is determined as the target address, and the call request is sent to the target gateway according to the target address, so that the target gateway forwards the call request to the local server running the target service; wherein, the routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located, and the routing address includes at least the local information and network address of the gateway device; The location information includes at least the administrative region, network region, and data center identifier of the location of the gateway device. Determining whether the target gateway is a local gateway or a remote gateway based on its location information includes: detecting whether the location information contained in the call request is completely consistent with the location information of the local gateway; determining the target gateway as the local gateway in response to the complete consistency between the location information contained in the call request and the location information of the local gateway; and determining the target gateway as the remote gateway in response to the inconsistency between the location information contained in the call request and the location information of the local gateway.

2. The method according to claim 1, characterized in that, Before the receiving device makes a request to invoke the target service, the method further includes: Send the location information and network address of the local gateway to the routing management platform, so that the routing management platform can generate routing rules based on the location information and network addresses of gateways in various locations within the target area where the local gateway is located; Receive the routing rules sent by the routing management platform.

3. The method according to claim 1, characterized in that, Before the receiving device makes a request to invoke the target service, the method further includes: Publish local services on the local gateway; The service information of the local service is obtained by concatenating the service address of the local service and the location information of the local gateway, and the service information of the local service is synchronized to the service management platform; wherein, the requesting device selects the target service to be called from the service management platform and determines the location information of the target gateway.

4. The method according to claim 1, characterized in that, When the target gateway is the remote gateway, after sending the call request to the target gateway according to the target address, so that the target gateway forwards the call request to the local server running the target service, the method further includes: Receive a response result forwarded by the target gateway; wherein the forwarding path of the response result is the original path from which the local gateway sent the call request to the target gateway, and the response result is obtained by the local server running the target service based on the call request, and the local server forwards the response result to the target gateway. Send the response result to the requesting device.

5. A service invocation method, characterized in that, The method includes: Generate a request to invoke the target service; wherein the request includes at least the location information of the target gateway, the target service is published on the target gateway, and the location information includes at least the administrative region, network area, and data center identifier of the location of the gateway device; The call request is sent to the local gateway; wherein, if the target gateway is the local gateway, the call request is directly forwarded by the local gateway to the local server running the target service, or if the target gateway is a remote gateway, the local gateway sends the call request to the target gateway according to the target address, so that the target gateway forwards it to the local server running the target service. The local gateway determines whether the target gateway is a local gateway or a remote gateway based on the location information of the target gateway. The local gateway detects whether the location information contained in the call request is completely consistent with the location information of the local gateway. In response to the location information contained in the call request being completely consistent with the location information of the local gateway, the target gateway is determined to be the local gateway. In response to the location information contained in the call request being not completely consistent with or completely inconsistent with the location information of the local gateway, the target gateway is determined to be the remote gateway. The target address is the network address of the target gateway determined by the local gateway based on routing rules. The routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located, and the routing address includes at least the location information and network address of the gateway device.

6. The method according to claim 5, characterized in that, After sending the call request to the local gateway, the method further includes: Receive the response result forwarded by the local gateway if the target gateway is the local gateway; or, Receive the response result that is forwarded by the target gateway to the local gateway and then forwarded by the local gateway when the target gateway is the remote gateway; The response result is obtained by the local server running the target service based on the call request. In the case that the target gateway is the remote gateway, the forwarding path of the target gateway to forward the response result to the local gateway is the original path of the local gateway sending the call request to the target gateway.

7. The method according to claim 5, characterized in that, Before generating the request to invoke the target service, the method further includes: The target service is selected from the service management platform, and the location information of the target gateway is determined. The gateway device, after publishing the local service, concatenates the service address of the local service and the location information of the local gateway as the service information of the local service, and synchronizes the service information to the service management platform. The generation of the request to invoke the target service includes: The invocation request is generated based on the service information of the target service.

8. A service invocation device, characterized in that, include: The first receiving module is used to receive a request from the requesting device to invoke a target service; wherein the request includes at least the location information of the target gateway, and the target service is published on the target gateway; The determination module is used to determine whether the target gateway is a local gateway or a remote gateway based on the location information of the target gateway. The first response module is used to forward the call request to the local server running the target service in response to the target gateway being the local gateway. The second response module is used to respond to the fact that the target gateway is the remote gateway, determine the network address of the target gateway as the target address based on routing rules, and send the call request to the target gateway according to the target address, so that the target gateway forwards the call request to the local server running the target service; wherein, the routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located, and the routing address includes at least the local information and network address of the gateway device; The location information includes at least the administrative region, network region, and data center identifier of the location of the gateway device. Determining whether the target gateway is a local gateway or a remote gateway based on its location information includes: detecting whether the location information contained in the call request is completely consistent with the location information of the local gateway; determining the target gateway as the local gateway in response to the complete consistency between the location information contained in the call request and the location information of the local gateway; and determining the target gateway as the remote gateway in response to the inconsistency between the location information contained in the call request and the location information of the local gateway.

9. A service invocation device, characterized in that, include: A generation module is used to generate a call request to the target service; wherein, the call request includes at least the location information of the target gateway, the target service is published on the target gateway, and the location information includes at least the administrative region, network area, and data center identifier of the location of the gateway device; A sending module is configured to send the call request to a local gateway; wherein, if the target gateway is the local gateway, the call request is directly forwarded by the local gateway to the local server running the target service, or if the target gateway is a remote gateway, the local gateway sends the call request to the target gateway according to the target address, so that the target gateway forwards it to the local server running the target service. The local gateway determines whether the target gateway is a local gateway or a remote gateway based on the location information of the target gateway. The local gateway detects whether the location information contained in the call request matches the location information of the target gateway. If the location information of the local gateway is completely consistent with the location information of the local gateway, the target gateway is determined to be the local gateway. If the location information of the local gateway is not completely consistent with the location information of the local gateway, the target gateway is determined to be the remote gateway. The target address is the network address of the target gateway determined by the local gateway based on routing rules. The routing rules include the routing addresses of gateways in various regions within the target area where the local gateway is located, and the routing address includes at least the location information and network address of the gateway device.

10. An electronic device, characterized in that, The device includes a communication circuit, a memory, and a processor. The communication circuit and the memory are respectively coupled to the processor. The processor is used to execute program instructions stored in the memory to implement the service invocation method according to any one of claims 1 to 7.

11. A service system, characterized in that, It includes at least gateway devices distributed in various locations and request devices that are communicatively connected to the gateway devices. The gateway devices are used to execute the service invocation method according to any one of claims 1 to 4, and the request devices are used to execute the service invocation method according to any one of claims 5 to 7.

12. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by the processor, they implement the service invocation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Service providing method and device in multi-region scene and storage medium

    CN113206866A