CN109005163B - HTTP dynamic request service calling method - Google Patents
HTTP dynamic request service calling method Download PDFInfo
- Publication number
- CN109005163B CN109005163B CN201810804414.8A CN201810804414A CN109005163B CN 109005163 B CN109005163 B CN 109005163B CN 201810804414 A CN201810804414 A CN 201810804414A CN 109005163 B CN109005163 B CN 109005163B
- Authority
- CN
- China
- Prior art keywords
- server
- calling
- application
- request
- service
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/133—Protocols for remote procedure calls [RPC]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/565—Conversion or adaptation of application format or content
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Stored Programmes (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention relates to a method for calling HTTP dynamic request service. Which comprises the following steps: s1: the server configures application module information; s2: the front-end application acquires the data of the loading module from the server; s3: loading the loading module data acquired by the front-end application from the server on the application front-end page according to a uniform calling method and format; s4: executing a calling server method in an application front-end page; s5: the server side analyzes the front-end application request in a unified mode, and elements required for calling the corresponding interfaces are obtained; s6: the server side calls a corresponding interface; s7: and the server returns data. The invention can be applied to application projects needing to dynamically call the server method, reduces the complexity of calling the service and is convenient for maintenance. Specifically, the service calling mode is abstracted, the structure and the transmission format of the method are called uniformly, and the front-end application can call corresponding services uniformly in different service scenes in a configuration mode, so that the complexity is reduced, and the maintenance is facilitated.
Description
Technical Field
The invention belongs to the technical field of computers, particularly relates to a service calling technology, and particularly relates to a dynamic HTTP request service calling method.
Background
With the development of mobile network technology, application programs are rapidly becoming mainstream programs on terminals. The user can use the application of each network service provider to communicate with the corresponding service end, so as to realize each service of the network service provider. Specifically, the user interacts with the server through each page opened in the application to complete each process of acquiring service information, starting and controlling a service process, submitting service data and the like.
However, in the prior art, each service scene, especially a module that needs to be dynamically rendered, needs to write a method call service (i.e., writing a method on each service scene as needed and calling a corresponding service interface respectively), and is complex to operate; in addition, the written methods are inconsistent among different people, which also causes difficulty in maintenance.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method for calling HTTP dynamic request service.
The technical scheme of the HTTP dynamic request service calling method is as follows:
an HTTP dynamic request service invocation method, comprising the following steps:
step S1: the server configures application module information;
step S2: the front-end application acquires the data of the loading module from the server;
step S3: loading the loading module data acquired by the front-end application from the server on the application front-end page according to a uniform calling method and format;
step S4: executing a calling server method in an application front-end page;
step S5: the server side analyzes the front-end application request in a unified mode, and elements required for calling the corresponding interfaces are obtained;
step S6: the server side calls a corresponding interface;
step S7: and the server returns data.
The HTTP dynamic request service calling method of the invention can uniformly call the corresponding service in different service scenes in a configuration mode by abstracting the service calling mode and unifying the structure and the transmission format of the calling method; compared with the traditional method (respectively compiling a method according to needs in each business scene and respectively calling corresponding service interfaces), the HTTP dynamic request service calling method can abstract a model of calling the service by the front-end application, enables the URL (uniform resource locator), the parameters and the like of the service to be dynamically obtained through the background configuration of the server, and enables the front-end application to uniformly call the corresponding service in different business scenes in a configuration mode through a uniform front-end application calling mode, thereby reducing the complexity and facilitating the maintenance.
According to a preferred embodiment, in step S1, the way that the server configures the application module information is as follows:
and configuring modules related to the whole application and interface information to be called in a server management background system.
According to a preferred embodiment, in step S2, the manner of acquiring the loaded module data from the server by the front-end application is as follows:
when the front-end application is opened, the front-end application pulls data of all modules of the application from the server, and a front-end page is rendered according to the data loading module.
According to a preferred embodiment, in step S5, the way that the server parses the front-end application request in a unified manner is:
the server receives the front-end application request according to a uniform processing model, analyzes the received request according to a mode appointed when the server configures the application module information, and converts the received request into elements required for calling the corresponding interface.
According to a preferred embodiment, in the step S5, the elements required for calling the corresponding interface include a service URL and parameters, a request mode, and a return type.
According to a preferred embodiment, in the step S5, the request mode is a POST request mode or a GET request mode.
According to a preferred embodiment, in step S6, the way that the server side invokes the corresponding interface is:
the elements required for calling the corresponding interface are obtained from the step S5, assembled into a network call format, and executed.
According to a preferred embodiment, in step S6, an http policy call interface is used.
According to a preferred embodiment, in the process of returning data by the server, if the returned data is abnormal, the server returns abnormal information; otherwise, returning the data returned by the calling server to the front-end page.
Compared with the prior art, the HTTP dynamic request service calling method has the following beneficial effects:
the HTTP dynamic request service calling method of the invention can uniformly call the corresponding service in different service scenes in a configuration mode by abstracting the service calling mode and unifying the structure and the transmission format of the calling method; compared with the traditional method (respectively compiling a method according to needs in each business scene and respectively calling corresponding service interfaces), the HTTP dynamic request service calling method can abstract a model of calling the service by the front-end application, enables the URL (uniform resource locator), the parameters and the like of the service to be dynamically obtained through the background configuration of the server, and enables the front-end application to uniformly call the corresponding service in different business scenes in a configuration mode through a uniform front-end application calling mode, thereby reducing the complexity and facilitating the maintenance.
The HTTP dynamic request service calling method can be applied to application items needing dynamic calling of the server method, reduces the complexity of calling the service and facilitates the maintenance of the service.
Drawings
Fig. 1 is a schematic diagram of the main steps of the HTTP dynamic request service invocation method of the present invention.
Detailed Description
The HTTP dynamic request service invoking method of the present invention is described in detail below with reference to the accompanying drawings.
FIG. 1 is a schematic diagram of the main steps of the HTTP dynamic request service invocation method of the present invention; a preferred embodiment of the HTTP dynamic request service invocation method of the present invention is shown.
As shown in fig. 1, a method for invoking HTTP dynamic request service includes the following steps:
step S1: and the server configures the application module information.
In step S1, the method for the server to configure the application module information is as follows:
and configuring modules related to the whole application and interface information to be called in a server management background system.
Step S2: and the front-end application acquires the loading module data from the server.
In step S2, the manner of acquiring the load module data from the server by the front-end application is as follows:
when the front-end application is opened, the front-end application pulls data of all modules of the application from the server, and a front-end page is rendered according to the data loading module.
Step S3: and loading the loading module data acquired by the front-end application from the server on the application front-end page according to a uniform calling method and format.
Step S4: and executing the calling server method in the application front-end page.
Step S5: and the server analyzes the front-end application request in a uniform mode to obtain elements required by calling the corresponding interfaces.
In step S5, the way for the server to resolve the front-end application request in a unified manner is:
the server receives the front-end application request according to a uniform processing model, analyzes the received request according to a mode appointed when the server configures the application module information, and converts the received request into elements required for calling the corresponding interface.
The elements required for calling the corresponding interface comprise a service URL and parameters, a request mode, a return type and the like.
Preferably, the request mode is a POST request mode or a GET request mode.
Step S6: and the server side calls a corresponding interface.
In step S6, the manner of the server invoking the corresponding interface is as follows: and obtaining elements required for calling the corresponding interface from the step S5, assembling the elements into a network calling format, for example, using an http client mode to call the interface, and executing the elements.
Step S7: and the server returns data. In the process that the server side returns data, if the returned data is abnormal, the server side returns abnormal information; otherwise, returning the data returned by the calling server to the front-end page.
The HTTP dynamic request service calling method can be applied to application items needing dynamic calling of the server method, reduces the complexity of calling the service and facilitates the maintenance of the service.
Specifically, the HTTP dynamic request service calling method of the present invention abstracts the service calling mode, unifies the structure and the transmission format of the calling method, and the front-end application can unify the calling of the corresponding service in different service scenarios in a configured manner; compared with the traditional method (respectively compiling a method according to needs in each business scene and respectively calling corresponding service interfaces), the HTTP dynamic request service calling method can abstract a model of calling the service by the front-end application, enables the URL (uniform resource locator), the parameters and the like of the service to be dynamically obtained through the background configuration of the server, and enables the front-end application to uniformly call the corresponding service in different business scenes in a configuration mode through a uniform front-end application calling mode, thereby reducing the complexity and facilitating the maintenance.
It should be noted that all of the features disclosed in this specification, or all of the steps in any method or process so disclosed, may be combined in any combination, except for mutually exclusive features and/or steps.
In addition, the above-described embodiments are exemplary, and those skilled in the art, having benefit of this disclosure, will appreciate numerous solutions that are within the scope of the disclosure and that fall within the scope of the invention. It should be understood by those skilled in the art that the present specification and figures are illustrative only and are not limiting upon the claims. The scope of the invention is defined by the claims and their equivalents.
Claims (9)
1. An HTTP dynamic request service calling method is characterized by comprising the following steps:
step S1: the server configures application module information;
step S2: the front-end application acquires the data of the loading module from the server;
step S3: loading the loading module data acquired by the front-end application from the server on the application front-end page according to a uniform calling method and format;
step S4: executing a calling server method in an application front-end page;
step S5: the server side analyzes the front-end application request in a unified mode, and elements required for calling the corresponding interfaces are obtained;
step S6: the server side calls a corresponding interface;
step S7: and the server returns data.
2. The HTTP dynamic request service invoking method according to claim 1, wherein in the step S1, a manner of configuring the application module information by the server side is:
and configuring modules related to the whole application and interface information to be called in a server management background system.
3. The HTTP dynamic request service invoking method according to claim 1, wherein in the step S2, a manner that the front-end application obtains the loaded module data from the server is:
when the front-end application is opened, the front-end application pulls the data of all the modules of the application from the server side, and a front-end page is rendered according to the loading module.
4. The method for invoking HTTP dynamic request service according to claim 1, wherein in the step S5, a manner that the server parses the front-end application request in a unified manner is:
the server receives the front-end application request according to a uniform processing model, analyzes the received request according to a mode appointed when the server configures the application module information, and converts the received request into elements required for calling the corresponding interface.
5. The HTTP dynamic request service calling method of claim 1 or 4, wherein in the step S5, the elements required for calling the corresponding interface include service URL and parameters, request mode and return type.
6. The HTTP dynamic request service invoking method according to claim 5, wherein in the step S5, the request mode is a POST request mode or a GET request mode.
7. The HTTP dynamic request service invoking method according to claim 1, wherein in the step S6, a manner that the server invokes the corresponding interface is:
the elements required for calling the corresponding interface are obtained from the step S5, assembled into a network call format, and executed.
8. The HTTP dynamic request service invoking method according to claim 7, wherein in step S6, an HTTP client mode invoking interface is used.
9. The HTTP dynamic request service invoking method according to claim 1, wherein in a process that the server returns data, if the returned data is abnormal, the server returns abnormal information; otherwise, returning the data returned by the calling server to the front-end page.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810804414.8A CN109005163B (en) | 2018-07-20 | 2018-07-20 | HTTP dynamic request service calling method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810804414.8A CN109005163B (en) | 2018-07-20 | 2018-07-20 | HTTP dynamic request service calling method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN109005163A CN109005163A (en) | 2018-12-14 |
| CN109005163B true CN109005163B (en) | 2021-01-26 |
Family
ID=64597372
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201810804414.8A Active CN109005163B (en) | 2018-07-20 | 2018-07-20 | HTTP dynamic request service calling method |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN109005163B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110928709B (en) * | 2019-11-21 | 2023-08-29 | 中国民航信息网络股份有限公司 | Service calling method and device under micro-service framework and server |
| CN113806037A (en) * | 2021-07-14 | 2021-12-17 | 远光软件股份有限公司 | Service calling method and device, storage medium and electronic equipment |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103699367B (en) * | 2012-09-27 | 2017-07-07 | 中国电信股份有限公司 | HTTP application programming interfaces call method and device |
| CN104363273B (en) * | 2014-10-31 | 2018-04-03 | 北京思特奇信息技术股份有限公司 | A kind of method and system of flex serverless backups calling external program |
| KR101910031B1 (en) * | 2017-01-10 | 2018-10-19 | 건국대학교 산학협력단 | Cached wadl execution engine and method for calling web services using the theory |
-
2018
- 2018-07-20 CN CN201810804414.8A patent/CN109005163B/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| CN109005163A (en) | 2018-12-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US7555538B2 (en) | System and method for building and execution of platform-neutral generic services' client applications | |
| US8495594B2 (en) | Method and system for providing a componentized resource adapter architecture | |
| US11269611B2 (en) | Data interface processing method, device, server and medium | |
| CN106533713B (en) | Application deployment method and device | |
| CN109002362A (en) | A kind of method of servicing, device, system and electronic equipment | |
| CA2511916A1 (en) | System and method of building wireless component applications | |
| US7752598B2 (en) | Generating executable objects implementing methods for an information model | |
| CN113535419B (en) | A service arrangement method and device | |
| CN112698817B (en) | Message access method, device and system based on micro-service architecture and storage medium | |
| CN113191889B (en) | Wind control configuration method, configuration system, electronic equipment and readable storage medium | |
| US9128886B2 (en) | Computer implemented method, computer system, electronic interface, mobile computing device and computer readable medium | |
| CN111666145A (en) | Message processing method and system of message queue and computer equipment | |
| US9652309B2 (en) | Mediator with interleaved static and dynamic routing | |
| CN102779071A (en) | Method, device and system for calling software interface | |
| WO2024174753A1 (en) | Customized contained engine, method, host and medium | |
| CN109005163B (en) | HTTP dynamic request service calling method | |
| US11411812B2 (en) | Dynamic service creation for microservice-based integration service | |
| CN112929453B (en) | Method and device for sharing session data | |
| US20070022154A1 (en) | Generating one or more clients for generating one or more synthetic transactions with one or more web service operations | |
| CN116016182B (en) | Method and device for configuring gateway by three-way interface, electronic equipment and storage medium | |
| CN113626001B (en) | API dynamic arrangement method and device based on script | |
| US7907619B2 (en) | Method, system and program product for adapting to protocol changes | |
| CN118350814B (en) | Method, device, medium and equipment for generating distributed cross-protocol callback transaction | |
| CN118118471B (en) | HTTP protocol-based service flow arrangement method, device, computer program product, and computer-readable storage medium | |
| CN110750314A (en) | Command execution method and system of micro-service terminal |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address | ||
| CP03 | Change of name, title or address |
Address after: 519000 Rooms 806, 901 and 902, No. 29, Lanwan Lane, Tangjiawan Town, Xiangzhou District, Zhuhai City, Guangdong Province Patentee after: Hongqiao Hi Tech Group Co.,Ltd. Address before: 519000 1st floor, area D, South Software Park, No.1, Tangjiawan Software Park Road, Zhuhai City, Guangdong Province Patentee before: ZHUHAI HONGQIAO HIGH-TECH Co.,Ltd. |