A message generation method, device and electronic equipment

By parsing the target front-end source code on the client side to generate message bodies and add message headers, the problem of poor code readability when non-Web system clients interact with Web front-ends is solved. This achieves efficient message generation and interaction, avoids modification and coupling of Web front-end code, and ensures code reusability.

CN119135780BActive Publication Date: 2025-11-07CHINA CONSTRUCTION BANK +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410739877.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2025-11-07
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

When a client on a non-web system interacts with a web front-end, code needs to be added or modified on the web front-end to enable the interaction, resulting in poor code readability and high maintenance difficulty.

Method used

The client generates a message body and adds a message header by parsing the source code of the target front-end, thus generating the first message. This avoids adding code to the web front-end and bypasses the cookie operation restriction by using the embedded engine and network interaction unit, enabling message generation and interaction.

Benefits of technology

It enables efficient message generation without modifying the web front-end code, solving the problems of strong code coupling and poor readability, and ensuring code reusability and maintainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119135780B_ABST
    Figure CN119135780B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of network services, in particular to a message generation method and device and electronic equipment, which are used for generating a message body according to rules contained in target source code, and solve the problem that when a client not supporting a Web system interacts with a target front end supporting the Web system, the code of the target front end needs to be increased or modified, leading to poor readability of the code of the target front end. The message generation method comprises the following steps: a client receives a business instruction; target source code obtained is compiled to generate a message body corresponding to the business instruction; wherein the target source code comprises rules for generating the message body, the target source code is source code of a target front end, the target front end supports a Web system, and the client does not support the Web system; a message head is added to the message body to generate a first message.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of network services, and in particular to a message generation method and device and electronic equipment. BACKGROUND

[0002] In order to improve security, various browser kernels (i.e. Web engines), including Chrome browser, prohibit reading of cookies in HTTP (Hypertext Transfer Protocol) message headers from the local file system and assignment of values to cookies. Since HTTP messages are written according to Java Script methods in HTML (HyperText Markup Language) files, this makes it impossible for the Web front end to be deployed in the local file system under the aforementioned prohibition requirements, so that the Web engine can directly load the HTML file deployed on the front-end server when the user needs to search, query, etc. using the Web engine.

[0003] However, the above direct loading of HTML files is mainly used in pure Web systems in which the front end and the back end are both deployed on a Web server. When a non-Web system client, such as a C++, Python, etc. client with a different programming language from the Web system needs to load an HTML file, because the interface of the Web front end is fixed and the code logic and / or programming language of the aforementioned client is different from that of the Web front end, the aforementioned cookie-related operations are prohibited, and the Web front end can only be increased with code for interacting with the client to make the interface of the Web front end compatible with the messages of the aforementioned client, thereby meeting the needs of the client and the Web front end to interact. At the same time, code that can interact with the Web front end code logic under the client code logic needs to be added in the client to ensure that the Web front end can process the client's message according to the HTML file after receiving the client's message, thereby enabling the client to send corresponding messages to the back-end server. The aforementioned code added and / or modified in the Web front end to meet the needs of the non-Web system client to send messages to the Web front end has strong coupling with the existing code of the Web front end for other services, resulting in poor readability of the Web front end code. SUMMARY

[0004] The application provides a message generation method and device and electronic equipment, which are used for generating a message body according to a rule contained in a target source code, and solve the problem that the code of a target front end needs to be increased or modified when a client not supporting a Web system interacts with the target front end supporting the Web system, and the readability of the code of the target front end is poor.

[0005] In a first aspect, the application provides a message generation method, comprising:

[0006] The client receives a service instruction.

[0007] In response to the service instruction, the target source code obtained is compiled to generate a message body corresponding to the service instruction; wherein the target source code comprises a rule for generating the message body, the target source code is a source code of a target front end, the target front end supports a Web system, and the client does not support the Web system.

[0008] A message header is added to the message body to generate a first message.

[0009] In a possible implementation, the compiling of the target source code obtained to generate the message body corresponding to the service instruction comprises:

[0010] The target source code is parsed to extract the rule for generating the message body.

[0011] The rule is compiled to generate the message body corresponding to the service instruction.

[0012] In a possible implementation, after the message header is added to the message body to generate the first message, the method further comprises:

[0013] The first message is sent.

[0014] A second message is received; wherein the response information of the first message in the second message comprises a first cookie field.

[0015] The first cookie field is read and cached.

[0016] In a possible implementation, the adding of the message header to the message body to generate the first message comprises:

[0017] A second cookie field cached most recently is determined.

[0018] The second cookie field is added to the message header to generate the first message.

[0019] In a possible implementation, the target source code is obtained according to the following method:

[0020] obtaining a target file;

[0021] In the target file, determining the target source code.

[0022] In a possible implementation, the target file is an HTML file;

[0023] The target source code is JS source code

[0024] In a second aspect, the embodiments of the present application provide a client, which is configured to execute the method in the first aspect and any possible implementation.

[0025] In a possible implementation, the client comprises an embedded engine and a network interaction unit; wherein,

[0026] The embedded engine is configured to receive a service instruction, and in response to the service instruction, compile a target source code obtained to generate a message body corresponding to the service instruction; wherein, the target source code comprises a rule for generating the message body, the target source code is a source code of a target front end, the target front end supports a Web system, and the client does not support the Web system.

[0027] The network interaction unit is configured to add a message header to the message body to generate the first message.

[0028] In a third aspect, the embodiments of the present application provide a message generation apparatus, comprising:

[0029] An instruction unit configured to receive a service instruction by a client;

[0030] A source code unit configured to, in response to the service instruction, compile a target source code obtained to generate a message body corresponding to the service instruction; wherein, the target source code comprises a rule for generating the message body, the target source code is a source code of a target front end, the target front end supports a Web system, and the client does not support the Web system.

[0031] A message unit configured to add a message header to the message body to generate the first message.

[0032] In a possible implementation, the source code unit is specifically configured to parse the target source code, extract the rule for generating the message body, and generate the message body corresponding to the service instruction by compiling the rule.

[0033] In a possible implementation, the apparatus further includes a cache unit configured to send the first packet; receive a second packet; wherein the response information to the first packet in the second packet includes a first cookie field; read the first cookie field and cache the first cookie field.

[0034] In a possible implementation, the packet unit is further configured to determine a second cookie field that is newly cached; add the second cookie field in the packet header and generate the first packet.

[0035] In a possible implementation, the apparatus further includes a file unit configured to obtain a target file; and determine the target source code in the target file.

[0036] In a possible implementation, the target file is an HTML file; and the target source code is JS source code.

[0037] In a fourth aspect, an electronic device is provided, and the electronic device includes:

[0038] a memory configured to store program instructions;

[0039] a processor configured to invoke the program instructions stored in the memory and perform steps included in the method according to the first aspect and any possible implementation of the method according to the first aspect.

[0040] In a fifth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, the computer program includes program instructions, and the program instructions, when executed by a computer, cause the computer to perform the method according to the first aspect and any possible implementation of the method.

[0041] In a sixth aspect, a computer program product is provided, and the computer program product includes computer program code, and when the computer program code runs on a computer, the computer program code causes the computer to perform the method according to the first aspect and any possible implementation of the method.

[0042] The one or more technical solutions provided in the embodiments of the present application have at least the following technical effects:

[0043] In the message generation method provided by the embodiment of the present application, the client generates a message body through the target source code of the target front end to construct a first message for accessing the target front end. Since the message body is generated based on the target source code, the message body and the corresponding first message can match the server interface of the system where the target front end is located in the specific business scenario (corresponding to the business instruction). In this way, the code is added to the target front end, and the problem of poor readability and difficult maintenance caused by strong coupling of the target front end code is avoided, thereby ensuring the reusability of the target front end code.

[0044] Other features and advantages of the present application will be set forth in the following description, and in part will become apparent to those skilled in the art from the description, or can be learned by practice of the present application. The objects and other advantages of the present application can be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings. It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of the provided drawings.

[0046] Figure 1 A flowchart of a message generation method provided by an embodiment of the present application;

[0047] Figure 2 A structural schematic diagram of a client provided by an embodiment of the present application;

[0048] Figure 3 A structural schematic diagram of a client provided by an embodiment of the present application;

[0049] Figure 4 A method schematic diagram of a client executing a message generation method provided by an embodiment of the present application;

[0050] Figure 5 A structural schematic diagram of a message generation device provided by an embodiment of the present application;

[0051] Figure 6 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to make the objectives, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application and are not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the scope of protection of the present application. The embodiments in the present application and the features in the embodiments can be combined with each other in a non-conflicting manner. Moreover, although a logical sequence is shown in the flowchart, in some cases, the steps shown or described can be performed in an order different from that shown.

[0053] The terms "first" and "second" in the specification and claims of the present application and the above drawings are used to distinguish different objects and are not used to describe a specific sequence. In addition, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed or can optionally include other steps or units inherent to the process, method, product or device. "Multiple" in the present application can mean at least two, for example, can be two, three or more, and the embodiments of the present application are not limited.

[0054] Exemplary embodiments of the present application are described below with reference to the accompanying drawings, including various details of the embodiments of the present application to help understanding, which should be considered only as exemplary. Therefore, a person of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present disclosure. Also, for the sake of clarity and conciseness, the description below omits the description of well-known functions and structures. It should be noted that in the embodiments of the present application, some software, components, models and other industry solutions can be mentioned, which should be considered as exemplary and only for the purpose of illustrating the feasibility of the implementation of the technical solutions of the present application, but do not mean that the applicant has or will necessarily use the solutions.

[0055] In the technical solutions of the present application, the acquisition, transmission, storage and use of data comply with the requirements of relevant national laws and regulations.

[0056] The technical scheme of the present application is described in detail below with reference to the drawings and specific embodiments. The present application provides a message generation method, which can be applied to a client of a non-Web system. The code interaction logic of the non-Web system is different from that of a Web system. The message generation method can avoid modifying the code of the Web front end, and solve the problem of poor readability and high maintenance difficulty of the front-end code caused by the need to add related code in the Web front end when the third-party program of the current non-Web system interacts with the Web system. Please refer to Figure 1 The method specifically includes the following implementation steps:

[0057] Step 101: The client receives a business instruction.

[0058] Specifically, the business instruction includes a user's business request. The business request may be, for example, login, browsing, and query.

[0059] The business instruction can include user information, such as user password, mobile phone number, etc.

[0060] The business instruction also includes business information, such as the price of a certain type of commodity.

[0061] Step 102: In response to the business instruction, the target source code obtained is compiled to generate a message body.

[0062] The target source code is the source code of a target front end, and the target front end supports a Web system. The target front end can be a Web front end.

[0063] The client does not support the Web system. For example, the client is an office. Therefore, when the client interacts with the target front end, it is actually cross-system interaction. Here, cross-system can refer to two systems with different business functions.

[0064] In some embodiments, after obtaining the target source code, the target source code can be introduced into the corresponding project of the client to save the target source code under the corresponding file directory, so as to facilitate the execution of step 102.

[0065] The above-mentioned target source code can be obtained before step 101 or after step 101 and before step 102.

[0066] Further, the above-mentioned target source code can be directly obtained from the target front end.

[0067] Further, since the target source code is generally embedded in a file, in order to improve the efficiency of obtaining the target source code, in some embodiments, the target file embedding the target source code can be obtained from the repository of the target front end first. Specifically, the target file embedding the aforementioned target source code can be obtained first. Then, in the target file, the target source code is determined, thereby avoiding the problems of resource consumption and low efficiency caused by determining the target source code in the target front end or the repository of the target front end.

[0068] Taking the target source code as the JS source code as an example, the target file can be an HTML file. When the JS source code is determined, the CSS (Cascading Style Sheet), HTML (HyperText Markup Language) in the HTML file can be deleted, and only the JS source code can be retained. When the engine embedded in the client is a Web engine, the JS source code can be easily obtained through the HTML file, and the Web engine can directly reuse the JS source code, that is, reuse the corresponding method in the JS source code to generate the message body.

[0069] The target source code can be, for example, a JS (JavaScript) source code. The target source code includes a rule for generating a message body. When the message body is generated, the target source code can be parsed first to extract the rule for generating the message body from the target source code. Then, the rule is compiled to efficiently generate the message body.

[0070] The above rule actually specifies the message body generation rule corresponding to the business instruction, so that the backend service can read the message body and respond after receiving the first message containing the message body.

[0071] In some embodiments, the message body can still use the target source code. Specifically, by embedding an embedded engine capable of directly reusing the target source code in the client, the embedded engine can directly generate the message body by reusing the target source code compilation rule after extracting the rule for generating the message body, without having to modify the code again to improve the efficiency of generating the message body. For example, the target source code is a JS source code of a web front end, and the embedded engine is a Web engine. The Web engine can directly reuse the JS source code to generate the message body after compiling the rule in the JS source code.

[0072] Alternatively, in some embodiments, the message body can use a target language. The target language is a programming language other than the target source code, for example, C++. Specifically, when the client does not contain the aforementioned embedded engine, or the embedded engine in the client cannot reuse the JS source code because it does not support the Web system, the rule for generating the message body can be extracted, and then the rule can be compiled by using a programming language other than the target source code to generate the aforementioned message body. It can be seen that this embodiment has the advantage of wide application range.

[0073] Further, the message body corresponds to the service instruction. Specifically, the message body includes specific service information contained in the service instruction. Taking the login scenario as an example, the message body can include service information such as a username, a password, or a mobile phone number.

[0074] Step 103: Adding a message header to the message body to generate a first message.

[0075] Specifically, the first message can be an HTTP message, and specifically can be an HTTP request message.

[0076] In some embodiments, the first message is a message in which the client requests login from the target front end, and the message header includes data (time), content type (text type), connecting (connection state), server (service type), and the like.

[0077] In this way, after the first message is generated, the first message can be sent to the backend service, so that the backend service processes, responds, and the like to the first message. Specifically, the backend service can implement identity verification of the client based on the first message, and then send a second message containing response information of the first message to the client. The response information includes a cookie field.

[0078] The second message is a response message of the backend service based on the first message. Therefore, the client can first send the first message to the backend service. Then, the second message responded by the backend service based on the first message is received. The second message includes response information of the first message.

[0079] Next, the first cookie field in the second message can be read by any component or program of the client other than the Web engine, so as to avoid the forbidden setting of the cookie field by the Web system. After reading the first cookie field, the first cookie field in the second message can be further cached.

[0080] Further, the first message is a message for further interaction between the client and the backend service after the client completes login, for example, query of sensitive data. At this time, the message header further includes the cookie field issued by the backend service, so that when the client sends the first message to the backend service, the backend service can identify the identity of the client based on the cookie field. Specifically, the latest cached second cookie field can be determined. The second cookie field can be the first cookie field or can not be the first cookie field. Then, the second cookie field is added to the message header, and the message header after adding the second cookie field is combined with the message body to generate the first message.

[0081] In determining the second cookie field of the latest cache, the third cookie field in each received second packet can be read, and compared with the first cookie field. If the same, the first cookie field is determined as the second cookie field, and the first cookie field in the packet header does not need to be modified. If different, the third cookie field is determined as the latest cookie field, and the third cookie field is cached as the second cookie field, and the first cookie field is deleted.

[0082] Alternatively, the third cookie field in each received second packet can be read, and then the third cookie field is directly taken as the second cookie field, and the first cookie field in the cache is replaced by the second cookie field.

[0083] Further, when the first packet is an HTTP packet, the first packet can be encapsulated through a third-party warehouse to obtain a first packet meeting the format required by the HTTP protocol.

[0084] Further, when the second cookie field needs to be added in the packet header so that the backend service can efficiently identify the client, and in step 102, in order to generate the packet body efficiently and at low cost, an embedded engine capable of directly reusing the target source code is embedded in the client to generate the packet body, in order to break through the current prohibition setting of the Web engine on the cookie operation, the packet body can be sent to a network interaction unit other than the embedded engine in the client through inter-process communication, and step 103 is executed by the network interaction unit.

[0085] Based on the same inventive concept, the embodiments of the present application provide a client, which is used to execute Figure 1 the packet processing method.

[0086] In some embodiments, referring to Figure 2 , the client includes an embedded engine and a network interaction unit.

[0087] In some embodiments, the embedded engine is an engine that can directly reuse target source code of a target front end. For example, the target front end is a Web front end, and the embedded engine is a Web engine. The Web engine is configured to compile target source code obtained in response to a received service instruction to generate a message body corresponding to the service instruction, wherein the target source code includes a rule for generating the message body, the target source code is source code of the target front end, the target front end supports a Web system, and the client does not support the Web system.

[0088] The service instruction can be received by the Web engine or by a program other than the Web engine in the client.

[0089] The network interaction unit is configured to add a message header to the message body to generate the first message, so that when the message header includes a cookie field, the Web engine can add the message header to the first message to avoid a related prohibition setting of the cookie.

[0090] In some embodiments, the embedded engine is a Web engine, and to break through the aforementioned prohibition setting that the Web engine cannot read the cookie field, the network interaction unit is further configured to send the first message and receive a second message. The second message includes response information to the first message, and the response information includes a first cookie field.

[0091] Then, the first cookie field in the second message is read and cached.

[0092] In some embodiments, the embedded engine is a Web engine, and to break through the aforementioned prohibition setting regarding the cookie field, the network interaction unit is further configured to determine a newly cached second cookie field, add the second cookie field to the message header, and generate the first message, thereby breaking through the limitation that the client cannot generate the first message due to the Web engine's inability to add the cookie field to the message.

[0093] In some embodiments, when the message header does not include the cookie field, the embedded engine is configured to receive a service instruction, compile target source code obtained in response to the service instruction to generate a message body corresponding to the service instruction, wherein the target source code includes a rule for generating the message body, the target source code is source code of a target front end, the target front end supports a Web system, and the client does not support the Web system, and add a message header to the message body to generate the first message.

[0094] The client can be a program, an APP, or the like. The network interaction unit can be a collection of all programs in the client except the embedded engine. Please refer toFigure 3 .

[0095] Please refer to Figure 4 , the following target source code for JS source code, embedded in the client engine for Web engine as an example, combined with the above message generation method, the client is described:

[0096] First, the target source code can be introduced into the client corresponding to the project / directory file.

[0097] Then, when the client receives the user's business instructions (for example, login, query account information, etc.), the Web engine in the client can call the JS source code that has been pre-introduced based on the business instructions to generate the message body of the HTTP request.

[0098] Then, the Web engine can pass the above message body to the network interaction unit through inter-process communication.

[0099] The network interaction unit can determine the HTTP message header corresponding to the message body based on the business instruction after receiving the message body, and add the message header to the message body to obtain the HTTP request message.

[0100] Next, the network interaction unit sends the HTTP request message to achieve the purpose of initiating the HTTP request. After that, the network interaction unit can receive the response message of the HTTP request message from the backend service. The cookie field read in the response message can be cached.

[0101] Based on the same inventive concept, the embodiments of the present application provide a message generation device, please refer to Figure 5 , the device comprises:

[0102] The instruction unit 501 is configured to receive a business instruction by the client.

[0103] The source code unit 502 is configured to compile the target source code to generate a message body corresponding to the business instruction in response to the business instruction.

[0104] Among them, the target source code includes the rule for generating the message body, the target source code is the source code of the target front end, the target front end supports the Web system, and the client does not support the Web system.

[0105] The source code unit 502 is specifically configured to:

[0106] The target source code is parsed to extract the rule for generating the message body; by compiling the rule, the message body corresponding to the business instruction is generated.

[0107] The message unit 503 is configured to add a message header to the message body to generate the first message.

[0108] The device further includes a cache unit configured to send the first message, receive a second message, wherein the response information of the first message in the second message includes a first cookie field, read the first cookie field, and cache the first cookie field.

[0109] The message unit 503 is further configured to:

[0110] determine a latest cached second cookie field, add the second cookie field in the message header, and generate the first message.

[0111] The device further includes a file unit configured to obtain a target file, and determine the target source code in the target file.

[0112] The target file is an HTML file, and the target source code is a JS source code.

[0113] For the convenience of description, each part is divided into modules (or units) according to functions and is described respectively. Of course, the functions of the modules (or units) can be realized in one or more software or hardware in the implementation of the present application.

[0114] After introducing the intelligent repayment method and device of the exemplary embodiment of the present application, next, the electronic device according to another exemplary embodiment of the present application is introduced.

[0115] Those skilled in the art can understand that each aspect of the present application can be implemented as a system, a method or a program product. Therefore, each aspect of the present application can be specifically implemented as a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combined with hardware and software, which can be collectively referred to as "circuit", "module" or "system".

[0116] Based on the same inventive concept as the message generation method described above, the present application embodiment further provides an electronic device, which can realize the function of the message generation method described above, please refer to Figure 6 In an embodiment, the electronic device includes:

[0117] The memory 601, the communication module 603 and one or more processors 602. The memory 601 is configured to store computer programs executed by the processor 602. The memory 601 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, and the data storage area can store various operation instruction sets, etc.

[0118] The memory 601 can be a volatile memory, such as a random-access memory (RAM); the memory 601 can also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 601 can be any other medium capable of carrying or storing desired program codes in the form of instructions or data structures and capable of being accessed by a computer, but is not limited thereto. The memory 601 can be a combination of the above memories.

[0119] The processor 602 can include one or more central processing units (CPUs) or digital processing units, etc. The processor 602 is used to implement the above-mentioned packet generation detection method when calling the computer program stored in the memory 601.

[0120] The communication module 603 is used to communicate with terminal devices, station devices or other network devices.

[0121] The specific connection medium between the above-mentioned memory 601, communication module 603 and processor 602 is not limited in the embodiments of the present application. In the embodiments of the present application, the memory 601 and the processor 602 are connected through a bus 604, the bus 604 is described by a thick line in the embodiments of the present application, and the connection mode between other components is only schematically described, and is not limited thereto. The bus 604 can be divided into an address bus, a data bus, a control bus, etc. For the convenience of description, only one thick line is used to describe the bus 604 in the embodiments of the present application, but it is not described that there is only one bus or only one type of bus. Figure 6 Figure 6 Figure 6

[0122] The memory 601 stores a computer storage medium, the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the packet generation detection method of the embodiments of the present application. The processor 602 is used to execute the packet generation detection method of each embodiment.

[0123] The embodiments of the present application also provide a computer storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is used to make a computer execute the technical solutions of the above-mentioned embodiments of the intelligent repayment method.

[0124] ​​​The embodiment of the present application further provides a computer program product, which comprises computer program codes, and when the computer program codes are run on a computer, the computer program codes make the computer execute the technical solution of the intelligent repayment method in the above embodiment.

[0125] Those skilled in the art can understand that all or part of the steps of the above method embodiments can be completed by program instruction related hardware, and the program instruction is a computer program, which can be stored in a computer readable storage medium. When the computer program is executed, the steps of the above method embodiments are executed. The readable storage medium may, for example, but is not limited to, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include an electric connection with one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0126] The program product of the embodiment of the present application can adopt a portable compact disc read-only memory (CD-ROM) and include program codes, and can be run on a computing device. However, the program product of the present application is not limited to this, and in this document, the readable storage medium can be any tangible medium containing or storing a program, which can be used or combined with a command execution system, device or apparatus.

[0127] The readable signal medium can include a data signal propagating in a baseband or as a carrier wave in a propagated data signal, in which a readable program code is borne. Such a propagated data signal can adopt multiple forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The readable signal medium can also be any readable medium that is not a readable storage medium, which can send, propagate or transmit a program for use by or in connection with a command execution system, device or apparatus.

[0128] The program code contained in the readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0129] The program code can be executed by one or more programmable processors, digital signal processors, ASICs, FPGAs, or other programmable digital logic devices. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). These network connections are

[0130] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional modules is taken as an example for description, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.

[0131] In several embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented by other ways. For example, the device embodiments described above are only schematic, and for example, the division of the modules or units is only a logical function division, and there can be another division way in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or other forms.

[0132] The units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0133] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0134] While the preferred embodiments of the application have been described, additional variations and modifications can be made to these embodiments by those skilled in the art once they have the benefit of the present disclosure without departing from the spirit and scope of the application. Accordingly, it is intended that the appended claims include all such modifications and variations as fall within the scope of the present application.

[0135] It is apparent that many modifications and variations of this application can be effected although only a few have been chosen for purposes of disclosure. Thus, it is intended that this application include all such modifications and variations as fall within the scope of the claims and their equivalents.

Claims

1. A method of generating a packet, characterized by, The method comprises the following steps: The client receives a service instruction; In response to the service instruction, a target source code is compiled to generate a message body corresponding to the service instruction; wherein the target source code comprises a rule for generating the message body, the target source code is a source code of a target front end, the target front end supports a Web system, and the client does not support the Web system; A message header is added to the message body, a second cookie field in the latest cache is determined, the second cookie field is added to the message header, and a first message is generated.

2. The method of claim 1, wherein, The method of compiling the target source code to generate the message body corresponding to the service instruction comprises the following steps: The target source code is parsed to extract the rule for generating the message body; The rule is compiled to generate the message body corresponding to the service instruction.

3. The method of claim 1 or 2, wherein, After the message header is added to the message body to generate the first message, the method further comprises the following steps: The first message is sent; A second message is received; wherein the response information of the first message in the second message comprises a first cookie field; The first cookie field is read and cached.

4. The method according to any one of claims 1 to 2, wherein The target source code is obtained according to the following method: A target file is obtained; In the target file, the target source code is determined.

5. The method of claim 4, wherein, The target file is an HTML file; The target source code is a JS source code.

6. A client, characterized in that, The client comprises an embedded engine and a network interaction unit; wherein The embedded engine is used to receive a service instruction; in response to the service instruction, a target source code is compiled to generate a message body corresponding to the service instruction; wherein the target source code comprises a rule for generating the message body, the target source code is a source code of a target front end, the target front end supports a Web system, and the client does not support the Web system; The network interaction unit is used to add a message header to the message body, determine a second cookie field in the latest cache, add the second cookie field to the message header, and generate a first message.

7. A packet generating apparatus characterized by comprising: The method comprises the following steps: An instruction unit is used to receive a service instruction by a client; A source code unit is used to compile a target source code in response to the service instruction to generate a message body corresponding to the service instruction; wherein the target source code comprises a rule for generating the message body, the target source code is a source code of a target front end, the target front end supports a Web system, and the client does not support the Web system; A message unit is used to add a message header to the message body, determine a second cookie field in the latest cache, add the second cookie field to the message header, and generate a first message.

8. The apparatus of claim 7, wherein, The source code unit is specifically used to parse the target source code to extract the rule for generating the message body; and the rule is compiled to generate the message body corresponding to the service instruction.

9. The apparatus of claim 7 or 8, wherein, The device further comprises a cache unit, configured to send the first packet; receive a second packet; wherein the response information of the first packet in the second packet comprises a first cookie field; read the first cookie field, and cache the first cookie field.

10. The apparatus of claim 7 or 8, wherein, The device further comprises a file unit, configured to obtain a target file; and determine the target source code in the target file.

11. The apparatus of claim 10, wherein, The target file is an HTML file; and the target source code is a JS source code.

12. An electronic device, comprising: The device comprises: a memory, configured to store program instructions; a processor, configured to invoke the program instructions stored in the memory, and perform the steps included in the method according to any one of claims 1-5 according to the obtained program instructions.

13. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program comprises program instructions, which, when executed by a computer, cause the computer to perform the method according to any one of claims 1-5.

14. A computer program product, characterised in that, The computer program product comprises computer program code, which, when executed on a computer, causes the computer to perform the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Agent system and method supporting real-time analysis of GRPC request

    CN113746851A

  • Binary code modification system and method for implementing a web service interface

    US20100333065A1