WO2016192556A1 - Procédé, dispositif et terminal d'invocation d'interface - Google Patents
Procédé, dispositif et terminal d'invocation d'interface Download PDFInfo
- Publication number
- WO2016192556A1 WO2016192556A1 PCT/CN2016/083359 CN2016083359W WO2016192556A1 WO 2016192556 A1 WO2016192556 A1 WO 2016192556A1 CN 2016083359 W CN2016083359 W CN 2016083359W WO 2016192556 A1 WO2016192556 A1 WO 2016192556A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- interface
- parameter
- call
- identifier
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
Definitions
- the present invention relates to the field of computer technologies, and in particular, to an interface calling method, apparatus, and terminal.
- the browser has become one of the necessary application software on the mobile terminal.
- the browser kernel interprets and renders the webpage syntax.
- the browser kernel provides some standard interfaces for the client script to use or call. Therefore, by loading the client script in the webpage and interpreting and executing the client script by the browser, the dynamic display effect of the webpage can be realized, and the interaction of the webpage is enhanced. Sex. For example: implement special display effects of page elements, respond to user actions, validate form data, and more.
- the embodiment of the invention provides an interface calling method, device and terminal, which can improve the development efficiency of the extended interface.
- an embodiment of the present invention provides an interface calling method, including:
- the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to call, and the target interface is one of the extended interfaces provided by the browser;
- the data type of the output parameter is a preset first data type
- the method further includes:
- Formatting the first parameter, and the data type of the converted first parameter is a preset second data type
- the method further includes:
- the determining, according to the calling manner and the interface parameter, The first parameter in the input parameters of the target interface function includes:
- the calling mode is a synchronous call, determining the interface parameter as the first parameter in the input parameter of the target interface function;
- the other parameters of the interface parameter except the preset parameter are determined as the first parameter in the input parameter of the target interface function, and the preset parameter is used to identify the callback function.
- the request according to the second parameter, The result of the call returned to the client script includes:
- the second parameter is returned to the client script as a result of the call of the interface call request corresponding to the request identifier
- the calling mode is an asynchronous call, determining a target callback function corresponding to the request identifier, and using the second parameter as an input parameter of the target callback function, running the target callback function to obtain an output result, and then The output result is returned to the client script as a result of the call of the interface call request.
- the method further includes:
- the callback information is saved in the callback database, where the callback information includes the request identifier and a callback function identified by the preset parameter;
- Determining the target callback function corresponding to the request identifier including:
- the callback function specified by the callback information is determined as a target callback function.
- the second parameter is returned to the call result of the interface call request corresponding to the request identifier to After the client script, the method further includes:
- the determining, by the interface identifier, the calling manner of the target interface includes:
- the interface information corresponding to the interface identifier from a preset interface database, where the interface information includes an interface identifier and a calling mode;
- the calling mode corresponding to the interface identifier in the interface database is determined as the calling mode of the target interface.
- an interface calling apparatus including:
- a receiving module configured to receive an interface call request, where the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to invoke, and the target interface is one of the extended interfaces provided by the browser;
- a mode determining module configured to determine, according to the interface identifier, a calling mode of the target interface
- a parameter determining module configured to determine, according to the calling manner and the interface parameter, a first parameter in an input parameter of a target interface function corresponding to the interface identifier
- a calling module configured to invoke the request identifier of the interface call request and the first parameter as an input parameter of the target interface function, and invoke the target interface function;
- An obtaining module configured to obtain an output parameter returned after the target interface function is invoked, where the output parameter includes the request identifier and the second parameter;
- a returning module configured to return, according to the second parameter, a call result of the interface call request corresponding to the request identifier to the client script.
- the data type of the output parameter is a preset first data type
- the device further includes:
- a first conversion module configured to perform format conversion on the first parameter, and the data type of the converted first parameter is a pre- The second data type set;
- the second conversion module is configured to perform format conversion on the second parameter, and the data type of the converted second parameter is a preset third data type.
- the parameter determining module is specifically configured to:
- the calling mode is a synchronous call, determining the interface parameter as the first parameter in the input parameter of the target interface function;
- the other parameters of the interface parameter except the preset parameter are determined as the first parameter in the input parameter of the target interface function, and the preset parameter is used to identify the callback function.
- the returning module includes:
- An asynchronous return unit if the calling mode is an asynchronous call, determining a target callback function corresponding to the request identifier, and using the second parameter as an input parameter of the target callback function, running the target callback function to obtain an output result And returning the output result to the client script as a result of the call of the interface call request.
- the device further includes:
- a saving module configured to save the callback information to the callback database if the calling mode is an asynchronous call, where the callback information includes the request identifier and a callback function identified by the preset parameter;
- the synchronous return unit is specifically configured to:
- the callback function specified by the callback information is determined as a target callback function.
- the device further includes:
- a deleting module configured to delete the callback information corresponding to the request identifier in the callback database.
- the mode determining module is specifically configured to:
- the interface information corresponding to the interface identifier from a preset interface database, where the interface information includes an interface identifier and a calling mode;
- the calling mode corresponding to the interface identifier in the interface database is determined as the calling mode of the target interface.
- an embodiment of the present invention provides an interface calling apparatus, including at least one processor and a memory storing instructions executable by at least one processor.
- At least one processor is configured to: receive an interface call request, where the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to invoke, and the target interface is one of the extended interfaces provided by the browser; Determining, by the interface identifier, a calling mode of the target interface; determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of a target interface function corresponding to the interface identifier; Calling the target interface function as the input parameter of the target interface function, and acquiring an output parameter returned after calling the target interface function, where the output parameter includes the request identifier and the a second parameter, based on the second parameter, returning a call result of the interface call request corresponding to the request identifier to the client script.
- an embodiment of the present invention provides an interface calling device, including: an interface registrar, configured to record registration information of an interface, where registration information of the interface includes an interface identifier and a calling mode of the interface, and an interface database for storing Interface information of each interface; a request request database for storing the call request identifier and calling mode; a parameter converter for receiving an interface call request of the client script, the interface call request carrying a target that the client script needs to call An interface identifier and an interface parameter corresponding to the interface, where the target interface is one of the extended interfaces provided by the browser; determining, according to the interface identifier, a calling mode of the target interface; according to the calling mode and the interface parameter, Determining, by the interface proxy, the first parameter in the input parameter of the target interface function corresponding to the interface identifier; the interface proxy is configured to obtain the call information required by the interface call request, where the call information includes a request identifier, an interface identifier, and a first parameter And calling mode; and reconstructing
- an embodiment of the present invention provides a terminal, including the interface calling device according to the second aspect, the third aspect, or the fourth aspect.
- an embodiment of the present invention provides a computer readable storage medium having instructions stored therein, and when a processor of a terminal executes the instruction, the terminal executes an interface calling method as described above.
- an embodiment of the present invention provides a computer program that, when run on a processor, performs the above The interface call method.
- the interface call request is received, and the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to invoke, and the target interface is one of the extended interfaces provided by the browser; Determining, by the interface identifier, a calling mode of the target interface; determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of a target interface function corresponding to the interface identifier; Calling the target interface function as the input parameter of the target interface function, and acquiring an output parameter returned after calling the target interface function, where the output parameter includes the request identifier and the a second parameter, based on the second parameter, returning a call result of the interface call request corresponding to the request identifier to the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when developers develop an extension interface, it is only necessary to develop an interface function corresponding to the extension interface, which can improve the development efficiency of the extension interface.
- Figure 1a is a schematic diagram of an interface call provided by the prior method
- FIG. 1 is a schematic flowchart of an interface calling method according to an embodiment of the present invention.
- Figure 1b is a schematic diagram of an interface call provided in Figure 1;
- FIG. 2 is another schematic flowchart of an interface calling method according to an embodiment of the present invention.
- FIG. 3 is a schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention.
- FIG. 4 is another schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention.
- FIG. 4a is a schematic structural view of one of the return modules provided in FIG. 4;
- FIG. 5 is still another schematic structural diagram of an interface calling apparatus according to an embodiment of the present disclosure.
- FIG. 6 is a schematic structural diagram of a terminal according to an embodiment of the present disclosure.
- FIG. 7 is still another schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention.
- the embodiment of the present invention provides an interface calling method, device, and terminal.
- the interface calling method, device, and terminal provided by the embodiment of the present invention are respectively described in detail in conjunction with FIG.
- FIG. 1 is a schematic flowchart of a method for invoking an interface according to an embodiment of the present invention.
- the method may include the following steps.
- S101 Receive an interface call request, where the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to call, and the target interface is one of the extended interfaces provided by the browser.
- the method described in the embodiment of the present invention may be used in a browser on a terminal or a browser-like product.
- the terminal may be a terminal such as a computer, an IPAD, a mobile phone, or other smart device.
- the embodiment of the invention does not impose any limitation.
- the browser provides a large number of interfaces to the webpage for the client script to be loaded in the webpage, and the browser interprets and executes the client script. For example, when the browser receives the interface call request of the client script, the browser runs the interface function corresponding to the target interface specified by the information according to the information carried by the interface call request, thereby implementing the corresponding function. Therefore, in the process of loading the webpage, if the client script in the webpage needs to invoke the extension interface provided by the browser, the browser receives the interface call request.
- S102 Determine, according to the interface identifier, a calling manner of the target interface.
- the calling mode of the interface includes a synchronous call and an asynchronous call.
- the synchronous call is a blocking call, and the caller waits for the callee to return after executing, and belongs to a one-way call;
- the asynchronous call is a two-way call, similar to The processing mechanism of the message or event, the caller only has an operation request, and returns immediately after the callee finishes executing.
- the callee actively calls the callback function (callback) provided by the caller to return the execution result to the call. Therefore, asynchronous calls can improve the efficiency of the browser executing web pages.
- the calling mode of the interface is preset according to the function implemented by the extended interface.
- the subsequent operations can be performed without the return result of the interface A.
- the calling mode of the interface A can be set to be asynchronously invoked, thereby the interface parameters of the interface A.
- There is a parameter indicating the callback function which is independent of the specific function that the interface needs to implement, and is used to return the running result of the interface. For example, if the client script invokes interface B and the return result of interface B is the premise of subsequent operations, the call mode of interface B can be set to synchronous call.
- the interface information of the extended interface may be recorded in the preset interface database, where the interface information includes an interface identifier and a calling mode, and the interface identifier may be an interface name of the interface function, or may be an interface name.
- the other identifiers of the one-to-one correspondence are not limited in the embodiment of the present invention; the calling modes include synchronous calling and asynchronous calling.
- Table 1 is a schematic diagram of storage of an interface database according to an embodiment of the present invention.
- the call mode corresponding to the interface whose interface identifier is "recordHistory” and “downloadUrl” is called asynchronously, and the interface whose interface identifier is "playAudio" corresponds to the calling mode. Called for synchronization. Therefore, in the embodiment of the present invention, the calling mode of the target interface corresponding to the interface identifier may be queried from the interface database according to the interface identifier carried in the interface call request.
- the interface parameter carried in the interface call request may include a parameter that identifies a calling mode of the target interface.
- the first parameter in the interface parameter is used to indicate the calling mode of the target interface.
- the "1" is used to indicate the synchronous call, and the "0" is used to indicate the asynchronous call.
- the parameter indicating the calling mode of the target interface can also be The parameter at the other position in the interface parameter indicates that the specific value of the calling mode may be other characters, which is not limited in the embodiment of the present invention.
- the calling mode of the target interface may be determined according to the specific value of the first parameter in the interface parameter.
- the calling mode of the target interface corresponding to the interface identifier may be determined to be synchronously invoked; If it is "0", it can be determined that the calling mode corresponding to the interface identifier is asynchronously called.
- the specific form of the parameter of the calling mode of the calibration target interface is not limited, and the calibration rule may be agreed in advance.
- the calling mode of the target interface corresponding to the interface identifier may be determined according to the interface parameter carried in the interface call request. To facilitate the description of the subsequent steps, the first embodiment of the present invention is taken as an example.
- S103 Determine, according to the calling manner and the interface parameter, a first parameter in an input parameter of a target interface function corresponding to the interface identifier.
- the asynchronous call requires the caller to provide a parameter identifying the callback function, and the callee returns the execution result of the target interface function through the callback function after the execution is completed.
- the synchronous call is the result of the caller returning directly to the target interface function after execution. Therefore, if the calling mode is asynchronous, the interface parameter carried by the interface calling request has a preset parameter that identifies a callback function, and the preset parameter is provided by the caller, and the called party is responsible for calling the preset parameter.
- the callback function for the identity.
- the manner in which the client script invokes the interface is normalized, for example, the script indicating the synchronous call and the asynchronous call may be as shown in the code 1.
- the embodiment of the present invention normalizes the specification of the script call interface, wherein the number of interface parameters (arg1, arg2, etc.) and the data type are set according to actual needs.
- the last parameter in the interface parameter can be used to represent the parameter of the callback function.
- the embodiment of the present invention does not limit, and the agreement is reached in advance.
- the callback function in the asynchronous call is used to notify the client script of the result of the call.
- the specification of the callback function is also listed in code 1. It accepts an input parameter, and the type of the input parameter can be a common data type supported by the script. For example: Object object.
- the first parameter in the input parameter of the target interface function corresponding to the target interface may be directly determined according to the interface parameter carried in the interface call request. If the calling mode is asynchronous, the first parameter in the input parameter of the target interface function corresponding to the target interface is determined according to the interface parameter carried in the interface call request, and the other parameters of the interface parameter except the preset parameter are Set parameters to identify the callback function, and each preset parameter corresponds to a callback function.
- S104 Call the request identifier of the interface call request and the first parameter as an input parameter of the target interface function, and invoke the target interface function.
- the request identifier of the interface call request may be determined before the target interface function is invoked by using the request identifier of the interface call request and the first parameter as an input parameter of the target interface function. Further, considering that the browser processes the webpage, there may be a case of processing multiple interface call requests at the same time. Therefore, the request identifier is used to calibrate each interface call request of the client script call interface, and the request identifier corresponds to The interface invokes all the information associated with the request, the information including the interface identifier of the interface call request, the interface parameter, the call result, and the like, thereby tracking each interface call request and the call result by the request identifier.
- determining the request identifier of the interface call request where the request identifier may be automatically allocated when the browser kernel receives the interface call request. It can be seen that a request identifier uniquely aligns an interface call request, and the request identifier is associated with an interface identifier and an interface parameter carried in the interface call request.
- the design mode of the interface function is normalized, that is, each interface function receives one request identifier as one of the parameters of the input parameter, and the request identifier is also used as one of the parameters of the output parameter.
- the request identifier is one of the input parameters of the interface function, that is, the input parameter includes the request identifier and the first parameter;
- the request identifier is one of the parameters of the output parameter of the interface function, that is, the output parameter includes the request identifier and the The second parameter, the request identifier and the second parameter association.
- the output parameter of the interface function is obtained, and the output parameter includes a request identifier and a second parameter, and the request result identifies the call result of the interface call request by the second parameter associated with the request identifier.
- the request identifier and the first parameter are used as input parameters of the target interface function corresponding to the target interface, and the target interface function is invoked, that is, the target interface function is run.
- S105 Acquire an output parameter returned after calling the target interface function, where the output parameter includes the request identifier and the second parameter.
- the output parameter of the interface function includes a request identifier and a second parameter, where the second parameter is a parameter used by the interface function to implement the interface function and is returned to the client script, and the request identifier is used to identify the second parameter.
- the parameter is the result of the call to the request of the interface of the client script.
- an output parameter returned after the target interface function is invoked is obtained, where the output parameter includes the request identifier and the second parameter.
- the second parameter is directly returned to the calling as the calling result of the interface calling request corresponding to the request identifier.
- a party wherein the request identifier is associated with the second parameter.
- the calling mode is an asynchronous call
- the caller since the caller can continue to perform subsequent operations without waiting for the callee to return the call result, the call result is returned to the caller through the callback function. Therefore, the called party uses the second parameter as an input parameter of the callback function, and returns the call result of the interface call request corresponding to the request identifier to the caller by calling the callback function, wherein the request identifier is associated with the second parameter, and the callback is The function is a preset parameter that is calibrated in the interface parameter carried by the interface request request corresponding to the request identifier. Understandably, the caller is a client-side script and the callee is a browser. Thus, the result of the call of the interface call request is returned to the client script, and the call of the interface is completed.
- FIG. 1b is a schematic diagram of an interface call provided in FIG.
- the interface middle layer receives the interface call request, and the interface call request carries the target interface that the client script needs to call.
- Interface identifier and interface parameters wherein the target interface is an extension provided by the browser Any expansion interface in the port; the target interface function corresponding to the target interface is invoked by the above method, and the running result of the target interface function is returned to the client script as a result of the call of the interface call request.
- the developer when developing the extended interface, the developer only needs to develop a corresponding interface function for the extended interface, and it is not necessary to design a set of the interface for each extended interface. Method to reduce workload and improve development efficiency.
- an interface call request is received, where the interface call request carries an interface identifier and an interface parameter corresponding to a target interface that the client script needs to invoke, and the target interface is provided by the browser.
- Determining, according to the interface identifier, a calling mode of the target interface determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of the target interface function corresponding to the target interface; Calling the request identifier of the interface call request and the first parameter as input parameters of the target interface function, calling the target interface function; and obtaining an output parameter returned after calling the target interface function, where the output parameter includes the Determining the identifier and the second parameter; and returning, according to the second parameter, the result of the call of the interface call request corresponding to the request identifier to the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when a developer develops an extension interface, it is only necessary to develop an interface function corresponding to the extension interface to improve development efficiency.
- FIG. 2 is another schematic flowchart of an interface calling method according to an embodiment of the present invention.
- the method may include the following steps.
- S201 Receive an interface call request, where the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to invoke.
- S202 Determine, according to the interface identifier, a calling manner of the target interface.
- the calling interface to be called is determined according to the interface call request, and the calling mode of the target interface is determined, and the calling manner includes a synchronous call and an asynchronous call.
- the interface information of each interface is pre-stored in the interface database, and the interface information includes an interface identifier and a calling mode.
- the interface identifier is used to query the interface information corresponding to the interface identifier, and the interface information includes the interface identifier and the calling mode, and the interface information is included in the interface database.
- the calling mode corresponding to the interface identifier is determined as the calling mode of the target interface.
- the calling mode of the target interface may also be calibrated in the interface parameter of the interface call request when the client script calls the target interface.
- the embodiment of the present invention is not limited.
- determining the calling mode of the target interface may be: querying, according to the interface identifier, the interface information corresponding to the interface identifier from the preset interface database, where the interface information includes the interface identifier and the calling mode; The calling mode corresponding to the interface identifier that is queried in the interface database is determined as the calling mode of the target interface.
- S203 Determine, according to the calling manner and the interface parameter, a first parameter in an input parameter of a target interface function corresponding to the interface identifier.
- the asynchronous call requires the client script to carry a parameter identifying the callback function in the interface parameter.
- the parameter identifying the callback function is referred to as a preset parameter.
- the last parameter in the interface parameter of the asynchronous call may be used to store the preset parameter.
- the preset parameter may be set to other positions in the interface parameter according to a pre-agreed.
- the preset parameter that identifies the callback function in the interface parameter is obtained, and the callback information is saved in a preset callback database, where the callback information includes the request identifier and
- the callback function identified by the preset parameter may further include other information such as an environment variable required to run the callback function, and the embodiment of the present invention is not limited. Therefore, when the subsequent step (for example, step S208) returns the result of the asynchronous call, the target callback function corresponding to the request identifier is queried from the callback database according to the request identifier in the output parameter returned after the target interface function is called.
- a script representing a synchronous call and an asynchronous call may be as shown in code 1 in the above embodiment.
- the interface parameters synchronously called are the parameters required by the target interface function corresponding to the target interface, and the preset parameters (callback) used to represent the callback function in the interface parameters of the asynchronous interface are not required in the target interface function corresponding to the target interface.
- the preset parameters calledback
- the first parameter in the input parameter of the target interface function corresponding to the target interface is determined according to the calling mode of the target interface and the interface parameter.
- the interface parameter carried in the interface call request is determined as the first parameter in the input parameter of the target interface function corresponding to the target interface; if the calling mode is asynchronous, the interface call request is carried.
- the other parameters of the interface parameter except the preset parameter are determined as the first parameter of the input parameter of the target interface function, wherein the preset parameter is used to identify a callback function, and each preset parameter corresponds to a callback function.
- S204 Perform format conversion on the first parameter, and the data type of the converted first parameter is a preset second data type.
- the design of the interface function is standardized, and the interface module is designed using the same specification regardless of the browser kernel.
- the design specification of the interface function can be as shown in the code 2.
- the developer When adding the interface function, the developer only needs to implement the corresponding function according to the specification. It is worth noting that the code 2 is merely an example, and the present invention is not limited to this example.
- id represents the request identifier corresponding to the interface call request
- kv_map saves the parameters passed in the script
- the id is a request identifier for tracking the interface call request and the call result;
- the data type of the first parameter kv_map of the interface function is a preset second data type, and the second data type may be a predefined
- the KeyValueMap type or the Value type is not limited in the embodiment of the present invention.
- the embodiment of the present invention takes the second data type as the KeyValueMap type as an example, but it should be noted that the second data type is not limited to the KeyValueMap type.
- KeyValueMap or Value is a data type, like a storage box, can be used to store a variety of different types of data, such as: integers, floating-point numbers, strings, and so on.
- the KeyValueMap is a key-value mapping table, and the mapping table stores a one-to-one correspondence between a key and a value.
- the key can be a number (the order of the parameters) ) or string (the name of the parameter), the value (Value) is the specific value of a key in the parameter.
- the determined first parameter is format converted, and the data type of the converted first parameter is a preset second data type. That is, before calling the target interface function corresponding to the target interface, it is necessary to convert the first parameter passed in by the script, such as converting the first parameter into a KeyValueMap object.
- the interface specification provided by the client script may be: function recordHistory(url,date,callback), One parameter indicates the URL of the incoming web page (url, assumed to be http: ⁇ www. Kunststoffao.cn), and the second parameter indicates the time that the incoming access is required (time, assumed to be 2014-07-20 20:00) : 00), the last parameter is a script function object, the parameter is not used as a parameter of the calling interface function, but is used to notify the script after the interface function is successfully operated. Therefore, the first parameter determined according to the interface parameter in step S103 does not include This parameter. After the first parameter is converted, the first parameter of the converted KeyValueMap type is as shown in Table 2. Table 2 is a schematic diagram of a second data type provided by the embodiment of the present invention.
- the step can be adopted. Converting the first parameter to the same data type parameter, the data type of the input parameter of the interface function is unified. Therefore, developers only need to design an interface function when developing a set of interfaces for the multi-core browser.
- S205 Call the request identifier of the interface call request and the first parameter as an input parameter of the target interface function, and invoke the target interface function.
- the request identifier of the interface call request may be determined before the target interface function is invoked by using the request identifier of the interface call request and the first parameter as an input parameter of the target interface function.
- the request identifier of the interface call request may be determined. Considering that in the process of loading the webpage, the browser may handle multiple interface call requests at the same time. Therefore, the request identifier is used to calibrate each interface call request of the client script call interface, and the request identifier corresponds to the corresponding interface call. All the requested information is associated, the information includes the interface identifier of the interface call request, the interface parameter, the call result, and the like, so that each interface call request and the call result are tracked by the request identifier.
- determining the request identifier of the interface call request where the request identifier may be automatically allocated when the browser kernel receives the interface call request. It can be seen that a request identifier uniquely aligns an interface call request, and the request identifier is associated with an interface identifier and an interface parameter carried in the interface call request.
- the related information of the interface is saved in a preset interface database, where the interface related information includes an interface identifier and an interface function, and the interface identifier may be an interface name. If the developer has provided the target interface specified by the interface call request, the interface identifier carried in the interface call request can find a unique interface function matching the interface identifier in the preset information base. In the embodiment of the present invention, according to the interface identifier carried in the interface call request, whether the interface function matching the interface identifier exists in the interface database is queried.
- the browser provides the target interface specified by the interface identifier, and searches for the target interface function according to the request identifier corresponding to the interface call request and the converted first parameter; if not, the browser does not provide the target interface function.
- the target interface returns the default error message.
- the request identifier and the first parameter converted in step S204 are used as input parameters of the found target interface function, and the target interface function is invoked.
- the request identifier and the converted first parameter are substituted into the found target interface function, and the found target interface function is run or executed. Therefore, for different browser kernels, after adopting the embodiment of the present invention, a unified specification call interface function can be adopted, and different browser kernels call the interface in the same manner, the efficiency of calling the interface is high, and the execution efficiency of the webpage is also improved.
- S206 Obtain an output parameter that is returned after the target interface function is invoked, where the output parameter includes the request identifier and a second parameter, and the data type of the output parameter is a preset first data type.
- the output parameter returned after the target interface function is invoked is obtained, where the output parameter includes the request identifier and the second parameter, and the data type of the output parameter is a preset first Data class Type, where the second parameter is used to represent the result of the operation of the target interface function.
- the first data type may be a predefined data type for accepting any type of data, or may be a general data type in a database that is included in the programming language, and the data type may receive data of any data type.
- the KeyValueMap type or the Value type is not limited in the embodiment of the present invention.
- the code 2 or the embodiment of the present invention takes the first data type as the Value type as an example, but the embodiment of the present invention does not limit the first data type to the Value type. Therefore, when developers develop extension interfaces for different browser kernels, they only need to design an interface function according to the specification. It is not necessary to design an interface function for different browser kernels, and there is no need to design the interface method corresponding to the interface function. Not only can it reduce development costs, but also improve development efficiency.
- the data type of the second parameter may be a preset first data type
- the data type of the output parameter of the interface function is a structure
- the structure includes a request identifier and a second parameter.
- S207 Perform format conversion on the second parameter, and the data type of the converted second parameter is a preset third data type.
- the second parameter in the output parameter returned after the acquired target interface function is formatted, and the data type of the converted second parameter is a preset third data type.
- the third data type may be a pre-defined data structure type for accepting any type of data, or may be a general data type in the client-side scripting language, for example, an Object object.
- the embodiment of the present invention is not limited.
- the result of the call returned to the client script is normalized to improve the execution efficiency of the script.
- the format conversion may not be performed for the second parameter, and the step S208 is performed by skipping this step.
- the second parameter is returned to the client script as a result of the call of the interface call request corresponding to the request identifier in the output parameter according to the calling mode of the target interface.
- the calling mode of the target interface is a synchronous call
- the second parameter or the formatted second parameter is returned to the client script as the calling result of the interface call request corresponding to the request identifier;
- the calling mode is an asynchronous call
- the request identifier is determined according to the request identifier.
- the target target callback function takes the second parameter or the formatted second parameter as an input parameter of the target callback function, runs the target callback function to obtain an output result, and further calls the output result as the interface.
- the result of the requested call is returned to the client script.
- the manner of determining the target callback function corresponding to the request identifier may be: querying, according to the request identifier, a callback corresponding to the request identifier from the callback database Information; the callback function specified by the callback information is determined as a target callback function.
- the callback information is stored with other information for running the target callback function, the current environment variable is set according to the information to ensure that the target callback function is normally run, and the result of the call is notified to the client script.
- the callback information corresponding to the request identifier in the callback database is deleted. Thereby, the amount of data is reduced, and the query efficiency of the target callback function is improved.
- an interface call request is received, where the interface call request carries an interface identifier and an interface parameter corresponding to a target interface that the client script needs to invoke, and the target interface is provided by the browser.
- Determining, according to the interface identifier, a calling mode of the target interface determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of the target interface function corresponding to the target interface; Calling the request identifier of the interface call request and the first parameter as input parameters of the target interface function, calling the target interface function; and obtaining an output parameter returned after calling the target interface function, where the output parameter includes the Determining the identifier and the second parameter; and returning, according to the second parameter, the result of the call of the interface call request corresponding to the request identifier to the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when a developer develops an extension interface, it is only necessary to develop an interface function corresponding to the extension interface to improve development efficiency.
- the device embodiment of the present invention is the same as the method embodiment of the present invention, and is used to perform the method described in the method embodiment of the present invention.
- the device embodiment of the present invention only shows a part related to the device embodiment of the present invention.
- details of the technical details please refer to the description of the method embodiment of the present invention, and details are not described herein again.
- FIG. 3 is a schematic structural diagram of an interface invoking device according to an embodiment of the present invention.
- the device may include: a receiving module 101, a mode determining module 102, a parameter determining module 103, and a call.
- the receiving module 101 is configured to receive an interface call request, where the interface call request carries an interface identifier and an interface parameter corresponding to a target interface that is required to be invoked by the client script, where the target interface is any one of the extended interfaces provided by the browser. extension port.
- the mode determining module 102 is configured to determine, according to the interface identifier, a calling manner of the target interface.
- the parameter determining module 103 is configured to determine, according to the calling manner and the interface parameter, a first parameter in an input parameter of a target interface function corresponding to the target interface.
- the calling module 104 is configured to invoke the target interface function by using the request identifier of the interface call request and the first parameter as an input parameter of the target interface function.
- the obtaining module 105 is configured to obtain an output parameter returned after the target interface function is invoked, where the output parameter includes the request identifier and the second parameter.
- the returning module 106 is configured to return, according to the second parameter, a call result of the interface call request corresponding to the request identifier to the client script.
- an interface call request is received, where the interface call request carries an interface identifier and an interface parameter corresponding to a target interface that the client script needs to invoke, and the target interface is provided by the browser.
- Determining, according to the interface identifier, a calling mode of the target interface determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of the target interface function corresponding to the target interface; Calling the request identifier of the interface call request and the first parameter as input parameters of the target interface function, calling the target interface function; and obtaining an output parameter returned after calling the target interface function, where the output parameter includes the Determining the identifier and the second parameter; and returning, according to the second parameter, the result of the call of the interface call request corresponding to the request identifier to the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when a developer develops an extension interface, it is only necessary to develop an interface function corresponding to the extension interface to improve development efficiency.
- FIG. 4 is another schematic structural diagram of an interface invoking device according to an embodiment of the present invention.
- the device may include: a receiving module 201, a mode determining module 202, and a parameter determining module 203.
- the receiving module 201 is configured to receive an interface call request, where the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to invoke, and the target interface is one of the extended interfaces provided by the browser.
- the mode determining module 202 is configured to determine, according to the interface identifier, a calling manner of the target interface.
- the parameter determining module 203 is configured to determine, according to the calling manner and the interface parameter, a first parameter in an input parameter of a target interface function corresponding to the target interface.
- the calling module 204 is configured to invoke the target interface function by using the request identifier of the interface call request and the first parameter as an input parameter of the target interface function.
- the obtaining module 205 is configured to obtain an output parameter returned after the target interface function is invoked, where the output parameter includes the request identifier and the second parameter.
- the returning module 206 is configured to return, according to the second parameter, a call result of the interface call request corresponding to the request identifier to the client script.
- the data type of the output parameter is a preset first data type.
- the first conversion module 207 is configured to perform format conversion on the first parameter, and the data type of the converted first parameter is a preset second data type.
- the second conversion module 208 is configured to perform format conversion on the second parameter, and the data type of the converted second parameter is a preset third data type.
- the saving module 301 is configured to save the callback information to the callback database if the calling mode is an asynchronous call, where the callback information includes the request identifier and a callback function identified by the preset parameter.
- the deleting module 302 is configured to delete the callback information corresponding to the request identifier in the callback database.
- the parameter determining module 203 is specifically configured to:
- the calling mode is a synchronous call, determining the interface parameter as the first parameter in the input parameter of the target interface function;
- the other parameters of the interface parameter except the preset parameter are determined as the first parameter in the input parameter of the target interface function, and the preset parameter is used to identify the callback function.
- the return module 206 includes: a synchronous return unit 2061 and an asynchronous return unit 2062, as shown in FIG. 4a, which is a schematic structural diagram of one of the return modules provided in FIG.
- the synchronization returning unit 2061 if the calling mode is a synchronous call, returning the second parameter to the client script as a result of calling the interface call request corresponding to the request identifier;
- the asynchronous return unit 2062 if the calling mode is an asynchronous call, determining a target callback function corresponding to the request identifier, and using the second parameter as an input parameter of the target callback function, running the target callback function to obtain an output As a result, the output result is returned to the client script as a result of the call of the interface call request.
- the synchronization return unit 2061 is specifically configured to:
- the callback function specified by the callback information is determined as a target callback function.
- the mode determining module 202 is specifically configured to:
- the interface information corresponding to the interface identifier from a preset interface database, where the interface information includes an interface identifier and a calling mode;
- the calling mode corresponding to the interface identifier in the interface database is determined as the calling mode of the target interface.
- an interface call request is received, where the interface call request carries an interface identifier and an interface parameter corresponding to a target interface that the client script needs to invoke, and the target interface is provided by the browser.
- Determining, according to the interface identifier, a calling mode of the target interface determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of the target interface function corresponding to the target interface; Calling the request identifier of the interface call request and the first parameter as input parameters of the target interface function, calling the target interface function; and obtaining an output parameter returned after calling the target interface function, where the output parameter includes the Determining the identifier and the second parameter; and returning, according to the second parameter, the result of the call of the interface call request corresponding to the request identifier to the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when a developer develops an extension interface, it is only necessary to develop an interface function corresponding to the extension interface to improve development efficiency.
- FIG. 5 is a schematic diagram of another structure of an interface calling device according to an embodiment of the present invention.
- the device may include: a parameter converter 301, an interface proxy 302, and an interface forwarder 303.
- the interface calling device may further include a callback database 308 and a callback 309.
- the developer needs to provide the interface registrar 305 with the registration information such as the interface identifier and the calling mode of the interface.
- the interface identifier is assumed to be the interface name, and the specific implementation of the interface function is provided in the main process.
- the interface registrar 305 records the registration information, and after the browser creates the rendering process, sends the registration information to the rendering process by means of inter-process communication, and the rendering process caches the registration information in the interface database 306, thereby, the interface database
- the interface information of each interface is recorded in 306.
- the storage format of the interface database can be as shown in Table 1.
- the callback database 308 is configured to store the request identifier of the asynchronous call and the callback function carried in the interface call request calibrated by the request identifier when the calling mode is asynchronous, so that the callback 309 can query the callback database 308 according to the request identifier.
- the request identifies the corresponding target callback function, and returns the call result to the script by calling the target callback function.
- the call request database 307 is configured to store the requested identifier and the calling mode, so that the interface notifier 304 obtains the output parameter after the target interface function is completed, and then queries the request database 307 according to the request identifier in the output parameter.
- the calling mode corresponds to the calling mode.
- the output parameter is directly sent to the interface proxy 302; if it is an asynchronous call, the output parameter is sent to the callback 309.
- the interface calling device can be used in a single-process browser or in a multi-process browser, but for convenience of description, a multi-process browser is taken as an example.
- the browser mostly appears as a multi-process during the running process, and the multi-process includes at least a rendering process and a main process, wherein the rendering process is used to process the rendering of the webpage content, the main process is used to process the user interface and manage all other Process Wait. Since the rendering process can only execute web pages and cannot perform other operations, the implementation of the extended interface (ie, the implementation of the interface function) must be provided in the main process. For convenience of description, assuming that the browser starts the rendering process and the main process during the running process, in the interface calling process of implementing the client script, the rendering process receives an interface call request of the client script, and the interface call request carries the client.
- the parameter converter 301 receives the interface call request of the client script 201, and the interface call request carries the interface identifier and the interface parameter corresponding to the target interface that the client script 201 needs to call, and the target interface is browsed.
- the parameter converter 301 queries the interface database 306 for the interface information corresponding to the interface identifier. If the interface does not exist, the interface is incorrectly called, and the default error information is directly returned. If yes, the interface name corresponding to the interface identifier is determined. This interface identifies the calling mode of the corresponding target interface. Further, the first parameter in the input parameter of the target interface function corresponding to the target interface is determined according to the calling mode and the interface parameter.
- the parameter converter 301 performs format conversion on the first parameter, and the data type of the converted first parameter is a preset second data type, for example, a KeyValueMap type or a Value type.
- the interface proxy 302 obtains the call information required for the interface call request from the parameter converter 301, or the parameter converter 301 sends the call information to the interface proxy 302, where the call information includes the request identifier of the interface call request, The interface name, the first parameter, and the calling mode. If the calling mode is asynchronous, the calling information further includes a callback function. Of course, the request identifier may also be determined or generated by the interface proxy 302. Specifically, the embodiment of the present invention is not limited. If the calling mode is an asynchronous call, the interface proxy 302 adds the request identifier and the callback function corresponding to the request identifier to the callback database 308 according to the acquired call information.
- the target callback function corresponding to the request identifier is queried from the callback database 308 according to the request identifier in the output parameter.
- the interface proxy 302 sends an interface call request to the interface forwarder 303 located in the main process, which may be as shown in code 4.
- the code of the client script calling the target interface can be: recordHistory('http: ⁇ www. Kunststoffao.cn' , '2014-07-20 20:00:00', onRecordHistoryDone), we can see that the first parameters include "http: ⁇ www. Kunststoffao.cn", "2014-07-20 20:00:00", callback function
- the function name is onRecordHistoryDone.
- the parameter converter 301 receives the interface call request of the client script to call the target interface recordHistory, determines the request identifier of the interface call request, and the calling mode of the target interface; And calling the mode and the interface parameter to determine a first parameter of the input parameter of the target interface function corresponding to the target interface.
- the parameter converter 303 performs format conversion on the first parameter, and the first parameter after the format conversion can be as shown in Table 2.
- the interface proxy 302 can add information such as a request identifier (request_id) identifying the interface call request, a callback function object (here, the onRecordHistoryDone function), and an environment variable required to normally execute the callback function to the callback database 308, ensuring that the callback can The result of the call is successfully returned to the script based on the information stored in the callback database 308.
- the interface proxy 302 reconstructs the interface call request according to the acquired call information, and sends the interface call request to the interface forwarder 303 in the browser main process by means of inter-process communication.
- the call request of the interface may be like a code. As shown in FIG. 4, the call request of the interface may carry a request identifier request_id, an interface name interface, a first parameter arguments, and a call mode sync, where the data type of the first parameter is a preset second data type.
- the code 4 describes the call request of the asynchronous interface.
- the request_id is used to identify the interface call request, the interface indicates that the interface identifier corresponding to the target interface is to be called, and the argument type obtained by the parameter converter 301 is preset.
- the first parameter of the first data type, sync is used to indicate the calling mode of the target interface.
- the interface proxy 302 sends the call request of the constructed interface to the interface in the browser main process by means of inter-process communication. Transponder 303. If the calling mode is a synchronous call, after the interface proxy 302 sends a call request to the interface forwarder 303, the interface proxy 302 suspends execution until the browser main process finishes executing and passes the return value. If the calling mode is an asynchronous call, after the interface proxy 302 sends the call request to the interface forwarder 303, the interface proxy 302 returns immediately, so that the rendering process can continue to perform other operations, and the execution efficiency of the webpage is high.
- the interface forwarder 303 After receiving the call request sent by the interface proxy, the interface forwarder 303 adds the request identifier and the calling manner that identifies the call request to the call request database 307 according to the call information carried in the call request, thereby being located in the main process.
- the call request database 307 stores the correspondence between each request identifier and the calling mode of the target interface specified by the call request.
- the interface forwarder 303 queries the interface registrar 305 to query the target interface function corresponding to the interface name, obtains the location of the target interface function 401 corresponding to the target interface, and uses the request identifier request_id and the first parameter argument as the queried query.
- the input parameter of the target interface function 401 is called, and the implementation of the target interface function may be an asynchronous implementation or a synchronous implementation.
- the interface function After the interface function is finished, it needs to return the running result, such as whether the operation is successful, the data to be read, etc., and the data is the output parameter of the interface function, and the data type of the output parameter is the preset first data type. Such as KeyValueMap type or Value type.
- the output parameter is passed to the interface notifier 304, where the output parameter includes the request identifier and the second parameter, and the second parameter is the call result of the interface call request corresponding to the request identifier.
- the interface notifier 304 looks up the corresponding call request and calling mode in the call request database 307 according to the request identifier.
- the interface notifier 304 sends the request identifier and the second parameter to the interface proxy 302, so that the interface proxy 302 continues to perform other operations after receiving the output parameter of the target interface function returned by the interface notifier 304.
- the parameter converter 301 performs format conversion on the second parameter of the output parameter, and the data type of the converted second parameter is a preset third data type, for example, an Object object inside the script, and further, returns a corresponding identifier of the request identifier. The result is called to the script and the synchronous call is completed. After the synchronization call is completed, the corresponding item in the call request database 307 is deleted according to the request identifier, thereby reducing the amount of data and improving the query efficiency.
- the interface proxy 302 will return to the interface forwarder 303 after sending the call request of the interface, and continue to execute other parts of the script.
- the return result of the calling interface needs to be returned by calling the callback function specified by the request. Therefore, the interface notifier 304 sends the request identifier and the second parameter to the callback 309 in the rendering process after the asynchronous call is made to the target interface corresponding to the request identifier from the call request database 307 according to the request identifier in the output parameter.
- the caller 309 uses the request identifier to query the target callback function corresponding to the request identifier from the callback database 308, and at the same time, invokes the parameter converter 301 to format convert the second parameter, and the data type of the converted second parameter is preset.
- the third data type for example, the Object object of the script, uses the converted second parameter as an input parameter of the target callback function, runs the target callback function provided by the script, and returns the result of the call, and the asynchronous interface call is completed. After the asynchronous call is completed, the corresponding items in the call request database 307 and the callback database 308 are deleted according to the request identifier, thereby reducing the amount of data and improving the query efficiency.
- an interface call request is received, where the interface call request carries an interface identifier and an interface parameter corresponding to a target interface that the client script needs to invoke, and the target interface is provided by a browser.
- Determining, according to the interface identifier, a calling mode of the target interface determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of the target interface function corresponding to the target interface;
- the interface calls the request identifier and the first parameter as input parameters of the target interface function, and invokes the target interface function; and obtains an output parameter returned after calling the target interface function, where the output parameter includes Determining the request identifier and the second parameter; and returning, according to the second parameter, a call result of the interface call request corresponding to the request identifier to the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when a developer develops an extension interface, it is only necessary to develop an interface function corresponding to the extension interface to improve development efficiency.
- FIG. 6 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
- the terminal 10 includes the interface calling device as described above.
- the terminal may include: a smart phone, a computer, a tablet computer, a notebook computer, a palmtop computer, and a terminal device such as a mobile Internet device (MID) or a PAD.
- MID mobile Internet device
- PAD PAD
- the embodiment of the present invention is not limited.
- the terminal 10 includes any interface calling device as described above, and the terminal receives an interface call request, where the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to invoke.
- the target interface is one of the extended interfaces provided by the browser; determining the calling mode of the target interface according to the interface identifier; determining the input of the target interface function corresponding to the target interface according to the calling mode and the interface parameter a first parameter of the parameter; calling the request identifier of the interface call request and the first parameter as an input parameter of the target interface function, calling the target interface function; and obtaining an output returned after calling the target interface function a parameter, the output parameter includes the request identifier and the second parameter; and based on the second parameter, returning an invocation result of the interface call request corresponding to the request identifier to the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when a developer develops an extension interface, it is only necessary to develop an interface function corresponding to the extension interface to improve development efficiency.
- FIG. 7 is a schematic structural diagram of an interface calling apparatus according to an embodiment of the present invention, for performing an interface calling method disclosed in an embodiment of the present invention, where the apparatus may include: at least one processor 401, for example, The CPU, at least one network interface 404 or other user interface 403, memory 405, at least one communication bus 402. Communication bus 402 is used to implement connection communication between these components.
- the user interface 403 can optionally include a USB interface and other standard interfaces and wired interfaces.
- Network interface 404 can optionally include a Wi-Fi interface as well as other wireless interfaces.
- the memory 405 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
- the memory 405 can optionally include at least one located far from the foregoing The storage device of the processor 401. As shown in FIG. 7, an operating system 4051 and an application 4052 may be included in the memory 405 as a computer storage medium.
- the memory 405 stores the following elements, executable modules or data structures, or a subset thereof, or their extension set:
- An operating system 4051 including various system programs for implementing various basic services and processing hardware-based tasks;
- the application 4052 includes various setting programs of a data block parameter setting program of the target network data, a partitioning program of the target data block, a comparison program of the target data block and the data block in the database, and a deletion program of the target data block, and the like. To achieve a variety of application services.
- the processor 401 is configured to invoke a program stored in the memory 405 to perform the following operations:
- the interface call request carries an interface identifier and an interface parameter corresponding to the target interface that the client script needs to call, and the target interface is one of the extended interfaces provided by the browser;
- the data type of the output parameter is a preset first data type
- the method further includes: performing the following operations:
- Formatting the first parameter, and the data type of the converted first parameter is a preset second data type
- the processor 401 performs the obtaining the output parameter returned after the calling of the target interface function, and after the output parameter includes the operation of the request identifier and the second parameter, the method further includes:
- the processor 401 performs the operation of determining the first parameter of the input parameters of the target interface function according to the calling mode and the interface parameter, including: performing the following operations:
- the calling mode is a synchronous call, determining the interface parameter as the first parameter in the input parameter of the target interface function;
- the other parameters of the interface parameter except the preset parameter are determined as the first parameter in the input parameter of the target interface function, and the preset parameter is used to identify the callback function.
- the processor 401 performs the returning, according to the second parameter, a result of calling the interface call request corresponding to the request identifier to the client script, and the following operations are performed:
- the second parameter is returned to the client script as a result of the call of the interface call request corresponding to the request identifier
- the calling mode is an asynchronous call, determining a target callback function corresponding to the request identifier, and using the second parameter as an input parameter of the target callback function, running the target callback function to obtain an output result, and then The output result is returned to the client script as a result of the call of the interface call request.
- the method further includes:
- the callback information is saved in the callback database, where the callback information includes the request identifier and a callback function identified by the preset parameter;
- the processor 401 performs the operation of determining the target callback function corresponding to the request identifier, including performing the following operations:
- the callback function specified by the callback information is determined as a target callback function.
- the method further includes:
- the processor 401 performs an operation of determining a calling manner of the target interface according to the interface identifier, including performing the following operations:
- the interface information corresponding to the interface identifier from a preset interface database, where the interface information includes an interface identifier and a calling mode;
- the calling mode corresponding to the interface identifier in the interface database is determined as the calling mode of the target interface.
- an interface call request is received, where the interface call request carries an interface identifier and an interface parameter corresponding to a target interface that the client script needs to invoke, and the target interface is an extension provided by the browser.
- Determining, according to the interface identifier, a calling mode of the target interface determining, according to the calling mode and the interface parameter, a first parameter in an input parameter of the target interface function corresponding to the target interface; Calling the requested identifier of the interface and the first parameter as input parameters of the target interface function, and calling the target interface function; Obtaining an output parameter returned after the target interface function is invoked, where the output parameter includes the request identifier and the second parameter; and returning, according to the second parameter, a call result of the interface call request corresponding to the request identifier to the Describe the client script.
- the browser can adopt a unified interface calling method to implement the call of the client script to any extended interface. Therefore, when a developer develops an extension interface, it is only necessary to develop an interface function corresponding to the extension interface to improve development efficiency.
- modules or units in all the embodiments of the present invention may be implemented by a general-purpose integrated circuit, such as a CPU (Central Processing Unit) or an ASIC (Application Specific Integrated Circuit).
- a CPU Central Processing Unit
- ASIC Application Specific Integrated Circuit
- a "computer-readable medium” can be any apparatus that can contain, store, communicate, propagate, or transport a program for use in an instruction execution system, apparatus, or device, or in conjunction with the instruction execution system, apparatus, or device.
- a more specific example (non-exhaustive list) of computer readable media includes the following: electrical connections having one or more wires (electrical Sub-device), portable computer case (magnetic device), random access memory (RAM), read only memory (ROM), erasable editable read only memory (EPROM or flash memory), fiber optic device, and portable CD Read only memory (CDROM).
- the computer readable medium may even be a paper or other suitable medium on which the program can be printed, as it may be optically scanned, for example by paper or other medium, followed by editing, interpretation or, if appropriate, other suitable The method is processed to obtain the program electronically and then stored in computer memory.
- each functional unit in each embodiment of the present invention may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
- the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
- the integrated modules, if implemented in the form of software functional modules and sold or used as stand-alone products, may also be stored in a computer readable storage medium.
- the above mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
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)
- Telephonic Communication Services (AREA)
Abstract
Conformément à des modes de réalisation, la présente invention concerne un procédé et un terminal d'invocation d'interface. Le procédé consiste : à recevoir une requête d'invocation d'interface, la requête d'invocation d'interface transportant un identificateur d'interface et un paramètre d'interface correspondant à une interface cible demandée d'être invoquée par un script de client ; à déterminer, selon l'identificateur d'interface, un mode d'invocation de l'interface cible ; à déterminer, selon le mode d'invocation et le paramètre d'interface, un premier paramètre dans des paramètres d'entrée d'une fonction d'interface cible correspondant à l'interface cible ; à invoquer la fonction d'interface cible par utilisation d'un identificateur de requête de la requête d'invocation d'interface et du premier paramètre comme les paramètres d'entrée de la fonction d'interface cible ; à acquérir des paramètres de sortie renvoyés après invocation de la fonction d'interface cible, les paramètres de sortie comprenant l'identificateur de requête et un second paramètre ; et à renvoyer, sur la base du second paramètre, un résultat d'invocation de la requête d'invocation d'interface correspondant à l'identificateur de requête au script de client. Les modes de réalisation de la présente invention améliorent une efficacité de développement d'une interface d'expansion.
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510289070.8A CN104866383B (zh) | 2015-05-29 | 2015-05-29 | 一种接口调用方法、装置及终端 |
| CN201510289070.8 | 2015-05-29 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2016192556A1 true WO2016192556A1 (fr) | 2016-12-08 |
Family
ID=53912231
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2016/083359 Ceased WO2016192556A1 (fr) | 2015-05-29 | 2016-05-25 | Procédé, dispositif et terminal d'invocation d'interface |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN104866383B (fr) |
| WO (1) | WO2016192556A1 (fr) |
Cited By (19)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109274656A (zh) * | 2018-09-04 | 2019-01-25 | 平安普惠企业管理有限公司 | 接口参数解密方法、装置、计算机设备及存储介质 |
| CN110333914A (zh) * | 2019-04-12 | 2019-10-15 | 上海连尚网络科技有限公司 | 一种用于执行目标操作的方法与设备 |
| CN110737428A (zh) * | 2019-10-21 | 2020-01-31 | Oppo广东移动通信有限公司 | 基于Hidl的通用接口设计方法、装置、终端及可读存储介质 |
| CN110968296A (zh) * | 2019-12-03 | 2020-04-07 | 政采云有限公司 | 一种数据获取方法、装置、设备及可读存储介质 |
| CN111124873A (zh) * | 2018-10-31 | 2020-05-08 | 北京国双科技有限公司 | 一种Mock数据返回方法及装置 |
| CN111310007A (zh) * | 2020-02-11 | 2020-06-19 | 北京达佳互联信息技术有限公司 | 网页接口查询方法、装置、电子设备及存储介质 |
| CN111552578A (zh) * | 2020-04-30 | 2020-08-18 | 成都新潮传媒集团有限公司 | 一种第三方接口调用方法及装置 |
| CN113377353A (zh) * | 2021-05-11 | 2021-09-10 | 北京沃东天骏信息技术有限公司 | 一种接口扫描方法及设备、存储介质 |
| CN113535830A (zh) * | 2020-04-21 | 2021-10-22 | 中移信息技术有限公司 | 接口自动扩展方法、装置、设备及存储介质 |
| CN114443019A (zh) * | 2020-11-03 | 2022-05-06 | 福建天泉教育科技有限公司 | 一种图形化编程多语言交互线程异步调用方法及终端 |
| CN114840276A (zh) * | 2022-04-15 | 2022-08-02 | 北京百度网讯科技有限公司 | 对象调用方法、装置、设备、存储介质以及程序产品 |
| CN115080006A (zh) * | 2021-03-15 | 2022-09-20 | 武汉斗鱼网络科技有限公司 | 一种数据调用方法及相关设备 |
| CN115208936A (zh) * | 2022-05-26 | 2022-10-18 | 锐凌无线有限责任公司 | 远程调用方法、系统、装置、电子设备和存储介质 |
| CN115225812A (zh) * | 2022-06-01 | 2022-10-21 | 合肥移瑞通信技术有限公司 | 摄像头控制方法、装置、电子设备及存储介质 |
| CN115499291A (zh) * | 2022-09-14 | 2022-12-20 | 平安壹钱包电子商务有限公司 | 一种业务跌零告警信息的处理方法及装置、存储介质 |
| CN115865886A (zh) * | 2022-11-28 | 2023-03-28 | 灵犀科技有限公司 | 一种基于http的跨网络数据交互方法和装置 |
| CN116128422A (zh) * | 2022-10-14 | 2023-05-16 | 马上消费金融股份有限公司 | 获取接口数据的方法、系统及装置 |
| CN117270831A (zh) * | 2023-11-17 | 2023-12-22 | 天津华来科技股份有限公司 | 一种协议类同步与协程调用兼容实现方法 |
| CN110780929B (zh) * | 2019-09-18 | 2024-05-03 | 华为技术有限公司 | 调用硬件接口的方法及电子设备 |
Families Citing this family (36)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104866383B (zh) * | 2015-05-29 | 2018-11-23 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
| CN106649078B (zh) * | 2015-11-02 | 2019-06-25 | 阿里巴巴集团控股有限公司 | 应用接口测试方法及装置 |
| CN107135073B (zh) * | 2016-02-26 | 2021-05-25 | 北京京东尚科信息技术有限公司 | 接口调用方法和装置 |
| CN106412009A (zh) * | 2016-08-29 | 2017-02-15 | 郑州悉知信息科技股份有限公司 | 接口调用方法及装置 |
| CN107194014B (zh) * | 2017-07-04 | 2021-05-28 | 贵州数据宝网络科技有限公司 | 数据源调用方法及装置 |
| CN109426570A (zh) * | 2017-08-29 | 2019-03-05 | 阿里巴巴集团控股有限公司 | 一种数据的获取方法、装置及设备 |
| CN108009026A (zh) * | 2017-10-27 | 2018-05-08 | 深圳市买买提乐购金融服务有限公司 | 接口调用方法、第三方数据接入平台及计算机可读介质 |
| CN107809332A (zh) * | 2017-11-10 | 2018-03-16 | 中国民生银行股份有限公司 | 复合接口配置及复合接口调用方法、装置 |
| CN109871285A (zh) * | 2017-12-05 | 2019-06-11 | 北京嘀嘀无限科技发展有限公司 | 动态调整方法、装置、服务器、移动终端和可读存储介质 |
| CN108650093A (zh) * | 2018-03-30 | 2018-10-12 | 深圳市富途网络科技有限公司 | 一种基于幂等性的接口实现方法 |
| CN108874557B (zh) * | 2018-05-24 | 2022-03-22 | 广东睿江云计算股份有限公司 | 一种前端接口处理方法及系统 |
| CN110618875B (zh) * | 2018-06-20 | 2025-06-20 | 北京三快在线科技有限公司 | 通信方法、分布式系统、电子设备及存储介质 |
| CN109218841B (zh) * | 2018-08-17 | 2021-01-01 | 武汉斗鱼网络科技有限公司 | 弹幕消息传输方法、装置、设备与存储介质 |
| CN109445960B (zh) * | 2018-10-18 | 2021-03-02 | 腾讯科技(深圳)有限公司 | 应用的路由方法、装置及存储介质 |
| CN109446261A (zh) * | 2018-10-31 | 2019-03-08 | 北京酷我科技有限公司 | 一种基于多个接口混合调用数据的方法及其系统 |
| CN111142960B (zh) * | 2018-11-02 | 2023-11-14 | 中国电信股份有限公司 | 接口提供方法、装置和系统 |
| CN109814863A (zh) * | 2018-12-14 | 2019-05-28 | 深圳壹账通智能科技有限公司 | 一种请求返回数据的处理方法、装置、计算机设备及计算机存储介质 |
| CN109710426A (zh) * | 2018-12-24 | 2019-05-03 | 珠海豹趣科技有限公司 | 一种进程间通信方法及相关设备 |
| CN110413423B (zh) * | 2019-07-23 | 2024-07-23 | 腾讯科技(深圳)有限公司 | 数据处理方法、相关装置、设备及存储介质 |
| CN111190950B (zh) * | 2019-10-31 | 2021-12-31 | 腾讯科技(深圳)有限公司 | 一种资产检索方法和装置 |
| CN112925589B (zh) * | 2019-12-06 | 2023-10-17 | 深圳市雅阅科技有限公司 | 扩展接口的调用方法及装置 |
| CN111158794B (zh) * | 2019-12-19 | 2023-03-31 | 苏州浪潮智能科技有限公司 | 一种面向OpenStack的API接口组合优化方法及装置 |
| CN111030111A (zh) * | 2019-12-30 | 2020-04-17 | 广东电网有限责任公司电力调度控制中心 | 电力系统稳定控制断面参数配置方法、装置、系统及介质 |
| CN111274453A (zh) * | 2020-01-14 | 2020-06-12 | 北京市商汤科技开发有限公司 | 数据运行方法、系统、电子设备以及计算机可读存储介质 |
| CN111428171B (zh) * | 2020-03-23 | 2023-06-30 | 郑州悉知信息科技股份有限公司 | 接口调用处理方法和系统 |
| CN113448742B (zh) * | 2020-03-25 | 2023-11-03 | 北京京东振世信息技术有限公司 | 一种接口数据采集方法和装置 |
| CN111581578B (zh) * | 2020-05-09 | 2022-11-29 | 郑州悉知信息科技股份有限公司 | 接口请求处理方法和装置 |
| CN112667371B (zh) * | 2020-12-07 | 2024-07-23 | 深圳市远行科技股份有限公司 | 异步任务的处理方法、装置、设备及存储介质 |
| CN112395024B (zh) * | 2020-12-09 | 2021-12-24 | 上海益世界信息技术集团有限公司 | 一种接口调用方法和相关装置 |
| CN113452721A (zh) * | 2021-08-30 | 2021-09-28 | 湖南高至科技有限公司 | 一种网络交互函数优化系统、方法、计算机设备和介质 |
| CN113849753B (zh) * | 2021-09-27 | 2025-03-21 | 平安国际智慧城市科技股份有限公司 | 动态图片缓存方法、装置、设备及存储介质 |
| CN113934476B (zh) * | 2021-10-15 | 2022-08-19 | 中电金信软件有限公司 | 逻辑调用方法、装置及电子设备 |
| CN114090082B (zh) * | 2021-11-29 | 2024-07-26 | 广州宸祺出行科技有限公司 | 一种整合规则引擎的调用外部接口的方法及系统 |
| CN116450369A (zh) * | 2022-01-05 | 2023-07-18 | 青岛海尔科技有限公司 | 一种技能接口调用方法、装置、电子设备以及存储介质 |
| CN115408415A (zh) * | 2022-07-13 | 2022-11-29 | 网易(杭州)网络有限公司 | 业务数据的获取方法、装置及电子设备 |
| CN115756415A (zh) * | 2022-12-06 | 2023-03-07 | 深圳市汇川技术股份有限公司 | 逻辑数据驱动方法、装置、设备及存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103177040A (zh) * | 2011-12-26 | 2013-06-26 | 腾讯科技(深圳)有限公司 | 网页应用的功能调用方法及装置 |
| CN103309728A (zh) * | 2012-03-12 | 2013-09-18 | 腾讯科技(深圳)有限公司 | 异步请求处理方法和设备 |
| CN104281455A (zh) * | 2014-10-11 | 2015-01-14 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
| CN104866383A (zh) * | 2015-05-29 | 2015-08-26 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CA2440321A1 (fr) * | 2001-03-23 | 2002-10-03 | S2 Technologies, Inc. | Systeme et procede de developpement et de test |
| US8019839B2 (en) * | 2009-05-11 | 2011-09-13 | Accenture Global Services Limited | Enhanced network adapter framework |
| CN103226474B (zh) * | 2013-05-10 | 2016-09-28 | 北京奇虎科技有限公司 | 网页脚本与浏览器程序之间的交互方法、装置及系统 |
-
2015
- 2015-05-29 CN CN201510289070.8A patent/CN104866383B/zh active Active
-
2016
- 2016-05-25 WO PCT/CN2016/083359 patent/WO2016192556A1/fr not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103177040A (zh) * | 2011-12-26 | 2013-06-26 | 腾讯科技(深圳)有限公司 | 网页应用的功能调用方法及装置 |
| CN103309728A (zh) * | 2012-03-12 | 2013-09-18 | 腾讯科技(深圳)有限公司 | 异步请求处理方法和设备 |
| CN104281455A (zh) * | 2014-10-11 | 2015-01-14 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
| CN104866383A (zh) * | 2015-05-29 | 2015-08-26 | 北京金山安全软件有限公司 | 一种接口调用方法、装置及终端 |
Cited By (29)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109274656A (zh) * | 2018-09-04 | 2019-01-25 | 平安普惠企业管理有限公司 | 接口参数解密方法、装置、计算机设备及存储介质 |
| CN109274656B (zh) * | 2018-09-04 | 2022-04-22 | 平安普惠企业管理有限公司 | 接口参数解密方法、装置、计算机设备及存储介质 |
| CN111124873A (zh) * | 2018-10-31 | 2020-05-08 | 北京国双科技有限公司 | 一种Mock数据返回方法及装置 |
| CN110333914B (zh) * | 2019-04-12 | 2023-09-15 | 上海连尚网络科技有限公司 | 一种用于执行目标操作的方法与设备 |
| CN110333914A (zh) * | 2019-04-12 | 2019-10-15 | 上海连尚网络科技有限公司 | 一种用于执行目标操作的方法与设备 |
| CN110780929B (zh) * | 2019-09-18 | 2024-05-03 | 华为技术有限公司 | 调用硬件接口的方法及电子设备 |
| CN110737428A (zh) * | 2019-10-21 | 2020-01-31 | Oppo广东移动通信有限公司 | 基于Hidl的通用接口设计方法、装置、终端及可读存储介质 |
| CN110737428B (zh) * | 2019-10-21 | 2023-08-15 | Oppo广东移动通信有限公司 | 基于Hidl的通用接口设计方法、装置、终端及可读存储介质 |
| CN110968296A (zh) * | 2019-12-03 | 2020-04-07 | 政采云有限公司 | 一种数据获取方法、装置、设备及可读存储介质 |
| CN110968296B (zh) * | 2019-12-03 | 2023-07-25 | 政采云有限公司 | 一种数据获取方法、装置、设备及可读存储介质 |
| CN111310007A (zh) * | 2020-02-11 | 2020-06-19 | 北京达佳互联信息技术有限公司 | 网页接口查询方法、装置、电子设备及存储介质 |
| CN111310007B (zh) * | 2020-02-11 | 2023-07-07 | 北京达佳互联信息技术有限公司 | 网页接口查询方法、装置、电子设备及存储介质 |
| CN113535830A (zh) * | 2020-04-21 | 2021-10-22 | 中移信息技术有限公司 | 接口自动扩展方法、装置、设备及存储介质 |
| CN111552578B (zh) * | 2020-04-30 | 2023-08-04 | 成都新潮传媒集团有限公司 | 一种第三方接口调用方法及装置 |
| CN111552578A (zh) * | 2020-04-30 | 2020-08-18 | 成都新潮传媒集团有限公司 | 一种第三方接口调用方法及装置 |
| CN114443019A (zh) * | 2020-11-03 | 2022-05-06 | 福建天泉教育科技有限公司 | 一种图形化编程多语言交互线程异步调用方法及终端 |
| CN115080006A (zh) * | 2021-03-15 | 2022-09-20 | 武汉斗鱼网络科技有限公司 | 一种数据调用方法及相关设备 |
| CN113377353A (zh) * | 2021-05-11 | 2021-09-10 | 北京沃东天骏信息技术有限公司 | 一种接口扫描方法及设备、存储介质 |
| CN114840276A (zh) * | 2022-04-15 | 2022-08-02 | 北京百度网讯科技有限公司 | 对象调用方法、装置、设备、存储介质以及程序产品 |
| CN115208936A (zh) * | 2022-05-26 | 2022-10-18 | 锐凌无线有限责任公司 | 远程调用方法、系统、装置、电子设备和存储介质 |
| CN115225812A (zh) * | 2022-06-01 | 2022-10-21 | 合肥移瑞通信技术有限公司 | 摄像头控制方法、装置、电子设备及存储介质 |
| CN115225812B (zh) * | 2022-06-01 | 2024-04-09 | 合肥移瑞通信技术有限公司 | 摄像头控制方法、装置、电子设备及存储介质 |
| CN115499291A (zh) * | 2022-09-14 | 2022-12-20 | 平安壹钱包电子商务有限公司 | 一种业务跌零告警信息的处理方法及装置、存储介质 |
| CN115499291B (zh) * | 2022-09-14 | 2024-04-02 | 平安壹钱包电子商务有限公司 | 一种业务跌零告警信息的处理方法及装置、存储介质 |
| CN116128422A (zh) * | 2022-10-14 | 2023-05-16 | 马上消费金融股份有限公司 | 获取接口数据的方法、系统及装置 |
| CN115865886B (zh) * | 2022-11-28 | 2023-07-18 | 灵犀科技有限公司 | 一种基于http的跨网络数据交互方法和装置 |
| CN115865886A (zh) * | 2022-11-28 | 2023-03-28 | 灵犀科技有限公司 | 一种基于http的跨网络数据交互方法和装置 |
| CN117270831A (zh) * | 2023-11-17 | 2023-12-22 | 天津华来科技股份有限公司 | 一种协议类同步与协程调用兼容实现方法 |
| CN117270831B (zh) * | 2023-11-17 | 2024-02-23 | 天津华来科技股份有限公司 | 一种协议类同步与协程调用兼容实现方法 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN104866383A (zh) | 2015-08-26 |
| CN104866383B (zh) | 2018-11-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2016192556A1 (fr) | Procédé, dispositif et terminal d'invocation d'interface | |
| CN113468448B (zh) | 页面渲染方法及装置 | |
| CN109088764B (zh) | 访问请求处理方法及相关设备 | |
| US8978023B2 (en) | Canonical mechanism for securely assembling features into a mobile application | |
| US20180196665A1 (en) | Managing, using, and updating application resources | |
| WO2019104973A1 (fr) | Procédé d'invocation de langage croisé, serveur et support d'informations | |
| WO2019104975A1 (fr) | Procédé d'appel à distance basé sur une infrastructure dubbo, serveur et support d'informations | |
| WO2016177341A1 (fr) | Procédé et dispositif d'appel d'interface, et terminal | |
| US9400633B2 (en) | Methods and apparatus for voiced-enabling a web application | |
| WO2018161813A1 (fr) | Procédé et dispositif de chargement de ressources | |
| CN110109983B (zh) | 一种操作Redis数据库的方法和装置 | |
| WO2013097592A1 (fr) | Technique de chargement de script | |
| WO2015021809A1 (fr) | Procédé et appareil d'exécution de code langage dynamique | |
| US11930096B2 (en) | Systems and methods for rendering interactive web pages | |
| JP2014513821A (ja) | Webアクセスを実装するための方法およびWebサーバ | |
| CN105871960B (zh) | 调用数据共享的方法、装置及设备 | |
| US11556608B2 (en) | Caching for single page web applications | |
| CN112347794B (zh) | 数据翻译方法、装置、设备及计算机存储介质 | |
| CN112235132B (zh) | 动态配置服务的方法、装置、介质以及服务器 | |
| CN113448995B (zh) | 数据库操作方法及装置、系统、电子设备和存储介质 | |
| CN110858238B (zh) | 一种数据处理的方法和装置 | |
| CN118331765B (zh) | 鸿蒙小程序运行时的jsBridge通信方法、装置及存储介质 | |
| CN110413270A (zh) | 一种dbus对象的通用创建方法及装置 | |
| CN117520000A (zh) | Html5页面与原生应用模块的通信方法及装置 | |
| CN111581578B (zh) | 接口请求处理方法和装置 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16802479 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 27.03.2018) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 16802479 Country of ref document: EP Kind code of ref document: A1 |