A method and device for processing a service request

By identifying and calling the interface parameters and adaptation scripts of the target service interface, the problem of inconsistent interface standards and low serial docking efficiency is solved, and efficient interface docking and diversified interface requirements are achieved.

CN113449022BActive Publication Date: 2025-04-15BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010229546.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-27
Publication Date
2025-04-15
Estimated Expiration
2040-03-27

AI Technical Summary

Technical Problem

In the prior art, the interface standards are not unified and the business processes are large, which leads to difficulties in interface docking and low serial docking efficiency.

Method used

By receiving and parsing business requests, identifying the interface parameters and interface adaptation scripts of the target service interface, initializing the context environment and executing the interface adaptation scripts, calling the target service interface and performing result adaptation.

Benefits of technology

It improves interface docking efficiency, avoids interface docking between each service provider, and adapts to the diverse interface needs of each service provider.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113449022B_ABST
    Figure CN113449022B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for processing a business request, and relates to the field of computer technology. A specific implementation of the method includes: receiving and parsing a business request sent by a first service provider to obtain request parameters; identifying the target service interface of the second service provider according to the request parameters, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface; initializing the context environment of the interface adaptation script according to the interface parameters, executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and adapting the return value of the target service interface; returning the adaptation result of the return value to the first service provider. This implementation can solve the technical problem of low interface docking efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for processing a service request. Background Art

[0002] With the rapid development of the Internet industry, various service providers often need to call each other's interface services. For example, in the process of selling telecom operator services or services, e-commerce platforms need to call the interface services provided by operators to complete user number status, business qualification verification, real-name authentication, order placement and other services. The conventional solution is to perform interface docking and joint debugging between various service providers.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] 1) Due to the lack of unified interface standards and differences in business processes, interface docking is difficult;

[0005] 2) Serial docking interface leads to low docking efficiency. Summary of the invention

[0006] In view of this, an embodiment of the present invention provides a method and apparatus for processing a service request to solve the technical problem of low interface connection efficiency.

[0007] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for processing a service request is provided, comprising:

[0008] Receive and parse the business request sent by the first service provider to obtain request parameters;

[0009] Identifying a target service interface of the second service provider according to the request parameters, thereby identifying interface parameters and an interface adaptation script corresponding to the target service interface;

[0010] Initializing the context environment of the interface adaptation script according to the interface parameters, executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface;

[0011] The adaptation result of the return value is returned to the first service provider.

[0012] Optionally, identifying the target service interface of the second service provider according to the request parameters, thereby identifying interface parameters and an interface adaptation script corresponding to the target service interface, includes:

[0013] identifying a target service interface of a second service provider according to the request parameters;

[0014] According to the correspondence between each service interface and each release package, the target release package corresponding to the target service interface is identified; wherein the target release package includes the interface parameters and interface adaptation script of the target service interface.

[0015] Optionally, initializing the context environment of the interface adaptation script according to the interface parameters and executing the interface adaptation script includes:

[0016] Determining the status of the target release package;

[0017] If the status of the target release package is online, the context environment of the interface adaptation script is initialized according to the interface parameters, and the interface adaptation script is executed.

[0018] Optionally, initializing the context environment of the interface adaptation script according to the interface parameters, executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface, includes:

[0019] Loading the interface parameters from the target release package, and adapting the interface parameters to the context environment of the interface adaptation script;

[0020] Loading the interface adaptation script from the snapshot of the target release package according to the script information configured in the target service interface;

[0021] The interface adaptation script is executed, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface.

[0022] Optionally, inputting the request parameter into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface includes:

[0023] The request parameters are input into the interface adaptation script, and the request parameters are encapsulated as a request message;

[0024] Calling the target service interface to send the request message to a message queue of a message system;

[0025] The return value of the target service interface is adapted as a result.

[0026] Optionally, the request parameter includes at least one of a user identifier, a service identifier, a service type, a first service provider identifier, and a second service provider identifier.

[0027] Optionally, the interface parameter includes parameter scopes at multiple levels, and the multiple levels include at least one of a business level, an interface level, a first service provider level, and a second service provider level.

[0028] In addition, according to another aspect of an embodiment of the present invention, there is provided a device for processing a service request, including:

[0029] A receiving module, used to receive and parse the business request sent by the first service provider to obtain request parameters;

[0030] An identification module, used to identify the target service interface of the second service provider according to the request parameters, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface;

[0031] An adaptation module, used to initialize the context environment of the interface adaptation script according to the interface parameters, execute the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface;

[0032] The returning module is used to return the adaptation result of the return value to the first service provider.

[0033] Optionally, the identification module is further used for:

[0034] identifying a target service interface of a second service provider according to the request parameters;

[0035] According to the correspondence between each service interface and each release package, the target release package corresponding to the target service interface is identified; wherein the target release package includes the interface parameters and interface adaptation script of the target service interface.

[0036] Optionally, the adaptation module is further used for:

[0037] Determining the status of the target release package;

[0038] If the status of the target release package is online, the context environment of the interface adaptation script is initialized according to the interface parameters, and the interface adaptation script is executed.

[0039] Optionally, the adaptation module is further used for:

[0040] Loading the interface parameters from the target release package, and adapting the interface parameters to the context environment of the interface adaptation script;

[0041] Loading the interface adaptation script from the snapshot of the target release package according to the script information configured in the target service interface;

[0042] The interface adaptation script is executed, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface.

[0043] Optionally, the adaptation module is further used for:

[0044] The request parameters are input into the interface adaptation script, and the request parameters are encapsulated as a request message;

[0045] Calling the target service interface to send the request message to a message queue of a message system;

[0046] The return value of the target service interface is adapted as a result.

[0047] Optionally, the request parameter includes at least one of a user identifier, a service identifier, a service type, a first service provider identifier, and a second service provider identifier.

[0048] Optionally, the interface parameter includes parameter scopes at multiple levels, and the multiple levels include at least one of a business level, an interface level, a first service provider level, and a second service provider level.

[0049] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:

[0050] one or more processors;

[0051] a storage device for storing one or more programs,

[0052] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.

[0053] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0054] One embodiment of the above invention has the following advantages or beneficial effects: because the interface parameters and interface adaptation script of the target service interface of the second service provider are identified according to the request parameters, and then the context environment is initialized according to the interface parameters, and the interface adaptation script is executed, so that the request parameters are input into the interface adaptation script, the target service interface is called, and the return value of the target service interface is adapted to the result, the technical problem of low interface docking efficiency in the prior art is overcome. The embodiment of the present invention identifies the interface parameters and interface adaptation script of the target service interface according to the request parameters, and performs parameter adaptation and result adaptation. It is no longer necessary to perform interface docking one by one between each service provider, thereby improving the interface docking efficiency; and with a multi-level parameter matrix as the parameter scope, it can adapt to the diverse interface requirements of each service provider.

[0055] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0057] Figure 1 is a schematic diagram of the main process of the method for processing a service request according to an embodiment of the present invention;

[0058] Figure 2 is a schematic diagram of a parameter matrix of interface parameters according to an embodiment of the present invention;

[0059] Figure 3 is a schematic diagram of a system framework for processing a service request according to an embodiment of the present invention;

[0060] Figure 4 is a forward flow chart of a method for processing a service request according to an embodiment of the present invention;

[0061] Figure 5 is a callback flow chart of a method for processing a service request according to an embodiment of the present invention;

[0062] Figure 6 is a diagram comparing the encoding process according to an embodiment of the present invention and the encoding process of the prior art;

[0063] Figure 7 is a schematic diagram of the full life cycle of multiple environments provided by the docking platform according to an embodiment of the present invention;

[0064] Figure 8 is a routing flow chart of a router component according to an embodiment of the present invention;

[0065] Fig. 9 is an adaptation flow chart of an adapter component according to an embodiment of the present invention;

[0066] Fig.10 is a schematic diagram of main modules of an apparatus for processing a service request according to an embodiment of the present invention;

[0067] Fig.11 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0068] Fig.12 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0069] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0070] At present, the existing joint debugging and docking solutions mainly have the following technical problems:

[0071] 1) Each service provider is an independent software developer who provides software development services. For the same business, the interface standards provided by different service providers are not unified, which makes docking difficult and causes huge workload. Moreover, the processing procedures for the same business of different service providers will also be different, which may even directly affect the end-user experience.

[0072] 2) In the traditional docking method, each time the service provider docks with the other party, the service provider needs to allocate corresponding R&D and testing resources to dock with the corresponding service provider. Due to limited R&D and testing resources, the docking work is basically in a serial mode, that is, docking one by one, resulting in low overall docking efficiency.

[0073] 3) In the traditional mode, the connection between service providers basically adopts the mainstream Java language to develop interface connection modules. However, Java language has a certain learning threshold, and it requires specialized R&D personnel to complete the connection. In addition, since Java language is a compiled language, during the connection debugging process, every time the connection code is adjusted, the entire project needs to be recompiled, packaged, and released before it can take effect, resulting in a long connection period and low work efficiency.

[0074] Figure 1 FIG. 1 is a schematic diagram of the main flow of a method for processing a service request according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1As shown, the method for processing a service request may include:

[0075] Step 101: Receive and parse a business request sent by a first service provider to obtain request parameters.

[0076] After receiving the service request initiated by the first service provider, the service request is parsed to obtain request parameters, and basic parameter verification can be further performed on the service request to filter out illegal requests, and then legal requests are saved in the request log for later query. Optionally, the request parameters include at least one of a user identifier, a service identifier, a service type, a first service provider identifier, and a second service provider identifier.

[0077] Optionally, in step 101, before verifying the request parameters, the service request may be deduplicated. Specifically, the service request is deduplicated according to a preset deduplication condition, and duplicate requests are discarded or an exception is thrown to the upstream.

[0078] Step 102: Identify the target service interface of the second service provider according to the request parameters, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface.

[0079] In step 102, the target service interface of the second service provider is first identified based on the business parameters obtained by parsing, and then the interface parameters and interface adaptation script corresponding to the target service interface are obtained. In an embodiment of the present invention, it is necessary to pre-configure the correspondence between the request parameters and the service interface of the second service provider. For example, the correspondence between the business identifier and the service interface of the second service provider can be pre-configured, or the correspondence between the business identifier and the business type and the service interface of the second service provider can be pre-configured, or the correspondence between the first service provider identifier, the business identifier and the business type and the service interface of the second service provider can be pre-configured. The configuration information is configured by the developer according to actual business needs, and the embodiment of the present invention does not limit this. In step 102, based on the configuration information pre-configured by the developer, the target service interface of the second service provider is identified, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface.

[0080] Optionally, step 102 may include: identifying the target service interface of the second service provider according to the request parameters; and identifying the target release package corresponding to the target service interface according to the corresponding relationship between each service interface and each release package. Wherein, the target release package contains the interface parameters and interface adaptation script of the target service interface. In an embodiment of the present invention, the target service interface of the second service provider can be identified first according to the request parameters, and then the target release package corresponding to the target service interface is identified according to the information of each release package (i.e., the service interface and other information contained in each release package). It should be pointed out that each release package may contain multiple service interfaces and the interface parameters and interface adaptation scripts of these service interfaces. Developers can pre-configure the corresponding relationship between each service interface and each release package. Since a release package can contain multiple service interfaces, one release package can correspond to multiple service interfaces, and developers package the interface parameters and interface adaptation scripts of these service interfaces in one release package.

[0081] Step 103, initialize the context environment of the interface adaptation script according to the interface parameters, execute the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and adapting the return value of the target service interface.

[0082] After obtaining the interface parameters of the target service interface, the interface parameters are first adapted to the context environment of the interface adaptation script, and then the interface adaptation script is executed, so that the request parameters are input into the interface adaptation script, the target service interface is called, and the return value of the target service interface is adapted.

[0083] Optionally, the interface parameters include parameter scopes at multiple levels, including at least one of a business level, an interface level, a first service provider level, and a second service provider level. For example, the first service provider may be an e-commerce platform, and the second service provider may be a merchant or an operator, etc. Therefore, interface parameters at business level, interface level, platform level, and merchant level may be constructed, and these interface parameters may be used as parameter scopes. By combining these interface parameters, a multi-level parameter matrix may be obtained to meet the diverse interface requirements of various service providers.

[0084] Optionally, these interface parameters can be set by the developers of the first service provider or the developers of the second service provider. According to the different setting parties and the different levels, a parameter matrix can be constructed. Figure 2As shown, the parameter scope is divided into platform level, business level, merchant level and interface level, and the parameter setting party is divided into platform and merchant. Six types of interface parameters can be obtained to meet the personalized needs in interface docking. For example, "merchant level-merchant-parameter" means that the parameter is at the merchant level and the parameter setting party is the merchant. Generally speaking, the platform level and business level parameter setting authority is not open to merchants, so in this embodiment, there are only six types of interface parameters.

[0085] Optionally, the context environment of the interface adaptation script is initialized according to the interface parameters, and the interface adaptation script is executed, including: judging the status of the target release package; if the status of the target release package is online, the context environment of the interface adaptation script is initialized according to the interface parameters, and the interface adaptation script is executed. In an embodiment of the present invention, the status of each release package can be pre-configured, such as online or offline, and if the status of the identified release package is online, the context environment of the interface adaptation script is initialized according to the interface parameters, and then the interface adaptation script is executed.

[0086] Optionally, step 103 may include: loading the interface parameters from the target release package, adapting the interface parameters to the context of the interface adaptation script; loading the interface adaptation script from the snapshot of the target release package according to the script information configured by the target service interface; executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface. After adapting the interface parameters to the context of the interface adaptation script, according to the script information configured by the target service interface, load the interface adaptation script source code of the target service interface from the snapshot of the target release package, then call the groovy code engine to execute the interface adaptation script to complete the business logic processing.

[0087] Executing the interface adaptation script mainly includes input parameter adaptation, network call and result adaptation. The request parameters of the first service provider are converted into the parameters required by the second service provider through input parameter adaptation, a request is initiated to the interface of the second service provider through network call, and the interface return value of the second service provider is converted into the result value of the first service provider through result adaptation.

[0088] Optionally, the request parameters are input into the interface adaptation script, the target service interface is called, and the return value of the target service interface is adapted as a result, including: inputting the request parameters into the interface adaptation script, encapsulating the request parameters into a request message; calling the target service interface to send the request message to the message queue of the message system; and adapting the return value of the target service interface as a result. In this embodiment, the target service interface is a message sending interface, and by calling the request message sending interface, the encapsulated request message can be sent to the message system, and then the execution result (execution success or execution failure) is directly returned.

[0089] Step 104: Return the adaptation result of the return value to the first service provider.

[0090] After the return value of the target service interface is adapted, the adaptation result is returned to the first service provider.

[0091] According to the various embodiments described above, it can be seen that the embodiment of the present invention solves the technical problem of low interface docking efficiency in the prior art by identifying the interface parameters and interface adaptation script of the target service interface of the second service provider according to the request parameters, then initializing the context environment according to the interface parameters, and executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface. The embodiment of the present invention solves the technical problem of low interface docking efficiency in the prior art by identifying the interface parameters and interface adaptation script of the target service interface according to the request parameters, and performing parameter adaptation and result adaptation, thereby no longer requiring each service provider to perform interface docking one by one, and improving the interface docking efficiency; and using a multi-level parameter matrix as a parameter scope, it can adapt to the diverse interface requirements of each service provider.

[0092] Figure 3 Schematic diagram of a system framework for processing service requests according to an embodiment of the present invention. Figure 3 As shown, the system includes a docking platform, a first service provider and a second service provider. The upstream of the docking platform is the first service provider, and the downstream is the second service provider. For a business or service, the first service provider has formulated a set of its own interface standards and processes, and different second service providers have their own interface standards and processes. The docking platform provided by the embodiment of the present invention realizes the adaptation of the interface standard of the first service provider to the interface standards of different second service providers.

[0093] like Figure 3As shown, the docking platform mainly includes a callback system, a router system and an adapter engine system; wherein, the callback system mainly includes a release package module, an interface module, an adaptation script module, an online editor and an online and offline module; the router system is the entrance for the docking platform to dock with the upstream, and the core component is the router component. All requests from the upstream business system need to be sent to the router component first. The router component routes the request to the adapter component of the corresponding cluster according to the cluster routing strategy; the adapter engine system is the core of the docking platform, and the core components include the adapter component, the context component, etc.

[0094] Figure 4 1 is a forward flow chart of a method for processing a service request according to an embodiment of the present invention. In the embodiment of the present invention, the first service provider initiates a request and the second service provider provides a service as a forward process. For example, the interface call is initiated by the business system of the e-commerce platform, and the operator provides the service, such as the user qualification verification interface in the package service. The forward process of the method for processing a service request mainly includes the following steps:

[0095] 1. The business system of the first service provider initiates a business request.

[0096] 2. After receiving the business request, the router component parses the request parameters and performs basic parameter verification on the request parameters (such as whether the ID card number meets the requirements), and then saves the requests that pass the verification into the request log for later query. Before performing parameter verification on the request parameters, the router component can also perform deduplication processing on the business request. Specifically, according to the preset deduplication conditions, the business request is deduplicated, and duplicate requests will be discarded or exceptions will be thrown upstream.

[0097] Next, the router component routes the request to the corresponding cluster according to the routing parameters in the request parameters and based on the cluster routing strategy. It should be noted that developers can pre-configure the cluster routing strategy, which configures the corresponding relationship between each routing parameter and the cluster, and match the corresponding cluster from the cluster routing strategy through the routing parameters carried in the request parameters (which can be at least one of the business identifier, business type, first service provider identifier, and second service provider identifier).

[0098] 3. After receiving the service request from the router component, the adapter component of the corresponding cluster identifies the corresponding service interface according to the request parameters, thereby identifying the release package containing the interface parameters and interface adaptation script of the service interface. Determine whether the status of the release package is online. If not, end and return the result to the first service provider; if yes, execute the following steps:

[0099] Next, the interface parameters of the service interface are loaded from the release package, the context environment for the interface adaptation script to run is initialized according to the interface parameters, and then the interface adaptation script of the service interface is read from the release package.

[0100] Finally, the interface adaptation script is executed to complete the input parameter adaptation, call the service interface, and after receiving the return value of the service interface, the result is adapted, and finally the adaptation result is returned to the business system of the upstream first service provider.

[0101] 4. The second service provider performs corresponding business processing.

[0102] In addition, the specific implementation content of the method for processing a service request in a reference embodiment of the present invention has been described in detail in the method for processing a service request described above, so the repeated content will not be described here.

[0103] Figure 5 It is a callback flow chart of the method for processing a business request according to an embodiment of the present invention. In the embodiment of the present invention, the second service provider initiates a request and the first service provider provides a service as a callback process. For example, the interface call is initiated by the operator, and the business system of the e-commerce platform provides services, such as the order status notification interface in the number card business, the asynchronous real-name authentication feedback interface, etc. The callback process of the method for processing a business request mainly includes the following steps:

[0104] 1. The second service provider initiates a business request and accesses the callback system of the docking platform.

[0105] 2. After receiving the business request, the callback system parses the request parameters, decrypts the request parameters, filters illegal requests, encapsulates the request parameters, and then calls the router component.

[0106] 3. The router component receives incoming business requests, performs basic parameter verification on the requests, and then saves the requests that pass the verification into the request log for later query.

[0107] Next, the router component routes the request to the corresponding cluster based on the routing parameters in the request parameters and the cluster routing strategy.

[0108] 4. After receiving the service request transmitted by the router component, the adapter component of the corresponding cluster identifies the corresponding service interface according to the request parameters, thereby identifying the release package containing the interface parameters of the service interface and the interface adaptation script.

[0109] Next, the interface parameters of the service interface are loaded from the release package, the context environment for the interface adaptation script to run is initialized according to the interface parameters, and then the interface adaptation script of the service interface is read from the release package.

[0110] Finally, the interface adaptation script is executed to complete the input parameter adaptation, re-encapsulate the request information, call the service interface (i.e., the message sending interface), send the request message to the message queue of the message system, receive the return value of the service interface (successful sending or failed sending), adapt the result, and finally return the adaptation result to the business system of the downstream second service provider.

[0111] 5. After the message processing module of the first service provider monitors the request message, it parses the request message and performs corresponding business processing.

[0112] In addition, the specific implementation content of the method for processing a service request in another reference embodiment of the present invention has been described in detail in the method for processing a service request described above, so the repeated content will not be described here.

[0113] like Figure 3 As shown, the docking platform can provide two modes: standard mode and adaptation mode.

[0114] Standard mode: When a service provider accesses the docking platform, it develops its own interface according to the standards provided by the platform and complies with standard business processes. This mode is more suitable for new businesses and service providers that have not yet established their own capability platforms.

[0115] Adaptation mode: For service providers who have established their own capability platforms and have their own business interface capabilities, but their platform standards are somewhat different from those of other service providers. The docking platform also provides an adaptation mode to achieve the adaptation of the standards of each service provider. This allows service providers to quickly access the docking platform without making any changes to themselves.

[0116] The docking efficiency can be greatly improved by allowing the service provider to independently access the docking platform: the docking platform provides a dedicated docking platform for the developers of the service provider. The R&D personnel of the service provider can independently perform interface docking without being restricted by the development or testing resources of other service providers. The original serial docking mode is changed to a parallel docking mode, which greatly improves the overall docking efficiency.

[0117] The joint debugging process based on the Java compiled language has the following disadvantages: after R&D personnel finish writing the code, they need to compile, package, deploy, and publish it before it can be put online and take effect. Figure 6 As shown, the embodiment of the present invention uses an online editor based on the groovy scripting language to develop code, save the script, and directly publish the version, which can be put online and take effect, reducing three links and greatly improving the efficiency of interface joint debugging. Therefore, it can be modified immediately and take effect immediately, which improves the efficiency of docking research and development.

[0118] Based on the groovy scripting language, the technical difficulty is low, and the code can be modified online in real time: the docking platform provides an online code editor based on the groovy scripting language. On the one hand, it reduces the technical difficulty. Ordinary product or test personnel can master the writing of scripting languages ​​after a short period of training. Since groovy is a scripting language, during the interface docking process, the code can be modified online in real time, and it will take effect immediately. There is no need to compile, package, release, etc., which greatly shortens the interface joint debugging time. In addition, the groovy language is based on the JVM engine and is compatible with the java language. Existing java R&D personnel can use it directly without learning costs.

[0119] Figure 7 Schematic diagram of the multi-environment full life cycle provided by the docking platform according to an embodiment of the present invention. Figure 3 and 7 As shown, the docking platform provides developers with a mock environment, a pre-production environment, and a production environment.

[0120] Mock environment: a sandbox testing environment where developers use an online editor to write groovy script code. After writing, they can input mock data to perform real-time joint debugging tests on the docking platform and service provider interface. The error log of code execution can be viewed in real time through the log query component.

[0121] Pre-release environment: Mainly used for grayscale testing in the R&D stage of the service provider. The service provider's developers develop code in the mock environment. After testing and debugging, they enter the pre-release environment, configure the pre-release environment parameters, and select the script written in the mock environment. Configure the gray test business identifier (such as SKU) and user identifier (such as user PIN), etc. Once the pre-release environment release package is online, the grayscale test can be performed on the new interface before it goes online.

[0122] Production environment: After the service provider's developers have passed the grayscale test of the new interface in the pre-release environment, they can launch the entire release package interface online, and end users can purchase the service provider's products and services through the normal page.

[0123] Therefore, the docking platform of the embodiment of the present invention provides the developers of the service provider with a mock environment, a pre-release environment and a production environment, fully supports the research and development of the service provider, independently completes the development, testing, gray testing and launch of the docking script, and can cover the entire process of interface docking.

[0124] Figure 8 is a routing flow chart of a router component according to an embodiment of the present invention. Figure 8As shown, the router component is a gateway component of the docking platform, which is connected to the business system of the first service provider upstream and to the adapter component downstream. The routing process of the router component mainly includes the following steps:

[0125] Receive request: Receive business requests initiated by upstream business systems.

[0126] Parameter verification: perform parameter verification on request parameters and filter out illegal requests.

[0127] Deduplication: Deduplication is performed on requests based on deduplication conditions. Duplicate requests will be discarded or exceptions will be thrown upstream.

[0128] Traffic control: According to the traffic control rules, it is determined whether the request exceeds the threshold. Otherwise, a warning will be issued through the threshold mechanism.

[0129] Blacklist verification: Determine whether to refuse to route the request based on the blacklist.

[0130] Save logs: For legitimate requests, request logs will be recorded for later reference.

[0131] Cluster routing: Cluster routing is the core function of the router. It completes cluster routing according to the cluster routing strategy of the docking platform.

[0132] Fig. 9 FIG. 1 is an adaptation flow chart of an adapter component according to an embodiment of the present invention. Fig. 9 As shown, the adapter component is the core component of the docking platform, responsible for initializing the adaptation script context, loading the adaptation script, parsing and executing, etc. It mainly performs the following processes:

[0133] Start: The router component routes the request to the adapter component of the corresponding cluster according to the cluster routing rules.

[0134] Interface identification: Identify the service interface requested based on the request parameters.

[0135] Release package identification: Identify the corresponding release package information based on the service interface.

[0136] Context initialization: According to the release package information, load the interface parameters of the interface adaptation script in the release package during runtime, such as merchant-level-merchant-parameters, interface-level-merchant-parameters, etc.

[0137] Load the adaptation script: Load the adaptation script source code from the release package snapshot according to the script information configured in the release package interface.

[0138] Parse the adaptation script: call the groovy code engine, execute the interface adaptation script, and complete the business logic processing.

[0139] The core of the adapter component when executing the interface adaptation script includes three steps: input parameter adaptation, interface call and result adaptation.

[0140] Input parameter adaptation: The forward process adaptation script converts the request parameters of the first service provider into the parameters required by the second service provider interface, and the callback process does the opposite.

[0141] Interface call: The forward process is that the docking platform initiates a request to the second service provider interface, and the callback process is the opposite.

[0142] Result adaptation: The forward process is that the interface adaptation script adapts the interface return value of the second service provider to the result value of the docking platform, and the callback process is the opposite.

[0143] Fig.10 is a schematic diagram of main modules of an apparatus for processing a service request according to an embodiment of the present invention, such as Fig.10 As shown, the device 1000 for processing business requests includes a receiving module 1001, an identification module 1002, an adaptation module 1003 and a return module 1004; wherein the receiving module 1001 is used to receive and parse the business request sent by the first service provider to obtain request parameters; the identification module 1002 is used to identify the target service interface of the second service provider according to the request parameters, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface; the adaptation module 1003 is used to initialize the context environment of the interface adaptation script according to the interface parameters, execute the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface and adapting the return value of the target service interface; the return module 1004 is used to return the adaptation result of the return value to the first service provider.

[0144] Optionally, the identification module 1002 is further configured to:

[0145] identifying a target service interface of a second service provider according to the request parameters;

[0146] According to the correspondence between each service interface and each release package, the target release package corresponding to the target service interface is identified; wherein the target release package includes the interface parameters and interface adaptation script of the target service interface.

[0147] Optionally, the adaptation module 1003 is further used for:

[0148] Determining the status of the target release package;

[0149] If the status of the target release package is online, the context environment of the interface adaptation script is initialized according to the interface parameters, and the interface adaptation script is executed.

[0150] Optionally, the adaptation module 1003 is further used for:

[0151] Loading the interface parameters from the target release package, and adapting the interface parameters to the context environment of the interface adaptation script;

[0152] Loading the interface adaptation script from the snapshot of the target release package according to the script information configured in the target service interface;

[0153] The interface adaptation script is executed, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface.

[0154] Optionally, the adaptation module 1003 is further used for:

[0155] The request parameters are input into the interface adaptation script, and the request parameters are encapsulated as a request message;

[0156] Calling the target service interface to send the request message to a message queue of a message system;

[0157] The return value of the target service interface is adapted as a result.

[0158] Optionally, the request parameter includes at least one of a user identifier, a service identifier, a service type, a first service provider identifier, and a second service provider identifier.

[0159] Optionally, the interface parameter includes parameter scopes at multiple levels, and the multiple levels include at least one of a business level, an interface level, a first service provider level, and a second service provider level.

[0160] According to the various embodiments described above, it can be seen that the embodiment of the present invention solves the technical problem of low interface docking efficiency in the prior art by identifying the interface parameters and interface adaptation script of the target service interface of the second service provider according to the request parameters, then initializing the context environment according to the interface parameters, and executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface. The embodiment of the present invention solves the technical problem of low interface docking efficiency in the prior art by identifying the interface parameters and interface adaptation script of the target service interface according to the request parameters, and performing parameter adaptation and result adaptation, thereby no longer requiring each service provider to perform interface docking one by one, and improving the interface docking efficiency; and using a multi-level parameter matrix as a parameter scope, it can adapt to the diverse interface requirements of each service provider.

[0161] It should be noted that the specific implementation content of the device for processing a service request in the present invention has been described in detail in the method for processing a service request described above, so the repeated content will not be described again here.

[0162] Fig.11 An exemplary system architecture 1100 is shown to which the method for processing a service request or the apparatus for processing a service request according to the embodiments of the present invention can be applied.

[0163] like Fig.11 As shown, system architecture 1100 may include terminal devices 1101, 1102, 1103, a network 1104, and a server 1105. Network 1104 is used to provide a medium for communication links between terminal devices 1101, 1102, 1103 and server 1105. Network 1104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0164] Users can use terminal devices 1101, 1102, 1103 to interact with server 1105 through network 1104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 1101, 1102, 1103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0165] The terminal devices 1101 , 1102 , and 1103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0166] The server 1105 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 1101, 1102, and 1103. The backend management server may analyze and process the received data such as the item information query request, and feed back the processing results (such as target push information, item information - only an example) to the terminal device.

[0167] It should be noted that the method for processing a service request provided in the embodiment of the present invention is generally executed by the server 1105 , and accordingly, the device for processing a service request is generally disposed in the server 1105 .

[0168] It should be understood that Fig.11 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0169] Reference below Fig.12, which shows a schematic diagram of the structure of a computer system 1200 of a terminal device suitable for implementing an embodiment of the present invention. Fig.12 The terminal 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 invention.

[0170] like Fig.12 As shown, the computer system 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage part 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the system 1200 are also stored. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.

[0171] The following components are connected to the I / O interface 1205: an input section 1206 including a keyboard, a mouse, etc.; an output section 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card, a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1210 as needed, so that a computer program read therefrom is installed into the storage section 1208 as needed.

[0172] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1209, and / or installed from the removable medium 1211. When the computer program is executed by the central processing unit (CPU) 1201, the above-mentioned functions defined in the system of the present invention are executed.

[0173] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may 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 or 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 invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal 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 a program 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, wire, optical cable, RF, etc., or any suitable combination of the above.

[0174] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a 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 flow chart, and the combination of the boxes in the block diagram or flow chart 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.

[0175] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a receiving module, an identification module, an adaptation module and a return module, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.

[0176] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device implements the following method: receiving and parsing the business request sent by the first service provider to obtain request parameters; identifying the target service interface of the second service provider according to the request parameters, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface; initializing the context environment of the interface adaptation script according to the interface parameters, executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and adapting the return value of the target service interface; returning the adaptation result of the return value to the first service provider.

[0177] According to the technical solution of the embodiment of the present invention, the interface parameters and interface adaptation script of the target service interface of the second service provider are identified according to the request parameters, and then the context environment is initialized according to the interface parameters, and the interface adaptation script is executed, so that the request parameters are input into the interface adaptation script, the target service interface is called, and the return value of the target service interface is adapted to the result, so the technical problem of low interface docking efficiency in the prior art is overcome. The embodiment of the present invention, by identifying the interface parameters and interface adaptation script of the target service interface according to the request parameters, and performing parameter adaptation and result adaptation, no longer needs to perform interface docking one by one between each service provider, thereby improving the interface docking efficiency; and using a multi-level parameter matrix as a parameter scope, it can adapt to the diverse interface requirements of each service provider.

[0178] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for processing a service request, characterized in that: include: Receive and parse the business request sent by the first service provider to obtain request parameters; Identifying a target service interface of the second service provider according to the request parameters, thereby identifying interface parameters and an interface adaptation script corresponding to the target service interface; Initializing the context environment of the interface adaptation script according to the interface parameters, executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface; Returning the adaptation result of the return value to the first service provider; Identifying the target service interface of the second service provider according to the request parameters, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface, including: identifying a target service interface of a second service provider according to the request parameters; According to the correspondence between each service interface and each release package, the target release package corresponding to the target service interface is identified; wherein the target release package includes the interface parameters and interface adaptation script of the target service interface.

2. The method according to claim 1, characterized in that Initializing the context environment of the interface adaptation script according to the interface parameters and executing the interface adaptation script includes: Determining the status of the target release package; If the status of the target release package is online, the context environment of the interface adaptation script is initialized according to the interface parameters, and the interface adaptation script is executed.

3. The method according to claim 1, characterized in that Initializing the context environment of the interface adaptation script according to the interface parameters, executing the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface, including: Loading the interface parameters from the target release package, and adapting the interface parameters to the context environment of the interface adaptation script; Loading the interface adaptation script from the snapshot of the target release package according to the script information configured in the target service interface; The interface adaptation script is executed, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface.

4. The method according to claim 3, characterized in that: The request parameters are input into the interface adaptation script, the target service interface is called, and the return value of the target service interface is adapted as a result, including: The request parameters are input into the interface adaptation script, and the request parameters are encapsulated as a request message; Calling the target service interface to send the request message to a message queue of a message system; The return value of the target service interface is adapted as a result.

5. The method according to claim 1, characterized in that The request parameter includes at least one of a user identifier, a service identifier, a service type, a first service provider identifier, and a second service provider identifier.

6. The method according to claim 1, characterized in that The interface parameters include parameter scopes at multiple levels, the multiple levels including at least one of a business level, an interface level, a first service provider level, and a second service provider level.

7. A device for processing a service request, characterized in that: include: A receiving module, used to receive and parse the business request sent by the first service provider to obtain request parameters; An identification module, used to identify the target service interface of the second service provider according to the request parameters, thereby identifying the interface parameters and interface adaptation script corresponding to the target service interface; An adaptation module, used to initialize the context environment of the interface adaptation script according to the interface parameters, execute the interface adaptation script, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface; A returning module, used for returning the adaptation result of the return value to the first service provider; The identification module is also used for: identifying a target service interface of a second service provider according to the request parameters; According to the correspondence between each service interface and each release package, the target release package corresponding to the target service interface is identified; wherein the target release package includes the interface parameters and interface adaptation script of the target service interface.

8. The device according to claim 7, characterized in that The adapter module is also used for: Loading the interface parameters from the target release package, and adapting the interface parameters to the context environment of the interface adaptation script; Loading the interface adaptation script from the snapshot of the target release package according to the script information configured in the target service interface; The interface adaptation script is executed, thereby inputting the request parameters into the interface adaptation script, calling the target service interface, and performing result adaptation on the return value of the target service interface.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Redis-based request processing method, server, and computer-readable storage medium

    CN109189576A