Nothing Special   »   [go: up one dir, main page]

CN112528307A - Service request checking method and device, electronic equipment and storage medium - Google Patents

Service request checking method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112528307A
CN112528307A CN202011502233.3A CN202011502233A CN112528307A CN 112528307 A CN112528307 A CN 112528307A CN 202011502233 A CN202011502233 A CN 202011502233A CN 112528307 A CN112528307 A CN 112528307A
Authority
CN
China
Prior art keywords
verification
access request
interface
service access
service
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
CN202011502233.3A
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 Bank Co Ltd
Original Assignee
Ping An Bank 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 Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202011502233.3A priority Critical patent/CN112528307A/en
Publication of CN112528307A publication Critical patent/CN112528307A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/604Tools and structures for managing or administering access control systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2141Access rights, e.g. capability lists, access control lists, access tables, access matrices

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Automation & Control Theory (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明涉及测试领域,揭露了一种服务请求校验方法,包括:接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器;利用所述过滤器中的校验规则对所述服务访问请求进行数据校验;在所述服务访问请求数据校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。本发明还提出一种服务请求校验装置、电子设备以及存储介质。此外,本发明还涉及区块链技术,所述校验规则可存储于区块链中。本发明可以提高服务请求校验的时效。

Figure 202011502233

The invention relates to the field of testing, and discloses a service request verification method, comprising: receiving a service access request from a client, inserting a pre-created filter into a software development kit corresponding to the service access request; using the filter The verification rules in the server perform data verification on the service access request; when the service access request data verification is successful, call the server interface corresponding to the client to perform interface verification on the service access request, Get the verification result. The present invention also provides a service request verification device, an electronic device and a storage medium. In addition, the present invention also relates to blockchain technology, and the verification rules can be stored in the blockchain. The present invention can improve the time limit of service request verification.

Figure 202011502233

Description

服务请求校验方法、装置、电子设备及存储介质Service request verification method, device, electronic device and storage medium

技术领域technical field

本发明涉及测试领域,尤其涉及一种服务请求校验方法、装置、电子设备及计算机可读存储介质。The present invention relates to the field of testing, and in particular, to a service request verification method, device, electronic device and computer-readable storage medium.

背景技术Background technique

在向服务端发送服务请求时,通常会对所述服务请求进行拦截校验,以保障所述服务请求的安全可靠性,目前通常采用过滤器配置的检验规则实现服务请求的拦截校验,但是由于过滤器通常是封装在一个框架中,只限于本框架使用对应的过滤器,而其它框架无法调用已经封装的过滤器,这样容易导致通过不同框架进行服务请求时,需要配置多个过滤器,给开发人员带来了较大的时间成本,也影响了服务请求校验的时效性。When sending a service request to the server, the service request is usually intercepted and verified to ensure the security and reliability of the service request. Currently, the inspection rules configured by the filter are usually used to implement the interception and verification of the service request, but Since the filter is usually encapsulated in a framework, only the corresponding filter can be used in this framework, and other frameworks cannot call the encapsulated filter, which easily leads to the need to configure multiple filters when making service requests through different frameworks. It brings a large time cost to developers, and also affects the timeliness of service request verification.

发明内容SUMMARY OF THE INVENTION

本发明提供一种服务请求校验方法、装置、电子设备及计算机可读存储介质,其主要目的在于提高服务请求校验的时效。The present invention provides a service request verification method, device, electronic device and computer-readable storage medium, the main purpose of which is to improve the timeliness of service request verification.

为实现上述目的,本发明提供的一种服务请求校验方法,包括:To achieve the above purpose, a service request verification method provided by the present invention includes:

接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器;Receive a service access request from a client, and access a pre-created filter in a software development kit corresponding to the service access request;

利用所述过滤器中的校验规则对所述服务访问请求进行数据校验;Use the verification rules in the filter to perform data verification on the service access request;

在所述服务访问请求数据校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。When the data verification of the service access request is successful, the server interface corresponding to the client is invoked to perform interface verification on the service access request, and a verification result is obtained.

可选地,所述在服务访问请求对应的软件开发工具包中接入预先创建的过滤器,包括:Optionally, the access to the pre-created filter in the software development kit corresponding to the service access request includes:

获取所述过滤器的接口地址,及所述软件开发工具包的编译环境;Obtain the interface address of the filter, and the compilation environment of the software development kit;

利用预设的链接指令将所述接口地址加载至所述编译环境中。The interface address is loaded into the compilation environment by using a preset link instruction.

可选地,所述利用过滤器中的校验规则对所述服务访问请求进行数据校验,包括:Optionally, performing data verification on the service access request by using the verification rules in the filter includes:

计算所述服务访问请求与所述校验规则中校验逻辑的编辑距离,并选取所述编辑距离小于预设阈值的校验逻辑,得到服务校验逻辑;Calculate the edit distance between the service access request and the verification logic in the verification rule, and select the verification logic whose edit distance is less than a preset threshold to obtain the service verification logic;

根据所述校验规则的校验方式及所述服务校验逻辑,执行所述服务访问请求的校验。The verification of the service access request is performed according to the verification method of the verification rule and the service verification logic.

可选地,所述调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验之前,还包括:Optionally, before calling the server interface corresponding to the client to perform interface verification on the service access request, the method further includes:

获取所述服务端接口的接口参数对象,将所述接口参数对象转换成对应的接口响应报文,对所述接口响应报文进行解析后生成对应的接口校验脚本。Obtain the interface parameter object of the server interface, convert the interface parameter object into a corresponding interface response message, and generate a corresponding interface verification script after parsing the interface response message.

可选地,所述利用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果,包括:Optionally, performing interface verification on the service access request by using the server interface corresponding to the client to obtain a verification result, including:

将所述服务访问请求传输至所述客户端对应的服务端接口中;transmitting the service access request to the server interface corresponding to the client;

利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,得到校验结果。The interface verification script in the server interface is used to perform interface verification on the transmitted service access request, and a verification result is obtained.

可选地,所述利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,包括:Optionally, performing interface verification on the transmitted service access request by using an interface verification script in the server interface, including:

计算所述服务访问请求与所述接口校验脚本中接口响应报文的匹配度;Calculate the degree of matching between the service access request and the interface response message in the interface verification script;

若所述匹配度不大于预设匹配度,则所述服务访问请求校验失败;If the matching degree is not greater than the preset matching degree, the verification of the service access request fails;

若所述匹配度大于预设匹配度,则所述服务访问请求校验成功。If the matching degree is greater than the preset matching degree, the verification of the service access request is successful.

可选地,所述计算述服务访问请求与所述接口校验脚本的匹配度,包括:Optionally, the calculating the degree of matching between the service access request and the interface verification script includes:

利用下述方法计算述服务访问请求与所述接口校验脚本的匹配度:Use the following method to calculate the matching degree between the service access request and the interface verification script:

Figure BDA0002843789980000021
Figure BDA0002843789980000021

其中,T(x,y)表示匹配度,xi表示服务访问请求中的第i个服务访问请求,yi接口校验脚本中第i个接口响应报文。Among them, T(x, y) represents the matching degree, xi represents the ith service access request in the service access request, and yi represents the ith interface response message in the interface verification script.

为了解决上述问题,本发明还提供一种服务请求校验装置,所述装置包括:In order to solve the above problems, the present invention also provides a service request verification device, the device includes:

接入模块,用于接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器;an access module, configured to receive a service access request from a client, and access a pre-created filter in a software development kit corresponding to the service access request;

过滤器校验模块,用于利用所述过滤器中的校验规则对所述服务访问请求进行数据校验;a filter verification module, configured to perform data verification on the service access request by using the verification rules in the filter;

接口校验模块,用于在所述服务访问请求校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。The interface verification module is configured to call the server interface corresponding to the client to perform interface verification on the service access request when the verification of the service access request is successful, and obtain a verification result.

为了解决上述问题,本发明还提供一种电子设备,所述电子设备包括:In order to solve the above problems, the present invention also provides an electronic device, the electronic device includes:

至少一个处理器;以及,at least one processor; and,

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以实现上述所述的服务请求校验方法。The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to implement the service request verification method described above.

为了解决上述问题,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一个计算机程序,所述至少一个计算机程序被电子设备中的处理器执行以实现上述所述的服务请求校验方法。In order to solve the above problems, the present invention also provides a computer-readable storage medium, where at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is executed by a processor in an electronic device to realize the above-mentioned The service request verification method described above.

本发明实施例首先接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器,避免了需要配置不同的过滤器执行对应服务访问请求的拦截校验,实现了过滤器的通用化,提高了服务请求校验的时效性;其次,本发明实施例利用所述过滤器中的校验规则对所述服务访问请求进行数据校验,在所述服务访问请求校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果,采用过滤器+服务端接口的校验模式,保证了服务请求校验的准确可靠性。因此,本发明提出的一种服务请求校验方法、装置、电子设备以及存储介质可可以提高服务请求校验的时效。In this embodiment of the present invention, a service access request from a client is first received, and a pre-created filter is inserted into a software development kit corresponding to the service access request, thereby avoiding the need to configure different filters to perform interception and verification corresponding to the service access request. , realizes the generalization of the filter, and improves the timeliness of service request verification; secondly, the embodiment of the present invention uses the verification rules in the filter to perform data verification on the service access request. When the access request verification is successful, the server interface corresponding to the client is called to perform interface verification on the service access request, and the verification result is obtained, and the verification mode of filter + server interface is adopted to ensure the verification of the service request. accuracy and reliability of the test. Therefore, the service request verification method, device, electronic device and storage medium proposed by the present invention can improve the time limit of service request verification.

附图说明Description of drawings

图1为本发明一实施例提供的服务请求校验方法的流程示意图;1 is a schematic flowchart of a service request verification method provided by an embodiment of the present invention;

图2为本发明第一实施例中图1提供的服务请求校验方法其中一个步骤的详细流程示意图;FIG. 2 is a detailed flowchart of one step of the service request verification method provided in FIG. 1 in the first embodiment of the present invention;

图3为本发明一实施例提供的服务请求校验装置的模块示意图;3 is a schematic block diagram of a service request verification apparatus provided by an embodiment of the present invention;

图4为本发明一实施例提供的实现服务请求校验方法的电子设备的内部结构示意图;4 is a schematic diagram of an internal structure of an electronic device for implementing a service request verification method provided by an embodiment of the present invention;

本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments.

具体实施方式Detailed ways

应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

本申请实施例提供一种服务请求校验方法。所述服务请求校验方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述服务请求校验方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务器或云端服务器集群等。The embodiment of the present application provides a service request verification method. The execution body of the service request verification method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal. In other words, the service request verification method may be executed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.

参照图1所示,为本发明一实施例提供的服务请求校验方法的流程示意图。在本发明实施例中,所述服务请求校验方法包括:Referring to FIG. 1 , it is a schematic flowchart of a service request verification method provided by an embodiment of the present invention. In the embodiment of the present invention, the service request verification method includes:

S1、接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器。S1. Receive a service access request from a client, and insert a pre-created filter into a software development kit corresponding to the service access request.

本发明实施例中,所述客户端也可以称为移动端,用于进行网页访问,包括PC机。所述服务端访问请求指的是需要进行访问服务端业务的需求,比如,用户登录需求、查找某台服务器的IP地址以及查询商城订单等等。所述软件开发工具包(SoftwareDevelopmentKit,SDK)指的是由软件工程师为特定的软件包、软件框架、硬件平台、操作系统等建立应用软件时的开发工具集合。In this embodiment of the present invention, the client terminal may also be referred to as a mobile terminal, which is used to access web pages, including a PC. The server-side access request refers to a requirement for accessing a server-side business, such as a user login requirement, searching for the IP address of a server, querying a mall order, and so on. The software development kit (Software Development Kit, SDK) refers to a collection of development tools when a software engineer creates application software for a specific software package, software framework, hardware platform, operating system, and the like.

进一步地,应该了解,在访问服务端的web资源时,对应的服务访问请求中会存在许多不合法的数据,比如,字符编码格式有误、访问权限受阻以及用户信息错误等等,因此,本发明通过在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器,以拦截所述服务访问请求中的非法数据,保障所诉服务访问请求的正常访问。Further, it should be understood that when accessing the web resources of the server, there will be a lot of illegal data in the corresponding service access request, for example, the character encoding format is wrong, the access authority is blocked, and the user information is wrong, etc. Therefore, the present invention By inserting a pre-created filter into the software development kit corresponding to the service access request, illegal data in the service access request is intercepted, and normal access of the service access request is guaranteed.

详细地,所述在服务访问请求对应的软件开发工具包中接入预先创建的过滤器,包括:获取所述过滤器的接口地址,及所述软件开发工具包的编译环境;利用预设的链接指令将所述接口地址加载至所述编译环境中。In detail, the accessing a pre-created filter in the software development kit corresponding to the service access request includes: obtaining the interface address of the filter and the compilation environment of the software development kit; using a preset A link instruction loads the interface address into the compilation environment.

其中,所述接口地址指的是在创建所述过滤器时配置的链接地址,所述编译环境指的是所述软件工具开发包的代码编译环境,如Myeclipse,所述预设的链接指令为herf指令,用于实现所述过滤器的接入。The interface address refers to the link address configured when the filter is created, the compilation environment refers to the code compilation environment of the software tool development kit, such as Myeclipse, and the preset link instruction is The herf instruction is used to implement the access of the filter.

进一步地,本发明其中一个实施例中,所述过滤器利用Java框架开发得到,所述Java框架包括:Spring框架、Mybatis框架以及SpringMVC框架,所述过滤器包括filter过滤器和Servlet过滤器。其中,所述过滤器的创建技术属于当前较为成熟的技术,在此不做进一步地赘述。Further, in one embodiment of the present invention, the filter is developed using a Java framework, the Java framework includes: Spring framework, Mybatis framework and SpringMVC framework, and the filter includes filter filter and Servlet filter. Among them, the creation technology of the filter is a relatively mature technology at present, and will not be described further here.

S2、利用所述过滤器中的校验规则对所述服务访问请求进行数据校验。S2. Use the verification rule in the filter to perform data verification on the service access request.

本发明实施例中,所述利用所述过滤器中的校验规则对所述服务访问请求进行校验之前,还包括:利用预设的数据校验工具在所述过滤器中配置校验规则。其中,所述数据校验工具实质为一个独立项目软件,采用java语言进行编译,本发明实施例通过jar包形式将所述数据校验工具引入到所述过滤器中实现校验规则的配置。所述预设的数据校验工具包括:md5数据校验工具,如sendto md5。In this embodiment of the present invention, before using the verification rules in the filter to verify the service access request, the method further includes: using a preset data verification tool to configure verification rules in the filter . Wherein, the data verification tool is essentially an independent project software, which is compiled by using the java language. In the embodiment of the present invention, the data verification tool is introduced into the filter in the form of a jar package to realize the configuration of the verification rules. The preset data verification tools include: md5 data verification tools, such as sendto md5.

进一步地,所述校验规则包括:校验逻辑和校验方式,所述校验逻辑包括:数据的值是否为必填,数据填写的字母是否必须为大小写以及数据填写的字符长度不能超过预设阈值等。所述校验方式包括:方式一、遇见错误立即停止后续数据剩余配置项的校验并返回错误数据;方式二、遇见错误不停止,直至校验完数据的所有配置项,汇总出现错误的所有数据配置项并返回。Further, the verification rules include: verification logic and verification methods, the verification logic includes: whether the value of the data is required, whether the letters filled in the data must be uppercase and lowercase, and the length of the characters filled in the data cannot exceed Preset thresholds, etc. The verification methods include: method 1, immediately stop the verification of the remaining configuration items of the subsequent data and return the error data when encountering errors; method 2, do not stop when encountering errors, until all configuration items of the data are verified, and summarize all the configuration items with errors. Data configuration items and return.

进一步地,所述利用过滤器中的校验规则对所述服务访问请求进行数据校验,包括:计算所述服务访问请求与所述校验规则中校验逻辑的编辑距离,并选取所述编辑距离小于预设阈值的校验逻辑,得到服务校验逻辑;根据所述校验规则的校验方式及所述服务校验逻辑,执行所述服务访问请求的校验,得到校验结果。可选的,所述预设阈值为8。Further, performing data verification on the service access request using the verification rules in the filter includes: calculating an edit distance between the service access request and verification logic in the verification rule, and selecting the Edit the verification logic whose distance is less than the preset threshold to obtain the service verification logic; according to the verification method of the verification rule and the service verification logic, perform the verification of the service access request to obtain the verification result. Optionally, the preset threshold is 8.

进一步地,所述计算所述服务访问请求与所述校验规则中校验逻辑的编辑距离,包括:利用编辑函数计算所述服务访问请求的字符长度与所述校验规则中校验逻辑之间相互转换的次数,得到所述编辑距离。Further, the calculating the edit distance between the service access request and the verification logic in the verification rule includes: using an editing function to calculate the difference between the character length of the service access request and the verification logic in the verification rule. The number of mutual conversions between them is obtained to obtain the edit distance.

本发明其中一个可选实施例中,所述编辑函数可以为edit[][]函数。In an optional embodiment of the present invention, the editing function may be an edit[][] function.

进一步地,本发明另一实施例中还包括:在所述服务访问请求校验失败时,重新接收所述客户端的服务访问请求。Further, another embodiment of the present invention further includes: when the verification of the service access request fails, re-receive the service access request of the client.

进一步地,为保证所述校验规则的可用性和隐私性,所述校验规则还可存储于一区块链节点中。Further, in order to ensure the availability and privacy of the verification rules, the verification rules can also be stored in a blockchain node.

S3、在所述服务访问请求数据校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。S3. When the data verification of the service access request is successful, call the server interface corresponding to the client to perform interface verification on the service access request, and obtain a verification result.

本发明实施例中,在所述服务访问请求数据校验成功时,则表示所述服务访问请求时可以正常访问对应的服务端业务,因此,本发明实施例通过调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,以将对应的服务访问请求传输至对应的服务端业务模块中。In the embodiment of the present invention, when the data verification of the service access request is successful, it means that the service access request can normally access the corresponding server service. Therefore, the embodiment of the present invention calls the service corresponding to the client by calling the service. The terminal interface performs interface verification on the service access request, so as to transmit the corresponding service access request to the corresponding server service module.

进一步地,本发明实施例中,所述调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验之前,还包括:在所述服务端接口中配置接口校验脚本,以实现与所述服务访问请求的匹配。具体的,所述在所述服务端接口中配置接口校验脚本,包括:获取所述服务端接口的接口参数对象,利用session方法将所述接口参数对象转换成对应的接口响应报文,通过JavaScript脚本语言对所述接口响应报文进行解析后生成对应的接口校验脚本。Further, in this embodiment of the present invention, before calling the server interface corresponding to the client to perform interface verification on the service access request, the method further includes: configuring an interface verification script in the server interface, to A match is made with the service access request. Specifically, configuring the interface verification script in the server interface includes: acquiring an interface parameter object of the server interface, converting the interface parameter object into a corresponding interface response message by using the session method, The JavaScript script language parses the interface response message to generate a corresponding interface verification script.

详细地,参阅图2所示,所述利用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果,包括:In detail, referring to FIG. 2 , the interface verification is performed on the service access request by using the server interface corresponding to the client, and the verification result is obtained, including:

S20、将所述服务访问请求传输至所述客户端对应的服务端接口中;S20, transmitting the service access request to the server interface corresponding to the client;

S21、利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,得到校验结果。S21. Use the interface verification script in the server interface to perform interface verification on the transmitted service access request to obtain a verification result.

一个可选实施例中,所述服务访问请求的传输通过客户端调用http请求实现。In an optional embodiment, the transmission of the service access request is implemented by invoking an http request by the client.

一个可选实施例中,所述利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,包括:计算所述服务访问请求与所述接口校验脚本中接口响应报文的匹配度,若所述匹配度不大于预设匹配度,则所述服务访问请求校验失败,若所述匹配度大于预设匹配度,则所述服务访问请求校验成功。可选的,所述预设匹配度为0.89。In an optional embodiment, the performing interface verification on the transmitted service access request by using the interface verification script in the server interface includes: calculating the difference between the service access request and the interface verification script. The matching degree of the interface response message, if the matching degree is not greater than the preset matching degree, the service access request verification fails; if the matching degree is greater than the preset matching degree, the service access request verification succeeds . Optionally, the preset matching degree is 0.89.

进一步地,利用下述方法计算述服务访问请求与所述接口校验脚本的匹配度:Further, use the following method to calculate the degree of matching between the service access request and the interface verification script:

Figure BDA0002843789980000061
Figure BDA0002843789980000061

其中,T(x,y)表示匹配度,xi表示服务访问请求中的第i个服务访问请求,yi接口校验脚本中第i个接口响应报文。Among them, T(x, y) represents the matching degree, xi represents the ith service access request in the service access request, and yi represents the ith interface response message in the interface verification script.

本发明实施例首先接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器,避免了需要配置不同的过滤器执行对应服务访问请求的拦截校验,实现了过滤器的通用化,提高了服务请求校验的时效性;其次,本发明实施例利用所述过滤器中的校验规则对所述服务访问请求进行数据校验,在所述服务访问请求校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果,采用过滤器+服务端的校验模式,保证了服务请求校验的准确可靠性。因此,本发明可以提高服务请求校验的时效。In this embodiment of the present invention, a service access request from a client is first received, and a pre-created filter is inserted into a software development kit corresponding to the service access request, thereby avoiding the need to configure different filters to perform interception and verification corresponding to the service access request. , realizes the generalization of the filter, and improves the timeliness of service request verification; secondly, the embodiment of the present invention uses the verification rules in the filter to perform data verification on the service access request. When the access request verification is successful, the server interface corresponding to the client is called to perform interface verification on the service access request, and the verification result is obtained, and the verification mode of filter + server is adopted to ensure the verification of service request. Accurate and reliable. Therefore, the present invention can improve the timeliness of service request verification.

如图3所示,是本发明服务请求校验装置的功能模块图。As shown in FIG. 3 , it is a functional block diagram of the service request verification device of the present invention.

本发明所述服务请求校验装置100可以安装于电子设备中。根据实现的功能,所述服务请求校验装置可以包括接入模块101、过滤器校验模块102以及接口校验模块103。本发所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。The service request verification apparatus 100 of the present invention may be installed in an electronic device. According to the implemented functions, the service request verification apparatus may include an access module 101 , a filter verification module 102 and an interface verification module 103 . The modules described in the present invention can also be called units, which refer to a series of computer program segments that can be executed by the electronic device processor and can perform fixed functions, and are stored in the memory of the electronic device.

在本实施例中,关于各模块/单元的功能如下:In this embodiment, the functions of each module/unit are as follows:

所述接入模块101,用于接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器。The access module 101 is configured to receive a service access request from a client, and access a pre-created filter in a software development kit corresponding to the service access request.

本发明实施例中,所述客户端也可以称为移动端,用于进行网页访问,包括PC机。所述服务端访问请求指的是需要进行访问服务端业务的需求,比如,用户登录需求、查找某台服务器的IP地址以及查询商城订单等等。所述软件开发工具包(Software DevelopmentKit,SDK)指的是由软件工程师为特定的软件包、软件框架、硬件平台、操作系统等建立应用软件时的开发工具集合。In this embodiment of the present invention, the client terminal may also be referred to as a mobile terminal, which is used to access web pages, including a PC. The server-side access request refers to a requirement for accessing a server-side business, such as a user login requirement, searching for the IP address of a server, querying a mall order, and so on. The software development kit (Software Development Kit, SDK) refers to a collection of development tools when a software engineer creates application software for a specific software package, software framework, hardware platform, operating system, and the like.

进一步地,应该了解,在访问服务端的web资源时,对应的服务访问请求中会存在许多不合法的数据,比如,字符编码格式有误、访问权限受阻以及用户信息错误等等,因此,本发明通过在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器,以拦截所述服务访问请求中的非法数据,保障所诉服务访问请求的正常访问。Further, it should be understood that when accessing the web resources of the server, there will be a lot of illegal data in the corresponding service access request, for example, the character encoding format is wrong, the access authority is blocked, and the user information is wrong, etc. Therefore, the present invention By inserting a pre-created filter into the software development kit corresponding to the service access request, illegal data in the service access request is intercepted, and normal access of the service access request is guaranteed.

详细地,所述在服务访问请求对应的软件开发工具包中接入预先创建的过滤器,所述接入模块101采用下述方式执行:获取所述过滤器的接口地址,及所述软件开发工具包的编译环境;利用预设的链接指令将所述接口地址加载至所述编译环境中。Specifically, to access the pre-created filter in the software development kit corresponding to the service access request, the access module 101 executes in the following manner: acquiring the interface address of the filter, and developing the software The compilation environment of the toolkit; the interface address is loaded into the compilation environment by using a preset link instruction.

其中,所述接口地址指的是在创建所述过滤器时配置的链接地址,所述编译环境指的是所述软件工具开发包的代码编译环境,如Myeclipse,所述预设的链接指令为herf指令,用于实现所述过滤器的接入。The interface address refers to the link address configured when the filter is created, the compilation environment refers to the code compilation environment of the software tool development kit, such as Myeclipse, and the preset link instruction is The herf instruction is used to implement the access of the filter.

进一步地,本发明其中一个实施例中,所述过滤器利用Java框架开发得到,所述Java框架包括:Spring框架、Mybatis框架以及SpringMVC框架,所述过滤器包括filter过滤器和Servlet过滤器。其中,所述过滤器的创建技术属于当前较为成熟的技术,在此不做进一步地赘述。Further, in one embodiment of the present invention, the filter is developed using a Java framework, the Java framework includes: Spring framework, Mybatis framework and SpringMVC framework, and the filter includes filter filter and Servlet filter. Among them, the creation technology of the filter is a relatively mature technology at present, and will not be described further here.

所述过滤器校验模块102,用于利用所述过滤器中的校验规则对所述服务访问请求进行数据校验。The filter verification module 102 is configured to perform data verification on the service access request by using the verification rules in the filter.

本发明实施例中,所述利用所述过滤器中的校验规则对所述服务访问请求进行校验之前,所述过滤器校验模块102还包括:利用预设的数据校验工具在所述过滤器中配置校验规则。其中,所述数据校验工具实质为一个独立项目软件,采用java语言进行编译,本发明实施例通过jar包形式将所述数据校验工具引入到所述过滤器中实现校验规则的配置。所述预设的数据校验工具包括:md5数据校验工具,如sendto md5。In this embodiment of the present invention, before the service access request is verified by using the verification rules in the filter, the filter verification module 102 further includes: using a preset data verification tool in the Configure the validation rules in the filter described above. Wherein, the data verification tool is essentially an independent project software, which is compiled by using the java language. In the embodiment of the present invention, the data verification tool is introduced into the filter in the form of a jar package to realize the configuration of the verification rules. The preset data verification tools include: md5 data verification tools, such as sendto md5.

进一步地,所述校验规则包括:校验逻辑和校验方式,所述校验逻辑包括:数据的值是否为必填,数据填写的字母是否必须为大小写以及数据填写的字符长度不能超过预设阈值等。所述校验方式包括:方式一、遇见错误立即停止后续数据剩余配置项的校验并返回错误数据;方式二、遇见错误不停止,直至校验完数据的所有配置项,汇总出现错误的所有数据配置项并返回。Further, the verification rules include: verification logic and verification methods, the verification logic includes: whether the value of the data is required, whether the letters filled in the data must be uppercase and lowercase, and the length of the characters filled in the data cannot exceed Preset thresholds, etc. The verification methods include: method 1, immediately stop the verification of the remaining configuration items of the subsequent data and return the error data when encountering errors; method 2, do not stop when encountering errors, until all configuration items of the data are verified, and summarize all the configuration items with errors. Data configuration items and return.

进一步地,所述利用过滤器中的校验规则对所述服务访问请求进行数据校验,所述过滤器校验模块102采用下述方式执行:计算所述服务访问请求与所述校验规则中校验逻辑的编辑距离,并选取所述编辑距离小于预设阈值的校验逻辑,得到服务校验逻辑;根据所述校验规则的校验方式及所述服务校验逻辑,执行所述服务访问请求的校验,得到校验结果。可选的,所述预设阈值为8。Further, to perform data verification on the service access request using the verification rules in the filter, the filter verification module 102 executes in the following manner: calculating the service access request and the verification rule and select the verification logic whose edit distance is less than the preset threshold to obtain the service verification logic; according to the verification method of the verification rule and the service verification logic, execute the Verify the service access request and get the verification result. Optionally, the preset threshold is 8.

进一步地,所述计算所述服务访问请求与所述校验规则中校验逻辑的编辑距离,所述过滤器校验模块102采用下述方式执行:利用编辑函数计算所述服务访问请求的字符长度与所述校验规则中校验逻辑之间相互转换的次数,得到所述编辑距离。Further, to calculate the edit distance between the service access request and the verification logic in the verification rule, the filter verification module 102 executes in the following manner: using an editing function to calculate the character of the service access request The edit distance is obtained from the number of times of mutual conversion between the length and the verification logic in the verification rule.

本发明其中一个可选实施例中,所述编辑函数可以为edit[][]函数。In an optional embodiment of the present invention, the editing function may be an edit[][] function.

进一步地,本发明另一实施例中还包括:在所述服务访问请求校验失败时,重新接收所述客户端的服务访问请求。Further, another embodiment of the present invention further includes: when the verification of the service access request fails, re-receive the service access request of the client.

进一步地,为保证所述校验规则的可用性和隐私性,所述校验规则还可存储于一区块链节点中。Further, in order to ensure the availability and privacy of the verification rules, the verification rules can also be stored in a blockchain node.

所述接口校验模块103,用于在所述服务访问请求数据校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。The interface verification module 103 is configured to call the server interface corresponding to the client to perform interface verification on the service access request when the data verification of the service access request is successful, and obtain a verification result.

本发明实施例中,在所述服务访问请求数据校验成功时,则表示所述服务访问请求时可以正常访问对应的服务端业务,因此,本发明实施例通过调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,以将对应的服务访问请求传输至对应的服务端业务模块中。In the embodiment of the present invention, when the data verification of the service access request is successful, it means that the service access request can normally access the corresponding server service. Therefore, the embodiment of the present invention calls the service corresponding to the client by calling the service. The terminal interface performs interface verification on the service access request, so as to transmit the corresponding service access request to the corresponding server service module.

进一步地,本发明实施例中,所述调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验之前,所述接口校验模块103还包括:在所述服务端接口中配置接口校验脚本,以实现与所述服务访问请求的匹配。具体的,所述在所述服务端接口中配置接口校验脚本,所述接口校验模块103采用下述方式执行:获取所述服务端接口的接口参数对象,利用session方法将所述接口参数对象转换成对应的接口响应报文,通过JavaScript脚本语言对所述接口响应报文进行解析后生成对应的接口校验脚本。Further, in the embodiment of the present invention, before calling the server interface corresponding to the client to perform interface verification on the service access request, the interface verification module 103 further includes: in the server interface Configure the interface verification script to match the service access request. Specifically, in the configuration of the interface verification script in the server interface, the interface verification module 103 executes in the following manner: acquiring the interface parameter object of the server interface, and using the session method to convert the interface parameter The object is converted into a corresponding interface response message, and a corresponding interface verification script is generated after parsing the interface response message through the JavaScript script language.

详细地,所述利用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果,所述接口校验模块103采用下述方式执行:将所述服务访问请求传输至所述客户端对应的服务端接口中;利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,得到校验结果。In detail, the interface verification is performed on the service access request by using the server interface corresponding to the client to obtain a verification result, and the interface verification module 103 executes in the following manner: The interface is transmitted to the server interface corresponding to the client; the interface verification is performed on the transmitted service access request by using the interface verification script in the server interface, and a verification result is obtained.

一个可选实施例中,所述服务访问请求的传输通过客户端调用http请求实现。In an optional embodiment, the transmission of the service access request is implemented by invoking an http request by the client.

一个可选实施例中,所述利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,所述接口校验模块103采用下述方式执行:计算所述服务访问请求与所述接口校验脚本中接口响应报文的匹配度,若所述匹配度不大于预设匹配度,则所述服务访问请求校验失败,若所述匹配度大于预设匹配度,则所述服务访问请求校验成功。可选的,所述预设匹配度为0.89。In an optional embodiment, the interface verification is performed on the transmitted service access request by using the interface verification script in the server interface, and the interface verification module 103 executes in the following manner: calculating the The matching degree between the service access request and the interface response message in the interface verification script, if the matching degree is not greater than the preset matching degree, the service access request verification fails, if the matching degree is greater than the preset matching degree degree, the verification of the service access request is successful. Optionally, the preset matching degree is 0.89.

进一步地,所述接口校验模块103利用下述方法计算述服务访问请求与所述接口校验脚本的匹配度:Further, the interface verification module 103 uses the following method to calculate the degree of matching between the service access request and the interface verification script:

Figure BDA0002843789980000091
Figure BDA0002843789980000091

其中,T(x,y)表示匹配度,xi表示服务访问请求中的第i个服务访问请求,yi接口校验脚本中第i个接口响应报文。Among them, T(x, y) represents the matching degree, xi represents the ith service access request in the service access request, and yi represents the ith interface response message in the interface verification script.

本发明实施例首先接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器,避免了需要配置不同的过滤器执行对应服务访问请求的拦截校验,实现了过滤器的通用化,提高了服务请求校验的时效性;其次,本发明实施例利用所述过滤器中的校验规则对所述服务访问请求进行数据校验,在所述服务访问请求校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果,采用过滤器+服务端的校验模式,保证了服务请求校验的准确可靠性。因此,本发明可以提高服务请求校验的时效。In this embodiment of the present invention, a service access request from a client is first received, and a pre-created filter is inserted into a software development kit corresponding to the service access request, thereby avoiding the need to configure different filters to perform interception and verification corresponding to the service access request. , realizes the generalization of the filter, and improves the timeliness of service request verification; secondly, the embodiment of the present invention uses the verification rules in the filter to perform data verification on the service access request. When the access request verification is successful, the server interface corresponding to the client is called to perform interface verification on the service access request, and the verification result is obtained, and the verification mode of filter + server is adopted to ensure the verification of service request. Accurate and reliable. Therefore, the present invention can improve the timeliness of service request verification.

如图4所示,是本发明实现服务请求校验方法的电子设备的结构示意图。As shown in FIG. 4 , it is a schematic structural diagram of an electronic device implementing the service request verification method according to the present invention.

所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如服务请求校验程序12。The electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a service request verification program 12.

其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(SecureDigital,SD)卡、闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如服务请求校验的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。Wherein, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1 , such as a mobile hard disk of the electronic device 1 . In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as a service request verification code, etc., but also can be used to temporarily store data that has been output or will be output.

所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(Control Unit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如执行服务请求校验等),以及调用存储在所述存储器11内的数据,以执行电子设备1的各种功能和处理数据。In some embodiments, the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits. Central processing unit (Central Processing Unit, CPU), microprocessor, digital processing chip, graphics processor and combination of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and by running or executing the program or module (for example, executing the program) stored in the memory 11. service request verification, etc.), and call data stored in the memory 11 to perform various functions of the electronic device 1 and process data.

所述总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。The bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (extended industry standard architecture, EISA for short) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. The bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.

图4仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图4示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。FIG. 4 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.

例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management The device implements functions such as charge management, discharge management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components. The electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。Further, the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.

可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。Optionally, the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like. The display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.

应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。It should be understood that the embodiments are only used for illustration, and are not limited by this structure in the scope of the patent application.

所述电子设备1中的所述存储器11存储的服务请求校验12是多个计算机程序的组合,在所述处理器10中运行时,可以实现:The service request verification 12 stored in the memory 11 in the electronic device 1 is a combination of multiple computer programs, and when running in the processor 10, can realize:

接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器;Receive a service access request from a client, and access a pre-created filter in a software development kit corresponding to the service access request;

利用所述过滤器中的校验规则对所述服务访问请求进行数据校验;Use the verification rules in the filter to perform data verification on the service access request;

在所述服务访问请求数据校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。When the data verification of the service access request is successful, the server interface corresponding to the client is invoked to perform interface verification on the service access request, and a verification result is obtained.

具体地,所述处理器10对上述计算机程序的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。Specifically, for the specific implementation method of the above-mentioned computer program by the processor 10, reference may be made to the description of the relevant steps in the corresponding embodiment of FIG. 1, and details are not described herein.

进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个非易失性计算机可读取存储介质中。所述计算机可读存储介质可以是易失性的,也可以是非易失性的。例如,所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。Further, if the modules/units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they may be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disc, a computer memory, a read-only memory (ROM, Read-Only). Memory).

本发明还提供一种计算机可读存储介质,所述可读存储介质存储有计算机程序,所述计算机程序在被电子设备的处理器所执行时,可以实现:The present invention also provides a computer-readable storage medium, where the readable storage medium stores a computer program, and when executed by a processor of an electronic device, the computer program can realize:

接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器;Receive a service access request from a client, and access a pre-created filter in a software development kit corresponding to the service access request;

利用所述过滤器中的校验规则对所述服务访问请求进行数据校验;Use the verification rules in the filter to perform data verification on the service access request;

在所述服务访问请求数据校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。When the data verification of the service access request is successful, the server interface corresponding to the client is invoked to perform interface verification on the service access request, and a verification result is obtained.

在本发明所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division manners in actual implementation.

所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.

对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。It will be apparent to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, but that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics of the invention.

因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。Therefore, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the invention is to be defined by the appended claims rather than the foregoing description, which are therefore intended to fall within the scope of the claims. All changes within the meaning and range of the equivalents of , are included in the present invention. Any reference signs in the claims shall not be construed as limiting the involved claim.

本发明所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in the present invention is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。Furthermore, it is clear that the word "comprising" does not exclude other units or steps and the singular does not exclude the plural. Several units or means recited in the system claims can also be realized by one unit or means by means of software or hardware. Second-class terms are used to denote names and do not denote any particular order.

最后应说明的是,以上实施例仅用以说明本发明的技术方案而非限制,尽管参照较佳实施例对本发明进行了详细说明,本领域的普通技术人员应当理解,可以对本发明的技术方案进行修改或等同替换,而不脱离本发明技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be Modifications or equivalent substitutions can be made without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1.一种服务请求校验方法,其特征在于,所述方法包括:1. a service request verification method, is characterized in that, described method comprises: 接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器;Receive a service access request from a client, and access a pre-created filter in a software development kit corresponding to the service access request; 利用所述过滤器中的校验规则对所述服务访问请求进行数据校验;Use the verification rules in the filter to perform data verification on the service access request; 在所述服务访问请求数据校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。When the data verification of the service access request is successful, a server interface corresponding to the client is invoked to perform interface verification on the service access request, and a verification result is obtained. 2.如权利要求1所述的服务请求校验方法,其特征在于,所述在服务访问请求对应的软件开发工具包中接入预先创建的过滤器,包括:2. The service request verification method as claimed in claim 1, wherein the access to a pre-created filter in a software development kit corresponding to the service access request comprises: 获取所述过滤器的接口地址,及所述软件开发工具包的编译环境;Obtain the interface address of the filter, and the compilation environment of the software development kit; 利用预设的链接指令将所述接口地址加载至所述编译环境中。The interface address is loaded into the compilation environment by using a preset link instruction. 3.如权利要求1所述的服务请求校验方法,其特征在于,所述利用过滤器中的校验规则对所述服务访问请求进行数据校验,包括:3. The service request verification method according to claim 1, wherein the data verification is performed on the service access request using the verification rules in the filter, comprising: 计算所述服务访问请求与所述校验规则中校验逻辑的编辑距离,并选取所述编辑距离小于预设阈值的校验逻辑,得到服务校验逻辑;Calculate the edit distance between the service access request and the verification logic in the verification rule, and select the verification logic whose edit distance is less than a preset threshold to obtain the service verification logic; 根据所述校验规则的校验方式及所述服务校验逻辑,执行所述服务访问请求的校验。The verification of the service access request is performed according to the verification method of the verification rule and the service verification logic. 4.如权利要求1所述的服务请求校验方法,其特征在于,所述调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验之前,还包括:4. The service request verification method according to claim 1, wherein before the invoking the server interface corresponding to the client to perform interface verification on the service access request, the method further comprises: 获取所述服务端接口的接口参数对象,将所述接口参数对象转换成对应的接口响应报文,对所述接口响应报文进行解析后生成对应的接口校验脚本。The interface parameter object of the server interface is acquired, the interface parameter object is converted into a corresponding interface response message, and a corresponding interface verification script is generated after parsing the interface response message. 5.如权利要求1至4中任意一项所述的服务请求校验方法,其特征在于,所述利用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果,包括:5. The service request verification method according to any one of claims 1 to 4, wherein the interface verification is performed on the service access request by using the server interface corresponding to the client, and the verification method is obtained. test results, including: 将所述服务访问请求传输至所述客户端对应的服务端接口中;transmitting the service access request to the server interface corresponding to the client; 利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,得到校验结果。The interface verification script in the server interface is used to perform interface verification on the transmitted service access request, and a verification result is obtained. 6.如权利要求5中所述的服务请求校验方法,其特征在于,所述利用所述服务端接口中的接口校验脚本对传输的所述服务访问请求进行接口校验,包括:6. The service request verification method according to claim 5, wherein the interface verification is performed on the transmitted service access request using the interface verification script in the server interface, comprising: 计算所述服务访问请求与所述接口校验脚本中接口响应报文的匹配度;Calculate the degree of matching between the service access request and the interface response message in the interface verification script; 若所述匹配度不大于预设匹配度,则所述服务访问请求校验失败;If the matching degree is not greater than the preset matching degree, the verification of the service access request fails; 若所述匹配度大于预设匹配度,则所述服务访问请求校验成功。If the matching degree is greater than the preset matching degree, the verification of the service access request is successful. 7.如权利要求6所述的服务请求校验方法,其特征在于,所述计算述服务访问请求与所述接口校验脚本的匹配度,包括:7. The service request verification method according to claim 6, wherein the calculating the degree of matching between the service access request and the interface verification script comprises: 利用下述方法计算述服务访问请求与所述接口校验脚本的匹配度:Use the following method to calculate the matching degree between the service access request and the interface verification script:
Figure FDA0002843789970000021
Figure FDA0002843789970000021
其中,T(x,y)表示匹配度,xi表示服务访问请求中的第i个服务访问请求,yi接口校验脚本中第i个接口响应报文。Among them, T(x, y) represents the matching degree, xi represents the ith service access request in the service access request, and yi represents the ith interface response message in the interface verification script.
8.一种服务请求校验装置,其特征在于,所述装置包括:8. A service request verification device, wherein the device comprises: 接入模块,用于接收客户端的服务访问请求,在所述服务访问请求对应的软件开发工具包中接入预先创建的过滤器;an access module, configured to receive a service access request from a client, and access a pre-created filter in a software development kit corresponding to the service access request; 过滤器校验模块,用于利用所述过滤器中的校验规则对所述服务访问请求进行数据校验;a filter verification module, configured to perform data verification on the service access request by using the verification rules in the filter; 接口校验模块,用于在所述服务访问请求校验成功时,调用所述客户端对应的服务端接口对所述服务访问请求进行接口校验,得到校验结果。The interface verification module is used to call the server interface corresponding to the client to perform interface verification on the service access request when the verification of the service access request is successful, and obtain a verification result. 9.一种电子设备,其特征在于,所述电子设备包括:9. An electronic device, characterized in that the electronic device comprises: 至少一个处理器;以及,at least one processor; and, 与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein, 所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至7中任意一项所述的服务请求校验方法。The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform any one of claims 1 to 7 The service request verification method described in item. 10.一种计算机可读存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7中任意一项所述的服务请求校验方法。10 . A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the service request verification method according to any one of claims 1 to 7 is implemented. 11 .
CN202011502233.3A 2020-12-18 2020-12-18 Service request checking method and device, electronic equipment and storage medium Pending CN112528307A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011502233.3A CN112528307A (en) 2020-12-18 2020-12-18 Service request checking method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011502233.3A CN112528307A (en) 2020-12-18 2020-12-18 Service request checking method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112528307A true CN112528307A (en) 2021-03-19

Family

ID=75001345

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011502233.3A Pending CN112528307A (en) 2020-12-18 2020-12-18 Service request checking method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112528307A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127109A (en) * 2021-05-12 2021-07-16 平安信托有限责任公司 Interface calling method and device, electronic equipment and readable storage medium
CN113221154A (en) * 2021-06-01 2021-08-06 平安信托有限责任公司 Service password obtaining method and device, electronic equipment and storage medium
CN113259322A (en) * 2021-04-19 2021-08-13 山东英信计算机技术有限公司 Method, system and medium for preventing Web service abnormity
CN113364848A (en) * 2021-06-01 2021-09-07 平安银行股份有限公司 File caching method and device, electronic equipment and storage medium
CN113595978A (en) * 2021-06-23 2021-11-02 北京国电通网络技术有限公司 Data communication method based on micro-service architecture and related equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107451460A (en) * 2017-06-28 2017-12-08 努比亚技术有限公司 Interface processing method, equipment, server and computer-readable recording medium
CN110221925A (en) * 2019-05-13 2019-09-10 平安科技(深圳)有限公司 Processing method, device and the computer equipment of data submission request
CN110874244A (en) * 2019-10-16 2020-03-10 贝壳技术有限公司 Filtering method and device suitable for different service scenes and storage medium
CN111209325A (en) * 2019-12-31 2020-05-29 深信服科技股份有限公司 Service system interface identification method, device and storage medium
CN111259049A (en) * 2020-01-17 2020-06-09 中国平安人寿保险股份有限公司 Information query method, information query device and terminal equipment
WO2020155483A1 (en) * 2019-01-31 2020-08-06 平安科技(深圳)有限公司 Method and apparatus for adapting http request message header, and computer device
CN111651585A (en) * 2020-04-27 2020-09-11 平安普惠企业管理有限公司 Information verification method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107451460A (en) * 2017-06-28 2017-12-08 努比亚技术有限公司 Interface processing method, equipment, server and computer-readable recording medium
WO2020155483A1 (en) * 2019-01-31 2020-08-06 平安科技(深圳)有限公司 Method and apparatus for adapting http request message header, and computer device
CN110221925A (en) * 2019-05-13 2019-09-10 平安科技(深圳)有限公司 Processing method, device and the computer equipment of data submission request
CN110874244A (en) * 2019-10-16 2020-03-10 贝壳技术有限公司 Filtering method and device suitable for different service scenes and storage medium
CN111209325A (en) * 2019-12-31 2020-05-29 深信服科技股份有限公司 Service system interface identification method, device and storage medium
CN111259049A (en) * 2020-01-17 2020-06-09 中国平安人寿保险股份有限公司 Information query method, information query device and terminal equipment
CN111651585A (en) * 2020-04-27 2020-09-11 平安普惠企业管理有限公司 Information verification method and device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ERIC ZHOU: "NetCore技术研究_一套代码同时支持.NET Framework和.NET Core", pages 1 - 6, Retrieved from the Internet <URL:https://www.cnblogs.com/tianqing/p/11614303.html> *
JUN-QING LI 等: "Research on Peer Selection in Peer-to-Peer Networks using Ant Colony Optimization", 2008 FOURTH INTERNATIONAL CONFERENCE ON NATURAL COMPUTATION, 7 November 2008 (2008-11-07), pages 516 - 520 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113259322A (en) * 2021-04-19 2021-08-13 山东英信计算机技术有限公司 Method, system and medium for preventing Web service abnormity
CN113259322B (en) * 2021-04-19 2022-07-12 山东英信计算机技术有限公司 Method, system and medium for preventing Web service abnormity
CN113127109A (en) * 2021-05-12 2021-07-16 平安信托有限责任公司 Interface calling method and device, electronic equipment and readable storage medium
CN113221154A (en) * 2021-06-01 2021-08-06 平安信托有限责任公司 Service password obtaining method and device, electronic equipment and storage medium
CN113364848A (en) * 2021-06-01 2021-09-07 平安银行股份有限公司 File caching method and device, electronic equipment and storage medium
CN113364848B (en) * 2021-06-01 2024-03-19 平安银行股份有限公司 File caching method and device, electronic equipment and storage medium
CN113595978A (en) * 2021-06-23 2021-11-02 北京国电通网络技术有限公司 Data communication method based on micro-service architecture and related equipment

Similar Documents

Publication Publication Date Title
US10769228B2 (en) Systems and methods for web analytics testing and web development
CN112528307A (en) Service request checking method and device, electronic equipment and storage medium
CN110505162B (en) Message transmission method and device and electronic equipment
CN113238929B (en) Code testing method and device based on Mock data, electronic equipment and storage medium
CN112506779A (en) Software interface testing method and device, electronic equipment and storage medium
CN112579452A (en) Software automation test method, device, equipment and storage medium
CN112506559A (en) Gray scale publishing method and device based on gateway, electronic equipment and storage medium
CN112732567A (en) Mock data testing method and device based on ip, electronic equipment and storage medium
CN115086047B (en) Interface authentication method and device, electronic equipment and storage medium
CN113051171A (en) Interface test method, device, equipment and storage medium
CN112667244B (en) Data verification method, device, electronic equipment and computer readable storage medium
CN111373377A (en) Error handling
CN113221154A (en) Service password obtaining method and device, electronic equipment and storage medium
CN113434542A (en) Data relation identification method and device, electronic equipment and storage medium
CN114036068B (en) Update detection method, device, equipment and storage medium based on privacy security
CN112686759B (en) Account reconciliation monitoring method, device, equipment and medium
CN115033605A (en) Data query method and device, electronic equipment and storage medium
CN113127109A (en) Interface calling method and device, electronic equipment and readable storage medium
CN114185588A (en) Incremental package generation method, device, equipment and storage medium
CN113360825A (en) WebUI automatic test method and device, electronic equipment and storage medium
CN114356379A (en) Backup-based service upgrade method, device, device and storage medium
CN113886244A (en) Sql statement testing method, device, electronic device and readable storage medium
CN114978964A (en) Communication announcement configuration method, device, equipment and medium based on network self-checking
CN112905455A (en) Interface information checking method, device, equipment and storage medium
CN114564413B (en) Synchronous equipment testing method and device

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