Data processing method and device, storage medium and electronic equipment
By acquiring and authenticating service call requests in a distributed service architecture, identifying the target service, and adapting to request processing of different protocol types, the problem of service calls in different environments is solved, achieving efficient and secure service calls.
Patent Information
- Application Number
- CN202511723378.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-02-17
AI Technical Summary
In a distributed service architecture, it is difficult to achieve high efficiency and security for service calls across different environments, especially when crossing development, testing and production environments. Existing technical solutions increase the burden of operation and maintenance, security risks and latency, and are difficult to adapt to rapidly changing business needs.
By obtaining service call requests, determining the calling environment and target service, performing authentication, and calling the target service according to the request type, the service call request processing is realized, including parsing the request header, constructing the call request, and generating instructions to adapt to requests of different protocol types.
It enables seamless integration of service calls between different environments, simplifies front-end operations, improves the convenience and security of calls, and reduces the complexity and risk of operation and maintenance.
Smart Images

Figure CN121547512A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and more specifically, to a data processing method and apparatus, a storage medium and an electronic device. Background Technology
[0002] In distributed service architectures, service calls between different environments have become commonplace in enterprise applications, especially when services need to interact across isolated environments such as development, testing, and production. In this context, ensuring the efficiency and security of service calls has become a critical requirement, particularly in scenarios involving sensitive information or high concurrency, where strict standards apply to the controllability and response speed of service calls.
[0003] However, existing technical solutions face significant drawbacks in meeting this requirement. First, synchronously configuring firewall links during service deployment adds extra operational burden, especially when service nodes change dynamically, making firewall rule updates complex and error-prone (Part 3). Second, frequent firewall link activation increases security risks, providing more potential entry points for network attacks, particularly in scenarios with frequent calls across multiple environments. Furthermore, this configuration method struggles to adapt to rapidly changing business needs, leading to delays during service expansion and adjustments, impacting overall system performance and user experience.
[0004] There is currently no effective solution to the problem of difficulty in calling services in different environments in related technologies. Summary of the Invention
[0005] The main objective of this application is to provide a data processing method and apparatus, storage medium and electronic device to solve the problem of difficulty in calling services in different environments in related technologies.
[0006] To achieve the above objectives, according to one aspect of this application, a data processing method is provided. The method includes: obtaining a service invocation request from a caller in an access environment; determining a calling environment and a target service to be invoked within the calling environment based on the service invocation request; performing authentication processing on the service invocation request based on the target service to obtain an authentication result; and, if the authentication result indicates successful authentication, invoking the target service to process the service invocation request based on the type of the service invocation request to obtain a processing result.
[0007] Further, the authentication process for the service call request based on the target service to obtain the authentication result includes: parsing the request header of the service call request to obtain authentication field information; obtaining the call strategy corresponding to the target service; and performing authentication processing on the service call request based on the call strategy and the authentication field information to obtain the authentication result.
[0008] Further, determining the calling environment and the target service to be called in the calling environment based on the service call request includes: parsing the service call request to obtain call parameter information, wherein the call parameter information includes at least: environment parameter information and service description information; determining the calling environment based on the environment parameter information; and determining the target service in the calling environment based on the service description information.
[0009] Furthermore, before invoking the target service to process the service call request based on the type of the service call request and obtaining the processing result, the method further includes: identifying the protocol field of the service call request and obtaining an identification result; if the identification result is the target field, then the type of the service call request is determined to be the Hypertext Transfer Protocol type; if the identification result is not the target field, then the type of the service call request is determined to be the Remote Procedure Call type.
[0010] Further, based on the type of the service call request, the target service is invoked to process the service call request, and the processing result is obtained as follows: if the type of the service call request is Hypertext Transfer Protocol (HTTP), a target call request is constructed based on the parameters in the service call request and the address information of the target service; the target call request is sent to the HTTP service in the call environment; the target call request is routed to the target service through the HTTP service; and the service call request is processed through the target service to obtain the processing result.
[0011] Further, based on the type of the service call request, the target service is invoked to process the service call request, and the processing result is obtained as follows: if the type of the service call request is a remote procedure call type, a target call instruction is generated based on the service description information of the service call request; the target call instruction is received through the scheduling component in the call environment, and the target call instruction is distributed to the target service; the target service processes the service call request to obtain the processing result.
[0012] Furthermore, after processing the service call request through the target service and obtaining the processing result, the method further includes: encapsulating the processing result in the calling environment to obtain a response message conforming to the Hypertext Transfer Protocol; and returning the response message to the Hypertext Transfer Protocol service to return the response message to the caller in the access environment.
[0013] To achieve the above objectives, according to another aspect of this application, a data processing apparatus is provided. The apparatus includes: an acquisition unit for acquiring a service invocation request from a caller in an access environment; a first determination unit for determining, based on the service invocation request, a calling environment and a target service to be invoked within the calling environment; a first processing unit for performing authentication processing on the service invocation request based on the target service to obtain an authentication result; and a second processing unit for, if the authentication result indicates successful authentication, invoking the target service to process the service invocation request based on the type of the service invocation request to obtain a processing result.
[0014] Furthermore, the first processing unit includes: a first parsing module, used to parse the request header of the service call request to obtain authentication field information; an acquisition module, used to acquire the call strategy corresponding to the target service; and a first processing module, used to perform authentication processing on the service call request based on the call strategy and the authentication field information to obtain the authentication result.
[0015] Further, the first determining unit includes: a second parsing module, used to parse the service call request to obtain call parameter information, wherein the call parameter information includes at least: environment parameter information and service description information; a first determining module, used to determine the call environment based on the environment parameter information; and a second determining module, used to determine the target service in the call environment based on the service description information.
[0016] Furthermore, the apparatus further includes: an identification unit, configured to identify the protocol field of the service call request and obtain an identification result before calling the target service to process the service call request according to the type of the service call request and obtaining a processing result; a second determination unit, configured to determine that the type of the service call request is a Hypertext Transfer Protocol type if the identification result is a target field; and a third determination unit, configured to determine that the type of the service call request is a Remote Procedure Call type if the identification result is not the target field.
[0017] Further, the second processing unit includes: a construction module, configured to construct a target call request based on the parameters in the service call request and the address information of the target service if the type of the service call request is Hypertext Transfer Protocol (HTTP); a sending module, configured to send the target call request to the HTTP service in the call environment; a routing module, configured to route the target call request to the target service through the HTTP service; and a second processing module, configured to process the service call request through the target service to obtain the processing result.
[0018] Further, the second processing unit includes: a generation module, configured to generate a target call instruction based on the service description information of the service call request if the type of the service call request is a remote procedure call type; a distribution module, configured to receive the target call instruction through a scheduling component in the call environment and distribute the target call instruction to the target service; and a third processing module, configured to process the service call request through the target service to obtain the processing result.
[0019] Furthermore, the apparatus further includes: an encapsulation unit, configured to encapsulate the processing result in the calling environment after processing the service call request through the target service and obtaining the processing result, to obtain a response message conforming to the Hypertext Transfer Protocol; and a return unit, configured to return the response message to the Hypertext Transfer Protocol service, so as to return the response message to the caller in the access environment.
[0020] According to another aspect of the present invention, an electronic device is also provided, comprising: a memory storing an executable program; and a processor for running the program, wherein the program executes the data processing method described above during runtime.
[0021] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein the storage medium stores a program, and the program controls the device where the storage medium is located to execute the data processing method described above when it is running.
[0022] According to another aspect of the present invention, a computer program product is also provided, including a computer program or instructions, which, when executed by a processor, implement the data processing method described above.
[0023] In this embodiment, the following steps are adopted: obtaining the service call request from the caller in the access environment; determining the call environment and the target service to be called in the call environment based on the service call request; performing authentication processing on the service call request based on the target service to obtain the authentication result; if the authentication result indicates that the authentication is successful, calling the target service to process the service call request based on the type of the service call request to obtain the processing result, thereby solving the technical problem of difficulty in calling services in different environments in related technologies.
[0024] This solution receives a service call request from a caller, identifies the call environment the caller intends to access, and the target service to be called within that environment based on the request. Before forwarding the request, authentication is performed. If authentication is successful, the target service is invoked according to the type of the service call request to process the request and obtain the corresponding result. Through these steps, the caller does not need to concern itself with the specific environmental details of the target service or firewall policies; it only needs to send the call request in the usual manner. This achieves seamless integration of service calls across different environments, simplifies the front-end operations of service calls, and improves the convenience of service calls. Attached Figure Description
[0025] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0026] Figure 1 This is a hardware structure block diagram of a computer terminal for implementing a data processing method according to an embodiment of this application;
[0027] Figure 2 This is a flowchart of a data processing method provided according to an embodiment of this application;
[0028] Figure 3 This is a schematic diagram of a data processing method provided according to an embodiment of this application;
[0029] Figure 4 This is a schematic diagram of a data processing apparatus provided according to an embodiment of this application;
[0030] Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0031] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application 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 this application 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 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.
[0033] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.
[0034] Example 1
[0035] According to an embodiment of this application, a method embodiment for data processing is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0036] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a data processing method is shown. Figure 1As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0037] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0038] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the data processing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned data processing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0039] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0040] The display may be a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0041] Under the aforementioned operating environment, this application provides the following: Figure 2 The data processing method shown. Figure 2 This is a flowchart of a data processing method according to Embodiment 1 of this application. The data processing method includes:
[0042] Step S201: Obtain the service call request from the caller in the access environment.
[0043] Optionally, the data processing method provided in this application can be implemented through a forwarding node. The forwarding node can be bound to one or more network interfaces and ports in various environments to receive network traffic from that environment. It should be noted that these various environments include, but are not limited to, development environments, testing environments, pre-production environments, production environments, and even cloud environments, virtualization environments, containerized environments, or different geographically distributed environments. It should also be noted that the environment initiating the service call request is the access environment.
[0044] In an optional embodiment, a forwarding node listens for network traffic on a specified port. When a caller sends a service call request, the forwarding node captures the request. The service call request may include the caller's identity information, the identifier of the service to be called, call parameters, and other parameters.
[0045] Step S202: Based on the service call request, determine the call environment and the target service to be called in the call environment.
[0046] Optionally, after receiving a service call request, the forwarding node first parses the service call request and extracts the environment identification information carried in the service call request. The environment identification information can be contained in specific fields in the request header, URL parameters, or environment tags in the request body. They are used to indicate the environment in which the caller wants to access the service.
[0047] Based on the above analysis, forwarding nodes can identify the calling environment required by a service call request. The calling environment differs from the access environment of the caller; for example, a caller in a test environment might want to access a service in a production environment. After determining the calling environment, the target service to be called can be determined based on the service call request. For example, the current status, location information, and list of available nodes of the target service can be obtained by querying the service registry, thereby determining the target service to be called.
[0048] Step S203: Authentication is performed on the service call request based on the target service to obtain the authentication result.
[0049] Optionally, the service call request can include authentication information such as user identity, access token, role permissions, or specific authentication headers. After the forwarding node completes the identification of the environment and services in step S202, it will extract authentication information from the service call request.
[0050] The forwarding node processes the authentication information based on the target service's authentication policies and rules in the calling environment. These policies and rules include, but are not limited to, access control lists, defining which users or roles can access the service. Permission checks ensure the caller has the necessary permissions to perform specific operations on the target service. The authentication result is obtained by processing the authentication information. The authentication result can be a boolean value indicating whether the request is authorized. If the service call request fails authentication, the forwarding node rejects the request and returns an error message to the caller.
[0051] Step S204: If the authentication result indicates that the authentication is successful, the target service is invoked to process the service call request according to the type of the service call request, and the processing result is obtained.
[0052] Optionally, the forwarding node checks the authentication result obtained from step S203. If the authentication result shows that the request has been authorized (i.e., authentication passed), the forwarding node will continue to execute the subsequent request processing logic; otherwise, if authentication fails, the forwarding node will block the request and return an error or rejection message to the caller.
[0053] In an optional embodiment, upon successful authentication, the forwarding node identifies the type of service call request, determining whether it is an HTTP (Hypertext Transfer Protocol) request or an RPC (Remote Procedure Call) request. Finally, based on the type of service call request, it invokes the target service to process the request. The target service executes corresponding business logic based on the content of the service call request, such as processing data, performing queries or update operations, and obtains the processing result. The forwarding node is responsible for receiving this processing result. Finally, the forwarding node forwards the processing result to the caller in the access environment.
[0054] In summary, upon receiving a service call request from a caller, the system identifies the call environment the caller intends to access and the target service within that environment. Before forwarding the request, authentication is performed. If authentication is successful, the system invokes the target service based on the type of the service call request to obtain the appropriate processing result. Through these steps, the caller does not need to concern itself with the specific environmental details of the target service or firewall policies; it only needs to send the call request in the usual manner. This achieves seamless integration of service calls across different environments, simplifies the front-end operations of service calls, and significantly improves the convenience of service calls.
[0055] Optionally, in the data processing method provided in this application embodiment, the authentication processing of the service call request based on the target service to obtain the authentication result includes: parsing the request header of the service call request to obtain authentication field information; obtaining the call strategy corresponding to the target service; and authenticating the service call request based on the call strategy and the authentication field information to obtain the authentication result.
[0056] In an optional embodiment, when a service call request arrives at the forwarding node, the forwarding node first parses the request header to extract authentication field information. The request header contains various metadata, such as client type, request type, and fields used for authentication. Authentication field information may include, but is not limited to: Access token: a unique identifier used to verify the client's identity; User ID or role information: used to determine whether the requester has permission to access a specific resource; Timestamp and signature: to prevent the request from being replayed or tampered with, ensuring the timeliness and integrity of the request.
[0057] Then, the forwarding node obtains the authentication policy of the target service. The authentication policy can be generated in the forwarding node during service registration. It defines how the service handles authentication information, including allowed access levels, authentication methods, and behavior in case of authentication failure. The forwarding node executes the authentication logic based on the target service's invocation policy and the authentication fields parsed from the request header. For example, it verifies the token's validity, checking if it has expired, if the user is legitimate, and if they have the necessary service access permissions. It checks the requester's role or permissions to determine if they have the right to access the requested resource or perform the requested operation. It verifies the integrity and timeliness of the request based on the timestamp and signature to prevent replay attacks.
[0058] Finally, based on the authentication process described above, the forwarding node generates an authentication result, which indicates whether the request has been authorized. If authentication is successful, the result will be marked as passed, allowing the request to continue; if authentication fails, the result will be marked as rejected, the forwarding node will block the request, and return an error message to the caller.
[0059] The above steps ensure that only legitimate and authorized requests are forwarded to the target service, enhancing the security and controllability of cross-environment service calls. By implementing authentication at the forwarding node, not only can backend services be protected from unauthorized access, but authentication logic can also be centrally managed, simplifying the authentication process for both clients and servers, and improving the robustness and maintenance efficiency of the entire system.
[0060] Optionally, in the data processing method provided in this application embodiment, determining the calling environment and the target service to be called in the calling environment based on the service call request includes: parsing the service call request to obtain call parameter information, wherein the call parameter information includes at least: environment parameter information and service description information; determining the calling environment based on the environment parameter information; and determining the target service in the calling environment based on the service description information.
[0061] In an optional embodiment, when a service call request arrives at the forwarding node, the forwarding node first parses the service call request and extracts the call parameter information from the request message. The call parameter information is crucial for constructing the service call and includes, but is not limited to: environment parameter information: used to identify the service environment the call request intends to access, such as a test environment, pre-production environment, or production environment. Environment parameter information can be directly included in the request URL, or as part of the request header, or passed through specific parameter fields. Service description information: describes the specific service and method the requester intends to call, and may include the service name, interface name, method name, and possible business groups. The service description information is used to determine which specific service instance to call.
[0062] After parsing the environment parameter information, the forwarding node can determine the target environment of the request. For example, if the environment parameter information indicates that the request is for a service in a production environment, the forwarding node will identify the production environment as the calling environment. Based on determining the calling environment, the forwarding node uses the service description information to search for and determine the specific target service to be called within the calling environment.
[0063] For multiple service instances registered in the call environment, the forwarding node can also select a service instance as the target service to handle service call requests based on specific strategies (such as load balancing).
[0064] Through the above steps, the forwarding node can accurately identify the intent of the service call request, that is, identify the calling environment and the target service, and then proceed with the next step of authentication and call processing. This process not only ensures that the request can be efficiently routed to the correct service instance, but also provides the necessary context information for subsequent security checks and request processing, thereby improving the security and efficiency of service calls.
[0065] Optionally, in the data processing method provided in this application embodiment, before calling the target service to process the service call request according to the type of the service call request and obtaining the processing result, the method further includes: identifying the protocol field of the service call request and obtaining the identification result; if the identification result is the target field, then the type of the service call request is determined to be the Hypertext Transfer Protocol type; if the identification result is not the target field, then the type of the service call request is determined to be the Remote Procedure Call type.
[0066] In an optional embodiment, the forwarding node first identifies the protocol field in the service call request. The protocol field refers to the header information or request method of the request message, which helps the forwarding node determine which communication protocol the request uses. For example, for an HTTP request, the message header will contain methods such as GET and POST, as well as a Content-Type field, indicating that the request is based on HTTP. RPC requests, on the other hand, typically rely on a specific RPC framework.
[0067] If the identification results indicate that the request contains HTTP protocol characteristic fields (such as Content-Type: application / json or request methods like GET and POST), the forwarding node will determine the service call request type as Hypertext Transfer Protocol (HTTP). Conversely, if the identification results do not find HTTP protocol characteristic fields, or if they find RPC framework-specific identification information (such as gRPC's Content-Type: application / grpc), the service call request type will be determined as Remote Procedure Call (RPC).
[0068] Through the above identification and judgment, the forwarding node can intelligently adapt to different types of requests, ensuring that each request can be processed in the most suitable way, thereby improving the accuracy and efficiency of service calls.
[0069] Optionally, in the data processing method provided in this application embodiment, the process of calling the target service to process the service call request according to the type of the service call request and obtaining the processing result includes: if the type of the service call request is Hypertext Transfer Protocol type, then constructing a target call request based on the parameters in the service call request and the address information of the target service; sending the target call request to the Hypertext Transfer Protocol service in the call environment; routing the target call request to the target service through the Hypertext Transfer Protocol service; and processing the service call request through the target service to obtain the processing result.
[0070] In an optional embodiment, after determining that the service call request is of type HTTP, the forwarding node extracts all necessary parameter information and the target service's address information from the request. Parameter information includes, but is not limited to, the URL path, query parameters, request headers, and request body data (e.g., data to be processed). The target service's address information refers to the target service's network location, such as its IP address and port number, and may also include load balancing strategies or service instance selection strategies.
[0071] Based on the extracted parameters and address information, the forwarding node constructs a new HTTP request (i.e., the target call request mentioned above). This request will be used to directly invoke the HTTP service in the target environment. For example, it reconstructs the URL to ensure it matches the address information of the target service, and sets request headers to suit the requirements of the target service.
[0072] After the process is complete, the forwarding node sends the target call request to the HTTP service in the calling environment. In the target environment, the HTTP service routes the target call request to the target service based on the parameters of the target call request. The target service processes the service call request and obtains the final result.
[0073] Through the above steps, the forwarding node can not only proxy and forward HTTP service calls, but also adapt to service addresses and parameters in different environments, ensuring that requests are correctly routed to the target service and effectively processed, and finally return the processing results to the caller.
[0074] Optionally, in the data processing method provided in this application embodiment, the process of calling the target service to process the service call request according to the type of the service call request and obtaining the processing result includes: if the type of the service call request is a remote procedure call type, then generating a target call instruction based on the service description information of the service call request; receiving the target call instruction through the scheduling component in the call environment and distributing the target call instruction to the target service; and processing the service call request through the target service to obtain the processing result.
[0075] In an optional embodiment, if the service call request is a Remote Procedure Call (RPC) type, the forwarding node needs to identify service description information from the RPC request. This service description information includes, but is not limited to, the service name, method name, and business group. Based on the service description information, the forwarding node constructs a target call instruction. This instruction contains all the necessary information required to call the remote service. In the RPC framework, the target call instruction encapsulates the service name, method name, parameters, and possible timeouts and retry strategies. The generation of the target call instruction is performed according to the RPC framework specification, ensuring that the information format is compatible with the target service's RPC interface.
[0076] In the target environment, a scheduling component (such as a client proxy or service registration and discovery component in an RPC framework) is responsible for receiving target call instructions and distributing them to specific service instances. The scheduling component can select service instances based on information such as load, health status, or geographical location. After processing the request, the target service encapsulates the result into a response and returns it to the scheduling component via the RPC protocol. The scheduling component then forwards this response to a forwarding node, which finally returns the result to the original RPC service caller.
[0077] By deploying forwarding nodes across different environments, service call requests can be identified and transformed, enabling RPC calls to cross network boundaries or environmental isolation, thus improving the flexibility of service calls.
[0078] Optionally, in the data processing method provided in this application embodiment, after processing the service call request through the target service and obtaining the processing result, the method further includes: encapsulating the processing result in the calling environment to obtain a response message conforming to the Hypertext Transfer Protocol; and returning the response message to the Hypertext Transfer Protocol service to return the response message to the caller in the access environment.
[0079] In an optional embodiment, when the target service completes the processing of the service call request and generates a processing result, the processing result can be of any data type, including but not limited to text, JSON, XML, binary data, etc., depending on the service's business logic and the expected response of the call request.
[0080] The processing result is encapsulated to obtain a response message conforming to the Hypertext Transfer Protocol (HTTP). For example, status codes are set: HTTP response messages contain a status code to indicate the result of the request processing, such as 200 (success), 404 (not found), 500 (internal server error), etc. Response headers are constructed: Response headers contain metadata about the response, such as Content-Type and Content-Length. For example, if the response result is in JSON format, the Content-Type of the response header should be set to application / json. Response body data is formatted: The processing result is converted into response body data, formatted according to the content type specified in the response header, such as converting the processing result into a JSON string. Finally, the response message is returned to the HTTP service to deliver the response message to the caller in the access environment.
[0081] The above steps ensure that the processing results obtained from the target service can be returned to the caller in a standard HTTP response format, simplifying the complexity of cross-environment service calls.
[0082] In an optional embodiment, the forwarding node may consist of four main parts: a request forwarding module, a link permission management module, a link registration module, and a forwarding traffic monitoring module. For example... Figure 3 As shown, the request forwarding module handles both RPC and HTTP requests. HTTP request processing is based on dynamic URL technology, identifying the request URL and input parameters of the node, generating a corresponding HTTP request, calling the HTTP service in the specified environment, and forwarding the return to the caller, thus achieving seamless forwarding from the access environment to the calling environment. RPC requests use a generic RPC framework, registering generic call interfaces, and passing the interface name, business group, and method name parameter information to the service node before calling the corresponding service in the specified environment. The link permission management module confirms whether a request is allowed and the link is allowed by recognizing the authentication field in the request header. The link registration module configures the node deployment environment (access environment) and multiple node calling environments through configuration files. After project startup, the node service is deployed in the access environment. Upon receiving a request, it forwards the request to the target service in the corresponding calling environment based on whether the authentication field in the request header is registered. The forwarding traffic monitoring module acquires request status, request link information, request service, and message information during request forwarding. It analyzes the request and prevents risks through security controls, and archives or forwards the registration logs to various traffic monitoring platforms.
[0083] The data processing method provided in this application embodiment obtains the service call request from the caller in the access environment; determines the call environment and the target service to be called in the call environment based on the service call request; performs authentication processing on the service call request based on the target service to obtain the authentication result; and, if the authentication result indicates that the authentication is successful, calls the target service to process the service call request based on the type of the service call request to obtain the processing result, thereby solving the technical problem of difficulty in calling services between different environments in related technologies.
[0084] This solution receives a service call request from a caller, identifies the call environment the caller intends to access, and the target service to be called within that environment based on the request. Before forwarding the request, authentication is performed. If authentication is successful, the target service is invoked according to the type of the service call request to process the request and obtain the corresponding result. Through these steps, the caller does not need to concern itself with the specific environmental details of the target service or firewall policies; it only needs to send the call request in the usual manner. This achieves seamless integration of service calls across different environments, simplifies the front-end operations of service calls, and improves the convenience of service calls.
[0085] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0086] Example 2
[0087] This application also provides a data processing apparatus. It should be noted that the data processing apparatus of this application can be used to execute the data processing method provided in this application. The data processing apparatus provided in this application will be described below.
[0088] According to an embodiment of this application, an apparatus for implementing the above-described data processing method is also provided, such as... Figure 4 As shown, the device includes: an acquisition unit 401, a first determination unit 402, a first processing unit 403, and a second processing unit 404.
[0089] Acquisition unit 401 is used to acquire service invocation requests from callers in the access environment;
[0090] The first determining unit 402 is used to determine the calling environment and the target service to be called in the calling environment based on the service calling request;
[0091] The first processing unit 403 is used to perform authentication processing on the service call request based on the target service and obtain the authentication result.
[0092] The second processing unit 404 is used to, when the authentication result indicates that the authentication is successful, invoke the target service to process the service call request according to the type of the service call request, and obtain the processing result.
[0093] The data processing apparatus provided in this application embodiment acquires service call requests from callers in the access environment through an acquisition unit 401; a first determination unit 402 determines the call environment and the target service to be called in the call environment based on the service call request; a first processing unit 403 performs authentication processing on the service call request based on the target service to obtain an authentication result; and a second processing unit 404, if the authentication result indicates that the authentication is successful, calls the target service to process the service call request based on the type of the service call request to obtain a processing result, thereby solving the technical problem of difficulty in calling services between different environments in related technologies.
[0094] This solution receives a service call request from a caller, identifies the call environment the caller intends to access, and the target service to be called within that environment based on the request. Before forwarding the request, authentication is performed. If authentication is successful, the target service is invoked according to the type of the service call request to process the request and obtain the corresponding result. Through these steps, the caller does not need to concern itself with the specific environmental details of the target service or firewall policies; it only needs to send the call request in the usual manner. This achieves seamless integration of service calls across different environments, simplifies the front-end operations of service calls, and improves the convenience of service calls.
[0095] Optionally, in the data processing apparatus provided in this application embodiment, the first processing unit includes: a first parsing module, used to parse the request header of the service call request to obtain authentication field information; an acquisition module, used to acquire the call strategy corresponding to the target service; and a first processing module, used to perform authentication processing on the service call request based on the call strategy and the authentication field information to obtain the authentication result.
[0096] Optionally, in the data processing apparatus provided in this application embodiment, the first determining unit includes: a second parsing module, used to parse the service call request to obtain call parameter information, wherein the call parameter information includes at least: environment parameter information and service description information; a first determining module, used to determine the call environment based on the environment parameter information; and a second determining module, used to determine the target service in the call environment based on the service description information.
[0097] Optionally, in the data processing apparatus provided in this application embodiment, the apparatus further includes: an identification unit, configured to identify the protocol field of the service call request and obtain an identification result before calling the target service to process the service call request according to the type of the service call request and obtaining the processing result; a second determination unit, configured to determine that the type of the service call request is a Hypertext Transfer Protocol type if the identification result is a target field; and a third determination unit, configured to determine that the type of the service call request is a Remote Procedure Call type if the identification result is not a target field.
[0098] Optionally, in the data processing apparatus provided in this application embodiment, the second processing unit includes: a construction module, configured to construct a target call request based on the parameters in the service call request and the address information of the target service if the type of the service call request is Hypertext Transfer Protocol type; a sending module, configured to send the target call request to the Hypertext Transfer Protocol service in the call environment; a routing module, configured to route the target call request to the target service through the Hypertext Transfer Protocol service; and a second processing module, configured to process the service call request through the target service to obtain a processing result.
[0099] Optionally, in the data processing apparatus provided in this application embodiment, the second processing unit includes: a generation module, used to generate a target call instruction based on the service description information of the service call request if the type of the service call request is a remote procedure call type; a distribution module, used to receive the target call instruction through a scheduling component in the call environment and distribute the target call instruction to the target service; and a third processing module, used to process the service call request through the target service to obtain a processing result.
[0100] Optionally, in the data processing apparatus provided in the embodiments of this application, the apparatus further includes: an encapsulation unit, used to encapsulate the processing result in the calling environment after processing the service call request through the target service and obtaining the processing result, to obtain a response message conforming to the Hypertext Transfer Protocol; and a return unit, used to return the response message to the Hypertext Transfer Protocol service, so as to return the response message to the caller in the access environment.
[0101] It should be noted that the acquisition unit 401, the first determination unit 402, the first processing unit 403, and the second processing unit 404 mentioned above correspond to steps S201 to S204 in Embodiment 1. The four units and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above units can also be part of a device and run in the computer terminal 10 provided in Embodiment 1.
[0102] Example 3
[0103] Embodiments of this application may provide an electronic device. Figure 5 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 5 As shown, the electronic device may include: one or more ( Figure 5 (Only one is shown) processor 502, memory 504, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0104] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0105] The processor can access information and applications stored in memory via a transmission device to perform the following steps: obtain a service call request from a caller in the access environment; determine the calling environment and the target service to be called in the calling environment based on the service call request; perform authentication processing on the service call request based on the target service to obtain an authentication result; if the authentication result indicates that the authentication is successful, call the target service to process the service call request based on the type of the service call request to obtain a processing result.
[0106] The processor can access information and applications stored in memory via a transmission device to perform the following steps: authenticating the service call request based on the target service and obtaining the authentication result, including: parsing the request header of the service call request to obtain authentication field information; obtaining the call policy corresponding to the target service; and authenticating the service call request based on the call policy and authentication field information to obtain the authentication result.
[0107] The processor can invoke information and applications stored in memory via a transmission device to perform the following steps: determining the calling environment and the target service to be called in the calling environment based on the service call request, including: parsing the service call request to obtain call parameter information, wherein the call parameter information includes at least: environment parameter information and service description information; determining the calling environment based on the environment parameter information; and determining the target service in the calling environment based on the service description information.
[0108] The processor can invoke information and applications stored in memory through the transmission device to perform the following steps: before invoking the target service to process the service call request according to the type of the service call request and obtaining the processing result, the method further includes: identifying the protocol field of the service call request and obtaining the identification result; if the identification result is the target field, then the type of the service call request is determined to be the Hypertext Transfer Protocol type; if the identification result is not the target field, then the type of the service call request is determined to be the Remote Procedure Call type.
[0109] The processor can invoke information and applications stored in memory via a transmission device to perform the following steps: Based on the type of the service call request, invoke the target service to process the service call request and obtain the processing result, including: if the service call request type is Hypertext Transfer Protocol (HTTP), construct a target call request based on the parameters in the service call request and the address information of the target service; send the target call request to the HTTP service in the calling environment; route the target call request to the target service through the HTTP service; and process the service call request through the target service to obtain the processing result.
[0110] The processor can invoke information and applications stored in memory through the transmission device to perform the following steps: based on the type of the service call request, invoke the target service to process the service call request and obtain the processing result, including: if the type of the service call request is a remote procedure call, then generate a target call instruction based on the service description information of the service call request; receive the target call instruction through the scheduling component in the call environment and distribute the target call instruction to the target service; process the service call request through the target service and obtain the processing result.
[0111] The processor can invoke information and applications stored in memory through the transmission device to perform the following steps: After processing the service call request through the target service and obtaining the processing result, the method further includes: encapsulating the processing result in the calling environment to obtain a response message conforming to the Hypertext Transfer Protocol; and returning the response message to the Hypertext Transfer Protocol service to return the response message to the caller in the access environment.
[0112] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 5 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 5 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 5 The different configurations shown.
[0113] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0114] Example 4
[0115] Embodiments of this application also provide a computer-readable storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the data processing method provided in Embodiment 1.
[0116] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0117] This application also provides a computer program product, which, when executed on a data processing device, is a program adapted to perform data processing method steps.
[0118] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0119] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0120] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0121] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0122] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0123] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0124] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A data processing method, characterized by, The method comprises the following steps: acquiring a service call request of a calling party in an access environment; determining a calling environment and a target service to be called in the calling environment according to the service call request; performing authentication processing on the service call request according to the target service to obtain an authentication result; in the case that the authentication result represents that the authentication is passed, processing the service call request by calling the target service according to the type of the service call request to obtain a processing result.
2. The method of claim 1, wherein, The authentication processing on the service call request according to the target service to obtain an authentication result comprises the following steps: performing analysis on a request header of the service call request to obtain authentication field information; acquiring a calling strategy corresponding to the target service; performing authentication processing on the service call request according to the calling strategy and the authentication field information to obtain the authentication result.
3. The method of claim 1, wherein, The determination of the calling environment and the target service to be called in the calling environment according to the service call request comprises the following steps: performing analysis on the service call request to obtain calling parameter information, wherein the calling parameter information at least comprises environment parameter information and service description information; determining the calling environment according to the environment parameter information; determining the target service in the calling environment according to the service description information.
4. The method of claim 1, wherein, Before the processing of the service call request by calling the target service according to the type of the service call request to obtain a processing result, the method further comprises the following steps: performing identification on a protocol field of the service call request to obtain an identification result; if the identification result is a target field, it is determined that the type of the service call request is a hypertext transfer protocol type; if the identification result is not the target field, it is determined that the type of the service call request is a remote procedure call type.
5. The method of claim 1, wherein, The processing of the service call request by calling the target service according to the type of the service call request to obtain a processing result comprises the following steps: if the type of the service call request is the hypertext transfer protocol type, a target calling request is constructed according to parameters in the service call request and address information of the target service; the target calling request is sent to a hypertext transfer protocol service in the calling environment; the target calling request is routed to the target service through the hypertext transfer protocol service; the service call request is processed through the target service to obtain the processing result.
6. The method of claim 1, wherein, The processing of the service call request by calling the target service according to the type of the service call request to obtain a processing result comprises the following steps: if the type of the service call request is the remote procedure call type, a target calling instruction is generated according to service description information of the service call request; the target calling instruction is received by a scheduling component in the calling environment, and the target calling instruction is distributed to the target service; the service call request is processed through the target service to obtain the processing result.
7. The method of claim 5, wherein, After the service call request is processed through the target service to obtain the processing result, the method further comprises the following steps: The processing result is encapsulated in the calling environment to obtain a response message conforming to a hypertext transfer protocol; The response message is returned to the hypertext transfer protocol service to return the response message to the invoker in the access environment.
8. A data processing apparatus, characterized by, Comprise: An acquisition unit, configured to acquire a service invocation request of an invoker in an access environment; A first determination unit, configured to determine a calling environment and a target service to be invoked in the calling environment according to the service invocation request; A first processing unit, configured to perform authentication processing on the service invocation request according to the target service, to obtain an authentication result; A second processing unit, configured to, if the authentication result represents that the authentication is passed, invoke the target service to process the service invocation request according to a type of the service invocation request, to obtain a processing result.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium comprises a stored executable program, wherein the executable program controls a device where the computer readable storage medium is located to execute the data processing method in any one of claims 1 to 7 when the executable program is running.
10. An electronic device, comprising: Comprise: A memory, storing an executable program; A processor, configured to run the program, wherein the program executes the data processing method in any one of claims 1 to 7 when the program is running.