Service calling method, device and electronic device
The access code is generated by the proxy platform and the access request is forwarded using the software development tool kit, which solves the problem of low service invocation efficiency in the existing technology and realizes an efficient service invocation process.
Patent Information
- Application Number
- CN201911179261.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-26
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-10-15
AI Technical Summary
In the existing technology, service invocation requires engineers to manually write access codes, resulting in heavy workload and low efficiency.
The proxy platform generates access codes based on the configuration information of the target service, and uses the software development toolkit to control the forwarding of access requests to the service provider, realizing information forwarding and call control between the requester and the service provider.
It improves the efficiency of service invocation, reduces the workload, and avoids the need to write separate invocation control codes for different service providers.
Smart Images

Figure CN111176859B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device and electronic device for invoking a service. Background Art
[0002] In software development, it is often necessary to call services provided by other existing applications to implement specific functions, such as weather query, express delivery query, etc.
[0003] To implement service calls, the service provider's service document indicates basic information about the service being called, request protocol, access protocol, address, etc.
[0004] However, since the service document of the service provider cannot be directly applied to the requester, in order to implement the service call, it is necessary to develop access code for the service to be called, so that when the access code is run by the requester, it can access the service of the service provider and make a service call.
[0005] In the call of existing services, engineers are required to write access codes for the services to be called, which is a heavy workload and leads to low service access efficiency. Summary of the invention
[0006] The embodiments of the present application provide a service calling method, device and electronic device, which can at least to some extent solve the problems in the prior art of heavy workload and low service access efficiency caused by the need for engineers to manually write access codes.
[0007] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0008] According to one aspect of an embodiment of the present application, a service calling method is provided, which is applied to an agent platform, and the method includes:
[0009] Acquire an access request initiated by a requester based on an access code, wherein the access code is generated by the proxy platform according to configuration information of a target service;
[0010] Invoking a software development kit in the proxy platform according to the access request;
[0011] Through the software development kit, the access request is controlled to be forwarded to the service provider corresponding to the target service to call the target service.
[0012] According to one aspect of an embodiment of the present application, a service invocation device is provided, which is applied to an agent platform, and the device includes:
[0013] An access request acquisition module, used to acquire an access request initiated by a requester based on an access code, wherein the access code is generated by the proxy platform according to configuration information of a target service;
[0014] A calling module, used for calling a software development kit in the proxy platform according to the access request;
[0015] The forwarding control module is used to control the forwarding of the access request to the service provider corresponding to the target service through the software development kit to call the target service.
[0016] According to one aspect of an embodiment of the present application, there is provided an electronic device, including:
[0017] processor; and
[0018] A memory having computer-readable instructions stored therein, wherein the computer-readable instructions implement the method described above when executed by the processor.
[0019] In the technical solutions provided in some embodiments of the present application, an access code is generated for a target service according to the configuration information of the target service through a proxy platform, without the need for engineers to manually write access codes for the target service, thereby improving the calling efficiency of the target service. At the same time, since the requester sends an access request initiated based on the access code to the proxy platform, and the proxy platform controls the forwarding of the access request to the service provider, the information forwarding between the requester and the service provider is realized through the proxy platform, thereby facilitating the call control between the requester and the service provider through the proxy platform, instead of having to write call control codes for different service providers on the service provider, further reducing the workload and improving the calling efficiency.
[0020] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0022] Figure 1 A schematic diagram showing an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied;
[0023] Figure 2is a flow chart of a method for calling a service according to an embodiment of the present application;
[0024] Figure 3 is a flowchart showing the steps before step 210 according to an embodiment of the present application;
[0025] Figure 4 yes Figure 2 A flowchart of step 250 of the corresponding embodiment in one embodiment;
[0026] Figure 5 yes Figure 2 A flowchart of step 250 of the corresponding embodiment in another embodiment;
[0027] Figure 6 yes Figure 2 A flowchart of the steps after step 250 of the corresponding embodiment in an embodiment;
[0028] Figure 7 is a block diagram of a service calling device according to an embodiment of the present application;
[0029] Figure 8 is a block diagram of an agent platform according to an embodiment;
[0030] Fig. 9 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0031] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0032] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0034] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0035] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0036] like Figure 1 As shown, the system architecture may include a requester 110 , a proxy platform 130 , and a service provider 150 .
[0037] Service invocation refers to an application (assuming it is application A) calling a service provided by another application (assuming it is application B). The platform where the application that initiates the access request is located is the requester, and the platform where the application that provides the service is located is the service provider. In the above example, the platform where application A is located is the requester, and the platform where application B is located is the service provider.
[0038] In the solution of the present application, the requester 110 and the proxy platform 130, as well as the proxy platform 130 and the service provider 150, have established communication connections. In order to call the service provided by the service provider 150, the requester 110 needs to first send an access request to the proxy platform 130, and then the proxy platform 130 forwards the access request to the service provider 150.
[0039] That is to say, in the process of the requester 110 calling the service provided by the service provider 150, the information transmission between the requester 110 and the service provider 150 is forwarded by the proxy platform 130 as a transfer platform.
[0040] The implementation details of the technical solution of the embodiment of the present application are described in detail below:
[0041] Figure 2 A flowchart of a method for invoking a service according to an embodiment of the present application is shown. The method for invoking a service is applied to an agent platform and can be executed by a device with a computing and processing function. Figure 2As shown, the calling method of the service includes at least steps 210 to 250, which are described in detail as follows:
[0042] Step 210: obtaining an access request initiated by the requesting party based on an access code, where the access code is generated by the proxy platform according to configuration information of the target service.
[0043] It is worth mentioning that the target service does not refer to a specific service, but refers to the service to be called.
[0044] The target service that can be called may be a data service or a service provided by a target interface, such as data query, data insertion, and the like.
[0045] Similarly, the target interface does not refer to a specific interface, but refers to a general interface that can be called.
[0046] In order to enable the requester to call the target service provided by the service provider with the help of the proxy platform, the basic information of the target service is pre-configured on the proxy platform. The basic information of the target service may include the service name, gateway path, backend address, frequency limit (such as access frequency upper limit), request protocol, response protocol, etc. of the target service, which are not specifically limited here. In other embodiments, the basic information configured for the target service on the proxy platform can also be set according to actual needs, such as limiting the access time period, etc.
[0047] Among them, for the service provided by the interface as the target service, the interface request parameters, parameter format and other contents are defined in the request protocol. Similarly, the interface response parameters, parameter format and other contents are defined in the response protocol.
[0048] The configuration information of the target service at least includes basic information configured for the target service on the proxy platform. In other embodiments, the configuration information of the target service may also include a service identifier of the target service on the proxy platform.
[0049] In one embodiment, in order to configure the basic information corresponding to the target service, a configuration platform is provided in the proxy platform, so that the user can configure the basic information of the target service through the configuration platform.
[0050] Specifically, the configuration platform provides an interactive client to the user, and the user inputs basic information of the target service through the interactive client, so that the configuration platform integrates the input basic information to obtain the basic information of the target service.
[0051] As described in the background art, the code that runs on the requester to implement the target service call is the access code.
[0052] In the solution of the present application, in order to avoid manual writing of access codes and improve the access efficiency of target services, the proxy platform generates access codes for implementing target service calls according to the configuration information of the target services.
[0053] That is to say, the access request initiated by the requester to the proxy platform to call the target service is initiated by the requester based on the access code generated by the proxy platform for the target service, and the access request initiated is one of the results of the requester running the access code generated by the proxy platform for the target service.
[0054] Step 230: Call the software development kit in the proxy platform according to the access request.
[0055] The proxy platform includes a software development kit (SDK), which integrates common functions in the service call process, such as access address, signature verification, network protocol, format encapsulation, etc. The software development kit is applicable to the call of any target service, that is, the call of any target service can be controlled through the software development kit.
[0056] Step 250: Control, through the software development kit, to forward the access request to the service provider corresponding to the target service, so as to call the target service.
[0057] As described above, the software development kit integrates the common functions for performing service calls, so that the calling process of controlling the target service can be performed through the software development kit.
[0058] The call control between the requester and the service provider is performed through the software development kit in the proxy platform. Therefore, in order to perform call control on the target service, developers of different service providers do not need to write the code to implement the call control for the target service provided by the service provider, but can directly deploy the same software development kit in the proxy platform to implement the call control of different target services.
[0059] The proxy platform generates access codes for target services according to their configuration information, without the need for engineers to manually write access codes for target services, thus improving the efficiency of target service calls. At the same time, since the requester sends the access request based on the access code to the proxy platform, the proxy platform controls the forwarding of the access request to the service provider, and the proxy platform implements information forwarding between the requester and the service provider, making it easier to control calls between the requester and the service provider through the proxy platform, rather than writing call control codes for different service providers on the service provider, further reducing workload and improving call efficiency.
[0060] In one embodiment, if Figure 3 As shown, before step 210, the method further includes:
[0061] Step 310: Receive a code generation request, where the code generation request indicates a target service to be accessed.
[0062] In order to generate an access code for the target service to be called, the code requester initiates a code generation request to the proxy platform. It can be understood that the code generation request at least indicates the target service to be accessed, so that the proxy platform can determine which target service needs to generate an access code according to the received code generation request, and thus obtain the configuration information of the indicated target service according to the code generation request.
[0063] Step 330: Obtain configuration information of the target service according to the code generation request.
[0064] As described above, before initiating an access request to a target service, basic information of the target service is pre-configured in the proxy platform, and corresponding configuration information of the target service is obtained and stored.
[0065] Step 350: Generate an access code according to the configuration information.
[0066] Since the configuration information includes the basic information of the target service, such as the request / response protocol, backend address, access path, etc., an access code can be generated for the target service. Therefore, when the access code is run, an access request can be initiated to the proxy platform, so that the proxy platform can perform call control by calling the software development kit.
[0067] In one embodiment, the access code includes an access protocol definition code, an object declaration code, and a call function, and the configuration information includes an access protocol, an access path, and a service identifier of a target service; Step 350 includes:
[0068] Generate an access protocol definition code corresponding to the target service according to the access protocol of the target service; and
[0069] generating an object declaration code according to the address information of the proxy platform, and instructing the proxy platform to call a software development kit through the object declaration code; and
[0070] Generate a call function based on the access path and the service ID of the target service.
[0071] The access protocol of the target service includes a request protocol and a response protocol, wherein the request protocol specifies the request initiation method, request parameters, etc., and similarly, the response protocol defines the response method, response parameters, etc.
[0072] For example, for a service provided by an interface as the target service, the request protocol defines the request initiation method, interface parameters, type, and other contents.
[0073] In one embodiment, since different access protocols are different, in order to be applicable to different access protocols, a recursive definition method is used to define the parameters in the access protocol definition code.
[0074] Specifically, the parameters are defined through the schema standard. In the schema standard, the schema represents a collection of database objects, which can include multiple field classes. Each field object itself can be an object object and has its own protocol. For example, in the following code:
[0075]
[0076]
[0077] This code defines a user structure, as shown above, the user structure includes Name, Age, Degree, Title and Career fields. The Career field is a fields set, which further includes a Time field, a Site field, and a Corp field.
[0078] Therefore, this recursive approach can be used to define complex access protocols. Specifically, the structured protocol is described through schema and field.
[0079] For example, in a schema, the fields in Table 1 are defined as follows:
[0080] Table 1 schema
[0081] Fields type meaning name string Data protocol name desc string Data protocol description fields []field Data protocol field configuration
[0082] The fields in Table 1 may also be an object, as shown in Table 2. The fields further include:
[0083] Table 2field
[0084]
[0085] Therefore, by recursively defining the access protocol in this way, the proxy platform can be implemented completely according to the access protocol in the configuration information of the target service, ensuring that the configuration is completely consistent with the actual application.
[0086] The object declaration code is used to make an object declaration for the target service, so that when the object declaration code is executed, the agent platform software development tool kit is instructed.
[0087] In one embodiment, the object declaration code uses the address of the proxy platform, the service identifier of the target service, and the key of the code requester as parameters for creating a new sdk client object, and is declared using the var keyword. The generated object declaration code is as follows:
[0088] var(client=sdk.NewClient(A,B,C))
[0089] Among them, parameter A is the address of the proxy platform, parameter B is the service identifier corresponding to the target service, and parameter C is the key of the code requester.
[0090] In one embodiment, the code generation request further includes a code requester identifier, and the method further includes:
[0091] The code requester is authorized and verified according to the code requester ID.
[0092] If the code requester passes the authorization verification, step 350 is executed.
[0093] In this embodiment, the information of authorized users is pre-stored in the proxy platform, so that the access code is generated according to the configuration information of the target service only when the code requester is an authorized user in the proxy platform; otherwise, if the code requester fails the authorization verification, the access code generation for the code requester is refused.
[0094] In one embodiment, the generated access code also includes a code information list. The code information list exists in the access code as a comment part. The code information list facilitates readers of the access code to understand basic information of the target service corresponding to the access code. When the access code is executed, the code information list is not executed. The code information list can be generated according to the configuration information of the target service.
[0095] In one embodiment, the code information list includes the proxy platform address, interface ID, interface path, interface description information, call frequency, interface affiliation, authorization object, generation time, etc.
[0096] In one embodiment, the software development kit includes signature verification code, and the configuration information includes a set of authorized access objects for the target service;
[0097] like Figure 4 As shown, step 250 includes:
[0098] Step 410: Perform authorization verification on the requester according to the authorized access object set by running the signature verification code.
[0099] Signature verification code is the code that implements the authorization verification function for the requester.
[0100] The authorized access object set is composed of the corresponding identifiers of the authorized access objects of the target service.
[0101] By running the signature verification code, the requester's identifier is searched in the authorized access object set. If the requester's identifier is in the authorized access object set, it indicates that the requester is the authorized access object of the target service, that is, the requester has passed the authorization verification; otherwise, if the requester's identifier is not found in the authorized access object set, the requester has not passed the authorization verification.
[0102] Step 430: If the requester passes the authorization verification, the access request is forwarded to the service provider corresponding to the target service.
[0103] That is to say, the proxy platform forwards the access request to the service provider corresponding to the target service only when the requester passes the authorization verification.
[0104] In one embodiment, the signing code in the software development kit includes a gateway path, request parameters, and a key value corresponding to the requester in the access request. By running the signing code, the gateway path, request parameters, and key value are extracted from the access request, the gateway path, request parameters, and key value are concatenated, and then signed by the HMACSHA1 algorithm to obtain a string, and the string is added to the access request, so that after receiving the access request, the service provider verifies the information in the access request according to the string to ensure whether the information carried in the access request has been tampered with, so as to ensure the effectiveness and accuracy of information transfer and data transmission.
[0105] In another embodiment, the software development kit includes access frequency limiting code, such as Figure 5 As shown, step 250 includes:
[0106] Step 510: Obtain historical frequency information of the requester's access to the target service by running the access frequency limiting code, and calculate the current access frequency by using the historical frequency information and the current access time.
[0107] The access frequency limiting code is a code that implements the access frequency or number limiting function.
[0108] The frequency with which the requesting party requests to access the target service is determined by running the access frequency limiting code.
[0109] The historical frequency information of the requester's access to the target service may be at least one of a historical access frequency and a historical access count.
[0110] Then, based on the acquired historical frequency information and the current access time, the current access frequency can be calculated accordingly, where the current access frequency can be the current access frequency, such as 5 times / second, or the current number of accesses, which is equal to the historical number of accesses+1.
[0111] Step 530: If the current access frequency meets the preset condition, the access request is forwarded to the service provider corresponding to the target service.
[0112] The preset condition may be an access frequency range, so that if the current access frequency is within the access frequency range, the current access frequency satisfies the preset condition.
[0113] By acquiring historical access frequency information and calculating the current access frequency, the access request is forwarded to the service provider corresponding to the target service only when the current access frequency meets the preset conditions; conversely, if the calculated current access frequency does not meet the preset conditions, the current access frequency is calculated again according to the current time after waiting until the calculated current access frequency meets the preset conditions, and then the access request is forwarded to the service provider of the target service.
[0114] In another embodiment, the software development kit includes a signature verification code and an access frequency limitation code to perform authorization verification and access frequency limitation on the requesting party, so that the access request is forwarded to the service provider of the target service only when the requesting party passes the authorization verification and the current access frequency meets the preset conditions.
[0115] In one embodiment, the software development kit includes a format packaging code, and before forwarding the access request to the service provider corresponding to the target service, the method further includes:
[0116] By running the format encapsulation code, the access request is encapsulated according to the access protocol of the target service.
[0117] As described above, for the target service, there is an agreed access protocol, so any party that needs to call the target service needs to encapsulate information according to the access protocol, so that the service provider of the target service can perform corresponding analysis when receiving the corresponding request.
[0118] In this embodiment, information encapsulation is performed using the format encapsulation code in the software development kit, and the access request is encapsulated according to the access protocol of the target service. After receiving the encapsulated access request, the service provider of the target service can accurately parse the encapsulated access request.
[0119] In one embodiment, the software development kit also includes a general API access function, a general data insertion function, a general overwrite update function, a general partial update function, a general deletion function, a general data reading function, and a general data search function, thereby providing common functions suitable for calling various target services.
[0120] In one embodiment, if Figure 6 As shown, after step 250, the method further includes:
[0121] Step 610: Receive response data returned by the service provider according to the received access request.
[0122] Step 630: forward the response data to the requesting party.
[0123] Regardless of whether the target service called by the requester is a service provided by the target interface or a data service, it ultimately needs to obtain the result returned by the target service implementation. That is, the response data
[0124] In other words, the transmission of response data also needs to be completed through the proxy platform.
[0125] Furthermore, before step 630, the response data is encapsulated according to the protocol of the requesting party through the format encapsulation code in the software development kit.
[0126] The following describes an apparatus embodiment of the present application, which can be used to execute the method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned method embodiment of the present application.
[0127] Figure 7 is a block diagram of a service calling device 700 according to an exemplary embodiment. The service calling device 700 can be configured in Figure 1 In the agent platform, refer to Figure 7 As shown, the device comprises:
[0128] The access request acquisition module 710 is used to acquire the access request initiated by the requester based on the access code, where the access code is generated by the proxy platform according to the configuration information of the target service.
[0129] The calling module 730 is used to call the software development kit in the proxy platform according to the access request.
[0130] The forwarding control module 750 is used to control the forwarding of the access request to the service provider corresponding to the target service through the software development kit to call the target service.
[0131] In one embodiment, the device further comprises:
[0132] The code generation request receiving module is used to receive a code generation request, where the code generation request indicates a target service to be accessed.
[0133] The configuration information acquisition module is used to obtain the configuration information of the target service according to the code generation request.
[0134] The access code generation module is used to generate an access code according to the configuration information.
[0135] In one embodiment, the access code includes an access protocol definition code, an object declaration code, and a calling function, and the configuration information includes an access protocol, an access path, and a service identifier of a target service; and the access code generation module includes:
[0136] A first generating unit, configured to generate an access protocol definition code corresponding to a target service according to an access protocol of the target service; and
[0137] A second generating unit is used to generate an object declaration code according to the address information of the proxy platform, and to instruct the proxy platform to call the software development kit through the object declaration code; and
[0138] The third generating unit is used to generate a calling function according to the access path and the service identifier of the target service.
[0139] In one embodiment, the software development kit includes signature verification code, and the configuration information includes a set of authorized access objects for the target service; the forwarding control module 750 includes:
[0140] The authorization verification unit is used to perform authorization verification on the requester according to the authorized access object set by running the signature verification code.
[0141] The first forwarding unit is used to forward the access request to the service provider corresponding to the target service if the requester passes the authorization verification.
[0142] In one embodiment, the software development kit includes an access frequency limiting code, and the forwarding control module 750 includes:
[0143] The current access time calculation unit is used to obtain the historical frequency information of the requester's access to the target service by running the access frequency limitation code, and calculate the current access frequency based on the historical frequency information and the current access time.
[0144] The second forwarding unit is used to forward the access request to the service provider corresponding to the target service if the current access frequency meets the preset condition.
[0145] In one embodiment, the software development kit includes a format packaging code, and the apparatus further includes:
[0146] The encapsulation module is used to encapsulate the access request according to the access protocol of the target service by running the format encapsulation code.
[0147] In one embodiment, the device further comprises:
[0148] The response data receiving module is used to receive the response data returned by the service provider according to the received access request.
[0149] The response data forwarding module is used to forward the response data to the requesting party.
[0150] In one embodiment, the target service includes at least one of a data service and a service provided by a target interface.
[0151] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the calling method of the above-mentioned service, which will not be repeated here.
[0152] It is understood that these modules can be implemented by hardware, software, or a combination of the two. When implemented in hardware, these modules can be implemented as one or more hardware modules, such as one or more application specific integrated circuits. When implemented in software, these modules can be implemented as one or more computer programs executed on one or more processors.
[0153] Figure 8 is a block diagram of an agent platform according to an exemplary embodiment. Figure 8 As shown, the agent platform includes a code generation module 810 , a configuration platform 830 and a storage module 850 .
[0154] The proxy platform can generate access codes for data services and services provided by interfaces. The access codes generated for services provided by interfaces are called interface codes; the access codes generated for data services are called data codes. Figure 8 As shown, the code generation module 810 includes an interface code generator 811 and a data code generator 813, wherein the interface code generator 811 is used to generate an interface code, and the data code generator 813 is used to generate a data code.
[0155] The configuration platform 830 is used to configure the basic information of the target service, such as configuration. Figure 8 As shown, the configuration platform 830 includes an interface configuration platform 831 and a data service configuration platform 833. The interface configuration platform 831 is used to configure basic information for the service provided by the interface, such as the interface name, gateway path, backend address, frequency limit, structured request protocol / response protocol, etc. The data service configuration platform 833 is used to configure basic information for the data service, such as the structured data service protocol.
[0156] The storage module 850 is used to store data of the proxy platform, such as configuration information of each target service, etc. Further, the storage module 850 can be based on mongodb for low-level data storage, or any relational, document, or kv database such as mysql, postgresql, etc. for data storage, which is not specifically limited here.
[0157] In a specific embodiment, the proxy platform can be developed based on the golang language, or other programming languages, such as python, Java, c++ and other high-level programming languages.
[0158] Furthermore, the proxy platform may be based on HTTP protocol + json format, or a combination of UDP / TCP protocol and any format such as protobuf, xml, formdata, etc., or a combination of other protocols and formats, which are not specifically limited here.
[0159] Fig. 9 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0160] It should be noted that Fig. 9 The computer system 900 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0161] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage part 908 to the random access memory (RAM) 903, such as executing the method in the above embodiment. In the RAM 903, various programs and data required for system operation are also stored. The CPU 901, ROM 902 and RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0162] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed so that a computer program read therefrom is installed into the storage section 908 as needed.
[0163] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 909, and / or installed from a removable medium 911. When the computer program is executed by a central processing unit (CPU) 901, various functions defined in the system of the present application are executed.
[0164] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0165] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0166] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0167] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0168] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0169] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0170] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0171] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0172] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A service calling method, applied to an agent platform, comprising: receiving a code generation request, wherein the code generation request indicates a target service to be accessed; Acquire configuration information of the target service according to the code generation request, wherein the configuration information includes an access protocol, an access path, and a service identifier of the target service; generating an access code according to the configuration information; Obtaining an access request initiated by the requesting party based on the access code; Invoking a software development kit in the proxy platform according to the access request; Controlling, through the software development kit, forwarding the access request to a service provider corresponding to the target service to call the target service; The access code includes an access protocol definition code, an object declaration code, and a calling function; and generating the access code according to the configuration information includes: Generate an access protocol definition code corresponding to the target service according to the access protocol of the target service; generating the object declaration code according to the address information of the proxy platform, and instructing the proxy platform to call the software development kit through the object declaration code; and The calling function is generated according to the access path and the service identifier of the target service.
2. The method according to claim 1, characterized in that The software development kit includes a signature verification code, and the configuration information includes a set of authorized access objects for the target service; The controlling, through the software development kit, to forward the access request to the service provider corresponding to the target service comprises: By running the signature verification code, authorization verification is performed on the requesting party according to the authorized access object set; If the requester passes the authorization verification, the access request is forwarded to the service provider corresponding to the target service.
3. The method according to claim 1, characterized in that The software development kit includes an access frequency limiting code, and the software development kit is used to control the access request to be forwarded to the service provider corresponding to the target service, including: By running the access frequency limiting code, the historical frequency information of the requesting party accessing the target service is obtained, and the current access frequency is calculated according to the historical frequency information and the current access time; If the current access frequency meets the preset condition, the access request is forwarded to the service provider corresponding to the target service.
4. The method according to claim 2 or 3, characterized in that: The software development kit includes a format encapsulation code, and before the control forwards the access request to the service provider corresponding to the target service, the method further includes: By running the format encapsulation code, the access request is encapsulated according to the access protocol of the target service.
5. The method according to claim 1, characterized in that After controlling, through the software development kit, to forward the access request to the service provider corresponding to the target service, the method further comprises: Receiving response data returned by the service provider according to the received access request; The response data is forwarded to the requester.
6. The method according to claim 1, characterized in that The target service includes at least one of a data service and a service provided by a target interface.
7. A service calling device, applied to an agent platform, characterized in that: The device comprises: A code generation request receiving module, used to receive a code generation request, wherein the code generation request indicates a target service to be accessed; A configuration information acquisition module, used to acquire configuration information of the target service according to the code generation request, wherein the configuration information includes an access protocol, an access path and a service identifier of the target service; An access code generation module, used to generate an access code according to the configuration information; An access request acquisition module, used to acquire an access request initiated by a requester based on the access code; A calling module, used for calling a software development kit in the proxy platform according to the access request; A forwarding control module, used to control the forwarding of the access request to the service provider corresponding to the target service through the software development kit, so as to call the target service; Among them, the access code includes an access protocol definition code, an object declaration code and a calling function; the access code generation module is configured to: generate an access protocol definition code corresponding to the target service according to the access protocol of the target service; generate the object declaration code according to the address information of the proxy platform, and instruct the proxy platform to call the software development kit through the object declaration code; and generate the calling function according to the access path and the service identifier of the target service.
8. An electronic device, characterized in that: include: processor; and A memory having computer-readable instructions stored thereon, wherein the computer-readable instructions, when executed by the processor, implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, the computer program is stored in a computer-readable storage medium, a processor of an electronic device reads and executes the computer program from the computer-readable storage medium, so that the electronic device executes the method according to any one of claims 1 to 6.
