CN112860463A - Service request forwarding method and device, computer equipment and readable storage medium - Google Patents

Service request forwarding method and device, computer equipment and readable storage medium Download PDF

Info

Publication number
CN112860463A
CN112860463A CN202110302069.XA CN202110302069A CN112860463A CN 112860463 A CN112860463 A CN 112860463A CN 202110302069 A CN202110302069 A CN 202110302069A CN 112860463 A CN112860463 A CN 112860463A
Authority
CN
China
Prior art keywords
request
target
data
rule
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110302069.XA
Other languages
Chinese (zh)
Inventor
杨永山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Commercial Factoring Co ltd
Original Assignee
Ping An Commercial Factoring Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Commercial Factoring Co ltd filed Critical Ping An Commercial Factoring Co ltd
Priority to CN202110302069.XA priority Critical patent/CN112860463A/en
Publication of CN112860463A publication Critical patent/CN112860463A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to the technical field of big data, in particular to a service request forwarding method, a device, computer equipment and a readable storage medium, comprising the following steps: receiving a service calling request sent by a requester; acquiring a rule matched with the request parameter as a target rule of the service call request; acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through a verification rule; after the interface type and the address state of the called party are verified, converting the service calling request; and forwarding the target calling request to the called party through the target interface. By adopting the method, the forwarding efficiency of the service calling request can be improved. The application also relates to the technical field of block chains, and the service call request, the target rule, the target interface data, the called party data, the converted target call request and the like can be uploaded to the block chains.

Description

Service request forwarding method and device, computer equipment and readable storage medium
Technical Field
The present application relates to the field of big data technologies, and in particular, to a method and an apparatus for forwarding a service request, a computer device, and a readable storage medium.
Background
In actual business processing, communication with each third-party interface through a business interface is generally required to request to acquire corresponding data.
In a traditional mode, each third party has a specific interface, and when the interface of the third party needs to be docked, one set of interface needs to be encoded according to the requirement of the interface of the third party, so that each third party needs to have a corresponding code. Therefore, the workload is large, and the development efficiency is low.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a service request forwarding method, a device, a computer device, and a readable storage medium, which can improve the forwarding efficiency of a service invocation request.
A service request forwarding method, the method comprising:
receiving a service calling request sent by a requesting party, wherein the service calling request carries request parameters;
acquiring a rule matched with the request parameter as a target rule of the service call request, wherein the target rule is uniquely corresponding to the request parameter and comprises a verification rule and a conversion rule;
acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through a verification rule on the basis of the target interface data and the called party data;
after the interface type and the address state of the called party are verified, converting the service calling request according to a conversion rule to obtain a target calling request;
and forwarding the target calling request to the called party through the target interface.
In one embodiment, acquiring target interface data of a target interface for forwarding a service invocation request and callee data of a callee, and verifying an interface type of the target interface and an address state of the callee by a verification rule based on the target interface data and the callee data includes:
determining a target interface for forwarding the service calling request based on a target rule, and acquiring target interface data of the target interface, wherein the target interface data comprises interface type data of the target interface;
judging whether the target interface is a fixed return interface type or not based on the interface type data;
when the interface type of the target interface is the fixed return interface type, acquiring return result data corresponding to the fixed return interface type, and sending the return result data to the requester;
when the interface type of the target interface is a non-fixed return interface type, acquiring called party data of a called party, wherein the called party data comprises network address state data of the called party;
and judging whether the network state of the called party is in a fusing state or not according to the network address state data.
In one embodiment, converting the service invocation request according to the conversion rule to obtain a target-conversion invocation request includes:
determining configuration data for configuring a request header of the service call request according to the conversion rule;
configuring a request head of the service calling request based on the configuration data;
acquiring a conversion template for converting request content of a service calling request;
and converting the data format of the request content based on the conversion template to obtain a target calling request corresponding to the called party data format.
In one embodiment, before forwarding the target call request to the callee through the target interface, the method further includes:
judging whether the request format of the service transfer request is correct or not according to the verification rule;
and when the request format is determined to be correct, acquiring a verification item for verifying the service calling request, and verifying each verification item based on the acquired verification data of the requester.
In one embodiment, the method further includes:
receiving response data corresponding to the service calling request fed back by the called party;
acquiring a conversion template for performing data format conversion on the response data according to the target rule;
converting the data format of the response data through a conversion template to obtain target response data;
the target response data is sent to the requestor.
In one embodiment, the method further includes:
monitoring each target rule, and judging whether an updating instruction for updating the target rule is monitored;
when an updating instruction is monitored, updating the target rule based on the updating instruction;
acquiring a rule matched with the request parameter as a target rule of the service call request, wherein the rule comprises the following steps:
and acquiring the updated target rule matched with the request parameter as the target rule of the service call request.
In one embodiment, acquiring a rule matching with a request parameter as a target rule of a service invocation request includes:
and acquiring a rule matched with at least one array linked list in the request address, the request mode and the request content type as a target rule of the service call request.
A service request forwarding apparatus, the apparatus comprising:
the service calling request receiving module is used for receiving a service calling request sent by a requesting party, and the service calling request carries a request parameter;
the target rule obtaining module is used for obtaining a rule matched with the request parameter as a target rule of the service calling request, the target rule is uniquely corresponding to the request parameter, and the target rule comprises a verification rule and a conversion rule;
the data acquisition module is used for acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through a verification rule based on the target interface data and the called party data;
the conversion module is used for converting the service calling request according to a conversion rule after the interface type and the address state of the called party are verified to be passed, so as to obtain a target calling request;
and the forwarding module is used for forwarding the target calling request to the called party through the target interface.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method of any of the above embodiments when the computer program is executed.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of any of the above embodiments.
The service request forwarding method, the device, the computer equipment and the readable storage medium send the service calling request by receiving the request, the service calling request carries the request parameter, the rule matched with the request parameter is obtained to be used as the target rule of the service calling request, the target rule is uniquely corresponding to the request parameter and comprises a verification rule and a conversion rule, then the corresponding target interface and the called party data of the called party are obtained, the target interface and the called party data are verified, the service calling request is converted after the verification is passed, the target calling request is obtained, and further, the target calling request is forwarded to the called party through the target interface. Therefore, the interface and the called party can be verified according to the rule matched with the request parameter, the data format is converted, the request matched with the called party is obtained, the problem that interface coding needs to be carried out on each third-party interface in the traditional mode is solved, the development workload is reduced, and the development efficiency is improved. Moreover, the interface and the called party are verified, and then the data request is converted, so that the normal operation of the third-party interface and the called party is guaranteed, the probability of problems in request forwarding can be reduced, and the efficiency of request forwarding can be improved.
Drawings
Fig. 1 is an application scenario diagram of a service request forwarding method in an embodiment;
fig. 2 is a schematic flow chart of a service request forwarding method in an embodiment;
fig. 3 is a block diagram illustrating a structure of a service request forwarding apparatus according to an embodiment;
FIG. 4 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The service request forwarding method provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The requester inputs a service invocation request through the terminal 102 and sends the service invocation request to the server 104, wherein the service invocation request carries request parameters. After receiving a service invocation request sent by a requester, the server 104 obtains a rule matched with the request parameter as a target rule of the service invocation request, wherein the target rule is uniquely corresponding to the request parameter, and the target rule comprises a verification rule and a conversion rule. Then, the server 104 obtains target interface data of a target interface for forwarding the service invocation request and callee data of the callee, and verifies the interface type of the target interface and the address state of the callee by a verification rule based on the target interface data and the callee data. Further, after the interface type and the address state of the called party are verified, the server 104 converts the service call request according to the conversion rule to obtain a target call request, and forwards the target call request to the called party through the target interface. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In an embodiment, as shown in fig. 2, a service request forwarding method is provided, which is described by taking the application of the method to the server in fig. 1 as an example, and includes the following steps:
step S202, receiving a service calling request sent by a requester, wherein the service calling request carries request parameters.
The service invocation request refers to a request for invoking a service or a request for invoking a service, for example, processing some services, executing a certain service, and the like, and the service invocation request may carry a request parameter.
In this embodiment, the request parameters may include, but are not limited to, data such as a request address, a request mode, and a request content type. Specifically, the request address refers to a network address or an IP address and the like corresponding to the requester; the request mode refers to http, POST, get and other request modes. The request content type refers to a data format of the request content in the service invocation request, such as QUERY, JSON, FORM, XML, and the like.
In this embodiment, the requester may generate a service invocation request through a corresponding terminal, for example, a request terminal, and send the service invocation request to the server, so that the server may obtain the service invocation request and perform subsequent processing according to a request parameter carried in the service invocation request.
Step S204, a rule matched with the request parameter is obtained to serve as a target rule of the service calling request, the target rule is uniquely corresponding to the request parameter, and the target rule comprises a verification rule and a conversion rule.
The target rule refers to a rule corresponding to a service invocation request of a requester, and different requesters or different service invocation requests have different corresponding target rules. The target rules may include validation rules and transformation rules.
In this embodiment, the validation rule is used to validate the acquired data, and the conversion rule is used to convert the service invocation request, for example, convert the data format.
In this embodiment, the server may preset a target rule corresponding to each request parameter of each requester, so that after receiving the service invocation request, the server may perform matching of the target rule according to the request parameter carried in the request.
Specifically, the server may match and obtain the unique corresponding target rule according to parameters such as a request address, a request mode, a request content type, and the like. For example, in a service invocation request, the request mode is POST, the request content type is JSON, and the request address is "/fastpay-query", and the only target rule that can be matched is the rule corresponding to the key "POST _ JSON _/fastpay-query".
It should be understood by those skilled in the art that this is merely an example, and in other embodiments, the server performs matching of the target rule according to the request parameter, or may determine the corresponding target rule only according to at least one of the request address, the request manner, and the request content type in the request parameter.
In this embodiment, for a new request party or when a request parameter in a service invocation request is incorrect, the server cannot match the corresponding target rule when performing target rule matching based on the request parameter, and at this time, the server may generate corresponding error prompt information and feed the error prompt information back to the request party to perform error prompt.
And, the server may generate or otherwise create a corresponding target rule according to further direction of the requestor so that the request may continue to execute.
Step S206, acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through a verification rule based on the target interface data and the called party data.
The target interface is an interface for interfacing with the called party, and the target interface can forward the service calling request to the called party system.
The target interface data may include parameter data related to the target interface, such as interface type, interface forwarding amount, and encoding method of the interface.
The callee data refers to network-related data of the callee, for example, data such as a network address and a network address status. The network address may refer to an IP address, and the network address status is data indicating whether the network address is blown, for example, the network address is in a blown state or in a non-blown state.
In this embodiment, the server may determine, according to a target rule, a target interface for forwarding the service invocation request, and obtain corresponding target interface data and callee data of the callee.
Specifically, the server may parse the obtained target rule to determine and obtain a forwarding target interface for the service invocation request and a callee therefrom.
Further, the server may verify the target interface and the callee by a verification rule based on the acquired target interface data and the callee data to determine whether to forward the request and determine whether the callee is available, or whether the callee can be called normally, and the like.
Specifically, the server may verify the interface type of the target interface and the address state of the network address of the callee, and perform subsequent processing after the verification is passed.
And step S208, after the interface type and the address state of the called party are verified, converting the service calling request according to the conversion rule to obtain a target calling request.
In this embodiment, when the interface type of the target interface and the address state of the callee are verified, the server may determine, from the obtained target rules, conversion data or a conversion rule for converting the service invocation request, and convert the received service invocation request according to the obtained conversion rule, so as to obtain the converted target invocation request suitable for the callee to identify.
And step S210, forwarding the target calling request to the called party through the target interface.
Specifically, the server may select different Request (Request) instances according to different Request parameter types, such as QUERY, JSON, FORM, and XML, and then call different logics according to the target interface, so as to send the service call Request to the called party.
In the service request forwarding method, a service calling request is sent by receiving a request release, the service calling request carries a request parameter, a rule matched with the request parameter is obtained as a target rule of the service calling request, the target rule is uniquely corresponding to the request parameter and comprises a verification rule and a conversion rule, then a corresponding target interface and called party data of a called party are obtained, the target interface and the called party data are verified, the service calling request is converted after the verification is passed, the target calling request is obtained, and further the target calling request is forwarded to the called party through the target interface. Therefore, the interface and the called party can be verified according to the rule matched with the request parameter, the data format is converted, the request matched with the called party is obtained, the problem that interface coding needs to be carried out on each third-party interface in the traditional mode is solved, the development workload is reduced, and the development efficiency is improved. Moreover, the interface and the called party are verified, and then the data request is converted, so that the normal operation of the third-party interface and the called party is guaranteed, the probability of problems in request forwarding can be reduced, and the efficiency of request forwarding can be improved.
In one embodiment, obtaining target interface data of a target interface for forwarding the service invocation request and callee data of the callee, and verifying an interface type of the target interface and an address state of the callee according to a verification rule based on the target interface data and the callee data may include: determining a target interface for forwarding the service calling request based on a target rule, and acquiring target interface data of the target interface, wherein the target interface data comprises interface type data of the target interface; judging whether the target interface is a fixed return interface type or not based on the interface type data; when the interface type of the target interface is the fixed return interface type, acquiring return result data corresponding to the fixed return interface type, and sending the return result data to the requester; when the interface type of the target interface is a non-fixed return interface type, acquiring called party data of a called party, wherein the called party data comprises network address state data of the called party; and judging whether the network state of the called party is in a fusing state or not according to the network address state data.
The fixed return interface type refers to that when a request calls a service through a corresponding interface, a corresponding fixed feedback result is returned. For example, if the interface health check is requested, the corresponding interface health check result is returned.
In this embodiment, after acquiring the target interface corresponding to the service invocation request from the target rule, the server may query and acquire corresponding target interface data according to the acquired target interface, for example, acquire corresponding target interface data according to an interface identifier or an interface name, and the target interface data may include an interface type of the target interface. Then, the server may determine the interface type of the acquired target interface to determine whether the acquired interface type is a fixed return interface type.
Specifically, when the server determines that the interface type is the fixed return interface type, operations such as a call request do not need to be forwarded, but a corresponding fixed feedback result is obtained and sent to the requester.
Further, when the server determines that the interface type is the non-fixed return interface type, the called party data of the called party is obtained, and the called party data may include the network address type of the called party, the address state of the network address, and the like.
In this embodiment, after acquiring the callee data of the callee, the server may determine the address status of the network address of the callee to determine whether the callee is in the blown state.
In this embodiment, the fusing refers to fusing triggered when the service invocation request fails to be forwarded for multiple times, for example, if the requests fail for 5 consecutive times, the server triggers fusing, returns an error message to the requesting party within a preset time period, for example, within 3 seconds, and forwards the request again after waiting for a preset time duration, and continuously succeeds for a preset number of times, for example, after 2 times of success, the fusing is turned off, otherwise, the server continues to wait for the preset time duration and forwards the request again, and the process is repeated.
In the above embodiment, by determining the interface type, and performing subsequent operations when the interface type is determined to be the non-fixed return interface type, and determining the network address state of the called party, the following unnecessary data processing process can be reduced, and the processing efficiency can be improved.
In one embodiment, converting the service invocation request according to the conversion rule to obtain the target invocation request may include: determining configuration data for configuring a request header of the service call request according to the conversion rule; configuring a request head of the service calling request based on the configuration data; acquiring a conversion template for converting request content of a service calling request; and converting the data format of the request content based on the conversion template to obtain a target calling request corresponding to the called party data format.
In this embodiment, the server may determine, according to the obtained conversion rule, configuration data for configuring the request header of the service invocation request, for example, if the callee has a special requirement on the request header of the received service invocation request, the server may configure the request header according to the configuration data obtained by the server. For example, if a specific request header parameter (specialheader names) is set and a key "appkey" is included in the specific request header parameter, indicating that the request requires a specific header "appkey", the request header may be configured according to the acquired configuration data, for example, "appkey: 132".
Further, after the configuration of the request header is completed, the server may obtain a conversion template for performing format conversion on the request content of the service invocation request from the conversion rule, and perform data format conversion on the request content through the obtained conversion template.
In this embodiment, the server may process the request content into a map with ROOT as a ROOT through a conversion template, and then fill the map into a freemarker template to obtain the converted request content. For example, the request content is { "order no": OR1234567"," order trace no ": PA1234567" }, the request template is "version ═ 1.0.0& charset ═ UTF-8& transType ═ 005& merchantind ═ 10000& mercc Orderno $ { root.order no } & orderTrace ═ root $ [ -. orderTrace } & signmethond ═ SHA-256", and after the request template is processed, the resultant converted request content is "version ═ 1.0.0& charset ═ UTF-8& transmetType ═ 005& merchantind ═ 10000& merchantind ═ OR1234567& ordere ═ PA ═ nmfound ═ 1234567& merchantinware ═ 10000& nmda-256".
In the above embodiment, the request header is configured, and then the request content is converted in the data format, so that the finally obtained data is data adapted to the called party, the processing amount of the called party after obtaining the data can be reduced, and the processing efficiency of the called party can be improved.
In one embodiment, before forwarding the target call request to the callee through the target interface, the method may further include: judging whether the request format of the service transfer request is correct or not according to the verification rule; and when the request format is determined to be correct, acquiring a verification item for verifying the service calling request, and verifying each verification item based on the acquired verification data of the requester.
The request format of the service invocation request refers to the data format of the requested content in the service invocation request, such as QUERY, JSON, FORM, XML, and the like.
In this embodiment, the server may determine whether the request format of the service mediation request is correct according to the verification rule. For example, if the request is a JSON request, JSON format is verified, and verification failure prompts verification failure information.
In this embodiment, the verification uses the file-based format check provided by org.erict.json.schema, e.g., { "required": [ "orderNo", "orderTraceNo" ] }, indicating that the request content needs to contain two keys orderNo and orderTraceNo.
In this embodiment, when the server determines that the request format is correct, a validation item for validating the service invocation request is obtained according to the target rule, and each validation item is validated based on the obtained validation data of the requester.
Specifically, each callee can preset a setting verification item, for example, a verification signature or the like. The server can verify the verification item based on the acquired verification data, for example, when special operations such as signature verification exist, signature verification can be performed, a corresponding error prompt is returned when verification fails, and subsequent processing is performed after verification passes.
In the embodiment, the request which does not conform to the agreement can be found in advance through the verification of the request format and the verification item, so that the invalid request can be prevented from occupying service resources, and the processing efficiency is improved.
In one embodiment, the method may further include: receiving response data corresponding to the service calling request fed back by the called party; acquiring a conversion template for performing data format conversion on the response data according to the target rule; converting the data format of the response data through a conversion template to obtain target response data; the target response data is sent to the requestor.
In this embodiment, after forwarding the target call request to the callee through the target interface, the server may perform real-time monitoring on the target interface to monitor whether the callee has response data for feeding back the corresponding service call request.
In this embodiment, the response data may be labeled by an identifier of the requesting party, so that when the server receives a plurality of response data of the called party, the server determines the corresponding requesting party according to the labeled identifier.
Further, the server may obtain a corresponding conversion template, and perform data format conversion on the obtained response data to obtain target response data suitable for the requester to use.
Specifically, the server may use a configured freemarker response template to convert to data needed upstream, i.e., by the requestor. For example, the response data may be "version ═ 1.0.0& charset ═ UTF-8& signMethod ═ SHA-256& transType ═ 001& respecode ═ 0000& respMsg ═ 20201110162500& merchantId ═ 10000& merkerderno ═ OR1234567& ordettetime traceno ═ PA1234567& ordertstatus ═ 00& ordetime ═ 20201110162236& ordameunt ═ 1000& orderCurrency & customerprofit ═ 1& orderlenmented ═ 20201110162237& transcoded ═ 0064", and the response template may be { "code": "$ { root. "$ { root. "$ { root. mercorderno }", "amount": "$ { root. "$ { root. "$ { root. "$ { root. The target response data obtained after the conversion by the response template may be { "code": "0000", "msg": "operational success", "orderNo": "OR1234567", "amount": "1000", "orderStatus": "00", "orderTraceNo": "PA1234567", "ordercompleteitime": "20201110162237"}.
In the above embodiment, the target response data is obtained by converting the response data received from the feedback and is sent to the requester, so that the data sent to the requester can be adapted to the requester, and the data processing process of the subsequent requester can be reduced.
In one embodiment, the method may further include: monitoring each target rule, and judging whether an updating instruction for updating the target rule is monitored; and when the updating instruction is monitored, updating the target rule based on the updating instruction.
In this embodiment, acquiring the rule matched with the request parameter as the target rule of the service invocation request may include: and acquiring the updated target rule matched with the request parameter as the target rule of the service call request.
Specifically, the server may also change and monitor each stored rule, and if the update instruction is monitored, update the corresponding rule according to the update content carried in the update instruction. And after the rule is updated and changed, matching the updated target rule according to the request parameters after detecting the corresponding service call request.
In this embodiment, the essence of updating the target rule is to update the static configuration file, so that after the update, the file is only reloaded without restarting the system or starting the service, so that the update configuration is more flexible, and the processing efficiency is further improved.
In one embodiment, obtaining the rule matching the request parameter as the target rule of the service invocation request may include: and acquiring a rule matched with at least one array linked list in the request address, the request mode and the request content type as a target rule of the service call request.
As previously described, the request parameters may include a request address, a request manner, and a request content type. The array linked list may be referred to as a hashmap.
In this embodiment, the server may query the hashmap according to at least one of the request address, the request mode, and the request content type, and obtain the queried rule as the target rule of the service invocation request.
In one embodiment, the method may further include: and uploading at least one of the service calling request, the target rule, the target interface data, the called party data and the converted target calling request to a block chain node for storage.
The blockchain refers to a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A Block chain (Block chain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data Block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next Block.
Specifically, the blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In this embodiment, the server may upload and store one or more data of the service invocation request, the target rule, the target interface data, the callee data, and the converted target invocation request in a node of the block chain, so as to ensure privacy and security of the data.
In the above embodiment, at least one of the service call request, the target rule, the target interface data, the called party data and the converted target call request is uploaded to the block chain and stored in the node of the block chain, so that the privacy of the data stored in the node of the block chain can be guaranteed, and the security of the data can be improved.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 2 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 3, a service request forwarding apparatus is provided, which includes a service invocation request receiving module 100, a target rule obtaining module 200, a data obtaining module 300, a converting module 400, and a forwarding module 500, where:
the service invocation request receiving module 100 is configured to receive a service invocation request sent by a requester, where the service invocation request carries a request parameter.
And a target rule obtaining module 200, configured to obtain a rule matched with the request parameter as a target rule of the service invocation request, where the target rule uniquely corresponds to the request parameter, and the target rule includes a validation rule and a conversion rule.
The data obtaining module 300 is configured to obtain target interface data of a target interface for forwarding the service invocation request and callee data of the callee, and verify the interface type of the target interface and the address state of the callee according to a verification rule based on the target interface data and the callee data.
And the conversion module 400 is configured to convert the service invocation request according to the conversion rule after the interface type and the address state of the called party are verified, so as to obtain a target invocation request.
And a forwarding module 500, configured to forward the target call request to the callee through the target interface.
In one embodiment, the data acquisition module 300 may include:
and the target interface data acquisition submodule is used for determining a target interface for forwarding the service calling request based on the target rule and acquiring target interface data of the target interface, wherein the target interface data comprises interface type data of the target interface.
And the first judgment submodule is used for judging whether the target interface is the fixed return interface type or not based on the interface type data.
And the return result data acquisition submodule is used for acquiring return result data corresponding to the fixed return interface type and sending the return result data to the requester when the interface type of the target interface is the fixed return interface type.
And the called party data acquisition submodule is used for acquiring called party data of the called party when the interface type of the target interface is a non-fixed return interface type, wherein the called party data comprises network address state data of the called party.
And the second judging submodule is used for judging whether the network state of the called party is in a fusing state or not according to the network address state data.
In one embodiment, the conversion module 400 may include:
and the configuration data acquisition submodule is used for determining configuration data for configuring the request head of the service call request according to the conversion rule.
And the configuration submodule is used for configuring the request head of the service call request based on the configuration data.
A conversion template obtaining submodule for obtaining a conversion template for converting the request content of the service calling request;
and the conversion submodule is used for converting the data format of the request content based on the conversion template to obtain a target calling request corresponding to the called party data format.
In one embodiment, the apparatus may further include:
the judging module is used for judging whether the request format of the service transfer request is correct or not according to the verification rule before the target transfer request is forwarded to the called party through the target interface;
and the verification module is used for acquiring verification items for verifying the service calling request when the request format is determined to be correct, and verifying each verification item based on the acquired verification data of the requesting party.
In one embodiment, the apparatus may further include:
and the response data receiving module is used for receiving response data which are fed back by the called party and correspond to the service calling request.
And the conversion template acquisition module is used for acquiring a conversion template for performing data format conversion on the response data according to the target rule.
And the conversion module is used for converting the data format of the response data through the conversion template to obtain the target response data.
And the sending module is used for sending the target response data to the requester.
In one embodiment, the apparatus may further include:
and the monitoring module is used for monitoring each target rule and judging whether an updating instruction for updating the target rule is monitored.
And the updating module is used for updating the target rule based on the updating instruction when the updating instruction is monitored.
In this embodiment, the target rule obtaining module 200 is configured to obtain an updated target rule matching the request parameter as a target rule of the service invocation request.
In one embodiment, the target rule obtaining module 200 is configured to obtain a rule matched with at least one of a request address, a request manner, and a request content type from an array linked list as a target rule of the service invocation request.
In one embodiment, the apparatus may further include:
and the storage module is used for uploading at least one of the service calling request, the target rule, the target interface data, the called party data and the converted target calling request to the block chain node for storage.
For specific limitations of the service request forwarding apparatus, reference may be made to the above limitations on the service request forwarding method, which is not described herein again. The modules in the service request forwarding apparatus may be implemented wholly or partially by software, hardware, or a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing data such as service calling requests, target rules, target interface data, called party data, converted target calling requests and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a service request forwarding method.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, there is provided a computer device comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program: receiving a service calling request sent by a requesting party, wherein the service calling request carries request parameters; acquiring a rule matched with the request parameter as a target rule of the service call request, wherein the target rule is uniquely corresponding to the request parameter and comprises a verification rule and a conversion rule; acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through a verification rule on the basis of the target interface data and the called party data; after the interface type and the address state of the called party are verified, converting the service calling request according to a conversion rule to obtain a target calling request; and forwarding the target calling request to the called party through the target interface.
In one embodiment, the obtaining target interface data of a target interface for forwarding the service invocation request and callee data of the callee when the processor executes the computer program, and verifying the interface type of the target interface and the address state of the callee according to a verification rule based on the target interface data and the callee data may include: determining a target interface for forwarding the service calling request based on a target rule, and acquiring target interface data of the target interface, wherein the target interface data comprises interface type data of the target interface; judging whether the target interface is a fixed return interface type or not based on the interface type data; when the interface type of the target interface is the fixed return interface type, acquiring return result data corresponding to the fixed return interface type, and sending the return result data to the requester; when the interface type of the target interface is a non-fixed return interface type, acquiring called party data of a called party, wherein the called party data comprises network address state data of the called party; and judging whether the network state of the called party is in a fusing state or not according to the network address state data.
In one embodiment, when the processor executes the computer program, the converting the service invocation request according to the conversion rule to obtain the target invocation request may include: determining configuration data for configuring a request header of the service call request according to the conversion rule; configuring a request head of the service calling request based on the configuration data; acquiring a conversion template for converting request content of a service calling request; and converting the data format of the request content based on the conversion template to obtain a target calling request corresponding to the called party data format.
In one embodiment, before the processor executes the computer program to forward the target call request to the callee through the target interface, the following steps may be further implemented: judging whether the request format of the service transfer request is correct or not according to the verification rule; and when the request format is determined to be correct, acquiring a verification item for verifying the service calling request, and verifying each verification item based on the acquired verification data of the requester.
In one embodiment, the processor, when executing the computer program, may further implement the following steps: receiving response data corresponding to the service calling request fed back by the called party; acquiring a conversion template for performing data format conversion on the response data according to the target rule; converting the data format of the response data through a conversion template to obtain target response data; the target response data is sent to the requestor.
In one embodiment, the processor, when executing the computer program, may further implement the following steps: monitoring each target rule, and judging whether an updating instruction for updating the target rule is monitored; and when the updating instruction is monitored, updating the target rule based on the updating instruction.
In this embodiment, the obtaining, by the processor when executing the computer program, a rule matching the request parameter as a target rule of the service invocation request may include: and acquiring the updated target rule matched with the request parameter as the target rule of the service call request.
In one embodiment, the processor, when executing the computer program, implements obtaining a rule matching the request parameter as a target rule of the service invocation request, and may include: and acquiring a rule matched with at least one array linked list in the request address, the request mode and the request content type as a target rule of the service call request.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving a service calling request sent by a requesting party, wherein the service calling request carries request parameters; acquiring a rule matched with the request parameter as a target rule of the service call request, wherein the target rule is uniquely corresponding to the request parameter and comprises a verification rule and a conversion rule; acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through a verification rule on the basis of the target interface data and the called party data; after the interface type and the address state of the called party are verified, converting the service calling request according to a conversion rule to obtain a target calling request; and forwarding the target calling request to the called party through the target interface.
In one embodiment, the computer program, when executed by the processor, implements obtaining target interface data of a target interface for forwarding the service invocation request and callee data of the callee, and based on the target interface data and the callee data, verifies an interface type of the target interface and an address status of the callee through a verification rule, and may include: determining a target interface for forwarding the service calling request based on a target rule, and acquiring target interface data of the target interface, wherein the target interface data comprises interface type data of the target interface; judging whether the target interface is a fixed return interface type or not based on the interface type data; when the interface type of the target interface is the fixed return interface type, acquiring return result data corresponding to the fixed return interface type, and sending the return result data to the requester; when the interface type of the target interface is a non-fixed return interface type, acquiring called party data of a called party, wherein the called party data comprises network address state data of the called party; and judging whether the network state of the called party is in a fusing state or not according to the network address state data.
In one embodiment, when executed by a processor, the computer program implementing a conversion of a service invocation request according to a conversion rule to obtain a target invocation request may include: determining configuration data for configuring a request header of the service call request according to the conversion rule; configuring a request head of the service calling request based on the configuration data; acquiring a conversion template for converting request content of a service calling request; and converting the data format of the request content based on the conversion template to obtain a target calling request corresponding to the called party data format.
In one embodiment, the computer program when executed by the processor performs the following steps before forwarding the target call request to the callee through the target interface: judging whether the request format of the service transfer request is correct or not according to the verification rule; and when the request format is determined to be correct, acquiring a verification item for verifying the service calling request, and verifying each verification item based on the acquired verification data of the requester.
In one embodiment, the computer program when executed by the processor may further implement the steps of: receiving response data corresponding to the service calling request fed back by the called party; acquiring a conversion template for performing data format conversion on the response data according to the target rule; converting the data format of the response data through a conversion template to obtain target response data; the target response data is sent to the requestor.
In one embodiment, the computer program when executed by the processor may further implement the steps of: monitoring each target rule, and judging whether an updating instruction for updating the target rule is monitored; and when the updating instruction is monitored, updating the target rule based on the updating instruction.
In this embodiment, the computer program, when executed by the processor, implements obtaining a rule matching the request parameter as a target rule of the service invocation request, and may include: and acquiring the updated target rule matched with the request parameter as the target rule of the service call request.
In one embodiment, the computer program, when executed by the processor, may implement obtaining a rule matching the request parameter as a target rule of the service invocation request, and may include: and acquiring a rule matched with at least one array linked list in the request address, the request mode and the request content type as a target rule of the service call request.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A service request forwarding method is characterized in that the method comprises the following steps:
receiving a service calling request sent by a requesting party, wherein the service calling request carries request parameters;
acquiring a rule matched with the request parameter as a target rule of the service calling request, wherein the target rule is uniquely corresponding to the request parameter and comprises a verification rule and a conversion rule;
acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through the verification rule based on the target interface data and the called party data;
after the interface type and the address state of the called party are verified, converting the service calling request according to the conversion rule to obtain a target calling request;
forwarding the target invocation request to the callee through the target interface.
2. The method according to claim 1, wherein the obtaining target interface data of a target interface for forwarding the service invocation request and callee data of a callee, and verifying an interface type of the target interface and an address status of the callee according to the verification rule based on the target interface data and the callee data comprises:
determining a target interface for forwarding the service calling request based on the target rule, and acquiring target interface data of the target interface, wherein the target interface data comprises interface type data of the target interface;
judging whether the target interface is a fixed return interface type or not based on the interface type data;
when the interface type of the target interface is a fixed return interface type, acquiring return result data corresponding to the fixed return interface type, and sending the return result data to the requester;
when the interface type of the target interface is a non-fixed return interface type, acquiring called party data of the called party, wherein the called party data comprises network address state data of the called party;
and judging whether the network state of the called party is in a fusing state or not according to the network address state data.
3. The method of claim 1, wherein the converting the service invocation request according to the conversion rule to obtain a target invocation request comprises:
determining configuration data for configuring a request header of the service calling request according to the conversion rule;
configuring a request head of the service calling request based on the configuration data;
acquiring a conversion template for converting the request content of the service calling request;
and converting the data format of the request content based on the conversion template to obtain a target calling request corresponding to the called party data format.
4. The method of claim 1, wherein before forwarding the target call request to the callee through the target interface, further comprising:
judging whether the request format of the service transfer request is correct or not according to the verification rule;
and when the request format is determined to be correct, acquiring a verification item for verifying the service calling request, and verifying each verification item based on the acquired verification data of the requester.
5. The method of claim 1, further comprising:
receiving response data corresponding to the service calling request fed back by the called party;
acquiring a conversion template for performing data format conversion on the response data according to the target rule;
converting the data format of the response data through the conversion template to obtain target response data;
and sending the target response data to the requester.
6. The method of claim 1, further comprising:
monitoring each target rule, and judging whether an updating instruction for updating the target rule is monitored;
when the updating instruction is monitored, updating the target rule based on the updating instruction;
the acquiring the rule matched with the request parameter as a target rule of the service invoking request comprises:
and acquiring the updated target rule matched with the request parameter as the target rule of the service calling request.
7. The method according to any one of claims 1 to 6, wherein the obtaining a rule matching the request parameter as a target rule of the service invocation request comprises:
and acquiring a rule matched with at least one array linked list in a request address, a request mode and a request content type as a target rule of the service call request.
8. A service request forwarding apparatus, the apparatus comprising:
a service call request receiving module, configured to receive a service call request sent by a requester, where the service call request carries a request parameter;
a target rule obtaining module, configured to obtain a rule matched with the request parameter as a target rule of the service invocation request, where the target rule uniquely corresponds to the request parameter, and the target rule includes a validation rule and a conversion rule;
the data acquisition module is used for acquiring target interface data of a target interface for forwarding the service calling request and called party data of a called party, and verifying the interface type of the target interface and the address state of the called party through the verification rule based on the target interface data and the called party data;
the conversion module is used for converting the service calling request according to the conversion rule after the interface type and the address state of the called party are verified to pass, so as to obtain a target calling request;
and the forwarding module is used for forwarding the target calling request to the called party through the target interface.
9. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110302069.XA 2021-03-22 2021-03-22 Service request forwarding method and device, computer equipment and readable storage medium Pending CN112860463A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110302069.XA CN112860463A (en) 2021-03-22 2021-03-22 Service request forwarding method and device, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110302069.XA CN112860463A (en) 2021-03-22 2021-03-22 Service request forwarding method and device, computer equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN112860463A true CN112860463A (en) 2021-05-28

Family

ID=75991823

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110302069.XA Pending CN112860463A (en) 2021-03-22 2021-03-22 Service request forwarding method and device, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112860463A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113542369A (en) * 2021-06-28 2021-10-22 深圳海付移通科技有限公司 Interface data processing method and device, computer equipment and storage medium
CN113626644A (en) * 2021-08-31 2021-11-09 北京中电普华信息技术有限公司 Method and device for converting formats of business process data

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103095479A (en) * 2011-11-04 2013-05-08 华为技术有限公司 Method and device of business configuration
CN108255905A (en) * 2017-05-04 2018-07-06 平安科技(深圳)有限公司 Interface calls data processing method, device and computer equipment
CN108491281A (en) * 2018-03-22 2018-09-04 武汉斗鱼网络科技有限公司 Method, readable medium and the electronic equipment interacted between software systems
CN109240838A (en) * 2018-09-20 2019-01-18 深圳市牛鼎丰科技有限公司 Interface call method, device, computer equipment and storage medium
CN109802957A (en) * 2019-01-03 2019-05-24 深圳壹账通智能科技有限公司 Interface butt joint method, device, computer equipment and storage medium
CN110650186A (en) * 2019-09-06 2020-01-03 上海陆家嘴国际金融资产交易市场股份有限公司 Interface calling method and device, computer equipment and storage medium
CN110990205A (en) * 2019-11-28 2020-04-10 腾讯科技(深圳)有限公司 Interface call testing method, device and computer readable storage medium
CN111858083A (en) * 2019-12-30 2020-10-30 北京嘀嘀无限科技发展有限公司 Remote service calling method and device, electronic equipment and storage medium
CN112351059A (en) * 2020-07-30 2021-02-09 中兴通讯股份有限公司 Request processing method and device, electronic equipment and computer-readable storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103095479A (en) * 2011-11-04 2013-05-08 华为技术有限公司 Method and device of business configuration
CN108255905A (en) * 2017-05-04 2018-07-06 平安科技(深圳)有限公司 Interface calls data processing method, device and computer equipment
CN108491281A (en) * 2018-03-22 2018-09-04 武汉斗鱼网络科技有限公司 Method, readable medium and the electronic equipment interacted between software systems
CN109240838A (en) * 2018-09-20 2019-01-18 深圳市牛鼎丰科技有限公司 Interface call method, device, computer equipment and storage medium
CN109802957A (en) * 2019-01-03 2019-05-24 深圳壹账通智能科技有限公司 Interface butt joint method, device, computer equipment and storage medium
CN110650186A (en) * 2019-09-06 2020-01-03 上海陆家嘴国际金融资产交易市场股份有限公司 Interface calling method and device, computer equipment and storage medium
CN110990205A (en) * 2019-11-28 2020-04-10 腾讯科技(深圳)有限公司 Interface call testing method, device and computer readable storage medium
CN111858083A (en) * 2019-12-30 2020-10-30 北京嘀嘀无限科技发展有限公司 Remote service calling method and device, electronic equipment and storage medium
CN112351059A (en) * 2020-07-30 2021-02-09 中兴通讯股份有限公司 Request processing method and device, electronic equipment and computer-readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113542369A (en) * 2021-06-28 2021-10-22 深圳海付移通科技有限公司 Interface data processing method and device, computer equipment and storage medium
CN113626644A (en) * 2021-08-31 2021-11-09 北京中电普华信息技术有限公司 Method and device for converting formats of business process data
CN113626644B (en) * 2021-08-31 2024-03-15 北京中电普华信息技术有限公司 Format conversion method and device for business process data

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN109087054B (en) Collaborative office data stream processing method, device, computer equipment and storage medium
CN112860463A (en) Service request forwarding method and device, computer equipment and readable storage medium
CN109656778B (en) Data acquisition method and device, computer equipment and storage medium
CN111651285A (en) Batch business data processing method and device, computer equipment and storage medium
CN108446172B (en) Data calling method and device, computer equipment and storage medium
CN111143462A (en) Data export method and device, computer equipment and storage medium
CN110213392B (en) Data distribution method and device, computer equipment and storage medium
CN108388438B (en) System base table updating method and device, computer equipment and storage medium
CN112468540B (en) Cloud platform-based data distribution method, equipment and medium
CN110650186A (en) Interface calling method and device, computer equipment and storage medium
CN111177121A (en) Order data feedback method and device, computer equipment and storage medium
CN112860778A (en) Database management method, device, equipment and medium for desktop application program
CN110717156A (en) Identity authentication method, system, computer device and storage medium
CN112199441B (en) Data synchronous processing method, device, equipment and medium based on big data platform
CN108376154B (en) System base table synchronization method and device, computer equipment and storage medium
CN112948499A (en) Information acquisition method and device, electronic equipment and storage medium
CN113010306A (en) Service data processing method and device, computer equipment and storage medium
CN111552989A (en) Service data processing method, device, equipment and storage medium based on block chain
CN114429408B (en) Method, device, equipment and system for checking configuration file of intelligent substation
CN113157754B (en) Method, device and equipment for displaying flow form data and storage medium
CN111047187B (en) Information matching processing method, device, computer equipment and storage medium
CN114116356A (en) Simulation test method, device, equipment and medium
CN114239076A (en) Block chain-based electronic signature file processing method and device, and computer equipment
CN114924783A (en) Interface calling method, device, equipment and storage medium of application program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination