CN110753082B - Service calling method and terminal equipment - Google Patents

Service calling method and terminal equipment Download PDF

Info

Publication number
CN110753082B
CN110753082B CN201910840654.8A CN201910840654A CN110753082B CN 110753082 B CN110753082 B CN 110753082B CN 201910840654 A CN201910840654 A CN 201910840654A CN 110753082 B CN110753082 B CN 110753082B
Authority
CN
China
Prior art keywords
service
client
name
calling
registered
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
CN201910840654.8A
Other languages
Chinese (zh)
Other versions
CN110753082A (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.)
Shenzhen Ping An Communication Technology Co Ltd
Original Assignee
Shenzhen Ping An Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Ping An Communication Technology Co Ltd filed Critical Shenzhen Ping An Communication Technology Co Ltd
Priority to CN201910840654.8A priority Critical patent/CN110753082B/en
Publication of CN110753082A publication Critical patent/CN110753082A/en
Application granted granted Critical
Publication of CN110753082B publication Critical patent/CN110753082B/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/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention is suitable for the technical field of computer application, and provides a service calling method, terminal equipment and a computer readable storage medium, wherein the service calling method comprises the following steps: by pre-registering the call path of each service corresponding to each client, modification of a large number of related source programs is avoided when product requirements are increased or modified; when a calling request sent by a terminal is acquired, identifying calling paths corresponding to the service name and the name of the client at the same time as target paths from calling paths corresponding to all pre-registered clients; and the processing result of the target service corresponding to the target path is sent to the terminal, so that the service calling and processing efficiency is improved.

Description

Service calling method and terminal equipment
Technical Field
The invention belongs to the technical field of computer application, and particularly relates to a service calling method, terminal equipment and a computer readable storage medium.
Background
The current mainstream declarative inter-service call technology is declarative Cloud Feign technology. As a mature product, the Spring Cloud Feign is realized based on a network flight declaration technology Netflix Feign, can help a developer to define and realize an interface depending on services, and can support load balancing technologies such as a function area Cloud framework Spring Cloud Ribbon and the like as a part of a Cloud framework Spring Cloud, and is a pluggable and declarative type World Wide Web (Web) service client definition mode for defining the interface through annotation.
In practical application, although Spring Cloud Feign can reduce partial coupling for helping a developer, under a complex scene and a scene of bidirectional dependence, a Feign Client registered in a single instance cannot well solve the problem of program coupling, so that under the condition that a service requirement of the developer is newly increased or modified, a program of a service calling end corresponding to the service requirement needs to be continuously changed, and the problem of low calling efficiency is caused when the program of the service calling end is really called.
Disclosure of Invention
In view of this, embodiments of the present invention provide a service invocation method, a terminal device, and a computer-readable storage medium, so as to solve the problem in the prior art that efficiency is low when a program invokes a service invocation end.
A first aspect of an embodiment of the present invention provides a service invocation method, including:
acquiring a calling request sent by a terminal; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed;
identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the pre-registered clients;
and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal.
A second aspect of the embodiments of the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the following steps when executing the computer program:
acquiring a calling request sent by a terminal; the calling request comprises a service name of a service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed;
identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the clients registered in advance;
and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal.
A third aspect of an embodiment of the present invention provides a terminal device, including:
the acquiring unit is used for acquiring a calling request sent by a terminal; the calling request comprises a service name of a service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed;
the identification unit is used for identifying calling paths corresponding to the service name and the name of the client as target paths from calling paths corresponding to all clients registered in advance;
and the sending unit is used for determining the target service corresponding to the calling request according to the target path and sending a processing result corresponding to the target service to the terminal.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium having stored thereon a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of the first aspect described above.
Compared with the prior art, the embodiment of the invention has the following beneficial effects:
the embodiment of the invention obtains a call request sent by a terminal; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed; identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the clients registered in advance; and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal. By pre-registering the call path of each service corresponding to each client, modification of a large number of related source programs is avoided when product requirements are increased or modified; when a calling request sent by a terminal is acquired, identifying calling paths corresponding to the service name and the name of the client at the same time as target paths from calling paths corresponding to all pre-registered clients; and the processing result of the target service corresponding to the target path is sent to the terminal, so that the service calling and processing efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a flowchart of a service invocation method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a service invocation method provided in the second embodiment of the present invention;
FIG. 3 is a diagram illustrating client registration corresponding to services provided by a second embodiment of the invention;
fig. 4 is a schematic diagram of a terminal device according to a third embodiment of the present invention;
fig. 5 is a schematic diagram of a terminal device according to a fourth embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to illustrate the technical means of the present invention, the following description is given by way of specific examples.
Referring to fig. 1, fig. 1 is a flowchart of a service invocation method according to an embodiment of the present invention. The main execution body of the service calling method in this embodiment is a terminal. The terminal includes but is not limited to mobile terminals such as smart phones, tablet computers, wearable devices and the like, and can also be desktop computers and the like. The service invocation method as shown in the figure may comprise the following steps:
s101: acquiring a calling request sent by a terminal; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; and completing the pre-registration of each service corresponding to each client and the call path thereof.
The call between different services is generally implemented through a HyperText Transfer Protocol (HTTP), and a request result required by the terminal is obtained by accessing a Uniform Resource Locator (URL) corresponding to the HTTP. The declarative interface templates the request, declares a method in the program and the URL bound by the method, and when we use the method, automatically converts the method into a corresponding HTTP request to be sent to a corresponding server.
The binding registration process in this embodiment is completed before the service is started. The declarative interface only specifies a target server or server cluster, and when requests need to be made to multiple servers, multiple Client clients need to be declared for implementation. If the service changes frequently and the server to be called changes continuously, the Client or the method needs to be added or deleted continuously to realize the change, and because the binding process is completed when the service is started, the calling party service needs to be restarted continuously to perform adaptation modification, so that the influence of service interruption and the like is caused.
In the present embodiment, each service is pre-registered with its corresponding client, and each client is configured to execute its corresponding service. When the dynamic registration method in this embodiment is used, the system automatically registers the same Client as a plurality of frame tags springbeans with different names according to a certain specification, and the frame tags springbeans are used for mapping to different servers, that is, clients corresponding to the clients are registered in advance with each service, so that the URL of the method in the Client is bound to different services, and when the method is used by the obtained Cilent through the specification, the method is sent to different servers, thereby ensuring the stability of the program. Through the one-to-one registration mode of the service and the client, the modification of a large number of related source programs when the product requirements are increased or modified is avoided, and the efficiency of program arrangement, encoding and maintenance is improved.
For example, for services corresponding to different clients, the corresponding service name, i.e. the URL part of the service, is generated first: query/product, meaning product information in the queue; then determining the names and addresses of all clients, for example, cilent a (100.68.0.1) and Cilent B (100.68.0.2), that is, the address corresponding to client a is 100.68.0.1, and the address corresponding to client B is 100.68.0.2; finally, all the services are in one-to-one correspondence with the clients, the call path of each client corresponding to each service is respectively generated, and the requests are respectively as follows: HTTP: //100.68.0.1/query/product and HTTP: and the product information in the Cilent A and the Cilent B can be obtained through// 100.68.0.2/query/product.
The call request of this embodiment includes a service name of the service to be called and a name of a client corresponding to the service to be called. The service name of the calling service is used for determining the name of the service corresponding to the calling request sent by the terminal, and the client corresponding to the service to be called is used for determining the name of the client corresponding to the calling request sent by the terminal. In this embodiment, the service name of the service to be called and the name of the client corresponding to the service to be called are generated when the service to be called and the client corresponding to the service to be called are registered in advance, and are used for identifying each service and the client corresponding to the service.
S102: and identifying the calling path corresponding to the service name and the name of the client as a target path from the calling paths corresponding to all the clients registered in advance.
After a calling request sent by a calling terminal is obtained, a corresponding calling path and a realizing method are determined according to a service name and a client name in the calling request. For example, the call path in this embodiment may be represented by an IP address, and may also be represented in other ways, which is not limited herein. For example, the HTTP format of a call request sent by the terminal is as follows: HTTP: the method comprises the following steps of// 100.68.0.1/query/product, wherein the name of a service to be called is query/product, namely the service for acquiring product information, and the name of a Client corresponding to the service to be called is 100.68.0.1, and since the URL of the method corresponding to the Client during registration is already bound to different services respectively, namely the following path in the calling request, namely the URL part: therefore, after the call request sent by the terminal is acquired, the call path including the service name/query/product in the call request and the name 100.68.0.1 of the client can be determined to be the target path from the call paths corresponding to all the clients registered in advance.
S103: and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal.
After identifying the calling path corresponding to both the service name and the client name as a target path, determining a corresponding target service according to the target path, and sending a processing result corresponding to the target service to the terminal. Illustratively, after the target path 100.68.0.1/query/product is determined, the corresponding target service is product information of query Cilent a (100.68.0.1), and the corresponding processing result is that the product information of query Cilent a is red, rectangular and the like, and then the query result is sent to the terminal.
According to the scheme, the calling request sent by the terminal is obtained; the calling request comprises a service name of a service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed; identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the clients registered in advance; and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal. By pre-registering the call path of each service corresponding to each client, modification of a large number of related source programs is avoided when product requirements are increased or modified; when a calling request sent by a terminal is acquired, identifying calling paths corresponding to the service name and the name of the client as target paths from calling paths corresponding to all pre-registered clients; and the processing result of the target service corresponding to the target path is sent to the terminal, so that the service calling and processing efficiency is improved.
Referring to fig. 2, fig. 2 is a flowchart of a service invocation method according to a second embodiment of the present invention. The main execution body of the service calling method in the embodiment is a terminal. The terminal includes but is not limited to mobile terminals such as smart phones, tablet computers, wearable devices and the like, and can also be desktop computers and the like. The service invocation method as shown in the figure may comprise the following steps:
s201: acquiring a calling request sent by a terminal; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; and pre-registering each service corresponding to each client and a call path thereof.
In this embodiment, the implementation manner of S201 is completely the same as that of S101 in the embodiment corresponding to fig. 1, and reference may be specifically made to the related description of S101 in the embodiment corresponding to fig. 1, which is not repeated herein.
S202: acquiring configuration information of a client to be registered; the configuration information includes the name of the client to be registered, the service name of the service corresponding to the client to be registered, and the call path of the service corresponding to the client to be registered.
In this embodiment, when a service is started, if interfaces of other services need to be called, different clients need to be registered for different services, so as to meet actual service calling requirements. When registering, first obtaining configuration information of a client to be registered, where the configuration information of this embodiment includes: the method comprises the following steps of registering the name of a client to be registered, the service name of a service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered.
Illustratively, the name of the client to be registered is used for representing different object names, such as Cilent a and Cilent B, and the name of the client to be registered can be represented by 100.68.0.1 or 100.68.0.2; the service corresponding to the client to be registered can be inquiry product information and the like, and the corresponding service name can be/query/product; the call path of the service corresponding to the client to be registered may be HTTP: // 100.68.0.1/query/product.
S203: and registering the client to a preset service library according to the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered.
After the configuration information of the Client to be registered is acquired, the service name which needs to be registered as the Client is automatically generated according to the configuration file, different names of Springbeans are generated for each interface, all services are sequentially registered as different clients, and the corresponding clients are acquired through different service names at the calling terminal. The service caller can obtain the corresponding spring bean according to the appointed mode, thus realizing the dynamic call of different service end interfaces. Based on the preset basic service client, according to each calling path, the requests of different clients corresponding to the same calling path, namely the clients corresponding to different services, are respectively registered as different clients.
The SpringBean is a general name for collectively managing a part of classes in a springframe used in java development, and the Client is one of the springbeans. The call path in this embodiment is determined according to the generated configuration information, which may be set by a developer according to the call habit of the called client.
For example, referring to fig. 3 together, fig. 3 is a schematic diagram illustrating registration of a service corresponding to a client according to an embodiment of the present invention. The call path corresponding to the called party service A comprises the following steps: method 0: route 1, method 1: path 2, method 2: path 3. According to different called party services, the requests of the same calling path are respectively registered as the clients of different called party services, namely the clients of different called services: and the service A and the service B are provided with all call paths for later calls at any time.
When the dynamic registration method is adopted, only a program corresponding to a Client needs to be written all the time, but the Client is not bound with any service, and according to configuration information, cilent which is based on a basic service Client and has different service names and different calling paths is dynamically generated, wherein the calling paths can be represented by the calling paths and are used as a part of URL. The calling party takes different clients through the service names, the calling party can be sent to the corresponding service when requesting the method, and no matter how the service is increased, the calling party program only has one basic Client, namely a basic service Client, and the other clients are dynamically generated according to the configuration information. If the service C needs to be added, only the Client of one service C needs to be rewritten to call the method of the service C, and the calling service needs to be reissued to complete the method. By pre-registering the call path of each service corresponding to each client, modification of a large number of related source programs when product requirements are increased or modified is avoided, and the efficiency of program arrangement, encoding and maintenance is improved.
Further, after step S203, the method further includes:
acquiring a call path of a service corresponding to a registered client in the service library;
identifying child clients that belong to the same parent client; the calling path of the service corresponding to the parent client comprises the calling paths of the services corresponding to all child clients subordinate to the parent client;
the child clients belonging to the same parent client are merged and the registration information of the child clients is deleted.
Specifically, in this embodiment, when each client corresponding to each service is registered, there is a high possibility that redundancy is invoked, that is, a large number of redundant services, redundant clients, or redundant registration information exists in the current system. In view of this, in this embodiment, all call paths are checked from the call paths of the services corresponding to the clients registered in the acquired service library, the call paths included in each other are determined, the client whose call path includes the call path of the service corresponding to another client is identified as a parent client, and the client belonging to the call path corresponding to the parent client is identified as a child client corresponding to the parent client. And merges child clients belonging to the same parent client while deleting the registration information of the child clients. By means of deleting redundant sub-clients, the simplification of the clients in the system can be guaranteed, client programs corresponding to the services can be called and modified immediately, and too much data memory is not occupied.
S204: and identifying the calling path corresponding to the service name and the name of the client as a target path from the calling paths corresponding to all the clients registered in advance.
After a calling request sent by a calling terminal is obtained, a calling path and a realizing method corresponding to the calling request are determined according to a service name in the calling request and a name of a client. For example, the call path in this embodiment may be represented by an IP address, and may also be represented in other ways, which is not limited herein. For example, the HTTP format of a call request sent by the terminal is as follows: HTTP: the method comprises the following steps of// 100.68.0.1/query/product, wherein the name of a service to be called, namely the service for acquiring product information, is included, and the name of a Client corresponding to the service to be called, namely 100.68.0.1, is also included, and since the URL of a method corresponding to a Client during registration is already bound to different services respectively, namely a following path in a calling request, namely a URL part: therefore, after the call request sent by the terminal is acquired, the call path including the service name/query/product in the call request and the name 100.68.0.1 of the client can be determined to be the target path from the call paths corresponding to all the clients registered in advance.
Further, step S204 may specifically include:
detecting whether the name of the client in the calling request is registered in advance;
if the name of the client in the calling request is registered in advance, identifying a calling path corresponding to the service name and the name of the client as a target path;
if the name of the client in the calling request is not registered in advance, acquiring configuration information of the client corresponding to the calling request, and identifying a calling path corresponding to the service name and the name of the client in the configuration information as the target path.
Specifically, when the called service client is called, it may first detect whether the called service client corresponding to the call request exists, if so, the called service client may be directly called, and if not, the called service client corresponding to the call request is generated and then the call is performed. If the service client corresponding to the current method does not exist, the configuration information of the client is obtained firstly when the service client corresponding to the method is generated. In this embodiment, the configuration information of the client may include an interface name, a call path, a call mode, and the like of a data call interface in a service corresponding to the client, and is used to register the callee server according to the configuration information.
Further, the steps are as follows: if the name of the client in the call request is not registered in advance, acquiring configuration information of the client corresponding to the call request, and after identifying a call path corresponding to the service name and the name of the client in the configuration information as the target path, the method further includes: registering a client corresponding to the calling request according to the configuration information; the configuration information comprises the name of the client, the service name of the service corresponding to the client and the calling path corresponding to each service. Specifically, the registration method is the same as the registration method in step S203, and details are not repeated here.
S205: and determining a target service corresponding to the calling request according to the target path, and sending the target service to the terminal.
In this embodiment, the implementation manner of S205 is completely the same as that of S103 in the embodiment corresponding to fig. 1, and reference may be specifically made to the related description of S103 in the embodiment corresponding to fig. 1, which is not repeated herein.
According to the scheme, the calling request sent by the terminal is obtained; the calling request comprises a service name of a service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed; acquiring configuration information of a client to be registered; the configuration information comprises the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered; and registering the client to a preset service library according to the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered. Identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the pre-registered clients; and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal. By pre-registering the call path of each service corresponding to each client, modification of a large number of related source programs when product requirements are increased or modified is avoided, and the efficiency of program arrangement, encoding and maintenance is improved; when a calling request sent by a terminal is acquired, identifying calling paths corresponding to the service name and the name of the client at the same time as target paths from calling paths corresponding to all pre-registered clients; and the processing result of the target service corresponding to the target path is sent to the terminal, so that the service calling and processing efficiency is improved.
Referring to fig. 4, fig. 4 is a schematic diagram of a terminal device according to a third embodiment of the present invention. The terminal device comprises units for executing the steps in the embodiments corresponding to fig. 1-2. Please refer to the related description of the embodiments in fig. 1-2. For convenience of explanation, only the portions related to the present embodiment are shown. The terminal device 400 of the present embodiment includes:
an obtaining unit 401, configured to obtain a call request sent by a terminal; the calling request comprises a service name of a service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed;
an identifying unit 402, configured to identify, as a target path, a call path that corresponds to both the service name and the name of the client from call paths that correspond to all clients registered in advance;
a sending unit 403, configured to determine, according to the target path, a target service corresponding to the invocation request, and send a processing result corresponding to the target service to the terminal.
Further, the terminal device 400 further includes:
the configuration acquisition unit is used for acquiring the configuration information of the client to be registered; the configuration information comprises the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered;
and the service registration unit is used for registering the client to a preset service library according to the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered.
Further, the terminal device 400 further includes:
a path acquisition unit, configured to acquire a call path of a service corresponding to a client registered in the service library;
a parent-child recognition unit for recognizing child clients belonging to the same parent client; the calling path of the service corresponding to the parent client comprises the calling paths of the services corresponding to all child clients subordinate to the parent client;
and the merging unit is used for merging the sub-clients belonging to the same parent client and deleting the registration information of the sub-clients.
Further, the identifying unit 402 specifically includes:
a detection unit, configured to detect whether a name of the client in the call request is registered in advance;
a first identifying unit, configured to identify, as a target path, a call path that corresponds to both the service name and the name of the client if the name of the client in the call request is registered in advance;
a second identifying unit, configured to, if the name of the client in the call request is not registered in advance, obtain configuration information of the client corresponding to the call request, and identify, as the target path, a call path corresponding to a service name and a name of the client in the configuration information.
Further, the identifying unit 402 further includes:
the client registration unit is used for registering the client corresponding to the calling request according to the configuration information; the configuration information comprises the name of the client, the service name of the service corresponding to the client and the calling path corresponding to each service.
According to the scheme, the calling request sent by the terminal is obtained; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed; identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the clients registered in advance; and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal. By pre-registering the call path of each service corresponding to each client, modification of a large number of related source programs is avoided when product requirements are increased or modified; when a calling request sent by a terminal is acquired, identifying calling paths corresponding to the service name and the name of the client at the same time as target paths from calling paths corresponding to all pre-registered clients; and the processing result of the target service corresponding to the target path is sent to the terminal, so that the service calling and processing efficiency is improved.
Fig. 5 is a schematic diagram of a terminal device according to a fourth embodiment of the present invention. As shown in fig. 5, the terminal device 5 of this embodiment includes: a processor 50, a memory 51 and a computer program 52 stored in said memory 51 and executable on said processor 50. The processor 50, when executing the computer program 52, implements the steps in the various service invocation method embodiments described above, such as steps 101 through 103 shown in fig. 1. Alternatively, the processor 50, when executing the computer program 52, implements the functions of each module/unit in each device embodiment described above, for example, the functions of the units 301 to 303 shown in fig. 3.
Illustratively, the computer program 52 may be partitioned into one or more modules/units that are stored in the memory 51 and executed by the processor 50 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 52 in the terminal device 5.
The terminal device 5 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 50, a memory 51. Those skilled in the art will appreciate that fig. 5 is merely an example of a terminal device 5, and does not constitute a limitation of the terminal device 5, and may include more or fewer components than those shown, or some of the components may be combined, or different components, e.g., the terminal device may also include an input-output device, a network access device, a bus, etc.
The Processor 50 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the terminal device 5, such as a hard disk or a memory of the terminal device 5. The memory 51 may also be an external storage device of the terminal device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card, FC), and the like, which are provided on the terminal device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the terminal device 5. The memory 51 is used for storing the computer program and other programs and data required by the terminal device. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by a computer program, which may be stored in a computer-readable storage medium, to instruct related hardware.
The above-mentioned embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (8)

1. A service invocation method, characterized by comprising:
acquiring a calling request sent by a terminal; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed;
before service is started, obtaining configuration information of a client to be registered; the configuration information comprises the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered;
registering the client to a preset service library according to the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered;
identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the clients registered in advance;
and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal.
2. The service invocation method according to claim 1, wherein, after registering the client to a preset service library according to the name of the client, the service corresponding to the client, and the invocation path corresponding to each service, further comprising:
acquiring a call path of a service corresponding to a registered client in the service library;
identifying child clients belonging to the same parent client; the calling path of the service corresponding to the parent client comprises the calling paths of the services corresponding to all child clients subordinate to the parent client;
the child clients belonging to the same parent client are merged and the registration information of the child clients is deleted.
3. The service invocation method according to claim 1, wherein said identifying, as a target path, an invocation path simultaneously corresponding to both the service name and the name of the client from among invocation paths corresponding to all clients registered in advance, comprises:
detecting whether the name of the client in the calling request is registered in advance;
if the name of the client in the calling request is registered in advance, identifying a calling path corresponding to the service name and the name of the client as a target path;
if the name of the client in the calling request is not registered in advance, acquiring configuration information of the client corresponding to the calling request, and identifying a calling path corresponding to the service name and the name of the client in the configuration information as the target path.
4. The service invocation method according to claim 3, wherein, after acquiring the configuration information of the client corresponding to the invocation request and identifying the invocation path corresponding to the service name and the client name in the configuration information as the target path, if the client name in the invocation request is not registered in advance, the method further comprises:
registering a client corresponding to the calling request according to the configuration information; the configuration information comprises the name of the client, the service name of the service corresponding to the client and the calling path corresponding to each service.
5. A terminal device comprising a memory and a processor, the memory having stored therein a computer program operable on the processor, wherein the processor, when executing the computer program, implements the steps of:
acquiring a calling request sent by a terminal; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed;
before service is started, obtaining configuration information of a client to be registered; the configuration information comprises the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered;
registering the client to a preset service library according to the name of the client to be registered, the service name of the service corresponding to the client to be registered and the call path of the service corresponding to the client to be registered;
identifying calling paths corresponding to the service name and the name of the client as target paths from the calling paths corresponding to all the pre-registered clients;
and determining a target service corresponding to the calling request according to the target path, and sending a processing result corresponding to the target service to the terminal.
6. The terminal device of claim 5, wherein after registering the client to a preset service library according to the name of the client, the service corresponding to the client, and the call path corresponding to each service, further comprising:
acquiring a call path of a service corresponding to a registered client in the service library;
identifying child clients that belong to the same parent client; the calling path of the service corresponding to the parent client comprises the calling paths of the services corresponding to all child clients subordinate to the parent client;
and merging the sub-clients belonging to the same parent client, and deleting the registration information of the sub-clients.
7. A terminal device, comprising:
the acquiring unit is used for acquiring a calling request sent by a terminal; the calling request comprises a service name of the service to be called and a name of a client to which the service to be called belongs; the pre-registration of each service and the call path thereof corresponding to each client is completed;
the system comprises a configuration acquisition unit, a service registration unit and a service registration unit, wherein the configuration acquisition unit is used for acquiring configuration information of a client to be registered before service is started; the client registration unit is used for registering the client corresponding to the calling request according to the configuration information; the configuration information comprises the name of the client, the service name of the service corresponding to the client and the calling path corresponding to each service;
the identification unit is used for identifying calling paths corresponding to the service name and the name of the client as target paths from calling paths corresponding to all clients registered in advance;
and the sending unit is used for determining the target service corresponding to the calling request according to the target path and sending a processing result corresponding to the target service to the terminal.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN201910840654.8A 2019-09-06 2019-09-06 Service calling method and terminal equipment Active CN110753082B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910840654.8A CN110753082B (en) 2019-09-06 2019-09-06 Service calling method and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910840654.8A CN110753082B (en) 2019-09-06 2019-09-06 Service calling method and terminal equipment

Publications (2)

Publication Number Publication Date
CN110753082A CN110753082A (en) 2020-02-04
CN110753082B true CN110753082B (en) 2022-12-16

Family

ID=69276045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910840654.8A Active CN110753082B (en) 2019-09-06 2019-09-06 Service calling method and terminal equipment

Country Status (1)

Country Link
CN (1) CN110753082B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306710A (en) * 2020-10-20 2021-02-02 北京三快在线科技有限公司 Service processing system, interface calling method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104601702A (en) * 2015-01-19 2015-05-06 迈普通信技术股份有限公司 Cluster remote procedure call method and system
CN108206852A (en) * 2016-12-20 2018-06-26 杭州华为数字技术有限公司 A kind of dialogue-based Service Instance management method and equipment under micro services frame
CN108762949A (en) * 2018-05-21 2018-11-06 招银云创(深圳)信息技术有限公司 Centralized dispatching method, system, computer equipment and storage medium
CN109981716A (en) * 2017-12-28 2019-07-05 北京奇虎科技有限公司 A kind of micro services call method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104601702A (en) * 2015-01-19 2015-05-06 迈普通信技术股份有限公司 Cluster remote procedure call method and system
CN108206852A (en) * 2016-12-20 2018-06-26 杭州华为数字技术有限公司 A kind of dialogue-based Service Instance management method and equipment under micro services frame
CN109981716A (en) * 2017-12-28 2019-07-05 北京奇虎科技有限公司 A kind of micro services call method and device
CN108762949A (en) * 2018-05-21 2018-11-06 招银云创(深圳)信息技术有限公司 Centralized dispatching method, system, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110753082A (en) 2020-02-04

Similar Documents

Publication Publication Date Title
US11159411B2 (en) Distributed testing service
CN109922158A (en) Data processing method, device, medium and electronic equipment based on micro services
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
WO2019223136A1 (en) Data acquisition method and apparatus, and computer device and storage medium
CN114189525B (en) Service request method and device and electronic equipment
CN113794652A (en) Data processing method and device, electronic equipment and storage medium
CN110753082B (en) Service calling method and terminal equipment
CN109981697B (en) File unloading method, system, server and storage medium
CN114185973A (en) Parameter calling method, device, equipment and computer readable storage medium
CN112650804B (en) Big data access method, device, system and storage medium
US20230030856A1 (en) Distributed table storage processing method, device and system
CN113536168A (en) Component processing method and device
CN112491943A (en) Data request method, device, storage medium and electronic equipment
CN113779021B (en) Data processing method, device, computer system and readable storage medium
CN114124883B (en) Data access method and device based on cloud storage address, computer equipment and medium
CN113296911B (en) Cluster calling method, cluster calling device, electronic equipment and readable storage medium
CN112988604B (en) Object testing method, testing system, electronic device and readable storage medium
CN114356456A (en) Service processing method, device, storage medium and electronic equipment
CN109120692B (en) Method and apparatus for processing requests
CN115729693A (en) Data processing method and device, computer equipment and computer readable storage medium
US10394628B1 (en) In-line event handlers across domains
CN113556370A (en) Service calling method and device
CN110955430A (en) Application program native capability calling method and device and electronic equipment
WO2023143061A1 (en) Data access method and data access system thereof
CN109376023B (en) Method and equipment for generating calling information and issuing return code group

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