CN117009110A - Interface dynamic calling method based on description information - Google Patents
Interface dynamic calling method based on description information Download PDFInfo
- Publication number
- CN117009110A CN117009110A CN202311103193.9A CN202311103193A CN117009110A CN 117009110 A CN117009110 A CN 117009110A CN 202311103193 A CN202311103193 A CN 202311103193A CN 117009110 A CN117009110 A CN 117009110A
- Authority
- CN
- China
- Prior art keywords
- interface
- parameter
- request
- request parameter
- target
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 230000008569 process Effects 0.000 claims abstract description 20
- 230000004044 response Effects 0.000 claims description 47
- 238000004590 computer program Methods 0.000 claims description 16
- 238000012545 processing Methods 0.000 claims description 10
- 230000008859 change Effects 0.000 claims description 4
- 238000004891 communication Methods 0.000 abstract description 5
- 230000003993 interaction Effects 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 7
- 230000018109 developmental process Effects 0.000 description 3
- 230000010354 integration Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000002955 isolation Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000001737 promoting effect Effects 0.000 description 1
- 230000033772 system development Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/541—Interprogram communication via adapters, e.g. between incompatible applications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote 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
Description
技术领域Technical field
本发明涉及一种基于描述信息的接口动态调用方法,属于计算机交互技术领域。The invention relates to an interface dynamic calling method based on description information, and belongs to the field of computer interaction technology.
背景技术Background technique
计算机接口调用指的是不同软件组件、系统或者服务之间通过接口进行通信和交互的过程。接口调用通过接口抽象,不同的模块可以独立开发、测试和部署,促进系统的模块化和解耦,从而提高软件开发的灵活性和可维护性。接口调用通过定义标准化的接口和协议,不同的系统可以进行远程调用,实现跨网络的通信和协作,这种分布式架构使得系统能够实现高可用性、弹性伸缩和负载均衡等优势,同时也提供更好的安全性和隔离性;通过接口进行集成,实现数据的共享和功能的复用,接口标准化和规范化可以提供通用的接入点,降低集成的难度和成本,同时也促进不同系统之间的互操作性;通过将任务拆分为多个独立的接口调用,实现任务的并行处理和异步执行,提高系统的响应速度和并发能力;通过将功能封装为接口,不同的团队可以并行开发不同的模块,在保持接口一致性的前提下进行工作,这种软件组织方式提高代码的可维护性和可测试性,也有利于团队的规模化和协同开发。因此,计算机接口调用在软件开发和系统集成中具有重要的意义。Computer interface calls refer to the process of communication and interaction between different software components, systems or services through interfaces. Interface calls are abstracted through interfaces, and different modules can be developed, tested, and deployed independently, promoting the modularization and decoupling of the system, thereby improving the flexibility and maintainability of software development. Interface call By defining standardized interfaces and protocols, different systems can make remote calls to achieve cross-network communication and collaboration. This distributed architecture enables the system to achieve the advantages of high availability, elastic scaling and load balancing, and also provides more Good security and isolation; integration through interfaces enables data sharing and function reuse. Interface standardization and standardization can provide universal access points, reduce the difficulty and cost of integration, and also promote communication between different systems. Interoperability; by splitting tasks into multiple independent interface calls, parallel processing and asynchronous execution of tasks are achieved, improving the system's response speed and concurrency capabilities; by encapsulating functions into interfaces, different teams can develop different tasks in parallel Modules work while maintaining interface consistency. This software organization method improves the maintainability and testability of the code, and is also conducive to the scale and collaborative development of the team. Therefore, computer interface calls are of great significance in software development and system integration.
目前,在计算机系统开发工作过程中,当计算机接口因为业务需要而升级迭代,常规方法为对计算机接口进行人工修改,以避免接口调用失败,然而,计算机接口调用过程涉及参数较多,通过人工的方式对接口进行修改具有较大的人力成本,导致对接口调用的效率较低。Currently, in the process of computer system development work, when the computer interface is upgraded and iterated due to business needs, the conventional method is to manually modify the computer interface to avoid interface call failure. However, the computer interface call process involves many parameters, and manual Modifying the interface in this way has a large labor cost, resulting in low efficiency in calling the interface.
发明内容Contents of the invention
本发明的目的在于克服现有技术中的不足,提供一种基于描述信息的接口动态调用方法,能够提高接口调用端的兼容性,实现在目标接口的描述信息发生变化时,动态对目标接口的参数进行调整,增加了接口调用端的效率。The purpose of the present invention is to overcome the deficiencies in the prior art and provide a dynamic calling method for an interface based on description information, which can improve the compatibility of the interface calling end and enable dynamic adjustment of the parameters of the target interface when the description information of the target interface changes. Adjustments were made to increase the efficiency of the interface caller.
为达到上述目的/为解决上述技术问题,本发明是采用下述技术方案实现的:In order to achieve the above objects/to solve the above technical problems, the present invention is implemented by adopting the following technical solutions:
第一方面,本发明提供了一种基于描述信息的接口动态调用方法,应用于提供方的接口调用端,包括:In the first aspect, the present invention provides a dynamic interface calling method based on description information, which is applied to the interface calling end of the provider, including:
通过所述接口调用端,获取至少一个第一请求参数及对应的参数值,以及向目标服务中心发送访问请求,获取所述目标服务中心接收到访问请求后反馈的目标接口的接口自描述信息;Through the interface calling end, obtain at least one first request parameter and the corresponding parameter value, send an access request to the target service center, and obtain the interface self-description information of the target interface fed back by the target service center after receiving the access request;
根据所述接口自描述信息,获取目标接口的请求参数集;Obtain the request parameter set of the target interface according to the interface self-description information;
基于所述接口调用端获取的至少一个第一请求参数及对应的参数值,对所述请求参数集进行调整,获得调整后的请求参数集;Based on at least one first request parameter and the corresponding parameter value obtained by the interface calling end, adjust the request parameter set to obtain an adjusted request parameter set;
结合所述获取的至少一个第一请求参数和所述调整后的请求参数集,对目标接口进行调用。The target interface is called based on the obtained at least one first request parameter and the adjusted request parameter set.
结合第一方面,进一步地,所述目标接口的请求参数集注册到目标服务中心,所述目标服务中心用于提供webservice服务。With reference to the first aspect, further, the request parameter set of the target interface is registered in a target service center, and the target service center is used to provide webservice services.
结合第一方面,进一步地,所述目标接口的请求参数集包括:统一资源定位符url、参数标识、参数类型、默认值以及输出参数。With reference to the first aspect, further, the request parameter set of the target interface includes: uniform resource locator url, parameter identifier, parameter type, default value and output parameter.
结合第一方面,进一步地,所述获得调整后的请求参数集的调整过程包括:Combined with the first aspect, further, the adjustment process of obtaining the adjusted request parameter set includes:
若所述调整后的请求参数集中存在第二请求参数,且所述第二请求参数和第一请求参数相同,则将所述第一请求参数对应的参数值赋予到所述第二请求参数;If a second request parameter exists in the adjusted request parameter set, and the second request parameter is the same as the first request parameter, then assign the parameter value corresponding to the first request parameter to the second request parameter;
若所述调整后的请求参数集中存在第三请求参数,且所述第三请求参数和所述第一请求参数均不相同,则将预先设置的默认值赋予到所述第三请求参数中;If there is a third request parameter in the adjusted request parameter set, and the third request parameter is different from the first request parameter, then a preset default value is assigned to the third request parameter;
若所述请求参数集中存在除统一资源定位符url、参数标识、参数类型、默认值以及输出参数外的第四请求参数,且所述第四请求参数和所述第一请求参数均不相同,则将所述第一请求参数删除。If the request parameter set contains a fourth request parameter other than the uniform resource locator url, parameter identifier, parameter type, default value, and output parameter, and the fourth request parameter and the first request parameter are different, Then the first request parameter is deleted.
结合第一方面,进一步地,所述调整后的请求参数集与接口调用端的第一请求参数进行匹配操作,用于提高接口调用的准确性。Combined with the first aspect, further, the adjusted request parameter set is matched with the first request parameter of the interface calling end to improve the accuracy of the interface calling.
结合第一方面,进一步地,所述调整后的请求参数集与接口调用端的第一请求参数进行匹配操作的过程包括:With reference to the first aspect, further, the process of matching the adjusted request parameter set with the first request parameter of the interface calling end includes:
对所述第一请求参数中的所有参数进行排序,获取排序后的第一请求参数;Sort all parameters in the first request parameters and obtain the sorted first request parameters;
基于排序后的第一请求参数,对目标接口进行调用,并处理目标接口返回的响应数据。Based on the sorted first request parameter, the target interface is called and the response data returned by the target interface is processed.
结合第一方面,进一步地,所述处理目标接口返回的响应数据的过程包括:Combined with the first aspect, further, the process of processing the response data returned by the target interface includes:
获取所述接口调用端的至少一个第一响应参数,以及获取目标接口响应参数集;Obtain at least one first response parameter of the interface calling end, and obtain the target interface response parameter set;
若所述响应参数集中存在第二响应参数,且和所述第一响应参数相同,则将获取第二响应参数在响应参数集中所在位置,以及得到所述第二响应参数对应的参数值;If a second response parameter exists in the response parameter set and is the same as the first response parameter, then the position of the second response parameter in the response parameter set will be obtained, and the parameter value corresponding to the second response parameter will be obtained;
若所述响应参数集中不存在第三响应参数,且所述第三响应参数和所述第一响应参数均不相同,则将所述第一响应参数删除。If there is no third response parameter in the response parameter set and the third response parameter is different from the first response parameter, the first response parameter is deleted.
第二方面,本发明提供了一种基于描述信息的接口动态调用装置,其特征在于,包括:In a second aspect, the present invention provides an interface dynamic calling device based on description information, which is characterized by including:
第一获取模块,用于通过所述接口调用端,获取至少一个第一请求参数及对应的参数值,以及向目标服务中心发送访问请求,获取目标接口的接口自描述信息;The first acquisition module is configured to acquire at least one first request parameter and corresponding parameter value through the interface calling end, and send an access request to the target service center to acquire the interface self-description information of the target interface;
第二获取模块,用于根据所述接口自描述信息,获取目标接口的请求参数集;The second acquisition module is used to acquire the request parameter set of the target interface according to the interface self-description information;
调整模块,用于基于所述接口调用端获取的至少一个第一请求参数及对应的参数值,对所述请求参数集进行调整,获得调整后的请求参数集;An adjustment module, configured to adjust the request parameter set based on at least one first request parameter and the corresponding parameter value obtained by the interface calling end, and obtain an adjusted request parameter set;
调用模块,用于结合所述获取的至少一个第一请求参数和所述调整后的请求参数集,对目标接口进行调用,用于在目标接口的参数发生改变时,动态地对所述目标接口的请求参数进行调整。A calling module, configured to call the target interface in combination with the obtained at least one first request parameter and the adjusted request parameter set, and used to dynamically call the target interface when the parameters of the target interface change. Adjust the request parameters.
第三方面,一种电子终端,包括处理器与所述处理器连接的存储器,在所述存储器内存储有计算机程序,当所述计算机程序被所述处理器执行时,执行如第一方面任一项所述方法的步骤。In a third aspect, an electronic terminal includes a processor and a memory connected to the processor. A computer program is stored in the memory. When the computer program is executed by the processor, any of the steps of the first aspect are executed. One step of the method.
第四方面,一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现第一方面任一项所述方法的步骤。A fourth aspect is a computer-readable storage medium on which a computer program is stored, characterized in that when the program is executed by a processor, the steps of any one of the methods described in the first aspect are implemented.
与现有技术相比,本发明所达到的有益效果:Compared with the prior art, the beneficial effects achieved by the present invention are:
本发明通过向目标服务中心发送访问请求,获得目标接口的自描述信息,如果目标接口的自描述信息由于业务的需要进行了修改或者调整,此时修改后的自描述信息与目标接口不匹配,通过对请求参数集进行调整,再结合第一请求参数和调整后的请求参数集,对目标接口进行调用,从而实现在目标接口的自描述信息发生变化时,动态的对目标接口的参数进行及时调整,提高接口调用端的兼容性以及效率。The present invention obtains the self-describing information of the target interface by sending an access request to the target service center. If the self-describing information of the target interface is modified or adjusted due to business needs, the modified self-describing information does not match the target interface. By adjusting the request parameter set, and then combining the first request parameter and the adjusted request parameter set, the target interface is called, so that when the self-describing information of the target interface changes, the parameters of the target interface can be dynamically updated in a timely manner. Adjust to improve the compatibility and efficiency of the interface caller.
附图说明Description of the drawings
图1是本发明实施例提供的接口动态调用方法的流程图;Figure 1 is a flow chart of an interface dynamic calling method provided by an embodiment of the present invention;
图2是本发明实施例提供的接口动态调用装置的流程图。Figure 2 is a flow chart of an interface dynamic calling device provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面通过附图以及具体实施例对本发明技术方案做详细的说明,应当理解本申请实施例以及实施例中的具体特征是对本申请技术方案的详细的说明,而不是对本申请技术方案的限定,在不冲突的情况下,本申请实施例以及实施例中的技术特征可以相互组合。The technical solution of the present invention will be described in detail below through the accompanying drawings and specific examples. It should be understood that the embodiments of the present application and the specific features in the embodiments are a detailed description of the technical solution of the present application, rather than a limitation of the technical solution of the present application. If there is no conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符"/",一般表示前后关联对象是一种“或”的关系。The term "and/or" in this article is just an association relationship that describes related objects, indicating that three relationships can exist. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and they exist alone. B these three situations. In addition, the character "/" in this article generally indicates that the related objects are an "or" relationship.
实施例一Embodiment 1
图1是本发明实施例一中的接口动态调用方法的流程图。本流程图仅仅示出了本实施例所述方法的逻辑顺序,在互不冲突的前提下,在本发明其它可能的实施例中,可以以不同于图1所示的顺序完成所示出或描述的步骤。Figure 1 is a flow chart of an interface dynamic calling method in Embodiment 1 of the present invention. This flow chart only shows the logical sequence of the method described in this embodiment. On the premise that there is no conflict with each other, in other possible embodiments of the present invention, the shown or Describe the steps.
本实施例提供的接口动态调用方法可应用于提供方的接口调用端,可以由接口动态调用方法装置来执行,该装置可以由软件和/或硬件的方式实现,该装置可以集成在终端中,例如:任一具备通信功能的智能手机,平板电脑或计算机设备。参见图1,本实施的方法具体包括如下步骤:The interface dynamic calling method provided by this embodiment can be applied to the interface calling end of the provider, and can be executed by the interface dynamic calling method device. The device can be implemented by software and/or hardware, and the device can be integrated in the terminal. For example: any smartphone, tablet or computer device with communication capabilities. Referring to Figure 1, the method implemented specifically includes the following steps:
步骤一、通过所述接口调用端,获取至少一个第一请求参数及对应的参数值,以及向目标服务中心发送访问请求,获取所述目标服务中心接收到访问请求后反馈的目标接口的接口自描述信息;Step 1: Obtain at least one first request parameter and corresponding parameter value through the interface calling end, and send an access request to the target service center, and obtain the interface self-interface of the target interface fed back by the target service center after receiving the access request. Description;
步骤二、根据所述接口自描述信息,获取目标接口的请求参数集;Step 2: Obtain the request parameter set of the target interface according to the interface self-description information;
具体地,目标接口会将请求参数集注册到目标服务中心,用于提供webservice服务,便于接口调用端通过访问目标服务中心(发送访问请求)获取接口自描述信息,为后续的接口调用做准备。例如:当启动接口程序后,目标接口将接口自描述信息注册到目标服务中心,由于服务中心有不同的模块,通过所描述的信息自动找到注册中心模块,维护接口实例信息清单,形成自描述信息。Specifically, the target interface will register the request parameter set to the target service center to provide webservice services, so that the interface caller can obtain the interface self-description information by accessing the target service center (sending an access request) to prepare for subsequent interface calls. For example: when the interface program is started, the target interface registers the interface self-describing information to the target service center. Since the service center has different modules, the registration center module is automatically found through the described information, and the interface instance information list is maintained to form self-describing information. .
需要说明的是,目标服务中心是一种集成化的功能模块,由注册中心模块、业务模块、存储模块等组成,每一个功能模块,相互独立,各司其职。It should be noted that the target service center is an integrated functional module, consisting of a registration center module, a business module, a storage module, etc. Each functional module is independent of each other and performs its own duties.
进一步地,目标接口的请求参数集包括:统一资源定位符url、参数标识、参数类型、默认值以及输出参数。在后续进行参数集调整时,HTTP请求通过url携带参数进行传参,或者通过函数调用的方法进行传参,从而实现对请求参数集的调整。Further, the request parameter set of the target interface includes: uniform resource locator URL, parameter identifier, parameter type, default value, and output parameter. When adjusting the parameter set in the future, the HTTP request carries parameters through the URL or passes the parameters through the function call method, thereby adjusting the request parameter set.
步骤三、基于所述接口调用端获取的至少一个第一请求参数及对应的参数值,对所述请求参数集进行调整,获得调整后的请求参数集;Step 3: Based on at least one first request parameter and the corresponding parameter value obtained by the interface caller, adjust the request parameter set to obtain an adjusted request parameter set;
根据接口调用端提供的至少一个第一请求参数及对应的参数值,对目标接口的请求参数集及时进行调整,具体的调整方式如下:According to at least one first request parameter and the corresponding parameter value provided by the interface caller, the request parameter set of the target interface is adjusted in a timely manner. The specific adjustment method is as follows:
若调整后的请求参数集中存在第二请求参数,且和第一请求参数相同,则将第一请求参数对应的参数值赋予到第二请求参数,即调整后的新的参数会覆盖旧的参数,从而达到调整参数请求集的目的;If the second request parameter exists in the adjusted request parameter set and is the same as the first request parameter, the parameter value corresponding to the first request parameter will be assigned to the second request parameter, that is, the new adjusted parameter will overwrite the old parameter. , thereby achieving the purpose of adjusting the parameter request set;
若所述调整后的请求参数集中存在第三请求参数,且和第一请求参数均不相同,则将预先设置的默认值赋予到所述第三请求参数中;If a third request parameter exists in the adjusted request parameter set and is different from the first request parameter, then assign a preset default value to the third request parameter;
具体地,若存在第三请求参数,并设置第三请求参数的默认值,当第三请求参数与第一请求参数相同时,同上述参数覆盖的方法;当第三请求参数和第一请求参数不相同时,将请求参数集中的默认值赋予第三请求参数。Specifically, if there is a third request parameter and the default value of the third request parameter is set, when the third request parameter is the same as the first request parameter, the method of covering the above parameters is the same; when the third request parameter and the first request parameter are different If they are different, the default value in the request parameter set is assigned to the third request parameter.
若请求参数集中不存在第四请求参数,即不是统一资源定位符url、参数标识、参数类型、默认值以及输出参数五个参数中的其中一个,且和第一请求参数均不相同,则将第一请求参数删除。If the fourth request parameter does not exist in the request parameter set, that is, it is not one of the five parameters of the uniform resource locator url, parameter identifier, parameter type, default value, and output parameter, and is different from the first request parameter, then Delete the first request parameter.
例如:设置接口调用端Pi为第i个第一请求参数,且i为自然数;Qn为目标接口的请求参数集,且请求参数集中共有n个参数;如果Qn的请求参数集中存在一个子集Qk(第二请求参数),当Qk和Pi相同(0<k<n,k、n都为自然数),则将Pi对应的参数值赋值到Qk上;若Qn的请求参数集中存在一个子集Qa(第三请求参数),当Qa和Pi均不相同(0<k<n,k、n都为自然数),将将请求参数集中的默认值赋予第三请求参数。For example: set the interface calling end Pi as the i-th first request parameter, and i is a natural number; Q n is the request parameter set of the target interface, and there are n parameters in the request parameter set; if there is one in the request parameter set of Q n Subset Q k (second request parameter), when Q k and Pi are the same (0<k<n, both k and n are natural numbers), then assign the parameter value corresponding to Pi to Q k ; if Q n There is a subset Q a (the third request parameter) in the request parameter set. When Q a and Pi are different (0<k<n, k and n are both natural numbers), the default value in the request parameter set will be assigned The third request parameter.
步骤四、结合所述获取的至少一个第一请求参数和所述调整后的请求参数集,对目标接口进行调用。当目标接口的参数发生改变时,能够动态地对所述目标接口的请求参数进行调整。Step 4: Combine the obtained at least one first request parameter and the adjusted request parameter set to call the target interface. When the parameters of the target interface change, the request parameters of the target interface can be dynamically adjusted.
在本发明实施例中,如果给定一个目标接口,初始化后,确定目标接口的自描述信息,根据目标接口的自描述信息表示接口调用端的第一请求参数。如果目标接口的自描述信息由于业务的需要进行了调整或修改,接口调用端的第一请求参数也发生了改变,此时会出现目标接口与接口调用端不匹配的情况,因此将请求参数集进行调整,并基于调整后的请求参数集和接口调用端提供的第一请求参数,实现对目标接口进行调用,并且当目标接口的自描述信息发生变化时,动态地对目标接口的参数进行及时调整,避免人工调整,提高接口调用端的兼容性,从而接口调用端的效率也大大提高。In the embodiment of the present invention, if a target interface is given, after initialization, the self-describing information of the target interface is determined, and the first request parameter of the interface calling end is represented according to the self-describing information of the target interface. If the self-describing information of the target interface is adjusted or modified due to business needs, and the first request parameter of the interface caller is also changed, there will be a mismatch between the target interface and the interface caller, so the request parameter set will be changed. Adjust and implement the call to the target interface based on the adjusted request parameter set and the first request parameter provided by the interface caller, and when the self-describing information of the target interface changes, dynamically adjust the parameters of the target interface in a timely manner. , avoid manual adjustments and improve the compatibility of the interface caller, thus greatly improving the efficiency of the interface caller.
具体地,调整后的请求参数集与接口调用端的第一请求参数进行匹配操作,用于提高接口调用的准确性,具体过程如下:Specifically, the adjusted request parameter set is matched with the first request parameter of the interface caller to improve the accuracy of the interface call. The specific process is as follows:
对第一请求参数中的所有参数进行排序,获取排序后的第一请求参数;Sort all parameters in the first request parameter and obtain the sorted first request parameter;
基于排序后的第一请求参数,对目标接口进行调用,并处理目标接口返回的响应数据。Based on the sorted first request parameter, the target interface is called and the response data returned by the target interface is processed.
具体地,在确定调用的目标接口之后,将第一请求参数中的所有参数按照特定的排序规则进行排序,用于获取排序后的第一请求参数,以获取第一请求参数中的第一个参数为例,通过查找目标接口的自描述信息,确定排序后的第一个参数的名称、类型、取值范围等信息,基于排序后的第一个参数的要求,构建符合目标接口规范的请求,确保所请求参数的类型与目标接口的要求类型一致,并在取值范围内选取合适的值。Specifically, after determining the target interface to be called, all parameters in the first request parameters are sorted according to a specific sorting rule to obtain the sorted first request parameters, so as to obtain the first one of the first request parameters. Taking parameters as an example, by searching the self-describing information of the target interface, determine the name, type, value range and other information of the sorted first parameter, and build a request that conforms to the target interface specification based on the requirements of the sorted first parameter. , ensure that the type of the requested parameter is consistent with the required type of the target interface, and select an appropriate value within the value range.
进一步地,采用HTTP请求、函数调用等方法调用目标接口,处理目标接口返回的响应结果,根据目标接口的接口自描述信息,解析和处理返回的数据,验证接口调用端的响应结果是否符合预期,检查响应结果中是否包含所需要的信息,结合所需要的信息作进一步处理和调整,具体处理和调整过程如下:Further, the target interface is called using methods such as HTTP requests and function calls, and the response results returned by the target interface are processed. The returned data is parsed and processed according to the interface self-description information of the target interface, and the response results of the interface calling end are verified to be as expected. Check Whether the response result contains the required information, combined with the required information for further processing and adjustment, the specific processing and adjustment process is as follows:
获取所述接口调用端的至少一个第一响应参数,以及获取目标接口响应参数集;Obtain at least one first response parameter of the interface calling end, and obtain the target interface response parameter set;
若所述响应参数集中存在第二响应参数,且和所述第一响应参数相同,则将获取第二响应参数在响应参数集中所在位置,以及得到所述第二响应参数对应的参数值;If a second response parameter exists in the response parameter set and is the same as the first response parameter, then the position of the second response parameter in the response parameter set will be obtained, and the parameter value corresponding to the second response parameter will be obtained;
若所述响应参数集中不存在第三响应参数,且和所述第一响应参数均不相同,则将所述第一响应参数删除。If the third response parameter does not exist in the response parameter set and is different from the first response parameter, the first response parameter is deleted.
实施例二Embodiment 2
本发明实施例提供一种基于情报的事件预测装置,参见图2,该装置可以用于实现实施例一所述的方法,所述装置包括:An embodiment of the present invention provides an intelligence-based event prediction device. See Figure 2. The device can be used to implement the method described in Embodiment 1. The device includes:
第一获取模块,用于通过所述接口调用端,获取至少一个第一请求参数及对应的参数值,以及向目标服务中心发送访问请求,获取目标接口的接口自描述信息;The first acquisition module is configured to acquire at least one first request parameter and corresponding parameter value through the interface calling end, and send an access request to the target service center to acquire the interface self-description information of the target interface;
第二获取模块,用于根据所述接口自描述信息,获取目标接口的请求参数集;The second acquisition module is used to acquire the request parameter set of the target interface according to the interface self-description information;
调整模块,用于基于所述接口调用端获取的至少一个第一请求参数及对应的参数值,对所述请求参数集进行调整,获得调整后的请求参数集;An adjustment module, configured to adjust the request parameter set based on at least one first request parameter and the corresponding parameter value obtained by the interface calling end, and obtain an adjusted request parameter set;
调用模块,用于结合所述获取的至少一个第一请求参数和所述调整后的请求参数集,对目标接口进行调用,用于在目标接口的参数发生改变时,动态地对所述目标接口的请求参数进行调整。A calling module, configured to call the target interface in combination with the obtained at least one first request parameter and the adjusted request parameter set, and used to dynamically call the target interface when the parameters of the target interface change. Adjust the request parameters.
对于本实施例未尽的其他技术特征,可以参考实施例一。For other technical features not described in this embodiment, please refer to Embodiment 1.
实施例三Embodiment 3
本发明实施例还提供了一种电子终端,包括处理器及存储介质;An embodiment of the present invention also provides an electronic terminal, including a processor and a storage medium;
所述存储介质用于存储指令;The storage medium is used to store instructions;
所述处理器用于根据所述指令进行操作以执行实施例一所述方法的步骤。The processor is configured to operate according to the instructions to execute the steps of the method described in Embodiment 1.
实施例四Embodiment 4
本发明还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现实施例一所述方法的步骤。The present invention also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method described in Embodiment 1 are implemented.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will understand that embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will understand that embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device produce a use A device for realizing the functions specified in a process or processes in a flowchart and/or a block or blocks in a block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions The device implements the functions specified in a process or processes in the flowchart and/or in a block or blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device. Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明技术原理的前提下,还可以做出若干改进和变形,这些改进和变形也应视为本发明的保护范围。The above are only preferred embodiments of the present invention. It should be noted that those of ordinary skill in the art can also make several improvements and modifications without departing from the technical principles of the present invention. These improvements and modifications It should also be regarded as the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311103193.9A CN117009110A (en) | 2023-08-30 | 2023-08-30 | Interface dynamic calling method based on description information |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311103193.9A CN117009110A (en) | 2023-08-30 | 2023-08-30 | Interface dynamic calling method based on description information |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117009110A true CN117009110A (en) | 2023-11-07 |
Family
ID=88570975
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311103193.9A Pending CN117009110A (en) | 2023-08-30 | 2023-08-30 | Interface dynamic calling method based on description information |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117009110A (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107832161A (en) * | 2017-11-06 | 2018-03-23 | 东软集团股份有限公司 | Service calling method and device, storage medium, electronic equipment |
CN109086148A (en) * | 2018-08-01 | 2018-12-25 | 山东浪潮通软信息科技有限公司 | A kind of cross-platform method for calling Web Service service |
CN112153152A (en) * | 2020-09-28 | 2020-12-29 | 深圳壹账通智能科技有限公司 | Management method and system of algorithm service interface |
CN112948723A (en) * | 2021-02-26 | 2021-06-11 | 平安普惠企业管理有限公司 | Interface calling method and device and related equipment |
CN113296975A (en) * | 2020-10-13 | 2021-08-24 | 阿里云计算有限公司 | Service calling method and device |
CN114911472A (en) * | 2022-05-25 | 2022-08-16 | 上海众源网络有限公司 | GraphQL interface calling method and device, electronic equipment and storage medium |
WO2022194359A1 (en) * | 2021-03-16 | 2022-09-22 | Lenovo (Singapore) Pte. Ltd. | Platform independent application programming interface configuration |
CN115185717A (en) * | 2022-09-14 | 2022-10-14 | 北京达佳互联信息技术有限公司 | Interface calling method and device, electronic equipment and storage medium |
CN116320053A (en) * | 2021-12-21 | 2023-06-23 | 浙江宇视科技有限公司 | Adaptation method, device, equipment and medium for protocol transmission interface parameter |
-
2023
- 2023-08-30 CN CN202311103193.9A patent/CN117009110A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107832161A (en) * | 2017-11-06 | 2018-03-23 | 东软集团股份有限公司 | Service calling method and device, storage medium, electronic equipment |
CN109086148A (en) * | 2018-08-01 | 2018-12-25 | 山东浪潮通软信息科技有限公司 | A kind of cross-platform method for calling Web Service service |
CN112153152A (en) * | 2020-09-28 | 2020-12-29 | 深圳壹账通智能科技有限公司 | Management method and system of algorithm service interface |
CN113296975A (en) * | 2020-10-13 | 2021-08-24 | 阿里云计算有限公司 | Service calling method and device |
CN112948723A (en) * | 2021-02-26 | 2021-06-11 | 平安普惠企业管理有限公司 | Interface calling method and device and related equipment |
WO2022194359A1 (en) * | 2021-03-16 | 2022-09-22 | Lenovo (Singapore) Pte. Ltd. | Platform independent application programming interface configuration |
CN116320053A (en) * | 2021-12-21 | 2023-06-23 | 浙江宇视科技有限公司 | Adaptation method, device, equipment and medium for protocol transmission interface parameter |
CN114911472A (en) * | 2022-05-25 | 2022-08-16 | 上海众源网络有限公司 | GraphQL interface calling method and device, electronic equipment and storage medium |
CN115185717A (en) * | 2022-09-14 | 2022-10-14 | 北京达佳互联信息技术有限公司 | Interface calling method and device, electronic equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
陈玲平;: "基于SOA的统一应用服务接口平台设计与实现", 网络安全技术与应用, no. 03, 15 March 2009 (2009-03-15), pages 91 - 93 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20060101474A1 (en) | System, method and apparatus for an extensible distributed enterprise integration platform | |
US9176772B2 (en) | Suspending and resuming of sessions | |
US7983249B2 (en) | Enterprise web service data to mobile device synchronization | |
US7917629B2 (en) | Interface for external system management | |
WO2016123921A1 (en) | Http protocol-based multiple data resource data processing method and system | |
JP2008544400A (en) | Data centric workflow | |
US20030055862A1 (en) | Methods, systems, and articles of manufacture for managing systems using operation objects | |
US9037695B2 (en) | Management of networked resources on different platforms with a common interface | |
CN102081605A (en) | Data warehouse-based data encapsulation device and service data acquisition method | |
CN110413418A (en) | Cache synchronization device and method, cache synchronization system, electronic equipment | |
CN110321236A (en) | A kind of remote method call implementation method based on OpenDDS | |
US10235217B2 (en) | System and method for aggregate data from multiple sources to provide a single CIM object | |
CN116974948B (en) | Business system testing methods, systems, equipment and media | |
US7593917B2 (en) | Implementation of application management operations | |
CN115550354A (en) | Data processing method and device and computer readable storage medium | |
WO2009129745A1 (en) | A method and apparatus for interface invoking of distributed system | |
CN110633162B (en) | Remote call implementation method and device, computer equipment and storage medium | |
WO2021093671A1 (en) | Task processing method, system, apparatus and device, and computer readable storage medium | |
CN117009110A (en) | Interface dynamic calling method based on description information | |
US20140149540A1 (en) | Decentralized administration of access to target systems in identity management | |
CN109669793A (en) | Middleware in-process object call method | |
Ren et al. | Research on communication method of OPC UA client based on ARM | |
CN107103058A (en) | Big data service combining method and composite service combined method based on Artifact | |
US12086141B1 (en) | Coordination of services using PartiQL queries | |
CN117640177A (en) | Service center cluster system based on mycat and interface technology |
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 |