CN115878630A - User-defined interface calling method and device, electronic equipment and storage medium - Google Patents

User-defined interface calling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115878630A
CN115878630A CN202310050509.6A CN202310050509A CN115878630A CN 115878630 A CN115878630 A CN 115878630A CN 202310050509 A CN202310050509 A CN 202310050509A CN 115878630 A CN115878630 A CN 115878630A
Authority
CN
China
Prior art keywords
interface
request
parameter
polling
information
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.)
Granted
Application number
CN202310050509.6A
Other languages
Chinese (zh)
Other versions
CN115878630B (en
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.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology 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 Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202310050509.6A priority Critical patent/CN115878630B/en
Publication of CN115878630A publication Critical patent/CN115878630A/en
Application granted granted Critical
Publication of CN115878630B publication Critical patent/CN115878630B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention provides a custom interface calling method, a custom interface calling device, electronic equipment and a storage medium. Receiving a custom interface configuration parameter; generating a database table according to the user-defined interface configuration parameters, wherein the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table; when the user-defined interface is called, acquiring the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data; and calling the communication protocol tool packet to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table. The user-defined interface is dynamically configured to be called by the embodiment of the invention, so that the user-defined interface can meet different requirements for calling.

Description

User-defined interface calling method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a custom interface calling method, a custom interface calling apparatus, an electronic device, and a storage medium.
Background
The interface of the existing external system interface platform is usually fixed in input format, and the format of the returned data is also fixed. The interface compatibility between different systems is low, so that the interface calling with different requirements cannot be met.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are provided to provide a custom interface calling method, a custom interface calling apparatus, an electronic device, and a storage medium that overcome or at least partially solve the above problems.
In a first aspect of the present invention, an embodiment of the present invention discloses a method for calling a custom interface, where the custom interface is deployed with a communication protocol toolkit, and the method includes:
receiving configuration parameters of a custom interface;
generating a database table according to the user-defined interface configuration parameters, wherein the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table;
when the user-defined interface is called, acquiring the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data;
and calling the communication protocol tool packet to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table.
Optionally, the method further comprises:
receiving network response data, wherein the network response data comprises a network response data format;
and analyzing the network response data format to generate access data.
Optionally, the custom interface configuration parameters include interface basic information, interface request information, interface polling information, interface access format information, and data storage rule information; the step of generating a database table according to the custom interface configuration parameters comprises:
generating the interface detail table according to the interface basic information, the interface polling information and the interface access format information;
generating the interface request header information table and the interface request parameter table according to the interface request information;
and generating an interface storage data rule table according to the data storage rule information.
Optionally, the step of generating the interface detail table according to the interface basic information, the interface polling information, and the interface access format information includes:
analyzing the interface basic information to generate interface basic parameters;
analyzing the interface polling information to generate interface polling parameters;
analyzing the interface access format information to generate interface access parameters;
and generating the interface detail table by combining the interface basic parameters, the interface polling parameters and the interface access parameters.
Optionally, the interface basic information includes an interface state, an interface path, an interface communication type, an interface name, an interface description, and an interface scope; the step of analyzing the interface basic information and generating the interface basic parameters comprises the following steps:
determining an interface release parameter corresponding to the interface state;
determining a path parameter corresponding to the interface path;
determining data transmission parameters corresponding to the interface communication types;
determining interface function type parameters according to the interface action range;
determining the interface publishing parameter, the path parameter, the data transmission parameter, the interface function type parameter, the interface name and the interface description as the interface basic parameters.
Optionally, the step of determining the interface function type parameter according to the interface action range includes:
analyzing the interface action range to determine an action object, wherein the action object comprises a form drop-down box control, code embedding and function nodes;
and determining the type of the action object as the interface function type parameter.
Optionally, the interface polling information includes: polling single timeout time, polling total timeout time, polling interval, and polling interrupt condition; the step of analyzing the interface polling information and generating interface polling parameters comprises the following steps:
determining a single polling parameter corresponding to the polling single overtime time;
determining a polling control parameter corresponding to the total polling timeout time;
determining the single polling parameter, the polling control parameter, the polling interval, and the polling interrupt condition as the interface polling parameter.
Optionally, the interface access format information includes an access format; the step of analyzing the interface access format information and generating interface access parameters comprises the following steps:
determining default format parameters according to the access format;
and determining the default format parameter as the interface access parameter.
Optionally, the interface request information includes a request header and a request parameter; the step of generating the interface request header information table and the interface request parameter table according to the interface request information includes:
generating the interface request header information table according to the request header;
and generating the interface request parameter table according to the request parameters.
Optionally, the data saving rule information includes a form field name, a manually saved value, and a data source; the step of generating the interface storage data rule table according to the data storage rule information includes:
and generating the interface storage data rule table by combining the form field name, the manual storage value and the data source.
Optionally, the communication protocol toolkit is a hypertext transfer protocol toolkit; the step of calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table comprises the following steps:
calling the hypertext transfer protocol toolkit to execute the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table, setting the request data and generating a uniform resource positioning request;
and sending the uniform resource positioning request to carry out network communication.
Optionally, the step of calling the http toolkit to execute the interface detail table, the interface request header information table, the interface request parameter table, and the interface save data rule table, setting the request data, and generating a uniform resource location request includes:
determining a parameter type corresponding to the request data;
determining request sending information from the interface detail table, the interface request header information table, the interface request parameter table and the interface save data rule table based on the parameter type;
and calling the hypertext transfer protocol toolkit to convert the request sending information into the uniform resource positioning request.
Optionally, the method further comprises:
and receiving an interface calling result, and determining the state of the user-defined interface according to the interface calling result.
In a second aspect of the present invention, an embodiment of the present invention discloses a custom interface invoking device, where a communication protocol toolkit is deployed on a custom interface, and the device includes:
the first receiving module is used for receiving the configuration parameters of the custom interface;
the configuration module is used for generating a database table according to the custom interface configuration parameters, and the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table;
the first obtaining module is used for obtaining the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data when the user-defined interface is called;
and the calling module is used for calling the communication protocol toolkit to set the request data to carry out network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table.
In a third aspect of the present invention, an embodiment of the present invention discloses an electronic device, which includes a processor, a memory, and a computer program stored on the memory and capable of running on the processor, and when the computer program is executed by the processor, the steps of the custom interface calling method as described above are implemented.
In a fourth aspect of the present invention, an embodiment of the present invention discloses a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the custom interface calling method as described above.
The embodiment of the invention has the following advantages:
the embodiment of the invention receives the configuration parameters of the custom interface; generating a database table according to the custom interface configuration parameters, wherein the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table; when the user-defined interface is called, acquiring the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data; and calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table. The user-defined interface is configured through the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table, so that the user-defined interface can process the request data based on the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table, the request data can adapt to the specification of the user-defined interface, the user-defined interface can communicate with other interfaces, and the compatibility of the interface is enhanced.
Drawings
FIG. 1 is a flow chart of the steps of an embodiment of a custom interface invocation method of the present invention;
FIG. 2 is a flow chart of steps in another embodiment of a custom interface invocation method of the present invention;
FIG. 3 is a schematic diagram of a custom interface configuration parameter of the present invention;
FIG. 4 is a flowchart illustrating steps of an exemplary custom interface invocation method of the present invention;
fig. 5 is a block diagram of a custom interface calling device according to an embodiment of the present invention.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a method for calling a custom interface according to the present invention is shown, where the custom interface is deployed with a communication protocol toolkit, and the method specifically includes the following steps:
step 101, receiving a custom interface configuration parameter;
in the embodiment of the invention, when the user-defined interface is configured, the user-defined interface can be set according to actual requirements, and related personnel can input configuration parameters of the user-defined interface according to the requirements.
And receiving input custom interface configuration parameters, wherein the custom interface configuration parameters are used for configuring the transceiving function of the custom interface.
102, generating a database table according to the user-defined interface configuration parameters, wherein the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table;
and then carrying out type recognition on the received custom interface configuration parameters to generate a database table corresponding to the type function. The database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table. The interface detail table is a basic parameter table for configuring an interface; the interface request header information table is a parameter table when the interface is configured to generate a request; the interface request parameter table is a parameter table when the interface processing request is configured; the interface storage data rule table is a parameter table when the interface is configured to store data.
103, when the user-defined interface is called, acquiring the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data;
when a user-defined interface needs to be called, an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table can be obtained from a configuration storage address; the data conversion of the interface is realized through the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table. And acquires the requested data that needs to be processed.
And step 104, calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table.
In the embodiment of the present invention, a communication protocol toolkit deployed thereon may be started, where the communication protocol toolkit is used to access an interface to a corresponding communication protocol. The specific type of communication protocol may be determined based on the actual situation.
And calling a communication protocol toolkit to convert the request data according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table so as to set the request data to meet the interface requirement, and performing network communication by adopting the set request data.
The embodiment of the invention receives the configuration parameters of the custom interface; generating a database table according to the user-defined interface configuration parameters, wherein the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table; when the user-defined interface is called, acquiring the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data; and calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table. The user-defined interface is configured through the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table, so that the user-defined interface can process request data based on the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table, the request data can adapt to the specification of the user-defined interface, the user-defined interface can communicate with other interfaces, and the compatibility of the interface is enhanced.
Referring to fig. 2, a flowchart illustrating steps of another embodiment of a method for calling a custom interface according to the present invention is shown, where the custom interface is deployed with a communication protocol toolkit, and the method specifically includes the following steps:
step 201, receiving a configuration parameter of a custom interface;
obtaining user-defined configuration parameters such as ID and input parameters of a user-defined interface; the interface configuration parameters can adopt an analyzable file format such as a JSON format and the like to record the user-defined interface configuration parameters.
Step 202, generating a database table according to the custom interface configuration parameters, wherein the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table;
and dynamically generating a database table configured for the custom interface according to the custom interface configuration parameters. The database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table.
In an optional embodiment of the present invention, the custom interface configuration parameter includes interface basic information, interface request information, interface polling information, interface access format information, and data storage rule information; the step of generating a database table according to the custom interface configuration parameters comprises:
substep S2021, generating the interface detail table according to the interface basic information, the interface polling information and the interface access format information;
the basic information of the custom interface can be determined according to the basic information of the interface; determining a polling mode when the interface is accessed according to the interface polling information, and determining the format of interface access data according to the interface access format information; and combining the three kinds of information to generate an interface detail table.
In an optional embodiment of the present invention, the step of generating the interface detail table according to the interface basic information, the interface polling information, and the interface access format information may include:
substep S20211, analyzing the interface basic information to generate interface basic parameters;
the basic information of the interface can be analyzed, and various parameters of the interface are analyzed to generate basic parameters of the interface.
Specifically, the interface basic information includes an interface state, an interface path, an interface communication type, an interface name, an interface description, and an interface scope; the step of analyzing the interface basic information and generating the interface basic parameters comprises the following steps: determining an interface release parameter corresponding to the interface state; determining a path parameter corresponding to the interface path; determining data transmission parameters corresponding to the interface communication types; determining an interface function type parameter according to the interface action range; determining the interface publishing parameter, the path parameter, the data transmission parameter, the interface function type parameter, the interface name and the interface description as the interface basic parameters.
In the embodiment of the present invention, the interface basic information includes an interface state, an interface path, an interface communication type, an interface name, an interface description, and an interface scope. The interface release parameters corresponding to the interface state can be determined, and whether the interface releases or not is identified through the interface release parameters. Determining path parameters corresponding to the interface path to obtain a specific data processing path; wherein the path parameter may be url (uniform resource locator). And determining data transmission parameters corresponding to the interface communication type, and identifying the communication request modes of the interface through the data transmission parameters, such as POST (POST) and GET (GET) modes. And analyzing the interface action range, and determining the range of the corresponding processing data to obtain the interface function type parameters. And then, determining the interface release parameter, the path parameter, the data transmission parameter, the interface function type parameter, the interface name and the interface description as the interface basic parameters.
Further, the step of determining the interface function type parameter according to the interface action range includes: analyzing the interface action range to determine an action object, wherein the action object comprises a form drop-down box control, code embedding and function nodes; and determining the type of the action object as the interface function type parameter.
For the determination of the interface function type parameter, the interface action range can be analyzed, and an action object used by the interface action range is determined, wherein the action object comprises three objects of a form drop-down box control, code embedding and a function node. Then, the type of the action object is determined as an interface function type parameter.
Substep S20212, analyzing the interface polling information, and generating an interface polling parameter;
for the interface polling parameters, the interface polling information can be analyzed, the polling scheme of the custom interface is determined, and the corresponding interface polling parameters are generated. I.e., a data polling scheme that can identify custom interfaces via an interface polling parameter.
Specifically, the interface polling information includes: polling single timeout time, polling total timeout time, polling interval, and polling interrupt condition; the step of analyzing the interface polling information and generating interface polling parameters comprises the following steps: determining a single polling parameter corresponding to the polling single overtime time; determining a polling control parameter corresponding to the total polling timeout time; determining the single polling parameter, the polling control parameter, the polling interval, and the polling interrupt condition as the interface polling parameter.
In practical applications, the interface polling information includes a polling single timeout time, a polling total timeout time, a polling interval, and a polling interrupt condition. The polling interruption condition can be expressed in a code mode; such as in JS (programming language name) code.
The polling single timeout time can be determined, the single polling time range is calculated, and the polling single timeout time corresponding to the polling single timeout time is determined. The total polling timeout time can be determined, the overall time range of polling can be calculated, and the polling control parameters corresponding to the total polling timeout time can be determined. The single polling parameter, the polling control parameter, the polling interval, and the polled interrupt condition are then collectively determined to be the interface polling parameter.
Substep S20213, analyze the said interface and insert the format information, produce the interface and insert the parameter;
and analyzing the interface access format information, determining an initial format which can be identified and processed by the user-defined interface, and generating interface access parameters.
Specifically, the interface access format information includes an access format; the step of analyzing the interface access format information and generating interface access parameters comprises the following steps: determining default format parameters according to the access format; and determining the default format parameter as the interface access parameter.
In the embodiment of the present invention, the default format parameter may be determined according to the access format. The access format can be a self-defined data format, such as a JSON access format, and if the interface return format is not satisfied, the analysis logic of the format can be self-defined. And determining default format parameters as interface access parameters.
Sub-step S20214, generating the interface detail table by combining the interface basic parameter, the interface polling parameter and the interface access parameter.
And then combining the interface basic parameters, the interface polling parameters and the interface access parameters as a basic flow of the user-defined interface aiming at data processing to generate an interface detail table.
Substep S2022, generating the interface request header information table and the interface request parameter table according to the interface request information;
in the embodiment of the present invention, the interface request parameter table may be generated by determining the generation mode of the interface request according to the interface request information, and the interface request header information table may be generated by determining the header file of the interface request according to the interface request information.
Specifically, the interface request information includes a request header and request parameters; the step of generating the interface request header information table and the interface request parameter table according to the interface request information includes: generating the interface request header information table according to the request header; and generating the interface request parameter table according to the request parameters.
In practical application, the interface request information comprises a request header and a request parameter, wherein the request header corresponds to a header file, namely is determined by a request mode; the request parameters are specific request generation parameters.
And then determining the reference relation of the request header file corresponding to the request header as a request header information table according to the request header. And the specific value of the request parameter is used as the parameter of the interface request parameter table.
And a substep S2023 of generating the interface save data rule table according to the data save rule information.
And analyzing the data storage rule information, determining a data storage mode, and generating an interface storage data rule table.
Specifically, the data saving rule information includes a form field name, a manual saving value, and a data source; the step of generating the interface storage data rule table according to the data storage rule information includes: and generating the interface storage data rule table by combining the form field name, the manual storage value and the data source.
In practical application, the data storage rule information includes a form field name for data storage, whether the field needs to be filled, a data source (i.e. an interface return value or a manual input value), a field name for a return value, a manually stored value, and a preprocessing logic for return data; the preprocessing logic where the returned data is identified by means of the JS code. And then mapping and combining the form field name, the manually stored value and the data source to generate an interface stored data rule table.
That is, referring to fig. 3, the parameters of the above steps may be used to generate configuration contents of the custom interface.
Further, the interface detail table, the interface request header information table, the interface request parameter table, and the interface save data rule table may be stored; for subsequent reading.
Step 203, when the user-defined interface is called, acquiring the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data;
in the embodiment of the invention, when the user-defined interface is called, the user-defined interface can be defined by acquiring the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table; and acquiring request data for processing, and communicating with an external system.
Step 204, calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table;
when the user-defined interface is used, a communication protocol tool packet can be started at the same time, and the communication protocol tool packet is called to respectively process the request data which is suitable for the user-defined interface according to an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table so as to adopt the request data to carry out network communication.
Specifically, the communication protocol toolkit is a hypertext transfer protocol toolkit; the step of calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table comprises the following steps:
substep S2041, calling the hypertext transfer protocol toolkit to execute the interface detail table, the interface request header information table, the interface request parameter table and the interface save data rule table, setting the request data, and generating a uniform resource location request;
in the embodiment of the present invention, the hypertext transfer protocol toolkit may be http tool name; the configuration contents in the http policy execution interface detail table, the interface request header information table, the interface request parameter table, and the interface save data rule table can be called, the request data is set, and the uniform resource location request is generated.
Specifically, the step of calling the http toolkit to execute the interface detail table, the interface request header information table, the interface request parameter table, and the interface save data rule table, and setting the request data to generate a uniform resource location request includes: determining a parameter type corresponding to the request data; determining request sending information from the interface detail table, the interface request header information table, the interface request parameter table and the interface save data rule table based on the parameter type; and calling the hypertext transfer protocol toolkit to convert the request sending information into the uniform resource positioning request.
The type of the requested data can be determined, and request sending information matched with the type of the data is determined from an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table; and finally, calling the http live, namely converting the request sending information into a uniform resource positioning request by using a hypertext transfer protocol toolkit.
And a substep S2042 of sending the uniform resource location request for network communication.
And sending the same resource positioning request to an external system through a corresponding data transmission protocol, and connecting the external system for network communication.
Step 205, receiving network response data, wherein the network response data comprises a network response data format;
and after the network is established for network communication, receiving network response data. Wherein the network response data comprises a network response data format of the network response data.
Step 206, analyzing the network response data format to generate access data.
And analyzing the network response data format, determining a corresponding preprocessing flow, processing the network response data, and generating access data.
The user-defined interface of the embodiment of the invention has wider action range and can act on the form drop-down box control, code embedding and functional nodes; the user-defined interface can set the preprocessing of the request parameters, the access response format and the response data storage rule, and customize different preprocessing logics; the custom interface can configure polling conditions, customize polling times and interrupt conditions.
In order to enable a person skilled in the art to better understand the embodiments of the present invention, the following description is given by way of an example:
referring to FIG. 4, a flowchart illustrating steps of an exemplary custom interface invocation method of the present invention is shown
1. And acquiring the ID and input parameters (JSON format) of the custom interface.
2. And respectively obtaining the configuration scheme of the interface from an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table through the interface ID.
3. Firstly, judging the parameter type of each request parameter, and directly acquiring a default value stored in a database if the parameter is manually input; if the control obtains the parameters, reading the value of the corresponding control name of the input parameter (JSON) in the step 1; if the parameter is the system acquisition parameter, reading the corresponding form parameter in the system, wherein the parameter comprises the following steps: the method comprises the steps of application instance ID, node task ID, task name, task type, node ID, node type, node handler, node name, process state, process processing result, application name, application ID, process initiator ID and process initiation time. Then judging whether each request parameter has a preprocessing logic (JS code), if so, acquiring JS sandbox resources and a JS engine (Nashorn), executing the designated JS code in the sandbox through the engine, returning an execution result, saving an execution record (an execution ID, an execution result, an execution starting time, an execution ending time and an execution log) of the JS code after releasing the sandbox, and finally saving the execution result as a request parameter value; if no preprocessing logic is present, the parameter values are saved directly.
4. Network communication is performed through http client, and a request is sent and a response is received. The following parameters are required when sending a communication request: interface link, request header, request parameters, request type. If the scope of the custom interface is a function node and the saving of data or the polling of the interface is involved, a timer is started and the asynchronous processing is carried out by the timer. Firstly, an asynchronous thread is started, and an interface scheduling task is started in the thread. After each scheduling is finished, whether to continue polling is judged (whether the polling is overtime once or not, whether the total polling time is overtime or not and whether the polling interruption condition is met or not). And if the task scheduling is continued, calling the custom interface again after the polling interval. And after the polling is finished, receiving final network response data.
5. And analyzing the network response data format and judging whether the network response data format conforms to the access logic. And if the access format is not met, executing a custom function (JS code). The execution logic is similar to the parameter preprocessing logic in step 2 above. Meanwhile, if the data storage rule exists, the rule is executed, and the data is stored in the configured form field. If data preprocessing logic exists in the rule, corresponding logic (JS code) is executed, similar to the parameter preprocessing logic in step 2 above.
6. And finally returning an interface calling result.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 5, a block diagram of a custom interface calling device according to an embodiment of the present invention is shown, where a communication protocol toolkit is deployed in the custom interface, and the custom interface calling device may specifically include the following modules:
a first receiving module 501, configured to receive a configuration parameter of a custom interface;
a configuration module 502, configured to generate a database table according to the custom interface configuration parameters, where the database table includes an interface detail table, an interface request header information table, an interface request parameter table, and an interface storage data rule table;
a first obtaining module 503, configured to obtain the interface detail table, the interface request header information table, the interface request parameter table, the interface save data rule table, and the request data when the user-defined interface is called;
a calling module 504, configured to call the communication protocol toolkit, and set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table, and the interface storage data rule table.
In an optional embodiment of the invention, the apparatus further comprises:
the second receiving module is used for receiving network response data, and the network response data comprises a network response data format;
and the analysis module is used for analyzing the network response data format to generate access data.
In an optional embodiment of the present invention, the custom interface configuration parameter includes interface basic information, interface request information, interface polling information, interface access format information, and data storage rule information; the configuration module 502 includes:
the first configuration submodule is used for generating the interface detail table according to the interface basic information, the interface polling information and the interface access format information;
the second configuration submodule is used for generating the interface request header information table and the interface request parameter table according to the interface request information;
and the third configuration submodule is used for generating the interface storage data rule table according to the data storage rule information.
In an optional embodiment of the invention, the first configuration sub-module comprises:
the first analysis unit is used for analyzing the interface basic information to generate interface basic parameters;
the second analysis unit is used for analyzing the interface polling information and generating interface polling parameters;
the third analysis unit is used for analyzing the interface access format information and generating interface access parameters;
a first combining unit, configured to combine the interface basic parameter, the interface polling parameter, and the interface access parameter to generate the interface detail table.
In an optional embodiment of the present invention, the interface basic information includes an interface state, an interface path, an interface communication type, an interface name, an interface description, and an interface scope; the first parsing unit includes:
the interface release parameter determining subunit is used for determining an interface release parameter corresponding to the interface state;
a path parameter determining subunit, configured to determine a path parameter corresponding to the interface path;
the data transmission parameter determining subunit is used for determining the data transmission parameters corresponding to the interface communication types;
the first interface function type parameter determining unit is used for determining interface function type parameters according to the interface action range;
a first combining subunit, configured to determine that the interface publishing parameter, the path parameter, the data transfer parameter, the interface function type parameter, the interface name, and the interface description are the interface basic parameters.
In an optional embodiment of the present invention, the first interface function type parameter determining subunit includes:
the analysis subunit is used for analyzing the interface action range to determine an action object, wherein the action object comprises a form drop-down box control, a code embedded part and a function node;
and the second interface function type parameter determining subunit is used for determining the type of the action object as the interface function type parameter.
In an optional embodiment of the invention, the interface polling information includes: polling single timeout time, polling total timeout time, polling interval, and polling interrupt condition; the second parsing unit includes:
the single polling parameter determining subunit is used for determining a single polling parameter corresponding to the polling single timeout time;
the polling control parameter determining subunit is used for determining the polling control parameter corresponding to the polling total timeout time;
a second combining subunit, configured to determine that the single polling parameter, the polling control parameter, the polling interval, and the polling interrupt condition are the interface polling parameters.
In an optional embodiment of the present invention, the interface access format information includes an access format; the third parsing unit includes:
a default format parameter determining subunit, configured to determine a default format parameter according to the access format;
an interface access parameter determining subunit, configured to determine that the default format parameter is the interface access parameter.
In an optional embodiment of the present invention, the interface request information includes a request header and a request parameter; the second configuration submodule includes:
the second form generating unit is used for generating the interface request header information table according to the request header;
and the third list generating unit is used for generating the interface request parameter list according to the request parameters.
In an optional embodiment of the present invention, the data saving rule information includes a form field name, a manually saved value, and a data source; the third configuration sub-module includes:
and the third combination unit is used for combining the default format parameter, the form field name, the manual saved value and the data source to generate an interface saved data rule table.
In an optional embodiment of the present invention, the communication protocol toolkit is a hypertext transfer protocol toolkit; the calling module 504 includes:
the calling submodule is used for calling the hypertext transfer protocol toolkit to execute the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table, setting the request data and generating a uniform resource positioning request;
and the sending submodule is used for sending the uniform resource positioning request to carry out network communication.
In an optional embodiment of the present invention, the invoking sub-module includes:
the parameter type determining unit is used for determining the parameter type corresponding to the request data;
a request sending information determining unit, configured to determine, based on the parameter type, request sending information from the interface detail table, the interface request header information table, the interface request parameter table, and the interface save data rule table;
and the calling unit is used for calling the hypertext transfer protocol toolkit to convert the request sending information into the uniform resource positioning request.
In an optional embodiment of the invention, the apparatus further comprises:
and the third lesson module is used for receiving the interface calling result and determining the self-defined interface state according to the interface calling result.
For the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and reference may be made to the partial description of the method embodiment for relevant points.
An embodiment of the present invention further provides an electronic device, including:
a processor and a storage medium storing a computer program executable by the processor, the computer program being executable by the processor to perform a method according to any one of the embodiments of the invention when the electronic device is run. The specific implementation manner and technical effects are similar to those of the method embodiment, and are not described herein again.
The storage medium may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. In the alternative, the storage medium may be at least one memory device located remotely from the processor.
The processor may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.
Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the method according to any one of the embodiments of the present invention. The specific implementation manner and technical effects are similar to those of the method embodiment, and are not described herein again.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one of skill in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention 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, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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 terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the true scope of the embodiments of the present invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "include", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or terminal device including a series of elements includes not only those elements but also other elements not explicitly listed or inherent to such process, method, article, or terminal device. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or terminal apparatus that comprises the element.
The method, the device, the electronic device and the storage medium for calling the custom interface provided by the invention are introduced in detail, specific examples are applied in the text to explain the principle and the implementation mode of the invention, and the description of the above embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (15)

1. A method for calling a custom interface is characterized in that the custom interface is deployed with a communication protocol toolkit, and the method comprises the following steps:
receiving a custom interface configuration parameter;
generating a database table according to the custom interface configuration parameters, wherein the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table;
when the user-defined interface is called, acquiring the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data;
and calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table.
2. The method of claim 1, further comprising:
receiving network response data, wherein the network response data comprises a network response data format;
and analyzing the network response data format to generate access data.
3. The method of claim 1, wherein the custom interface configuration parameters include interface basic information, interface request information, interface polling information, interface access format information, and data retention rule information; the step of generating a database table according to the custom interface configuration parameters comprises:
generating the interface detail table according to the interface basic information, the interface polling information and the interface access format information;
generating the interface request header information table and the interface request parameter table according to the interface request information;
and generating the interface storage data rule table according to the data storage rule information.
4. The method of claim 3, wherein the step of generating the interface detail table according to the interface basic information, the interface polling information and the interface access format information comprises:
analyzing the interface basic information to generate interface basic parameters;
analyzing the interface polling information to generate interface polling parameters;
analyzing the interface access format information to generate interface access parameters;
and generating the interface detail table by combining the interface basic parameters, the interface polling parameters and the interface access parameters.
5. The method of claim 4, wherein the interface basic information comprises an interface status, an interface path, an interface communication type, an interface name, an interface description, and an interface scope; the step of analyzing the interface basic information and generating the interface basic parameters comprises the following steps:
determining an interface release parameter corresponding to the interface state;
determining a path parameter corresponding to the interface path;
determining data transmission parameters corresponding to the interface communication types;
determining interface function type parameters according to the interface action range;
determining the interface publishing parameter, the path parameter, the data transmission parameter, the interface function type parameter, the interface name and the interface description as the interface basic parameters.
6. The method of claim 5, wherein the step of determining the interface function type parameter according to the interface scope comprises:
analyzing the interface action range to determine an action object, wherein the action object comprises a form drop-down box control, a code embedded and a function node;
and determining the type of the action object as the interface function type parameter.
7. The method of claim 4, wherein the interface polling information comprises: polling single timeout time, polling total timeout time, polling interval, and polling interrupt condition; the step of analyzing the interface polling information and generating interface polling parameters comprises the following steps:
determining a single polling parameter corresponding to the polling single overtime time;
determining a polling control parameter corresponding to the total polling timeout time;
determining the single polling parameter, the polling control parameter, the polling interval, and the polling interrupt condition as the interface polling parameter.
8. The method of claim 4, wherein the interface access format information comprises an access format; the step of analyzing the interface access format information and generating interface access parameters comprises the following steps:
determining default format parameters according to the access format;
and determining the default format parameter as the interface access parameter.
9. The method of claim 3, wherein the interface request information comprises a request header and request parameters; the step of generating the interface request header information table and the interface request parameter table according to the interface request information includes:
generating the interface request header information table according to the request header;
and generating the interface request parameter table according to the request parameters.
10. The method of claim 3, wherein the data saving rule information comprises form field names, manually saved values, data sources; the step of generating the interface storage data rule table according to the data storage rule information includes:
and generating the interface storage data rule table by combining the form field name, the manual storage value and the data source.
11. The method of claim 1, wherein the communication protocol toolkit is a hypertext transfer protocol toolkit; the step of calling the communication protocol toolkit to set the request data to perform network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table comprises:
calling the hypertext transfer protocol toolkit to execute the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table, setting the request data, and generating a uniform resource positioning request;
and sending the uniform resource positioning request to carry out network communication.
12. The method according to claim 10, wherein said invoking said http toolkit to execute said interface details table, said interface request header information table, said interface request parameter table and said interface save data rule table, and said setting said request data to generate a uniform resource locator request comprises:
determining the parameter type corresponding to the request data;
determining request sending information from the interface detail table, the interface request header information table, the interface request parameter table and the interface save data rule table based on the parameter types;
and calling the hypertext transfer protocol toolkit to convert the request sending information into the uniform resource positioning request.
13. A custom interface invoking device, wherein the custom interface is deployed with a communication protocol toolkit, the device comprising:
the first receiving module is used for receiving the configuration parameters of the custom interface;
the configuration module is used for generating a database table according to the custom interface configuration parameters, and the database table comprises an interface detail table, an interface request header information table, an interface request parameter table and an interface storage data rule table;
the first obtaining module is used for obtaining the interface detail table, the interface request header information table, the interface request parameter table, the interface storage data rule table and the request data when the user-defined interface is called;
and the calling module is used for calling the communication protocol toolkit to set the request data for network communication according to the interface detail table, the interface request header information table, the interface request parameter table and the interface storage data rule table.
14. An electronic device comprising a processor, a memory, and a computer program stored on the memory and capable of running on the processor, the computer program when executed by the processor implementing the steps of the custom interface calling method according to any of claims 1 to 12.
15. A computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, carries out the steps of the custom interface calling method according to any one of claims 1 to 12.
CN202310050509.6A 2023-02-01 2023-02-01 Custom interface calling method and device, electronic equipment and storage medium Active CN115878630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310050509.6A CN115878630B (en) 2023-02-01 2023-02-01 Custom interface calling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310050509.6A CN115878630B (en) 2023-02-01 2023-02-01 Custom interface calling method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115878630A true CN115878630A (en) 2023-03-31
CN115878630B CN115878630B (en) 2023-06-23

Family

ID=85758599

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310050509.6A Active CN115878630B (en) 2023-02-01 2023-02-01 Custom interface calling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115878630B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026797A (en) * 2019-12-02 2020-04-17 卫盈联信息技术(深圳)有限公司 Service data processing method, server and storage medium
CN111104191A (en) * 2019-12-17 2020-05-05 深圳前海环融联易信息科技服务有限公司 Interface docking method and device, computer equipment and storage medium
US20210181970A1 (en) * 2019-12-12 2021-06-17 Exxonmobil Research And Engineering Company Multiple interface data exchange application for use in process control
CN113779444A (en) * 2021-11-12 2021-12-10 北京宇信科技集团股份有限公司 Interface development method, zero code engine and zero code data interface development system
CN114443732A (en) * 2021-12-29 2022-05-06 格美安(北京)信息技术有限公司 Dynamic interface calling method and storage medium
CN115185717A (en) * 2022-09-14 2022-10-14 北京达佳互联信息技术有限公司 Interface calling method and device, electronic equipment and storage medium
CN115543479A (en) * 2022-09-29 2022-12-30 城云科技(中国)有限公司 Interface calling analysis method and device suitable for dynamic parameters

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026797A (en) * 2019-12-02 2020-04-17 卫盈联信息技术(深圳)有限公司 Service data processing method, server and storage medium
US20210181970A1 (en) * 2019-12-12 2021-06-17 Exxonmobil Research And Engineering Company Multiple interface data exchange application for use in process control
CN111104191A (en) * 2019-12-17 2020-05-05 深圳前海环融联易信息科技服务有限公司 Interface docking method and device, computer equipment and storage medium
CN113779444A (en) * 2021-11-12 2021-12-10 北京宇信科技集团股份有限公司 Interface development method, zero code engine and zero code data interface development system
CN114443732A (en) * 2021-12-29 2022-05-06 格美安(北京)信息技术有限公司 Dynamic interface calling method and storage medium
CN115185717A (en) * 2022-09-14 2022-10-14 北京达佳互联信息技术有限公司 Interface calling method and device, electronic equipment and storage medium
CN115543479A (en) * 2022-09-29 2022-12-30 城云科技(中国)有限公司 Interface calling analysis method and device suitable for dynamic parameters

Also Published As

Publication number Publication date
CN115878630B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
CN110888722B (en) Task processing method and device, electronic equipment and computer readable storage medium
CN111092877B (en) Data processing method and device, electronic equipment and storage medium
CN106648940B (en) Remote procedure calling method and device
CN107360261B (en) HTTP request processing method and device and electronic equipment
TWI354475B (en) Dispatching client requests to appropriate server-
US9946520B1 (en) Conversion of interpretive language functions into web applications or services
CN113612686A (en) Traffic scheduling method and device and electronic equipment
CN113918232B (en) Algorithm service calling method, device, server and storage medium
CN109446648B (en) Simulation service establishing method and device
CN111147310A (en) Log tracking processing method, device, server and medium
CN113342503B (en) Real-time progress feedback method, device, equipment and storage medium
CN106294119B (en) Test scheduling system and method and terminal equipment
CN112804682B (en) Data transmission method and device, readable medium and electronic equipment
CN112256557B (en) Program regression testing method, device, system, computer equipment and storage medium
CN111752820A (en) Pressure testing method of gPC interface, computer equipment and storage medium
CN107395663B (en) Data acquisition method and device
CN115878630A (en) User-defined interface calling method and device, electronic equipment and storage medium
CN109885792B (en) Webdriver technology-based APP bridging method
CN115426416B (en) Protocol conversion method and device, electronic equipment and storage medium
CN111597020A (en) Application Programming Interface (API) debugging method and debugging terminal
CN110874278A (en) Embedding method of external system, workflow system, device and storage medium
CN115454878A (en) Interface calling test method applied to micro service and related device
CN110022332B (en) Hypertext transfer security protocol proxy method, device, equipment and medium
CN109525539B (en) Capability calling method, call receipt method, information processing method and system
Zilhão et al. A modular tool for benchmarking loT publish-subscribe middleware

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
GR01 Patent grant
GR01 Patent grant
CP02 Change in the address of a patent holder

Address after: 100007 room 205-32, floor 2, building 2, No. 1 and No. 3, qinglonghutong a, Dongcheng District, Beijing

Patentee after: Tianyiyun Technology Co.,Ltd.

Address before: 100093 Floor 4, Block E, Xishan Yingfu Business Center, Haidian District, Beijing

Patentee before: Tianyiyun Technology Co.,Ltd.

CP02 Change in the address of a patent holder