CN115086393A - Interface calling method, device, equipment and storage medium - Google Patents

Interface calling method, device, equipment and storage medium Download PDF

Info

Publication number
CN115086393A
CN115086393A CN202210660818.0A CN202210660818A CN115086393A CN 115086393 A CN115086393 A CN 115086393A CN 202210660818 A CN202210660818 A CN 202210660818A CN 115086393 A CN115086393 A CN 115086393A
Authority
CN
China
Prior art keywords
interface
service
proxy service
interface resource
resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210660818.0A
Other languages
Chinese (zh)
Inventor
刘卓
尤江
郝忠华
王涛
张栋
董林林
寇成勃
王立冬
梁俊龙
黄智勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Winning Health Technology Group Co Ltd
Original Assignee
Winning Health Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Winning Health Technology Group Co Ltd filed Critical Winning Health Technology Group Co Ltd
Priority to CN202210660818.0A priority Critical patent/CN115086393A/en
Publication of CN115086393A publication Critical patent/CN115086393A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The application provides an interface calling method, an interface calling device, interface calling equipment and a storage medium, and relates to the technical field of the Internet. The method is applied to the front-end equipment, a webpage is integrated on the front-end equipment in advance, at least one interface resource is deployed on the proxy service in advance, the architecture of each interface resource is different from that of the interface resource supported by the webpage, the webpage sends an interface calling request to the proxy service, the proxy service is adopted to convert the service information into the service parameter of the target interface resource corresponding to the interface address, and based on the service parameter, the method comprises the steps of calling a target interface resource to obtain a service processing result of the target interface resource, converting the service processing result of the target interface resource into a page processing result of a preset interface resource by adopting proxy service, and feeding the page processing result back to a webpage page, so that webpage interaction between a heterogeneous interface and any browser is realized.

Description

Interface calling method, device, equipment and storage medium
Technical Field
The present application relates to the field of internet technologies, and in particular, to an interface calling method, apparatus, device, and storage medium.
Background
Under the framework of a browser and a server (B/S), a working interface of a user is realized through the browser, wherein a webpage at the front end is usually developed at the front end by using frames such as Vue, read, Angular and the like, and can not directly access three-party heterogeneous interfaces in the traditional form, such as DLL, OCX, EXE and the like, but the interfaces of hardware equipment such as most medical insurance card readers, CA authentication and the like at present still maintain the interface technology in the traditional form, so that the integrity of the service function of B/S products is limited, and the research, development and popularization of new products can not be met.
In the prior art, the interaction between a webpage corresponding to a browser and a three-party heterogeneous interface can be realized through an ActiveX plug-in technology and a JavaScript object injection technology, but the ActiveX plug-in technology is strictly bound with the browser and needs a specific browser for support, and the JavaScript object injection technology needs to modify the specific browser for support, so that the compatibility of the browser is poor when the three-party heterogeneous interface is interacted with the browser in the prior art, and corresponding plug-ins and objects need to be redeveloped when various technology docking modes are designed, so that the flexibility is poor, and the realization cost is high.
Disclosure of Invention
The present invention provides an interface calling method, apparatus, device and storage medium to solve the problem of poor browser compatibility when a browser interacts with a heterogeneous interface in the prior art.
In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:
in a first aspect, an embodiment of the present application provides an interface calling method, which is applied to a front-end device, where a web page and a proxy service are integrated on the front-end device in advance, at least one interface resource is deployed on the proxy service in advance, and an architecture of each interface resource is different from an architecture of an interface resource supported by the web page; the method comprises the following steps:
sending, by the web page, an interface invocation request to the proxy service, the interface invocation request including: interface address, and service information;
adopting the proxy service to convert the service information into a service parameter of a target interface resource corresponding to the interface address, and calling the target interface resource based on the service parameter to obtain a service processing result of the target interface resource;
and converting the service processing result of the target interface resource into a page processing result of a preset interface resource by adopting the proxy service, and feeding back the page processing result to the webpage.
Optionally, before the sending, by the web page, the interface call request to the proxy service, the method further includes:
sending, by the web page, a cross-domain request to the proxy service, the cross-domain request comprising: the interface address;
performing cross-domain detection by the proxy service based on the interface address, and returning a cross-domain detection result to the webpage;
sending, by the web page, an interface call request to the proxy service, including:
and if the cross-domain detection result indicates that the cross-domain detection of the interface address passes, sending an interface calling request to the proxy service by the webpage.
Optionally, before the sending, by the web page, the interface call request to the proxy service, the method further includes:
sending, by the web page to the proxy service, an interface load notification, the interface load notification comprising: an interface identifier of the target interface resource;
downloading, by the proxy service, the target interface resource from a server based on the interface identification of the target interface resource;
loading, by the proxy service, the target interface resource and allocating the interface address for the target interface resource;
feeding back, by the proxy service, an interface load response to the web page, the interface load response including: the interface address.
Optionally, the interface loading notification further includes: information to be verified; before the downloading, by the proxy service, the target interface resource from the server based on the interface identifier of the target interface resource, the method further includes:
verifying the information to be verified by the proxy service;
the downloading, by the proxy service, the target interface resource from a server based on the interface identifier of the target interface resource includes:
and if the verification is passed, downloading the target interface resource from the server side by the proxy service based on the interface identifier of the target interface resource.
Optionally, before the target interface resource is loaded by the proxy service, the method further includes:
performing integrity check on the target interface resource by the proxy service;
the loading, by the proxy service, the target interface resource includes:
and if the integrity check is passed, loading the target interface resource by the proxy service.
Optionally, the downloading, by the proxy service, the target interface resource from the server based on the interface identifier of the target interface resource includes:
and downloading the target interface resource from the server by the proxy service by adopting a secure file transfer protocol based on the interface identifier of the target interface resource.
Optionally, the preset interface resource is any interface resource supported by the webpage, or a standard interface resource is preset;
the converting the service processing result of the target interface resource into the page processing result of the preset interface resource by using the proxy service includes:
and coding the service processing result of the target interface resource by adopting the proxy service to obtain a page processing result of the preset interface resource.
In a second aspect, an embodiment of the present application provides an interface invoking device, including:
a sending module, configured to send, by the web page, an interface call request to the proxy service, where the interface call request includes: interface address, and service information;
the calling module is used for converting the service information into a service parameter of a target interface resource corresponding to the interface address by adopting the proxy service, and calling the target interface resource based on the service parameter to obtain a service processing result of the target interface resource;
and the feedback module is used for converting the service processing result of the target interface resource into a page processing result of a preset interface resource by using the proxy service and feeding the page processing result back to the webpage.
In a third aspect, an embodiment of the present application provides a computer device, including: a storage medium and a processor, where the storage medium stores a computer program executable by the processor, and the processor implements the interface calling method according to the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored on the storage medium, and when the computer program is executed by a processor, the interface calling method of the first aspect is implemented.
Compared with the prior art, the method has the following beneficial effects:
according to the interface calling method, the device, the equipment and the storage medium provided by the embodiment of the application, a webpage and a proxy service can be pre-integrated on front-end equipment, at least one interface resource is pre-deployed on the proxy service, the architecture of each interface resource is different from that of the interface resource supported by the webpage, an interface calling request is sent to the proxy service through the webpage, and the interface calling request comprises the following steps: the method comprises the steps of adopting proxy service to convert service information into service parameters of target interface resources corresponding to interface addresses, calling the target interface resources based on the service parameters to obtain service processing results of the target interface resources, adopting the proxy service to convert the service processing results of the target interface resources into page processing results of preset interface resources, and feeding the page processing results back to a webpage, wherein the webpage and the proxy service are integrated on front-end equipment in advance, the webpage can call heterogeneous interfaces with architectures different from the architecture of the interface resources not supported by the webpage through the proxy service to obtain the service processing results corresponding to the heterogeneous interfaces, and further obtain the page processing results, the interaction of the heterogeneous interfaces and the webpage of any browser is realized, compared with the existing ActiveX plug-in technology and JavaScript object injection technology, the compatibility of the browser is improved, multiple plug-ins and objects do not need to be developed for various heterogeneous interfaces, the interaction flexibility of the heterogeneous interfaces and the webpage of any browser is improved, and the interaction cost is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of an interface calling method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another interface invoking method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another interface calling method according to an embodiment of the present application;
fig. 4 is a schematic timing diagram of an interface calling method according to an embodiment of the present application;
fig. 5 is a schematic flowchart of an application call according to an embodiment of the present application;
fig. 6 is a schematic diagram of an interface invoking device according to an embodiment of the present disclosure;
fig. 7 is a schematic diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present invention, the terms "first," "second," "third," and the like, if any, are used merely to distinguish one description from another, and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
Due to the limitation of a front-end framework (Vue, read, Angular, and the like), a webpage pre-integrated on a front-end device cannot directly access a three-party heterogeneous interface in a traditional form, such as DLL, OCX, EXE, and the like, wherein the three-party heterogeneous interface is an interface which is not supported by the webpage.
In order to enable a webpage pre-integrated on front-end equipment to directly access a three-party heterogeneous interface in a traditional form and improve the compatibility of a browser when accessing the heterogeneous interface, the scheme of the application provides an interface calling method. The interface calling method provided in the embodiments of the present application is specifically explained below with reference to a plurality of examples. Fig. 1 is a schematic flowchart of an interface calling method according to an embodiment of the present application, where the interface calling method is applied to a front-end device, a web page and a proxy service are pre-integrated on the front-end device, at least one interface resource is pre-deployed on the proxy service, an architecture of each interface resource is different from an architecture of an interface resource supported by the web page, and the at least one interface may be referred to as a heterogeneous interface. The proxy service can be configured between the browser and the server corresponding to the webpage on the front-end equipment, and can be responsible for forwarding legal network information, controlling and registering forwarding, and the functions of security, caching, content filtering, access control management and the like are also included. As shown in fig. 1, the method includes:
s101, the webpage sends the interface calling request to the proxy service.
Establishing a new response mode in the front-end equipment, wherein the response mode is a request initiated by a webpage, the proxy service processes the request after receiving the request of the webpage, and returns a processing result corresponding to the request to the webpage. Before the web page sends the interface call request to the proxy service, the proxy service may be configured for a browser corresponding to the web page on the front-end device based on a hypertext Transfer Protocol (HTTP), so as to complete deployment of the proxy service in the front-end device. For example, the proxy service may be configured in a setting page of the browser corresponding to the web page on the front-end device by setting information such as a proxy address, and may also be configured by running a configuration service code, which is not limited in this embodiment. After the proxy service is configured, information transmission between the webpage and the proxy service in the front-end equipment can be realized, and the webpage can call an interface through the proxy service.
After the proxy service is configured, establishing connection between a service proxy and a webpage, and after the connection is successful, the webpage sends an interface calling request to the service proxy, wherein the interface is a heterogeneous interface corresponding to at least one interface resource pre-deployed on the proxy service.
The interface call request includes: interface address, and traffic information.
Illustratively, the interface name corresponding to the interface call request is a print service, the interface identifier corresponding to the print service is rptresservice, and the interface address corresponding to the print service may be http://127.0.0.1: 9045/rptresservice, at this time, the interface call request may submit a form request for post, and the service information is service information corresponding to the form request, such as "disease: enteritis; hospital: the community health service center ", of course, the interface may also be other interfaces, the interface address may also be other interface addresses, and the business information may also be other business information, which is not particularly limited in the embodiment of the present application.
According to the difference of the interfaces, the corresponding interface call requests are also different, for example, the interface call requests may also be get requests, put requests, head requests, exchange requests, and the like, the interface names may be acquisition resources, log services, preferential policies, case printing, public health services (the interface may provide the community with the call of forms such as health records, physical examination of the elderly, traditional Chinese medicine records, traditional Chinese medicine identification, traditional Chinese medicine education, personal health education, and the like), medical insurance services (the interface is the call of a card reading interface and a medical insurance interface), and the like, and the embodiment of the present application is not particularly limited.
S102, adopting proxy service to convert the service information into service parameters of target interface resources corresponding to the interface addresses, and calling the target interface resources based on the service parameters to obtain service processing results of the target interface resources.
The proxy service can convert the service information in the interface calling request sent by the webpage into the service parameter of the target interface resource corresponding to the interface address. Illustratively, if the name of the target interface corresponding to the interface call request is a print service, input data of the print service needs to be in a JSON (javascript Object notation) format, where JSON is a lightweight data exchange format, and the service information at this time is a string of text information, the service information needs to be converted into information in the JSON format to obtain a service parameter of the target interface resource corresponding to the interface address, that is, the service information in the JSON format, and the service parameter can be input into the print service. Of course, the interface may also be other interfaces, and the type of the input data may also be other types, and is not particularly limited in the embodiment of the present application. When the service information in the text format is converted into the service information in the JSON format, the service information in the text format may be converted into byte data, and then the byte data may be serialized to obtain the service information in the JSON format. The conversion of the service information in the text format into the byte data can be implemented by a related function, for example, a byte function, a getBytes function, or the like, and may also be another function for converting the chinese data into the byte data, which is not limited in this embodiment of the application.
The proxy service can call the target interface resource based on the service parameter, and can obtain a service processing result of the target interface resource. For example, if the name of the target interface corresponding to the interface call request is a print service, the service processing result obtained after the proxy service calls the target interface resource may be a successful print or a failed print. Of course, the interface may also be other interfaces, and the service processing result may also be other service processing results, which is not specifically limited in this embodiment of the application.
And S103, converting the service processing result of the target interface resource into a page processing result of the preset interface resource by adopting the proxy service, and feeding back the page processing result to the webpage.
For example, if the name of the target interface corresponding to the interface call request is a print service, and input data of the print service is in a JSON format, output data of the interface is also in the JSON format, and if the output data in the JSON format is directly fed back to a webpage, the webpage cannot be identified, and therefore, a service processing result needs to be converted into a page processing result of a preset interface resource and fed back to the webpage, where the data format corresponding to the preset interface resource can be identified by the webpage, and therefore, the webpage can identify the page processing result and continue to process subsequent specific services.
According to the interface calling method, the webpage and the proxy service are integrated on the front-end equipment in advance, the webpage can call the heterogeneous interface with the structure different from the interface resource which is not supported by the webpage through the proxy service, the business processing result corresponding to the heterogeneous interface is obtained, and the page processing result is further obtained, interaction of the heterogeneous interface and the webpage of any browser is achieved, compared with the existing ActiveX plug-in technology and JavaScript object injection technology, compatibility of the browser is improved, multiple plug-ins and objects do not need to be developed for various heterogeneous interfaces, the flexibility of interaction of the heterogeneous interface and the webpage of any browser is improved, and interaction cost is reduced.
On the basis of the interface calling method shown in fig. 1, the embodiment of the present application further provides another method for implementing the interface calling method. Optionally, fig. 2 is a schematic flowchart of another interface invoking method provided in an embodiment of the present application, and as shown in fig. 2, before the method S101, before sending, by a web page, an interface invoking request to a proxy service, the method further includes:
s201, the webpage sends the cross-domain request to the proxy service.
The cross-domain request includes: an interface address.
The cross-domain resource sharing system defines a mode of interaction between the browser and the server to determine whether to allow a cross-domain request, and determines whether to allow the cross-domain request through interaction between the web page corresponding to the browser and the service agent, wherein the cross-domain request in the application is a cross-domain request with pre-check.
The webpage sends a cross-domain request with a preview to the proxy service. The cross-domain request with the pre-check requires that a webpage corresponding to the browser sends an OPTIONS pre-check request before sending a real HTTP request, and whether the proxy service supports the real request to perform cross-domain resource access is detected.
S202, the agent service carries out cross-domain detection based on the interface address and returns a cross-domain detection result to the webpage.
The proxy service intercepts the HTTP/HTTPS request, filters and identifies the OPTIONS pre-check request, and returns a response head according to resource authority configuration after receiving the OPTIONS pre-check request. Alternatively, an Origin field of the original request, i.e., an interface address, may be added to the response header Access-Control-low-Origin to indicate a domain where a cross-domain resource request is allowed, and an Access-Control-low-Origin may be added to the response header Access-Control-low-Headers to indicate a request header where a cross-domain resource request is allowed.
Optionally, the proxy service may also add Access-Control-Max-Age Header to the response Header, and identify that the web page corresponding to the browser is allowed to negotiate within a specified time without sending a pre-check request, and directly use the result of the negotiation.
And the webpage corresponding to the browser determines whether to continuously send a real request for cross-domain resource access or not according to a cross-domain detection result returned by the OPTIONS request. If the cross-domain detection result indicates that the cross-domain detection of the interface address passes, the webpage sends the interface calling request to the proxy service, and if the cross-domain detection result indicates that the cross-domain detection of the interface address does not pass, the webpage cannot cross-domain, namely the interface cannot be called.
In the interface calling method provided in the embodiment of the present application, a web page sends a cross-domain request to a proxy service, where the cross-domain request includes: and the proxy service carries out cross-domain detection based on the interface address and returns a cross-domain detection result to the webpage, so that the cross-domain of the HTTP protocol in the proxy service is realized, the interaction between the webpage corresponding to the browser and the interface is realized, the compatibility of the browser is improved, and the interaction cost is reduced.
On the basis of the interface calling method shown in fig. 1, the embodiment of the present application further provides another method for implementing the interface calling method. Optionally, fig. 3 is a schematic flowchart of another interface invoking method provided in this embodiment of the present application, and as shown in fig. 3, before the method S101, before sending, by a web page, an interface invoking request to a proxy service, the method further includes:
s301, the webpage sends an interface loading notice to the proxy service.
In the embodiment of the application, the interfaces are managed and distributed in a manner similar to online resources, namely, an interface resource management system exists, optionally, three parties can develop the interfaces according to the specification, and the interface resource management system performs management and loading. The interface resource management system may store interface codes, interface identification information, interface resource paths, interface descriptions, interface states, and the like of each heterogeneous interface, which is not specifically limited in the embodiments of the present application.
The webpage sends a loading notification of an interface to the proxy service through preset interface identification information if a certain interface needs to be called, wherein the interface loading notification comprises: an interface identification of the target interface resource.
S302, downloading the target interface resource from the server side by the proxy service based on the interface identifier of the target interface resource.
The proxy service loads the interface identifier of the target interface resource in the notification according to the interface sent by the webpage, searches for an interface resource path corresponding to the interface identifier in the interface resource management system, and downloads the corresponding target interface resource from the server according to the interface resource path. The server side stores interface resources of all interfaces in the interface resource management system. Exemplarily, if the target interface is a printing service, the interface identifier corresponding to the printing service is rptreservice, the interface resource path corresponding to the interface identifier is/opt/NETWPH/interface/rptresservice.
Optionally, the interface resource is stored in the form of an interface resource package.
Optionally, before sending the interface loading notification to the proxy service by the web page, the interface resources of all the interfaces need to be deployed to the server, and after the configuration of the interface resources is completed, the corresponding target interface resources can be downloaded from the server according to the interface resource path.
S303, the proxy service loads the target interface resource and allocates an interface address for the target interface resource.
After downloading the target interface resource from the server side, the proxy service allocates an interface address for the target interface resource, so that the webpage can directly call the interface through the interface address. Illustratively, the proxy service loads RptRestservice. zip and assigns an interface address for the print service, where the interface address may be http://127.0.0.1: 9045/RptRestservice.
S304, the proxy service loads the response to the webpage page feedback interface.
The interface load response includes: an interface address. The webpage can call a target interface corresponding to the interface loading response according to the interface loading response fed back by the proxy service.
The interface calling method provided by the embodiment of the application comprises the steps of sending an interface loading notice to the proxy service by the webpage, downloading the target interface resource from the server side by the proxy service based on the interface identifier of the target interface resource, loading the target interface resource by the proxy service, and allocates interface address for target interface resource, the proxy service feeds back interface loading response to web page, the web page can inform the proxy service to load corresponding interface according to requirement according to predefined interface identification, dynamically load and process interface resource, without deploying all interfaces to front-end equipment in advance, through the lightweight mode of interface loading, corresponding interface resources are loaded according to business requirements, the deployment workload of front-end equipment is reduced, the data storage pressure of proxy service is reduced, the data processing efficiency of the proxy service is improved, and further the interaction performance of a webpage corresponding to a browser and an interface is improved.
On the basis of the interface calling method shown in fig. 3, an embodiment of the present application further provides another method for implementing the interface calling method. Optionally, in the method S301, the interface loading notification further includes: before the method S302, before downloading the target interface resource from the server based on the interface identifier of the target interface resource, the method further includes: the information to be verified is verified by the proxy service.
In this embodiment of the present application, the information to be verified may include: the proxy service verifies the timestamp, the version information and other data in the information to be verified to determine whether the timestamp, the version information and other data meet preset requirements, and meanwhile, the proxy service also verifies the data validity. When the interface is connected, the parameter structure corresponding to the interface is easily captured by a hacker, so that the request is simulated and sent, the imposition calling of others is prevented in consideration of the safety, and the legality verification of the information in the request corresponding to the interface loading notification is required. Illustratively, validity verification can be performed through a signature method, a signature is added to all parameter values in the information to be verified, and if signature information corresponding to all parameter values in the information to be verified is consistent with signature information preset in the proxy service, the validity verification of the data is passed; the validity verification can be performed by a method of combining signature and encryption, and the validity verification can be performed on the information to be verified by other validity verification methods, which is not specifically limited in the embodiment of the present application.
And if the proxy service passes the verification of the information to be verified, downloading the target interface resource from the server side by the proxy service based on the interface identifier of the target interface resource. If the proxy service does not verify the information to be verified, the proxy service cannot download the target interface resource from the server side, and the webpage page is required to send the interface loading notification to the proxy service again.
According to the interface calling method provided by the embodiment of the application, the proxy service verifies the information to be verified, if the verification is passed, the proxy service downloads the target interface resource from the server based on the interface identifier of the target interface resource, and the proxy service verifies the information to be verified in the interface loading notification, so that the safety of the target interface resource can be improved.
On the basis of the interface calling method shown in fig. 3, an embodiment of the present application further provides another method for implementing the interface calling method. Optionally, before the method S303, before the proxy service loads the target interface resource, the method further includes: integrity checking is performed on the target interface resource by the proxy service.
After downloading the target interface resource from the server based on the interface identifier of the target interface resource, the proxy service needs to verify the integrity of the downloaded target interface resource, and if the integrity of the target interface resource passes the verification, the proxy service loads the complete target interface resource.
The integrity of the target interface resource is to check whether the target interface resource is complete, wherein if the target interface resource is infected with a virus or is infected with a virus when the target interface resource is downloaded, the integrity of the downloaded target interface resource is destroyed. The target interface resource may be implanted with a trojan or a virus by another person, the target interface resource may also have a transmission failure during the downloading process, and the integrity of the target interface resource may also be destroyed by other methods, which is not particularly limited in the embodiment of the present application.
For example, in the embodiment of the present application, the interface resource management system may store the hash value corresponding to the interface resource while uploading the interface resource through an integrity checking method based on a hash function, which may also be referred to as a hash algorithm. After downloading the target interface resource, the agent service calculates the hash value of the downloaded target interface resource, compares the calculated hash value with the prestored hash value, if the hash values are the same, the downloaded target interface resource is complete, and after the integrity check is passed, the agent service can load the target interface resource; if the hash values are different, the downloaded target interface resource is incomplete, the integrity check is not passed, and the proxy service downloads the target interface resource from the server again based on the interface identifier of the target interface resource.
According to the interface calling method provided by the embodiment of the application, the proxy service carries out integrity verification on the target interface resource, and if the integrity verification is passed, the proxy service loads the target interface resource, so that the safety of the target interface resource can be improved.
On the basis of the interface calling method shown in fig. 3, an embodiment of the present application further provides an implementation method for downloading a target interface resource method. Optionally, in the method S302, downloading, by the proxy service, the target interface resource from the server based on the interface identifier of the target interface resource, includes: and downloading the target interface resource from the server by the proxy service by adopting a secure file transfer protocol based on the interface identifier of the target interface resource.
In the embodiment of the present application, the secure File Transfer protocol may be an sftp (secure File Transfer protocol) protocol, which is a network Transfer protocol providing File access, Transfer, and management functions. The SFTP protocol is a part of an ssh (ssh File Transfer protocol) protocol, and can easily perform data transmission and data access through a secure SHELL data stream.
In an embodiment of the present application, the SFTP protocol may provide a secure encryption technique for the transmission of the interface resource to transmit and load the interface resource.
In this embodiment of the present application, the downloading of the downloading target interface resource may also be performed through other file transfer protocols such as ftp (file transfer protocol) protocol, scp (secure copy) protocol, and the like, which is not limited in this embodiment of the present application.
According to the method for downloading the target interface resource, the proxy service downloads the target interface resource from the server side by adopting the safe file transfer protocol based on the interface identifier of the target interface resource, and the safety of the target interface resource during downloading can be improved.
On the basis of the above embodiments, the embodiment of the present application further provides another method for implementing an interface calling method. Optionally, the preset interface resource is any interface resource supported by a Web page, or a standard interface resource is preset, in this embodiment, the preset interface may be a RESTful API interface, where the RESTful API interface is an application programming interface (API or Web API) conforming to the REST architecture specification, and supports interaction with a RESTful Web service.
The method S103, using the proxy service to convert the service processing result of the target interface resource into the page processing result of the preset interface resource, includes: and coding the service processing result of the target interface resource by adopting the proxy service to obtain a page processing result of the preset interface resource.
In the embodiment of the application, Base64 encoding can be performed on the service processing result of the target interface resource, an input format corresponding to a preset interface is formed by the data form of the character string and other configuration information, that is, the page processing result is fed back to the web page, so that the web page can receive the page processing result of the target interface resource.
According to the interface calling method provided by the embodiment of the application, the proxy service is adopted to encode the service processing result of the target interface resource to obtain the page processing result of the preset interface resource, and the friendliness of the webpage is improved through the interface processing mode of the preset interface.
Based on the interface calling method provided in fig. 1, fig. 2, and fig. 3 in the above embodiment of the present application, the following describes the interface calling method in detail by a complete embodiment with reference to the accompanying drawings. Fig. 4 is a timing diagram of an interface calling method according to an embodiment of the present application. As shown in fig. 4, the method includes:
s401, the webpage sends an interface loading notice to the proxy service.
The specific implementation and effect description of S401 refer to S301 in fig. 3, which is not described herein again.
S402, downloading the target interface resource from the server side by the proxy service based on the interface identification of the target interface resource.
The specific implementation and effect description of S402 refer to S302 in fig. 3, which is not described herein again.
S403, the proxy service loads the target interface resource and allocates an interface address for the target interface resource.
The specific implementation and effect description of S403 refer to S303 in fig. 3, which is not described herein again.
S404, the proxy service loads the response to the webpage page feedback interface.
The interface load response includes: an interface address.
The specific implementation and effect description of S404 refer to S304 in fig. 3, which is not described herein again.
S405, the webpage sends the cross-domain request to the proxy service.
The cross-domain request includes: an interface address.
The specific implementation and effect description of S405 are described in reference to S201 in fig. 2, and are not described herein again.
S406, the agent service carries out cross-domain detection based on the interface address and returns a cross-domain detection result to the webpage.
The specific implementation and effect description of S406 refer to S202 in fig. 2, which is not described herein again.
S407, if the cross-domain detection result indicates that the cross-domain detection of the interface address passes, the webpage sends the interface calling request to the proxy service.
The interface call request includes: interface address, and traffic information.
The specific implementation and effect description of S407 refer to S101 in fig. 1, and are not described herein again.
S408, adopting proxy service to convert the service information into service parameters of the target interface resource corresponding to the interface address, and calling the target interface resource based on the service parameters to obtain a service processing result of the target interface resource.
The specific implementation and effect description of S408 refer to S102 in fig. 1, and are not described herein again.
And S409, converting the service processing result of the target interface resource into a page processing result of the preset interface resource by adopting the proxy service, and feeding back the page processing result to the webpage.
The specific implementation and effect description of S409 refer to S103 in fig. 1, and are not described herein again.
Based on the interface calling method provided in fig. 4 in the embodiment of the present application, the following specifically explains the interface calling method with reference to an application calling flow chart. Fig. 5 is a schematic flowchart of an application call according to an embodiment of the present application. As shown in fig. 5, the proxy service downloads a target interface resource (CA interface resource, medical insurance interface resource) from the server, loads the target interface resource, and allocates an interface address for the target interface resource, and the front-end device sends an interface call request to the proxy service through a pre-integrated web page, so that the web page can implement a request call based on a service parameter through the proxy service, and can process the CA interface through the service parameter of the CA interface to obtain a service processing result of the CA interface, and can also process the medical insurance interface through the medical insurance interface to obtain a service processing result of the medical insurance interface, and can also process a corresponding interface through the service parameter of another interface, which is not specifically limited in the embodiment of the present application.
Compared with the prior art, the interface calling method provided by the embodiment of the application realizes CROSs-domain HTTP (CROS) in the proxy service, realizes unified interaction between a webpage and a heterogeneous interface through the proxy service, automatically loads and identifies heterogeneous interface resources of a request, forms a complete full-link solution for interaction between a three-party heterogeneous interface and a WEB webpage, effectively promotes service capability of a WEB webpage service system, effectively reduces workload of front-end research and development, avoids the problems of poor practicability, complex front-end delivery and the like of the prior art (ActiveX technology, CEF), is changed from the traditional lagging ActiveX technology which can be supported by a specific browser and the CEF technology which can be supported by a modified specific browser into the compatible most browsers, and can reduce workload of interaction with the heterogeneous interfaces compared with the ActiveX technology and the CEF technology for interface interaction and docking, through the improved interface loading lightweight mode, corresponding interface resources can be loaded according to business needs, and the deployment workload is reduced.
The following describes an interface calling apparatus, a device, and a storage medium for executing the interface calling apparatus, device, and storage medium provided by the present application, and specific implementation procedures and technical effects thereof are referred to above, and are not described again below.
Fig. 6 is a schematic diagram of an interface invoking device according to an embodiment of the present application, and as shown in fig. 6, the interface invoking device includes:
a sending module 601, configured to send, by the web page, an interface invocation request to the proxy service, where the interface invocation request includes: interface address, and traffic information.
The invoking module 602 is configured to use proxy service to convert the service information into a service parameter of the target interface resource corresponding to the interface address, and invoke the target interface resource based on the service parameter to obtain a service processing result of the target interface resource.
The feedback module 603 converts the service processing result of the target interface resource into a page processing result of a preset interface resource by using the proxy service, and feeds the page processing result back to the web page.
Optionally, the sending module 601 is further configured to send, by the web page, a cross-domain request to the proxy service, where the cross-domain request includes: the interface address is subjected to cross-domain detection by the proxy service based on the interface address, a cross-domain detection result is returned to the webpage, and the webpage sends an interface calling request to the proxy service, wherein the interface calling request comprises: and if the cross-domain detection result indicates that the cross-domain detection of the interface address passes, the webpage sends the interface calling request to the proxy service.
Optionally, the sending module 601 is further configured to send an interface loading notification from the web page to the proxy service, where the interface loading notification includes: the interface identification of the target interface resource is downloaded from a server side by the proxy service based on the interface identification of the target interface resource, the target interface resource is loaded by the proxy service, an interface address is distributed to the target interface resource, and the proxy service feeds back an interface loading response to the webpage page, wherein the interface loading response comprises: an interface address.
Optionally, the sending module 601 is further configured to verify, by the proxy service, the information to be verified, and download, by the proxy service, the target interface resource from the server based on the interface identifier of the target interface resource, where the method includes: and if the verification is passed, downloading the target interface resource from the server side by the proxy service based on the interface identifier of the target interface resource.
Optionally, the sending module 601 is further configured to perform integrity check on the target interface resource by the proxy service, and load the target interface resource by the proxy service, where the integrity check includes: if the integrity check passes, the proxy service loads the target interface resource.
Optionally, the sending module 601 is further configured to download, by the proxy service, the target interface resource from the server by using a secure file transfer protocol based on the interface identifier of the target interface resource.
Optionally, the feedback module 603 is further configured to encode the service processing result of the target interface resource by using the proxy service, so as to obtain a page processing result of the preset interface resource.
These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. As another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 7 is a schematic diagram of a computer device according to an embodiment of the present application, where the computer device may be a computing device or a server with a computing processing function.
The computer device includes: a processor 701, a storage medium 702, a bus 703. The processor 701 and the storage medium 702 are connected by a bus 703.
The storage medium 702 is used for storing programs, and the processor 701 calls the programs stored in the storage medium 702 to execute the above-mentioned method embodiments. The specific implementation and technical effects are similar, and are not described herein again.
Optionally, the invention also provides a program product, for example a computer-readable storage medium, comprising a program which, when being executed by a processor, is adapted to carry out the above-mentioned method embodiments.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An interface calling method is characterized in that the method is applied to front-end equipment, a webpage and a proxy service are integrated on the front-end equipment in advance, at least one interface resource is deployed on the proxy service in advance, and the architecture of each interface resource is different from that of the interface resource supported by the webpage; the method comprises the following steps:
sending, by the web page, an interface invocation request to the proxy service, the interface invocation request including: interface address, and service information;
adopting the proxy service to convert the service information into a service parameter of a target interface resource corresponding to the interface address, and calling the target interface resource based on the service parameter to obtain a service processing result of the target interface resource;
and converting the service processing result of the target interface resource into a page processing result of a preset interface resource by adopting the proxy service, and feeding back the page processing result to the webpage.
2. The interface invocation method according to claim 1, wherein, prior to the sending, by the web page, of the interface invocation request to the proxy service, the method further comprises:
sending, by the web page, a cross-domain request to the proxy service, the cross-domain request comprising: the interface address;
performing cross-domain detection by the proxy service based on the interface address, and returning a cross-domain detection result to the webpage;
sending, by the web page, an interface call request to the proxy service, including:
and if the cross-domain detection result indicates that the cross-domain detection of the interface address passes, sending an interface calling request to the proxy service by the webpage.
3. The interface call method according to claim 1, wherein before sending an interface call request to the proxy service by the web page, the method further comprises:
sending, by the web page, an interface load notification to the proxy service, the interface load notification including: an interface identifier of the target interface resource;
downloading, by the proxy service, the target interface resource from a server based on the interface identification of the target interface resource;
loading, by the proxy service, the target interface resource and allocating the interface address for the target interface resource;
feeding back, by the proxy service, an interface load response to the web page, the interface load response including: the interface address.
4. The interface call method according to claim 3, wherein the interface load notification further comprises: information to be verified; before the downloading, by the proxy service, the target interface resource from the server based on the interface identifier of the target interface resource, the method further includes:
verifying the information to be verified by the proxy service;
the downloading, by the proxy service, the target interface resource from a server based on the interface identifier of the target interface resource includes:
and if the verification is passed, downloading the target interface resource from the server side by the proxy service based on the interface identifier of the target interface resource.
5. The interface invocation method according to claim 3, wherein, prior to said loading of the target interface resource by the proxy service, the method further comprises:
performing integrity check on the target interface resource by the proxy service;
the loading, by the proxy service, the target interface resource includes:
and if the integrity check is passed, loading the target interface resource by the proxy service.
6. The interface calling method according to claim 3, wherein the downloading, by the proxy service, the target interface resource from a server based on the interface identifier of the target interface resource comprises:
and downloading the target interface resource from the server by the proxy service by adopting a secure file transfer protocol based on the interface identifier of the target interface resource.
7. The interface calling method according to any one of claims 1 to 6, wherein the preset interface resource is any interface resource supported by the web page, or a preset standard interface resource;
the converting the service processing result of the target interface resource into the page processing result of the preset interface resource by using the proxy service includes:
and coding the service processing result of the target interface resource by adopting the proxy service to obtain a page processing result of a preset interface resource.
8. An interface invocation apparatus, comprising:
the sending module sends an interface calling request to the proxy service by the webpage, wherein the interface calling request comprises: interface address, and service information;
the calling module is used for converting the service information into a service parameter of a target interface resource corresponding to the interface address by adopting the proxy service, and calling the target interface resource based on the service parameter to obtain a service processing result of the target interface resource;
and the feedback module is used for converting the service processing result of the target interface resource into a page processing result of a preset interface resource by using the proxy service and feeding the page processing result back to the webpage.
9. A computer device, comprising: a storage medium storing a computer program executable by the processor, and a processor implementing the interface calling method according to any one of claims 1 to 7 when the processor executes the computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when read and executed, implements the interface call method of any of claims 1-7.
CN202210660818.0A 2022-06-13 2022-06-13 Interface calling method, device, equipment and storage medium Pending CN115086393A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210660818.0A CN115086393A (en) 2022-06-13 2022-06-13 Interface calling method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210660818.0A CN115086393A (en) 2022-06-13 2022-06-13 Interface calling method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115086393A true CN115086393A (en) 2022-09-20

Family

ID=83251812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210660818.0A Pending CN115086393A (en) 2022-06-13 2022-06-13 Interface calling method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115086393A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016177341A1 (en) * 2015-05-07 2016-11-10 北京金山安全软件有限公司 Interface calling method and device, and terminal
CN109688280A (en) * 2018-08-21 2019-04-26 平安科技(深圳)有限公司 Request processing method, request processing equipment, browser and storage medium
CN109995720A (en) * 2017-12-30 2019-07-09 中国移动通信集团贵州有限公司 Heterogeneous device manages method, apparatus, system, equipment and medium concentratedly
CN110493352A (en) * 2019-08-30 2019-11-22 南京联创互联网技术有限公司 A kind of unified gateway service system and its method of servicing based on WEB middleware
CN110730208A (en) * 2019-09-16 2020-01-24 深圳市国信合成科技有限公司 Local device calling method and device, storage medium and device
CN110764846A (en) * 2019-12-30 2020-02-07 南京壹证通信息科技有限公司 Method for realizing cross-browser calling of computer external equipment based on local proxy service
CN112261111A (en) * 2020-10-16 2021-01-22 蜂助手股份有限公司 Method and system for realizing cross-domain access of browser in application program
CN112925589A (en) * 2019-12-06 2021-06-08 腾讯科技(深圳)有限公司 Calling method and device of expansion interface
CN113672403A (en) * 2021-07-30 2021-11-19 北京数码大方科技股份有限公司 Interface calling method and interface calling device in information system and management information system
WO2022002030A1 (en) * 2020-06-29 2022-01-06 北京沃东天骏信息技术有限公司 Data processing method, apparatus, and device, and computer readable storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016177341A1 (en) * 2015-05-07 2016-11-10 北京金山安全软件有限公司 Interface calling method and device, and terminal
CN109995720A (en) * 2017-12-30 2019-07-09 中国移动通信集团贵州有限公司 Heterogeneous device manages method, apparatus, system, equipment and medium concentratedly
CN109688280A (en) * 2018-08-21 2019-04-26 平安科技(深圳)有限公司 Request processing method, request processing equipment, browser and storage medium
CN110493352A (en) * 2019-08-30 2019-11-22 南京联创互联网技术有限公司 A kind of unified gateway service system and its method of servicing based on WEB middleware
CN110730208A (en) * 2019-09-16 2020-01-24 深圳市国信合成科技有限公司 Local device calling method and device, storage medium and device
CN112925589A (en) * 2019-12-06 2021-06-08 腾讯科技(深圳)有限公司 Calling method and device of expansion interface
CN110764846A (en) * 2019-12-30 2020-02-07 南京壹证通信息科技有限公司 Method for realizing cross-browser calling of computer external equipment based on local proxy service
WO2022002030A1 (en) * 2020-06-29 2022-01-06 北京沃东天骏信息技术有限公司 Data processing method, apparatus, and device, and computer readable storage medium
CN112261111A (en) * 2020-10-16 2021-01-22 蜂助手股份有限公司 Method and system for realizing cross-domain access of browser in application program
CN113672403A (en) * 2021-07-30 2021-11-19 北京数码大方科技股份有限公司 Interface calling method and interface calling device in information system and management information system

Similar Documents

Publication Publication Date Title
CN108901022B (en) Micro-service unified authentication method and gateway
EP3484125B1 (en) Method and device for scheduling interface of hybrid cloud
US9444787B2 (en) Non-intrusive method and apparatus for automatically dispatching security rules in cloud environment
CN110336810B (en) Information sharing method, platform, computing device and storage medium
US9015845B2 (en) Transit control for data
CN111698250B (en) Access request processing method and device, electronic equipment and computer storage medium
US20130104226A1 (en) Method and system for securing a third party communication with a hosting web page
CN110276202B (en) Method and device for detecting reverse-serialization loopholes
CN110764807B (en) Upgrading method, system, server and terminal equipment
CN108574709B (en) Method and device for realizing cross-domain operation
CN110020955B (en) Online medical insurance information processing method and device, server and user terminal
US10908971B1 (en) Method and system for generating a customizable connector
CN112688907B (en) Combined equipment remote proof mode negotiation method, related equipment and storage medium
US11556607B2 (en) System and method for abstracted analysis system design for dynamic API scanning service
CN112491776A (en) Security authentication method and related equipment
CN111988418B (en) Data processing method, device, equipment and computer readable storage medium
CN105554136B (en) Backup Data restoring method, apparatus and system
CN115543479A (en) Interface calling analysis method and device suitable for dynamic parameters
CN112968914B (en) System, method, device and medium for requesting data to be imported into vulnerability scanner in real time
CN113761509A (en) iframe verification login method and device
US11227032B1 (en) Dynamic posture assessment to mitigate reverse engineering
CN111314355B (en) Authentication method, device, equipment and medium of VPN (virtual private network) server
CN110875899A (en) Data processing method, system and network system
CN115001840B (en) Agent-based authentication method, system and computer storage medium
CN115086393A (en) Interface calling method, device, equipment and storage medium

Legal Events

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