CN113225379A - Method and device for sending HTTP request message - Google Patents

Method and device for sending HTTP request message Download PDF

Info

Publication number
CN113225379A
CN113225379A CN202110352829.8A CN202110352829A CN113225379A CN 113225379 A CN113225379 A CN 113225379A CN 202110352829 A CN202110352829 A CN 202110352829A CN 113225379 A CN113225379 A CN 113225379A
Authority
CN
China
Prior art keywords
request
target
http request
template
rule template
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.)
Withdrawn
Application number
CN202110352829.8A
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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202110352829.8A priority Critical patent/CN113225379A/en
Publication of CN113225379A publication Critical patent/CN113225379A/en
Withdrawn 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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the disclosure provides a method and a device for sending an HTTP request message. The method comprises the following steps: acquiring a target service identity and a target service request parameter input by a service party; acquiring a target HTTP request module group corresponding to the target service identity according to a mapping relation between the service identity and the HTTP request module group; the target HTTP request template set comprises target static request parameters; filling the target service request parameters into the target HTTP request module group; generating an HTTP request message according to the target service request parameter and the target static request parameter; and sending the HTTP request message to a server. According to the embodiment of the disclosure, the HTTP calling can be realized without URL splicing, request parameter splicing and the like through encoding, and the service developer only needs to pay attention to the service request parameters, so that the generation mode of the HTTP request message is simplified.

Description

Method and device for sending HTTP request message
Technical Field
The embodiment of the disclosure relates to the technical field of internet, in particular to a method and a device for sending an HTTP request message.
Background
HTTP (HyperText transfer protocol) is the most widely used network transport protocol over the Internet. In the internet application scenario, the HTTP protocol is often used for data interaction between enterprise-level backend systems. A complete HTTP request contains the request URL (Uniform Resource Locator), request method, request header, request body, code and character set, etc.
When data interaction is performed with a third-party service system, a plurality of HTTPAPI interfaces are usually required to be connected in a butt joint mode, and a complete service function butt joint can be completed. In order to obtain data from an HTTP api interface, developers need to pay attention to complete HTTP request information construction and invocation in addition to business parameters. This forces service developers to care about the specific implementation of the external http api.
When one internal system A is in butt joint with a plurality of external systems (such as B/C/D) for the same business function (such as order confirmation and the like), the business parameter model of the system A is the same, but the business parameter model needs to be converted into a plurality of external request models to respectively initiate requests to the systems such as B/C/D and the like. Further, when the system a needs to perform order confirmation docking with the new external system F, the developer needs to complete new "internal-external" parameter model conversion by coding based on the same internal service parameter model again. That is, when a new system is docked, HTTP API call code that is not service-dependent needs to be written.
At present, HTTP request information is usually replaced and modified through a pre-designed simplified dictionary table to generate a simplified version of HTTP request information, which improves efficiency of acquiring a web page while saving network resources. However, the service developer still needs to pay attention to the construction details of the original HTTP request message, and needs to splice the URL and the request parameter by encoding, which makes the HTTP request message more complicated to generate.
Disclosure of Invention
Embodiments of the present disclosure provide a method and an apparatus for sending an HTTP request message, so that HTTP call can be implemented through HTTP API templated configuration without URL splicing, request parameter splicing, and the like through encoding, and a service developer only needs to pay attention to a service request parameter, thereby simplifying a generation manner of the HTTP request message.
According to a first aspect of embodiments of the present disclosure, there is provided a method for sending an HTTP request message, including:
acquiring a target service identity and a target service request parameter input by a service party;
acquiring a target HTTP request module group corresponding to the target service identity according to a mapping relation between the service identity and the HTTP request module group; the target HTTP request template set comprises target static request parameters;
filling the target service request parameters into the target HTTP request module group;
generating an HTTP request message according to the target service request parameter and the target static request parameter;
and sending the HTTP request message to a server.
Optionally, before the obtaining the target service identity and the target service request parameter input by the service party, the method further includes:
configuring an HTTP request module group corresponding to the service identity; the HTTP request template set comprises: a uniform resource locator rule template, a request header rule template and a request body rule template;
and configuring static request parameters in the uniform resource locator rule template, the request head rule template and the request body rule template.
Optionally, the target service request parameter includes: dynamic path parameters and request body parameters, wherein the target HTTP request module group comprises: a target uniform resource locator rule template, a target request header rule template and a target request body rule template,
the populating the target service request parameter to the target HTTP request template set includes:
replacing placeholders in the target uniform resource locator rule template, the target request header rule template and the target request body rule template;
filling the dynamic path parameters into the target uniform resource locator rule template;
and filling the request body parameters into the target request body rule template.
Optionally, the target request header rule template includes: the access key is then used to access the key,
before the populating the target service request parameter to the target HTTP request template set, further comprising:
calling a preset algorithm to analyze the target service request parameter to obtain an analysis result;
and determining a key value corresponding to the access key according to the analysis result.
Optionally, the generating an HTTP request message according to the target service request parameter and the target static request parameter includes:
rendering the target uniform resource locator rule template, the target request header rule template and the target request body rule template;
determining a uniform resource locator, request header information and request body information according to a rendering result;
and generating the HTTP request message according to the key value, the uniform resource locator, the request header information and the request body information.
According to a second aspect of embodiments of the present disclosure, there is provided an apparatus for transmitting an HTTP request message, including:
the identification parameter acquisition module is used for acquiring a target service identity and a target service request parameter which are input by a service party;
the target template group acquisition module is used for acquiring a target HTTP request template group corresponding to the target service identity according to the mapping relation between the service identity and the HTTP request template group; the target HTTP request template set comprises target static request parameters;
the request parameter filling module is used for filling the target service request parameters into the target HTTP request module group;
the HTTP request generation module is used for generating HTTP request information according to the target service request parameters and the target static request parameters;
and the HTTP request sending module is used for sending the HTTP request message to a server.
Optionally, the apparatus further comprises:
the request module group configuration module is used for configuring an HTTP request module group corresponding to the service identity; the HTTP request template set comprises: a uniform resource locator rule template, a request header rule template and a request body rule template;
and the static request parameter configuration module is used for configuring the static request parameters in the uniform resource locator rule template, the request header rule template and the request body rule template.
Optionally, the target service request parameter includes: dynamic path parameters and request body parameters, wherein the target HTTP request module group comprises: a target uniform resource locator rule template, a target request header rule template and a target request body rule template,
the request parameter filling module comprises:
a placeholder replacing unit, configured to replace placeholders in the target uniform resource locator rule template, the target request header rule template, and the target request body rule template;
a dynamic path parameter filling unit, configured to fill the dynamic path parameter into the target uniform resource locator rule template;
and the request body parameter filling unit is used for filling the request body parameters into the target request body rule template.
Optionally, the target request header rule template includes: the access key is then used to access the key,
the device further comprises:
the analysis result acquisition module is used for calling a preset algorithm to analyze the target service request parameter to obtain an analysis result;
and the key value determining module is used for determining the key value corresponding to the access key according to the analysis result.
Optionally, the HTTP request generating module includes:
a rule template rendering unit, configured to render the target uniform resource locator rule template, the target request header rule template, and the target request body rule template;
the request information determining unit is used for determining a uniform resource locator, request header information and request body information according to the rendering result;
an HTTP request generating unit configured to generate the HTTP request message according to the key value, the uniform resource locator, the request header information, and the request body information.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor, a memory, and a computer program stored on the memory and executable on the processor, the processor implementing the method for transmitting the HTTP request message when executing the program.
According to a fourth aspect of embodiments of the present disclosure, there is provided a readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the method of transmitting an HTPP request message according to any one of the above.
The embodiment of the disclosure provides a method and a device for sending an HTTP request message, wherein a target HTTP request template group corresponding to a target service identity is obtained according to a mapping relation between the service identity and an HTTP request template group by obtaining the target service identity and target service request parameters input by a service party, the target HTTP request template group comprises target static request parameters, the target service request parameters are filled into the target HTTP request template group, the HTTP request message is generated according to the target service request parameters and the target static request parameters, and the HTTP request message is sent to a server. According to the embodiment of the disclosure, through HTTPAPI template configuration, URL splicing, request parameter splicing and the like are not required to be carried out through coding, HTTP calling can be realized, service developers only need to pay attention to service request parameters, and the generation mode of HTTP request messages is simplified.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments of the present disclosure will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart illustrating steps of a method for sending an HTTP request message according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating steps of another method for sending an HTTP request message according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an apparatus for sending an HTTP request message according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of another HTTP request message sending apparatus according to an embodiment of the present disclosure.
Detailed Description
Technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments, which can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present disclosure, belong to the protection scope of the embodiments of the present disclosure.
Example one
Referring to fig. 1, a flowchart illustrating steps of a method for sending an HTTP request message according to an embodiment of the present disclosure is shown, and as shown in fig. 1, the method for sending an HTTP request message may specifically include the following steps:
step 101: and acquiring a target service identity and a target service request parameter which are input by a service party.
Embodiments of the present disclosure may be applied in scenarios where HTTP request messages are automatically generated in conjunction with a preconfigured set of HTTP request templates and user-transmitted parameters.
The target service identity refers to an identity input by the service party and used for indicating the type of the generated HTTP request message, and in this example, the target service identity may include: the service line parameters are used for distinguishing different request types (such as occupation, confirmation, cancellation, verification and the like of the order service line) under the same service line.
The target service request parameter refers to a request parameter associated with the HTTP request message for populating the HTTP request template set. In this example, the target service request parameters may include: the dynamic path parameter, the request body parameter, and the like may be determined according to a service requirement, which is not limited in this embodiment.
When the HTTP request message needs to be generated, the target service identity and the target service request parameter may be input by the service party.
After the target service identity and the target service request parameter input by the user are obtained, step 102 is executed.
Step 102: acquiring a target HTTP request module group corresponding to the target service identity according to a mapping relation between the service identity and the HTTP request module group; the set of target HTTP request templates includes target static request parameters.
The HTTP request template group refers to a combination of a plurality of rule templates configured in advance, and in this example, the HTTP request template group may be a URL rule template, a request header rule template, and a request body rule template. These rule templates contain a static information part and a dynamic information part.
The static information part in the rule template may include: protocols, domain names, static path information, etc. in the URL, a Content-Type parameter with deterministic parameter values in the request header, etc.
The dynamic information part in the rule template may include: the dynamic path part in the URL, the key information required for accessing the API and carried in the request header, the request body information constructed and generated based on the service parameters and the like.
The target HTTP request template set refers to an HTTP request template set matched with a target service identity input by a user.
The target static request parameter refers to a static parameter preset in the rule template, and the static request parameter does not need to be input by a user.
After the target service identity input by the user is obtained, the target HTTP request template group corresponding to the target service identity may be obtained according to a mapping relationship between the service identity and the HTTP request template group.
After the target HTTP request template group corresponding to the target service identity is obtained, step 103 is executed.
Step 103: and filling the target service request parameters into the target HTTP request template group.
After the target HTTP request template set corresponding to the target service identity is obtained, the target service request parameter may be filled in the target HTTP request template set, specifically, the target HTTP request template set may include: the target URL rule template, the target request header rule template, and the target request body rule template, and the target service request parameters may include: after the target HTTP request template group is obtained, the dynamic path parameters and the request body parameters may be filled into the target URL rule template, and the request body parameters may be filled into the target request body rule template. The process will be described in detail in the following second embodiment, and the embodiments of the present disclosure will not be described herein again.
After populating the target set of HTTP request templates with the target service request parameters, step 104 is performed.
Step 104: and generating an HTTP request message according to the target service request parameter and the target static request parameter.
After the target service request parameters are filled into the target HTTP request template set, the HTTP request message may be generated according to the filled target service request parameters and the target static request parameters in the target HTTP request template set.
After generating the HTTP request message according to the target traffic request parameters and the target static request parameters, step 105 is performed.
Step 105: and sending the HTTP request message to a server.
After generating the HTTP request message, the HTTP request message may then be sent to a server to enable sending of the HTTP request message.
According to the embodiment of the disclosure, through HTTP API template configuration, URL splicing, request parameter splicing and the like are not required to be carried out through encoding, HTTP calling can be realized, service developers only need to pay attention to service request parameters, and the generation mode of HTTP request messages is simplified.
The method for sending the HTTP request message provided by the embodiment of the present disclosure obtains a target service identity and a target service request parameter input by a service party, and obtains a target HTTP request template set corresponding to the target service identity according to a mapping relationship between the service identity and the HTTP request template set, where the target HTTP request template set includes a target static request parameter, fills the target service request parameter into the target HTTP request template set, generates the HTTP request message according to the target service request parameter and the target static request parameter, and sends the HTTP request message to a server. According to the embodiment of the disclosure, through HTTP API template configuration, URL splicing, request parameter splicing and the like are not required to be carried out through encoding, HTTP calling can be realized, service developers only need to pay attention to service request parameters, and the generation mode of HTTP request messages is simplified.
Example two
Referring to fig. 2, a flowchart illustrating steps of another HTTP request message sending method provided by an embodiment of the present disclosure is shown, and as shown in fig. 2, the HTTP request message sending method may specifically include the following steps:
step 201: configuring an HTTP request module group corresponding to the service identity; the HTTP request template set comprises: a uniform resource locator rule template, a request header rule template, and a request body rule template.
Embodiments of the present disclosure may be applied in scenarios where HTTP request messages are automatically generated in conjunction with a preconfigured set of HTTP request templates and user-transmitted parameters.
In this embodiment, first, an HTTP request template set may be configured, where the HTTP request template set may include: a uniform resource locator (i.e., URL) rule template, a request header rule template, and a request body rule template.
And maintaining basic configuration information of the HTTPAPI in the background, wherein the basic configuration information comprises service identity marks such as a service line and a service type which the API belongs to, and basic information of the HTTP request such as a request method, a request URL template, a request head template, a request body template, a code and a character set.
After configuring the set of HTTP request templates corresponding to the service identities, step 202 is performed.
Step 202: and configuring static request parameters in the uniform resource locator rule template, the request head rule template and the request body rule template.
Static request parameters refer to parameters configured in the HTTP request template set that do not require attention of the service personnel.
A URL rule template, a request header rule template, a request body rule template, etc. is a set of configured rule templates. Each rule template contains an immutable static information portion and a dynamic information portion that is dynamically replaced/populated at runtime.
Specifically, the following can be combined for detailed description:
the URL is: "https:// domain.com/trade/order/{ order }? userid ═ userid } ", where" https:// "is the protocol section," domain.com "is the domain name section,"/track/order "is the static path section," { orderid } "is the dynamic path to be replaced, and" { userid } "is the dynamic parameter to be replaced. That is, in the example URL rule template, the protocol, domain name, static path belong to an immutable static information part; the dynamic path and the dynamic parameter belong to a dynamic information part.
The dynamic information part not only contains a scene of simple text replacement, but also contains an API (application programming interface) calling key and the like which can be acquired only through complex method calling. For example, "? In the client _ secret ═ getsecretfrom kms ('xxx'), the value of the dynamic request parameter "client _ secret" needs to be parsed by using the getsecretfrom kms () method after the service request parameter "xxx" is introduced.
The configured HTTP template set may support a request method of configuring HTTP, including GET, POST, HEAD, PUT, DELETE, etc., to define the manner in which the API execution service initiates the HTTP request.
After configuring the HTTP template set and the static request parameters in the uniform resource locator rule template, the request header rule template, and the request body rule template, the HTTP API management background may synchronize the relevant configuration parameters of the API to the configuration center.
After configuring the static request parameters in the uniform resource locator rule template, the request header rule template, and the request body rule template, step 203 is performed.
Step 203: and acquiring a target service identity and a target service request parameter which are input by a service party.
The target service identity refers to an identity input by the service party and used for indicating the type of the generated HTTP request message, and in this example, the target service identity may include: the service line parameters are used for distinguishing different request types (such as occupation, confirmation, cancellation, verification and the like of the order service line) under the same service line.
The target service request parameter refers to a request parameter associated with the HTTP request message for populating the HTTP request template set. In this example, the target service request parameters may include: the dynamic path parameter, the request body parameter, and the like may be determined according to a service requirement, which is not limited in this embodiment.
When the HTTP request message needs to be generated, the target service identity and the target service request parameter may be input by the service party.
After the target service identity and the target service request parameter input by the user are obtained, step 204 is executed.
Step 204: acquiring a target HTTP request module group corresponding to the target service identity according to a mapping relation between the service identity and the HTTP request module group; the set of target HTTP request templates includes target static request parameters.
The target HTTP request template set refers to an HTTP request template set matched with a target service identity input by a user.
The target static request parameter refers to a static parameter preset in the rule template, and the static request parameter does not need to be input by a user.
After the target service identity input by the user is obtained, the target HTTP request template group corresponding to the target service identity may be obtained according to a mapping relationship between the service identity and the HTTP request template group.
After acquiring the target HTTP request template set corresponding to the target service identity, step 205 is executed.
Step 205: and calling a preset algorithm to analyze the target service request parameter to obtain an analysis result.
After the target HTTP request template group corresponding to the target service identity is obtained, a preset algorithm may be invoked to analyze the target service request parameter to obtain an analysis result, for example, "? In the client _ secret ═ getsecretfrom kms ('xxx'), the value of the dynamic request parameter "client _ secret" needs to be parsed by using the getsecretfrom kms () method after the service request parameter "xxx" is introduced.
Therefore, after the target service request parameter is obtained, the target service request parameter may be analyzed to obtain an analysis result.
After the preset algorithm is called to analyze the target service request parameter to obtain an analysis result, step 206 is executed.
Step 206: and determining a key value corresponding to the access key according to the analysis result.
The key value refers to a key value corresponding to the access key in the request header.
After the preset algorithm is called to analyze the target service request parameter to obtain an analysis result, a key value corresponding to the access key can be determined according to the analysis result.
Step 207: and replacing placeholders in the target uniform resource locator rule template, the target request header rule template and the target request body rule template.
In this embodiment, the target HTTP template set may include: a target uniform resource locator rule template, a target request header rule template and a target request body rule template.
The template rendering engine comprises a static template rendering engine and a dynamic template rendering engine. Text rendering operations of the template rendering engine, including static text replacement and dynamic text content filling. Wherein the static text is replaced with a simple placeholder, accomplished by a static template rendering engine.
Namely, a static template rendering engine is called to replace placeholders in a target uniform resource locator rule template, a target request header rule template and a target request body rule template so as to complete the replacement process of the static text.
Step 208: and filling the dynamic path parameters into the target uniform resource locator rule template.
In this embodiment, the target service request parameter may include a dynamic path parameter.
After the dynamic path parameters are obtained, the dynamic path parameters may be filled into the target uniform resource locator rule template to realize filling of the dynamic parameter part in the target URL rule template, and specifically, a dynamic template rendering engine may be invoked to realize filling of the dynamic path parameters.
Step 209: and filling the request body parameters into the target request body rule template.
In this embodiment, the target service request parameter may include a request body parameter.
After the request body parameters are acquired, the request body parameters may be filled into the target request body rule template to implement filling of dynamic parameter portions in the target request body rule template, and specifically, a dynamic template rendering engine may be invoked to implement filling of the request body parameters.
Step 210: and rendering the target uniform resource locator rule template, the target request head rule template and the target request body rule template.
After the dynamic parameters are filled, the target uniform resource locator rule template, the target request header rule template and the target request body rule template can be rendered, so that a rendering result can be obtained.
Step 211: and determining the uniform resource locator, the request header information and the request body information according to the rendering result.
After the rendering of the rule template is performed, the uniform resource locator, the request header information and the request body information may be determined according to a rendering result, and specifically, the API executes a service, and the URL, the request header, the request body, the code and the character set obtained through the parsing and rendering of the above steps.
After determining the uniform resource locator, the request header information, and the request body information according to the rendering result, step 212 is performed.
Step 212: and generating the HTTP request message according to the key value, the uniform resource locator, the request header information and the request body information.
After determining the uniform resource locator, the request header information, and the request body information according to the rendering result, the HTTP request message may be generated jointly according to the key value, the uniform resource locator, the request header information, and the request body information, and specifically, the API performs the service, and the complete HTTP request message may be obtained by parsing and rendering the obtained request URL, request header, request body, code, and character set through the above steps and by using the request method defined in the API configuration. Therefore, the HTTP request calling is completed under the condition that the HTTP request information construction details are shielded for a business party.
After generating the HTTP request message, step 213 is performed.
Step 213: and sending the HTTP request message to a server.
After generating the HTTP request message, an HTTP request may be initiated by the HTTP client by the API executive service underlayer.
Through the method, service developers only need to pay attention to the service request parameters, just like calling a local method, and HTTP request calling is completed. When one internal system A finishes the same business function (such as order confirmation) connection with a plurality of external systems (B/C/D, etc.). If the system A wants to further perform order confirmation docking with a new external system F, a service developer can complete most docking work by only performing API templated information configuration in an HTTPAPI configuration management background without rewriting HTTP request codes irrelevant to services.
The method for sending the HTTP request message provided by the embodiment of the present disclosure obtains a target service identity and a target service request parameter input by a service party, and obtains a target HTTP request template set corresponding to the target service identity according to a mapping relationship between the service identity and the HTTP request template set, where the target HTTP request template set includes a target static request parameter, fills the target service request parameter into the target HTTP request template set, generates the HTTP request message according to the target service request parameter and the target static request parameter, and sends the HTTP request message to a server. According to the embodiment of the disclosure, through HTTPAPI template configuration, URL splicing, request parameter splicing and the like are not required to be carried out through coding, HTTP calling can be realized, service developers only need to pay attention to service request parameters, and the generation mode of HTTP request messages is simplified.
EXAMPLE III
Referring to fig. 3, a schematic structural diagram of an apparatus for sending an HTTP request message according to an embodiment of the present disclosure is shown, and as shown in fig. 3, the apparatus 300 for sending an HTTP request message may specifically include the following modules:
an identification parameter obtaining module 310, configured to obtain a target service identity and a target service request parameter input by a service party;
a target template set obtaining module 320, configured to obtain, according to a mapping relationship between a service identity and an HTTP request template set, a target HTTP request template set corresponding to the target service identity; the target HTTP request template set comprises target static request parameters;
a request parameter padding module 330, configured to pad the target service request parameter to the target HTTP request module group;
an HTTP request generation module 340, configured to generate an HTTP request message according to the target service request parameter and the target static request parameter;
an HTTP request sending module 350, configured to send the HTTP request message to the server.
The HTTP request message sending apparatus provided in the embodiment of the present disclosure obtains a target service identity and a target service request parameter input by a service party, and obtains a target HTTP request template set corresponding to the target service identity according to a mapping relationship between the service identity and the HTTP request template set, where the target HTTP request template set includes a target static request parameter, fills the target service request parameter into the target HTTP request template set, generates an HTTP request message according to the target service request parameter and the target static request parameter, and sends the HTTP request message to a server. According to the embodiment of the disclosure, through HTTP API template configuration, URL splicing, request parameter splicing and the like are not required to be carried out through encoding, HTTP calling can be realized, service developers only need to pay attention to service request parameters, and the generation mode of HTTP request messages is simplified.
Example four
Referring to fig. 4, a schematic structural diagram of another HTTP request message sending apparatus provided in an embodiment of the present disclosure is shown, and as shown in fig. 4, the HTTP request message sending apparatus may specifically include the following modules:
a request module group configuration module 410, configured to configure an HTTP request module group corresponding to the service identity; the HTTP request template set comprises: a uniform resource locator rule template, a request header rule template and a request body rule template;
a static request parameter configuration module 420, configured to configure static request parameters in the uniform resource locator rule template, the request header rule template, and the request body rule template;
an identification parameter obtaining module 430, configured to obtain a target service identity and a target service request parameter input by a service party;
a target template group obtaining module 440, configured to obtain, according to a mapping relationship between a service identity and an HTTP request template group, a target HTTP request template group corresponding to the target service identity; the target HTTP request template set comprises target static request parameters;
an analysis result obtaining module 450, configured to invoke a preset algorithm to analyze the target service request parameter, so as to obtain an analysis result;
a key value determining module 460, configured to determine, according to the parsing result, a key value corresponding to the access key;
a request parameter padding module 470, configured to pad the target service request parameter into the target HTTP request module group;
an HTTP request generation module 480, configured to generate an HTTP request message according to the target service request parameter and the target static request parameter;
an HTTP request sending module 490, configured to send the HTTP request message to the server.
Optionally, the target service request parameter includes: dynamic path parameters and request body parameters, wherein the target HTTP request module group comprises: a target uniform resource locator rule template, a target request header rule template and a target request body rule template,
the request parameter padding module 470 includes:
a placeholder replacing unit 471, configured to replace a placeholder in the target uniform resource locator rule template, the target request header rule template, and the target request body rule template;
a dynamic path parameter padding unit 472, configured to pad the dynamic path parameter to the target uniform resource locator rule template;
a request body parameter padding unit 473, configured to pad the request body parameter to the target request body rule template.
Optionally, the HTTP request generating module 480 includes:
a rule template rendering unit 481, configured to render the target uniform resource locator rule template, the target request header rule template, and the target request body rule template;
a request information determining unit 482, configured to determine a uniform resource locator, request header information, and request body information according to a rendering result;
an HTTP request generating unit 483, configured to generate the HTTP request message according to the key value, the uniform resource locator, the request header information, and the request body information.
The HTTP request message sending apparatus provided in the embodiment of the present disclosure obtains a target service identity and a target service request parameter input by a service party, and obtains a target HTTP request template set corresponding to the target service identity according to a mapping relationship between the service identity and the HTTP request template set, where the target HTTP request template set includes a target static request parameter, fills the target service request parameter into the target HTTP request template set, generates an HTTP request message according to the target service request parameter and the target static request parameter, and sends the HTTP request message to a server. According to the embodiment of the disclosure, through HTTPAPI template configuration, URL splicing, request parameter splicing and the like are not required to be carried out through coding, HTTP calling can be realized, service developers only need to pay attention to service request parameters, and the generation mode of HTTP request messages is simplified.
An embodiment of the present disclosure also provides an electronic device, including: a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the transmission method of the HTTP request message of the foregoing embodiments when executing the program.
Embodiments of the present disclosure also provide a readable storage medium, and instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the transmission method of the HTTP request message of the foregoing embodiments.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. In addition, embodiments of the present disclosure are not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the embodiments of the present disclosure as described herein, and any descriptions of specific languages are provided above to disclose the best modes of the embodiments of the present disclosure.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the disclosure may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the disclosure, various features of the embodiments of the disclosure are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that is, claimed embodiments of the disclosure require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of an embodiment of this disclosure.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
The various component embodiments of the disclosure may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be understood by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components in a motion picture generating device according to an embodiment of the present disclosure. Embodiments of the present disclosure may also be implemented as an apparatus or device program for performing a portion or all of the methods described herein. Such programs implementing embodiments of the present disclosure may be stored on a computer readable medium or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit embodiments of the disclosure, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of the disclosure may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present disclosure and is not to be construed as limiting the embodiments of the present disclosure, and any modifications, equivalents, improvements and the like that are made within the spirit and principle of the embodiments of the present disclosure are intended to be included within the scope of the embodiments of the present disclosure.
The above description is only a specific implementation of the embodiments of the present disclosure, but the scope of the embodiments of the present disclosure is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present disclosure, and all the changes or substitutions should be covered by the scope of the embodiments of the present disclosure. Therefore, the protection scope of the embodiments of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A method for transmitting an HTTP request message, comprising:
acquiring a target service identity and a target service request parameter input by a service party;
acquiring a target HTTP request module group corresponding to the target service identity according to a mapping relation between the service identity and the HTTP request module group; the target HTTP request template set comprises target static request parameters;
filling the target service request parameters into the target HTTP request module group;
generating an HTTP request message according to the target service request parameter and the target static request parameter;
and sending the HTTP request message to a server.
2. The method of claim 1, wherein before the obtaining the target service identity and the target service request parameter input by the service party, the method further comprises:
configuring an HTTP request module group corresponding to the service identity; the HTTP request template set comprises: a uniform resource locator rule template, a request header rule template and a request body rule template;
and configuring static request parameters in the uniform resource locator rule template, the request head rule template and the request body rule template.
3. The method of claim 1, wherein the target service request parameter comprises: dynamic path parameters and request body parameters, wherein the target HTTP request module group comprises: a target uniform resource locator rule template, a target request header rule template and a target request body rule template,
the populating the target service request parameter to the target HTTP request template set includes:
replacing placeholders in the target uniform resource locator rule template, the target request header rule template and the target request body rule template;
filling the dynamic path parameters into the target uniform resource locator rule template;
and filling the request body parameters into the target request body rule template.
4. The method of claim 3, wherein the target request header rule template comprises: the access key is then used to access the key,
before the populating the target service request parameter to the target HTTP request template set, further comprising:
calling a preset algorithm to analyze the target service request parameter to obtain an analysis result;
and determining a key value corresponding to the access key according to the analysis result.
5. The method of claim 4, wherein generating an HTTP request message according to the target service request parameters and the target static request parameters comprises:
rendering the target uniform resource locator rule template, the target request header rule template and the target request body rule template;
determining a uniform resource locator, request header information and request body information according to a rendering result;
and generating the HTTP request message according to the key value, the uniform resource locator, the request header information and the request body information.
6. An apparatus for transmitting an HTTP request message, comprising:
the identification parameter acquisition module is used for acquiring a target service identity and a target service request parameter which are input by a service party;
the target template group acquisition module is used for acquiring a target HTTP request template group corresponding to the target service identity according to the mapping relation between the service identity and the HTTP request template group; the target HTTP request template set comprises target static request parameters;
the request parameter filling module is used for filling the target service request parameters into the target HTTP request module group;
the HTTP request generation module is used for generating HTTP request information according to the target service request parameters and the target static request parameters;
and the HTTP request sending module is used for sending the HTTP request message to a server.
7. The apparatus of claim 6, further comprising:
the request module group configuration module is used for configuring an HTTP request module group corresponding to the service identity; the HTTP request template set comprises: a uniform resource locator rule template, a request header rule template and a request body rule template;
and the static request parameter configuration module is used for configuring the static request parameters in the uniform resource locator rule template, the request header rule template and the request body rule template.
8. The apparatus of claim 6, wherein the target service request parameter comprises: dynamic path parameters and request body parameters, wherein the target HTTP request module group comprises: a target uniform resource locator rule template, a target request header rule template and a target request body rule template,
the request parameter filling module comprises:
a placeholder replacing unit, configured to replace placeholders in the target uniform resource locator rule template, the target request header rule template, and the target request body rule template;
a dynamic path parameter filling unit, configured to fill the dynamic path parameter into the target uniform resource locator rule template;
and the request body parameter filling unit is used for filling the request body parameters into the target request body rule template.
9. An electronic device, comprising:
a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the method of transmitting an HTTP request message as claimed in any one of claims 1 to 5 when executing the program.
10. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of transmitting an HTPP request message of any of claims 1 to 5.
CN202110352829.8A 2021-03-31 2021-03-31 Method and device for sending HTTP request message Withdrawn CN113225379A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110352829.8A CN113225379A (en) 2021-03-31 2021-03-31 Method and device for sending HTTP request message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110352829.8A CN113225379A (en) 2021-03-31 2021-03-31 Method and device for sending HTTP request message

Publications (1)

Publication Number Publication Date
CN113225379A true CN113225379A (en) 2021-08-06

Family

ID=77086230

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110352829.8A Withdrawn CN113225379A (en) 2021-03-31 2021-03-31 Method and device for sending HTTP request message

Country Status (1)

Country Link
CN (1) CN113225379A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114221836A (en) * 2021-12-15 2022-03-22 杭州橙鹰数据技术有限公司 Data processing method and device
CN114553966A (en) * 2022-01-21 2022-05-27 山东浪潮通软信息科技有限公司 Front-end Http request construction method, device, equipment and medium
CN114816403A (en) * 2022-04-19 2022-07-29 北京字节跳动网络技术有限公司 Request processing method, device, equipment and storage medium
CN117390030B (en) * 2023-12-12 2024-03-08 北京仁科互动网络技术有限公司 Multidimensional parameter mapping configuration method and device and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103701761A (en) * 2012-09-28 2014-04-02 中国电信股份有限公司 Authentication method for invoking open interface and system
WO2016095729A1 (en) * 2014-12-16 2016-06-23 阿里巴巴集团控股有限公司 Message processing method, device and system
CN108833369A (en) * 2018-05-28 2018-11-16 郑州云海信息技术有限公司 A kind of method, device and equipment accessing file system
US20200314136A1 (en) * 2019-03-28 2020-10-01 Naver Business Platform Corporation Apparatus and method for analyzing security vulnerabilities
CN111988400A (en) * 2020-08-20 2020-11-24 广州探途网络技术有限公司 Access processing method, application server and electronic equipment
CN112306881A (en) * 2020-11-02 2021-02-02 平安普惠企业管理有限公司 Simulation data generation method, device, equipment and storage medium
CN112367164A (en) * 2020-10-14 2021-02-12 深圳追一科技有限公司 Service request processing method and device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103701761A (en) * 2012-09-28 2014-04-02 中国电信股份有限公司 Authentication method for invoking open interface and system
WO2016095729A1 (en) * 2014-12-16 2016-06-23 阿里巴巴集团控股有限公司 Message processing method, device and system
CN108833369A (en) * 2018-05-28 2018-11-16 郑州云海信息技术有限公司 A kind of method, device and equipment accessing file system
US20200314136A1 (en) * 2019-03-28 2020-10-01 Naver Business Platform Corporation Apparatus and method for analyzing security vulnerabilities
CN111988400A (en) * 2020-08-20 2020-11-24 广州探途网络技术有限公司 Access processing method, application server and electronic equipment
CN112367164A (en) * 2020-10-14 2021-02-12 深圳追一科技有限公司 Service request processing method and device, computer equipment and storage medium
CN112306881A (en) * 2020-11-02 2021-02-02 平安普惠企业管理有限公司 Simulation data generation method, device, equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114221836A (en) * 2021-12-15 2022-03-22 杭州橙鹰数据技术有限公司 Data processing method and device
CN114553966A (en) * 2022-01-21 2022-05-27 山东浪潮通软信息科技有限公司 Front-end Http request construction method, device, equipment and medium
CN114816403A (en) * 2022-04-19 2022-07-29 北京字节跳动网络技术有限公司 Request processing method, device, equipment and storage medium
CN117390030B (en) * 2023-12-12 2024-03-08 北京仁科互动网络技术有限公司 Multidimensional parameter mapping configuration method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN113225379A (en) Method and device for sending HTTP request message
CN110275831B (en) Mock data verification method and device of protocol interface
US20040093588A1 (en) Instrumenting a software application that includes distributed object technology
US20110302267A1 (en) Web Site Implementation by Mapping Expression Evaluation
CN111143207B (en) Method for checking model training notice and training log at mobile terminal
CN108984202B (en) Electronic resource sharing method and device and storage medium
CN102567400B (en) Method for realizing Web visit and Web server
US8250226B2 (en) Generating one or more clients for generating one or more synthetic transactions with one or more web service operations
US11405403B2 (en) Method and device, and server and terminal for processing network resource access
CN108810025A (en) A kind of security assessment method of darknet, server and computer-readable medium
CN111177664A (en) Watermark information adding method, server and system
CN112511591A (en) Method, device, equipment and medium for realizing hospital interface data interaction
CN113722114A (en) Data service processing method and device, computing equipment and storage medium
CN109725887B (en) Data interaction method and device based on message research and development framework and terminal equipment
CN107395663B (en) Data acquisition method and device
JP2004246747A (en) Wrapping method and system of existing service
CN113127335A (en) System testing method and device
CN110874278A (en) Embedding method of external system, workflow system, device and storage medium
CN111258778B (en) Security management platform access management receiving method, security management platform access management sending method and security management system
CN113626001A (en) API dynamic editing method and device based on script
CN113791766A (en) Method for combining data interfaces, electronic device and readable storage medium
CN112860398A (en) Data processing method, device, equipment and medium based on rule engine
CN112000313A (en) Request response method, device, equipment and storage medium
CN114860468A (en) SDK calling method and device, computer equipment and storage medium
CN111240958A (en) Interface testing method and device, electronic equipment and 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
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20210806