A method and system for implementing message conversion to simulate service requests

By using custom message conversion logic and AOP aspect technology, the problem of inconsistent message formats between the front-end and back-end application platforms was solved, and the decoupling of local front-end and back-end integration and business logic was achieved, improving development efficiency and code quality.

CN115407980BActive Publication Date: 2026-03-13CHINA CONSTRUCTION BANK
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-31
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In enterprise-level IT architectures, inconsistent message formats between front-end and back-end application platforms lead to reduced development efficiency and quality. Existing frameworks with fixed rules are not flexible enough, making it difficult to achieve local debugging and customized processing.

Method used

By customizing message conversion logic and AOP aspect technology, a mapping relationship between front-end and back-end message interfaces is constructed. AspectJ is used to create pointcuts and surround enhancement logic to realize the conversion of request and response messages. A mapping association thesaurus is used to map tag names and attribute names, and local front-end and back-end integration testing is performed.

Benefits of technology

It enables local front-end and back-end integration testing under an enterprise-level architecture, simulating transaction paths in test and production environments, facilitating problem discovery, reducing development complexity and time costs, and achieving isolation and decoupling from business logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115407980B_ABST
    Figure CN115407980B_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer technology, and more particularly to a method and system for implementing message conversion to simulate service requests. The method includes a front-end application platform sending request message information to a back-end application platform; the back-end application platform parsing the request message information based on a service tag; determining whether the tag name corresponding to the request message information matches the attribute name corresponding to the called object on the back-end application platform; if they match, the back-end application platform processes the request message information and sends a response message information to the front-end application platform; if they do not match, the back-end application platform processes the request message information using custom message conversion logic, processes the response message information using custom message conversion logic, and sends it to the front-end application platform; the front-end application platform receives the response message information and verifies it. This method performs message conversion according to the requirements of both the front-end and back-end application platforms, simulating testing and production environment transactions, thus solving the problem of local debugging.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and system for implementing message conversion to simulate service requests. Background Technology

[0002] In current enterprise IT architectures, multi-platform deployments are often based on a layered overall architecture. When developing a front-end / back-end separated project, the three most important components are the front-end application, the back-end application, and the service registry. For companies with mature IT architectures, developers often only need to focus on their business logic code. Transaction-related tasks such as transaction tracking number generation, message encryption / decryption, signing, and signature verification are handled by the enterprise framework. This reduces the burden on developers and ensures standardized specifications for information collection and problem discovery. However, frameworks also bring drawbacks: fixed rules and lack of flexibility. Projects with specific development requirements may require customization to function. For example, the front-end might be developed using the Vue framework with a uniform JSON message format, while the back-end uses XML according to platform requirements, with inconsistent tag names and front-end parameters. Message conversion between testing and production environments is handled by the respective platform frameworks based on platform message configurations. However, during front-end and back-end development, if the back-end only relies on API debugging tools like Postman or JMeter, or if the front-end only ensures page display without allowing local debugging of the complete transaction path, development efficiency and quality will be significantly reduced. Summary of the Invention

[0003] To address the shortcomings of existing technologies, this invention proposes a method and system for implementing message conversion simulation service requests. This system performs message conversion based on the requirements of front-end and back-end application platforms, simulates testing and production environment transactions, and solves the problem of local debugging.

[0004] To achieve the above objectives, the technical solution adopted by the present invention includes:

[0005] A method for implementing message conversion to simulate a service request includes the following steps:

[0006] The front-end application platform sends a request message to the back-end application platform; the request message is set with a corresponding tag name.

[0007] The backend application platform parses the request message information based on the service tag;

[0008] Determine whether the tag name corresponding to the request message information matches the attribute name corresponding to the object being called on the backend application platform;

[0009] If they match, the backend application platform processes the request message and sends the response message to the frontend application platform; if they do not match, the backend application platform processes the request message using custom message conversion logic and processes the response message using custom message conversion logic before sending it to the frontend application platform.

[0010] The front-end application platform receives and verifies the response message information.

[0011] The custom message conversion logic processes request message information and sends response message information to the front-end application platform through the custom message conversion logic, including completing the conversion processing of request message information and response message information according to the preset mapping relationship between tag name and attribute name.

[0012] Furthermore, the step of converting request message information and response message information according to the preset mapping relationship between tag names and attribute names includes: constructing a mapping association dictionary, setting mapping association words to associate the tag names with the attribute names, assigning the tag value corresponding to the tag name to the attribute corresponding to the attribute name, and completing the conversion processing of the request message information.

[0013] Furthermore, the backend application platform processes request message information through custom message conversion logic, and sends response message information to the frontend application platform through custom message conversion logic, which also includes processing the request message information and the response message information based on aspect ratio technology.

[0014] Furthermore, the processing of the request message information and the response message information based on aspect technology includes creating a complete AOP aspect object by combining a pointcut with the surrounding enhancement logic using AspectJ, and determining the weaving object according to the definition of the pointcut.

[0015] Furthermore, the step of creating a complete AOP aspect object by combining the pointcut and the surrounding enhancement logic using AspectJ, and determining the weaving object based on the pointcut definition, includes the following steps:

[0016] Create a Java class and annotate its name with @Aspect or @Component to mark it as an AspectJ configuration class and inject it into the Spring IOC container;

[0017] In the AspectJ configuration class, create a constructor to define the pointcut, including adding the @Pointcut tag and the value attribute to the constructor to define the pointcut;

[0018] In the AspectJ configuration class, create class methods to define the enhancement logic. Define the surrounding enhancement methods and dependency pointcuts by adding the @Around tag and the value attribute to the class methods.

[0019] Furthermore, the cutpoint includes weaving in enhanced logic by adding the @PostMapping tag.

[0020] The present invention also relates to a system for implementing a message conversion simulation service request, comprising:

[0021] The request module sends a message request information from the front-end application platform to the back-end application platform; the request message information is set with a corresponding tag name;

[0022] The processing module, in which the backend application platform parses the request message information based on the service tag;

[0023] The judgment module determines whether the tag name corresponding to the request message information matches the attribute name corresponding to the called object on the backend application platform. If they match, the backend application platform processes the request message information and sends the response message information to the frontend application platform. If they do not match, the backend application platform processes the request message information and the response message information through a custom message conversion logic and sends it to the frontend application platform. The custom message conversion logic processes the request message information and sends the response message information to the frontend application platform, including converting the request message information and the response message information according to a preset mapping relationship between tag names and attribute names.

[0024] The verification module is used by the front-end application platform to receive and verify response message information.

[0025] The present invention also relates to a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.

[0026] The present invention also relates to an electronic device, including a processor and a memory;

[0027] The memory is used to store operation instructions;

[0028] The processor is configured to execute the above-described method by invoking the operation instructions.

[0029] The present invention also relates to a computer program product, including a computer program and / or instructions that, when executed by a processor, implement the steps of the above-described method.

[0030] The beneficial effects of this invention are as follows:

[0031] The method and system for simulating service requests through message conversion as described in this invention, under an enterprise-level architecture, with a fixed front-end and back-end framework, allows for local front-end and back-end integration by exposing local services and establishing a mapping relationship between front-end and back-end message interfaces. This enables the simulation of transaction paths in both test and production environments to the greatest extent possible, facilitating problem detection and improving code quality. During the service exposing and message conversion process, the technical solution of this invention achieves isolation from business logic, preventing code not used in the production environment from affecting business logic, thus achieving decoupling and zero intrusion, minimizing the impact on business processes. Furthermore, AOP (Aspect-Oriented Programming) allows for development by a single person, applying to all service interfaces without requiring developers to write repetitive and complex code, reducing time costs. Attached Figure Description

[0032] Figure 1 This is a flowchart illustrating the method for implementing message conversion to simulate service requests according to the present invention.

[0033] Figure 2 This is a schematic diagram of the system structure for implementing message conversion simulation service requests according to the present invention. Detailed Implementation

[0034] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0035] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0036] The first aspect of this invention relates to a process flow as follows: Figure 1 The method shown for implementing message conversion to simulate a service request includes the following steps:

[0037] Step S1: The front-end application platform sends a request message to the back-end application platform; the request message is set with a corresponding tag name;

[0038] Step S2: The backend application platform parses the request message information according to the service tag;

[0039] Step S3: Determine whether the tag name corresponding to the request message information is consistent with the attribute name corresponding to the object being called on the backend application platform;

[0040] If they match, the backend application platform processes the request message and sends the response message to the frontend application platform; if they do not match, the backend application platform processes the request message using custom message conversion logic and processes the response message using custom message conversion logic before sending it to the frontend application platform.

[0041] Step S4: The front-end application platform receives the response message information and performs verification.

[0042] The custom message conversion logic processes request message information and sends response message information to the front-end application platform through the custom message conversion logic, including completing the conversion processing of request message information and response message information according to the preset mapping relationship between tag name and attribute name.

[0043] In this preferred embodiment, the step of converting request message information and response message information according to the preset mapping relationship between tag names and attribute names includes: constructing a mapping association dictionary, setting mapping association words to associate the tag names with the attribute names, assigning the tag value corresponding to the tag name to the attribute corresponding to the attribute name, and completing the conversion processing of the request message information.

[0044] Optionally in this embodiment, the processing of the request message information and the response message information based on aspect technology includes creating a complete AOP aspect object by combining a pointcut with the surround enhancement logic using AspectJ, and determining the weaving object according to the definition of the pointcut.

[0045] This embodiment performs message conversion based on the different requirements of the front-end and back-end application platform systems, simulates testing and production environment transactions, solves local debugging problems, and can also discover problems that require online verification, such as similar framework message configurations.

[0046] Optionally in this implementation, the step of creating a complete AOP aspect object by combining the pointcut and the surrounding enhancement logic using AspectJ, and determining the weaving object based on the pointcut definition, includes the following steps:

[0047] Create a Java class and annotate its name with @Aspect or @Component to mark it as an AspectJ configuration class and inject it into the Spring IOC container;

[0048] In the AspectJ configuration class, create a constructor to define a pointcut, including adding the @Pointcut tag and value attribute to the constructor to define the pointcut, which tells the framework which Java classes or methods need to be woven with enhancement logic;

[0049] In the AspectJ configuration class, create class methods to define the enhancement logic. Define the surrounding enhancement methods and dependency pointcuts by adding the @Around tag and the value attribute to the class methods.

[0050] The pointcut is where enhanced logic is woven in by adding the @PostMapping tag.

[0051] In this embodiment, custom request and response messages are converted before and after the controller method based on AOP aspects, so that the JSON message sent by the front-end application platform meets the XML message standard of the back-end application platform. During system operation, a dynamic proxy is applied to the controller, so that the local call is the proxy-enhanced object, thereby achieving the purpose of front-end and back-end joint debugging.

[0052] This approach utilizes Spring MVC's controller layer to expose local interfaces and the AspectJ framework to implement AOP (Aspect-Oriented Programming) features. AOP relies on dynamic proxies, which create a proxy object for the target object at runtime and enhance the methods within the target object. During proxy object creation, the target object remains unchanged; the methods in the proxy object are the enhanced methods of the target object. This can be understood as runtime interception of methods within the object, executing functionalities before and after the interception. Because it occurs at runtime, the enhancement logic doesn't need to be written in the code, hence the term "dynamic proxy." AOP, a key feature of the Spring framework, leverages runtime dynamic proxies to isolate different parts of the business logic, thereby reducing coupling between these parts and improving system development efficiency.

[0053] The two most important aspects of XML format messages are the tag names and tag values. The technical problem this embodiment aims to solve is that when the tag names do not match the attribute names of the backend application platform's POJO (which can be understood as the simplest Java object in a Java project, without business logic), calls cannot be made. Therefore, the key is to map the XML tag names to the attribute names of the backend POJO, and then assign the tag values ​​corresponding to the tag names to the corresponding attributes. Based on the preset mapping relationship between tag names and attribute names, the conversion of request and response message information is completed. This embodiment uses weaving enhancement logic to parse the message configuration based on the service tag before calling the service. Through Java reflection programming, the keys in the JSON (i.e., the XML tag names) are assigned one by one to the attribute names in the POJO, achieving message conversion and successfully calling the service method.

[0054] The method for simulating service requests through message conversion as described in this invention, under an enterprise-level architecture, where the front-end and back-end frameworks are fixed, allows for local front-end and back-end integration by opening local services and establishing a mapping relationship between the front-end and back-end message interfaces. This local integration maximizes the simulation of transaction paths in both test and production environments, facilitating problem identification and improving code quality. During service opening and message conversion, the technical solution of this invention achieves isolation from business logic, preventing code not used in the production environment from affecting business logic, thus achieving decoupling and zero intrusion, minimizing the impact on business processes. Furthermore, AOP (Aspect-Oriented Programming) allows for development by a single person, applying it to all service interfaces without requiring developers to write repetitive and complex code, reducing time costs.

[0055] Another aspect of the present invention relates to a system for implementing message conversion simulation service requests, the structure of which is as follows: Figure 2 As shown, it includes:

[0056] The request module sends a message request information from the front-end application platform to the back-end application platform; the request message information is set with a corresponding tag name;

[0057] The processing module, in which the backend application platform parses the request message information based on the service tag;

[0058] The judgment module determines whether the tag name corresponding to the request message information matches the attribute name corresponding to the called object on the backend application platform. If they match, the backend application platform processes the request message information and sends a response message information to the frontend application platform. If they do not match, the backend application platform processes the request message information and the response message information through a custom message conversion logic, and then sends them to the frontend application platform. The custom message conversion logic for processing the request message information and sending the response message information to the frontend application platform includes converting the request message information and the response message information according to a preset mapping relationship between tag names and attribute names.

[0059] The verification module is used by the front-end application platform to receive and verify response message information.

[0060] By using this system, the aforementioned computational processing methods can be executed and the corresponding technical effects can be achieved.

[0061] Embodiments of the present invention also provide a computer-readable storage medium capable of implementing all the steps of the methods in the above embodiments, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, implements all the steps of the methods in the above embodiments.

[0062] Embodiments of the present invention also provide an electronic device for performing the above-described method. As an implementation device for the method, the electronic device includes at least a processor and a memory. In particular, the memory stores data and related computer programs required for performing the method. The processor calls the data and programs in the memory to execute all the steps of the method and obtain the corresponding technical effect.

[0063] Preferably, the electronic device may include a bus architecture, which may include any number of interconnected buses and bridges. The bus will include various circuits linked together by one or more processors and memories. The bus may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface between the bus and the receiver and transmitter. The receiver and transmitter may be the same element, i.e., a transceiver, providing a unit for communicating with various other systems over a transmission medium. The processor is responsible for managing the bus and general processing, while the memory may be used to store data used by the processor during operation.

[0064] Additionally, the electronic device may further include components such as a communication module, an input unit, an audio processor, a display, and a power supply. The processor (or controller, operating control) used may include a microprocessor or other processor device and / or logic device, which receives input and controls the operation of various components of the electronic device; the memory may be one or more of a buffer, flash memory, hard drive, removable media, volatile memory, non-volatile memory, or other suitable devices, which can store the aforementioned data information, and may also store programs for executing the information, and the processor can execute the program stored in the memory to achieve information storage or processing, etc.; the input unit is used to provide input to the processor, for example, it can be a button or touch input device; the power supply is used to provide power to the electronic device; the display is used to display images and text, for example, it can be an LCD display. The communication module is a transmitter / receiver that transmits and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor to provide input signals and receive output signals, which can be the same as in conventional mobile communication terminals. Based on different communication technologies, multiple communication modules can be incorporated into the same electronic device, such as cellular network modules, Bluetooth modules, and / or wireless LAN modules. The communication module (transmitter / receiver) is also coupled to a speaker and microphone via an audio processor to provide audio output through the speaker and receive audio input from the microphone, thereby enabling typical telecommunications functions. The audio processor can include any suitable buffer, decoder, amplifier, etc. Furthermore, the audio processor is coupled to a central processing unit, enabling on-device recording via the microphone and on-device playback of stored sound via the speaker.

[0065] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0066] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.

[0067] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0068] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the functions specified in one or more boxes. Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention.

[0069] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for implementing a message conversion simulation service request, characterized in that, The method comprises the following steps: The front-end application platform sends a request message to the back-end application platform; the request message is provided with a corresponding label name; The back-end application platform parses the request message according to a service mark; It is judged whether the label name corresponding to the request message is consistent with the attribute name corresponding to the called object of the back-end application platform; If consistent, the back-end application platform processes the request message and sends a response message to the front-end application platform; If inconsistent, the back-end application platform processes the request message through a self-defined message conversion logic, processes the response message through the self-defined message conversion logic and sends the response message to the front-end application platform; The front-end application platform receives and verifies the response message; The self-defined message conversion logic processes the request message and sends the response message to the front-end application platform through the self-defined message conversion logic, which comprises completing the conversion processing of the request message and the response message according to a preset mapping relationship between the label name and the attribute name.

2. The method of claim 1, wherein, The conversion processing of the request message and the response message according to the preset mapping relationship between the label name and the attribute name comprises: constructing a mapping association word library, setting a mapping association word to associate the label name with the attribute name, assigning a label value corresponding to the label name to an attribute corresponding to the attribute name, and completing the conversion processing of the request message.

3. The method according to any one of claims 1 or 2, characterized in that, The back-end application platform processes the request message through the self-defined message conversion logic and sends the response message to the front-end application platform through the self-defined message conversion logic, which further comprises processing the request message and the response message based on an aspect technology.

4. The method of claim 3, wherein, The processing of the request message and the response message based on the aspect technology comprises creating a pointcut and a surrounding enhancement logic through AspectJ to form a complete AOP aspect object, and determining a weaving object according to the definition of the pointcut.

5. The method of claim 4, wherein, The processing of the request message and the response message based on the aspect technology comprises creating a pointcut and a surrounding enhancement logic through AspectJ to form a complete AOP aspect object, and determining a weaving object according to the definition of the pointcut. The processing of the request message and the response message based on the aspect technology comprises creating a pointcut and a surrounding enhancement logic through AspectJ to form a complete AOP aspect object, and determining a weaving object according to the definition of the pointcut. The pointcut comprises a method weaving enhancement logic added through a @PostMapping label. The method comprises the following steps:

6. The method of claim 5, wherein, A request module, in which the front-end application platform sends a request message to the back-end application platform; the request message is provided with a corresponding label name; 7. A system for implementing a message conversion simulation service request, the system comprising: A processing module, in which the back-end application platform parses the request message according to a service mark; ​ ​ The judgment module judges whether the label name corresponding to the request message information is consistent with the attribute name corresponding to the called object of the back-end application platform; if consistent, the back-end application platform processes the request message information and sends the response message information to the front-end application platform; if inconsistent, the back-end application platform processes the request message information through the custom message conversion logic and processes the response message information through the custom message conversion logic and sends it to the front-end application platform; wherein the custom message conversion logic processing the request message information and sending the response message information to the front-end application platform through the custom message conversion logic includes completing the conversion processing of the request message information and the response message information according to the preset mapping relationship between the label name and the attribute name; The verification module, the front-end application platform receives the response message information and performs verification.

8. A computer-readable storage medium, characterized in that, The storage medium has a computer program stored thereon, and the computer program is executed by the processor to implement the method of any one of claims 1-6.

9. An electronic device, comprising: It comprises a processor and a memory. The memory is used for storing operation instructions. The processor is used for executing the method of any one of claims 1-6 by calling the operation instructions.

10. A computer program product comprising computer programs and / or instructions, characterized in that, The computer program and / or instructions are executed by the processor to implement the steps of the method of any one of claims 1-6.

Citation Information

Patent Citations

  • Interface message conversion configuration method, interface message conversion method and equipment

    CN111787097A

  • Information processing method and device

    CN112291240A