CN117714218A - Cross-network service calling method and device - Google Patents

Cross-network service calling method and device Download PDF

Info

Publication number
CN117714218A
CN117714218A CN202410168982.9A CN202410168982A CN117714218A CN 117714218 A CN117714218 A CN 117714218A CN 202410168982 A CN202410168982 A CN 202410168982A CN 117714218 A CN117714218 A CN 117714218A
Authority
CN
China
Prior art keywords
state
task
request
file
service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410168982.9A
Other languages
Chinese (zh)
Inventor
杨茂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengfang Financial Technology Co ltd
Original Assignee
Chengfang Financial Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengfang Financial Technology Co ltd filed Critical Chengfang Financial Technology Co ltd
Priority to CN202410168982.9A priority Critical patent/CN117714218A/en
Publication of CN117714218A publication Critical patent/CN117714218A/en
Pending legal-status Critical Current

Links

Abstract

The invention provides a method and a device for calling a cross-network service, belonging to the technical field of data security, wherein the method comprises the following steps: after the first network successfully accepts the request of the terminal equipment, a task is established, and the state of the task is set to be a first state; generating a request file at regular time according to a request corresponding to a task with a first state, updating the state of the task into a second state, and ferrying the request file corresponding to the task with the second state to a second network based on a file ferrying strategy of an optical gate; and regularly receiving a receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling the first interface to execute the first processing logic according to the return data corresponding to the task in the third state and the service processing class associated with the service type corresponding to the task. The invention supports the cross-network service call in the asynchronous mode and realizes the safe data transmission under the condition of network isolation.

Description

Cross-network service calling method and device
Technical Field
The present invention relates to the field of data security technologies, and in particular, to a method and an apparatus for calling a cross-network service.
Background
Data security is the basis for network space security. In relation to cross-network data exchanges, particularly private and non-private networks, shutter devices that are more secure than physical firewalls are typically used. The optical gate device isolates the networks by cutting off the physical paths between the networks, and transmits data across the networks in the form of files based on the private protocol of the file ferrying strategy to complete data synchronization, thereby achieving the effects of physical isolation and logical communication.
However, file ferry strategies have limitations. The method is commonly used for file synchronization, supports data synchronization under a data archiving scene, such as accessory transmission, transaction result synchronization and the like, and is difficult to support the requirements of a business circulation scene. The service flow is usually driven by a service calling mode, but the existing service calling method takes network connectivity as a premise, and does not support service calling of an isolation environment, so that the service flow cannot be used in a secret-related network.
Disclosure of Invention
The invention provides a cross-network service calling method and device, which are used for solving the defect that cross-network service calling is not supported under the optical gate file ferrying strategy in the prior art, realizing service circulation through task states under the condition of network isolation, and ensuring data security transmission.
The invention provides a cross-network service calling method, which is applied to a first network and comprises the following steps:
after the first network successfully accepts the request of the terminal equipment, a task is established, and the state of the task is set to be a first state;
generating a request file at fixed time according to a request corresponding to a task with the state being a first state, updating the state of the task into a second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate;
and regularly receiving a receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute a first processing logic according to the return data corresponding to the task in the third state and a service processing class associated with the service type corresponding to the task.
According to the method for calling the cross-network service provided by the invention, the request file is generated at the timing according to the request corresponding to the task with the state being the first state, and the method comprises the following steps:
storing the state of the task, the data interaction direction, the request and the service type of the request into a first database;
Searching a request corresponding to a task of which the state is a first state and the data interaction direction is a request sending and the service type of the request from the first database at regular time;
generating a request message according to the searched request and the service type of the request, and storing the request message into a first text file to obtain the request file.
According to the method for calling the cross-network service provided by the invention, the timing is used for calling a first interface to execute a first processing logic according to the returned data corresponding to the task with the third state and the service processing class associated with the service type corresponding to the task, and the method comprises the following steps:
storing the return data into the first database;
searching returned data and a requested service type corresponding to a task which is requested to be sent from the first database in a timing way, wherein the state is a third state and the data interaction direction is the requested service type;
the searched return data is inversely sequenced into a return object, and a corresponding service processing class is obtained according to the searched service type;
and calling a first interface to execute first processing logic according to the returned object and the service processing class.
The invention also provides a cross-network service calling method, which is applied to the second network and comprises the following steps:
The method comprises the steps of receiving a request file of a first network based on file ferrying strategy ferrying of an optical gate at fixed time, setting a state of a task corresponding to the request file as a first state, and analyzing the request file to obtain request data;
the method comprises the steps of calling a second interface to execute second processing logic according to request data corresponding to a task with a first state and service processing classes associated with service types corresponding to the task at regular time, and updating the state of the task into a second state;
and generating a receipt file at regular time according to an execution result corresponding to the task with the second state, updating the state of the task into the fourth state, and ferrying the receipt file corresponding to the task with the fourth state to the first network based on the file ferrying strategy.
According to the method for calling the cross-network service provided by the invention, the timing is used for calling a second interface to execute a second processing logic according to the request data corresponding to the task with the first state and the service processing class associated with the service type corresponding to the task, and the method comprises the following steps:
storing the data interaction directions of the request data and the task into a second database;
Searching request data corresponding to a task and a service type corresponding to the task, wherein the request data corresponds to the task and the service type corresponds to the task, and the data interaction direction is the request;
the searched request data is inversely sequenced into a request object, and a service processing class corresponding to the service type is obtained according to the searched service type of the request;
and calling a second interface to execute second processing logic according to the request object and the service processing class.
According to the method for calling the cross-network service provided by the invention, the receipt file is generated at the timing according to the execution result corresponding to the task with the second state, and the method comprises the following steps:
storing the execution result into the second database;
searching the second database at regular time, wherein the state is a second state, and the data interaction direction is an execution result corresponding to the task requested to be received;
and generating a receipt message according to the searched execution result, and storing the receipt message to a second text file to obtain the receipt file.
The invention also provides a cross-network service calling device, which comprises:
the service acceptance module is used for establishing a task after the first network successfully accepts the request of the terminal equipment and setting the state of the task to be a first state;
The first file creation module is used for generating a request file at fixed time according to a request corresponding to a task with the state being the first state, updating the state of the task into the second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate;
and the first service calling module is used for regularly receiving the receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute first processing logic according to the return data corresponding to the task with the state of the third state and the service processing class associated with the service type corresponding to the task.
The invention also provides a cross-network service calling device, which comprises:
the file transmission module is used for receiving a request file of the first network based on the file ferrying strategy ferrying of the optical gate at fixed time, setting the state of a task corresponding to the request file as a first state, and analyzing the request file to obtain request data;
the second service calling module is used for calling a second interface to execute second processing logic according to the request data corresponding to the task with the first state and the service processing class associated with the service type corresponding to the task at regular time, and updating the state of the task into a second state;
And the second file creation module is used for generating receipt files at regular time according to the execution result corresponding to the task with the second state, updating the state of the task into the fourth state, and ferrying the receipt files corresponding to the task with the fourth state to the first network based on the file ferrying strategy.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the cross-network service invocation method as described in any of the above when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of cross-network service invocation as described in any of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a method of cross-network service invocation as described in any of the above.
According to the cross-network service calling method and device, the service request and the service response are tasked in the process of cross-network service calling by adopting the multi-stage processing mechanism in the asynchronous mode, the state of the task is updated, the service is asynchronously called according to the circulation of the task state, the service calling flow is reconstructed by combining with the file ferrying strategy, the cross-network service calling in the asynchronous mode is supported, and the data security transmission under the condition of network isolation is realized.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow diagram of a cross-network service invocation method provided by the present invention;
FIG. 2 is a schematic diagram of a request-to-send state flow in a cross-network service invocation method provided by the present invention;
FIG. 3 is a schematic diagram of a request receiving state flow in a cross-network service invocation method provided by the present invention;
FIG. 4 is a schematic flow chart of a first network initiated asynchronous request in a cross-network service invocation method provided by the present invention;
FIG. 5 is a schematic flow chart of a second network initiated asynchronous receipt in a cross-network service invocation method provided by the invention;
FIG. 6 is a second flow chart of a cross-network service invocation method provided by the present invention;
FIG. 7 is a schematic diagram of a cross-network service invocation apparatus according to the present invention;
FIG. 8 is a second schematic diagram of a cross-network service calling device according to the present invention;
FIG. 9 is a third schematic diagram of a cross-network service calling device according to the present invention;
fig. 10 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The following describes a cross-network service calling method of the present invention with reference to fig. 1, applied to a first network, including:
step 101, after the first network successfully accepts a request of a terminal device, a task is established, and the state of the task is set to be a first state;
the first network is a network that sends the request. The conventional asynchronous service call flow includes the request, accept, execute and respond 4 phases. In the embodiment, the asynchronous service call flow is expanded into 7 stages of request, request task acceptance, file processing, execution, response task acceptance, file processing and response for processing under the cross-network file ferry strategy. Where file processing may include 3 steps of file creation, file transfer, and file parsing. These 3 steps are automatically performed, transparent to the business system.
The embodiment controls the service call flow through the task state and identifies the execution stage where each service call is located. When the service call is executed, different processing flows exist for request sending and request receiving, so that state flows of the request sending and the request receiving are different.
As shown in fig. 2, for request transmission, after the current network successfully accepts the request, a task is established, and the task state is set to a first state, namely an initialization state; after the file is requested to be created, the task state is updated to a second state, namely a processing state; after receiving the opposite terminal network receipt message, changing the task state into a third state, namely a receipt state; after the service call execution is completed, the task state is changed to a fourth state, namely a completed state.
As shown in fig. 3, for request reception, after receiving a request message sent by an opposite-end network, a current network sets a task to a first state, namely an initialization state; after the service call is executed, updating the task state into a second state, namely a state in processing; after the receipt file is created, the task state is updated to a fourth state, namely a completed state.
The first network accepts flow conversion control when initiating remote service call, and accepts a service call request sent by the terminal device according to the service type. And establishing a task according to the request, and storing the task and the information of the request, so as to convert the request information into a service call task record. After the task is established, the state of the task is set to a first state, i.e., an initialization state.
Step 102, generating a request file at fixed time according to a request corresponding to a task with the state being the first state, updating the state of the task to the second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate;
service calls can be classified into two modes, synchronous calls and asynchronous calls, depending on whether real-time feedback is occurring. The service call is realized based on the file ferry strategy, and the condition of synchronous call is not provided, so that an asynchronous call mode is adopted.
And because the file ferrying strategy ferries the text file, the first network reads the request corresponding to the initialized task at regular time, generates a request message according to the related information of the request, and converts the request message into a text file form to obtain the request file. After the creation of the request file is completed, the state of the task is updated to a second state, i.e., an in-process state.
The file ferry policy in this embodiment may be a shutter file ferry policy used by a shutter device. The optical gate device realizes data exchange across networks by means of link blocking, protocol conversion and the like, and supports application protocols such as HTTP (Hypertext Transfer Protocol ), POP3 (Post Office Protocol Version, post office protocol version 3), NFS (Network File System ) and the like. Under the high-security network isolation environment, the network is often required to be isolated by cutting off a physical channel between a security network and a non-security network, two unidirectional channels can be established based on a private protocol of a shutter file ferrying strategy, and data is transmitted across the network in a file form to complete data synchronization, so that the effects of physical isolation and logical communication are achieved.
And storing the request file in a file server file placing directory of the first network, and placing the request file into the file server file placing directory of the second network through a shutter ferrying function.
And after the second network timing task reads the put-in request file, the state of the task is synchronously set to be an initialization state. And analyzing the data of each row of data, and then storing the data into a task record table of a database.
The second network sequentially reads the request data corresponding to the initialized task in the task record list through the timing task, inversely sequences the request data into a request object, searches the corresponding service processing class according to the service type, triggers a local method, calls a request interface to execute service logic, sequences a return object, and updates the request object to the task record list. After the service call execution is completed, the state of the task is updated to be in process. The service asynchronous request from the first network to the second network is completed, and the specific flow is shown in fig. 4.
And the second network generates a receipt file according to the service calling execution result, and ferries the receipt file to the first network based on the file ferrying strategy.
And step 103, receiving the receipt file ferred by the second network based on the file ferrying strategy at regular time, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute a first processing logic according to the return data corresponding to the task with the state of the third state and the service processing class associated with the service type of the task at regular time.
The first network reads the put receipt file and updates the state of the task to a third state, namely the receipt. And analyzing each data of the receipt file to obtain return data, and updating the return data into the original task record list of the database according to the unique task number.
The first network sequentially reads the return data corresponding to the tasks with the status of the returned receipt in the task record table through the timing tasks, and deserializes the return data into a return object. And according to the service type, searching the corresponding service processing class and triggering the local method, calling a first interface (receipt interface) to execute first processing logic, wherein the first processing logic is post processing logic. The service asynchronous response is completed, and the response from the second network to the first network is realized, and the specific flow is shown in fig. 5.
According to the method, the service request and the service response are tasked in the process of cross-network service call by adopting a multi-stage processing mechanism in an asynchronous mode, the state of the task is updated, the service is asynchronously called according to the circulation of the task state, the service call flow is reconstructed by combining a file ferrying strategy, the cross-network service call in the asynchronous mode is supported, and the data security transmission under the condition of network isolation is realized.
On the basis of the foregoing embodiment, in this embodiment, the generating, at the timing, a request file according to a request corresponding to a task whose state is a first state includes:
storing the state of the task, the data interaction direction, the request and the service type of the request into a first database;
searching a request corresponding to a task of which the state is a first state and the data interaction direction is a request sending and the service type of the request from the first database at regular time;
generating a request message according to the searched request and the service type of the request, and storing the request message into a first text file to obtain the request file.
When a local terminal initiates a service call request, the data interaction direction is the request transmission; when a service call request is initiated by the opposite terminal, the data interaction direction is the request receiving. And distinguishing the data when the local terminal initiates the service call request from the data when the opposite terminal initiates the service call request according to the data interaction direction.
And under the condition that the state of the task is an initialization state and the data interaction direction is a request transmission, the condition that the local terminal initiates a service call request and the task is established is explained.
The state of the task is searched from the first database at regular time to be an initialization state, and the data interaction direction is a request and a service type corresponding to the task which is requested to be sent. And generating a request message according to the request and the service type of the request.
The embodiment carries out multi-stage processing on the service call, and carries out integral reconstruction on the cross-network asynchronous call flow through data storage, state circulation, data exchange and service call, thereby realizing the cross-network service call based on files.
In data storage, a database and a text file are used for data storage. And establishing a task table in a database and storing data of service call, wherein a text file is used for storing message transmission data, and the data in the text file is a part of the data in the database.
Each row of records in the database task table stores the exchange data of one service call task, including key elements such as message data (request data and receipt data), task number, task state, execution time, service type, data exchange direction and the like.
These key elements all have an explicit role, such as the task number identifying the uniqueness of the service invocation request; the task state is used for service circulation and driving service execution; recording task acceptance and response time by the execution time; the service type is used for distinguishing the service type, so that the task is associated and bound with the execution service; the local data exchange direction is used for distinguishing data when a service call request is initiated and data when the service call request is received, and the text file stores message transmission data of each request or receipt in a unit of row.
For data exchange and service call, task data are exchanged across networks based on text files, the files are exchanged to an opposite-end network and are resolved and restored to service call tasks, then corresponding local methods are called according to task types to achieve service call, and finally execution results are returned.
On the basis of the foregoing embodiment, in this embodiment, the timing calls a first interface to execute a first processing logic according to the returned data corresponding to the task whose state is the third state and a service processing class associated with a service type corresponding to the task, where the first processing logic includes:
storing the return data into the first database;
searching returned data and a requested service type corresponding to a task which is requested to be sent from the first database in a timing way, wherein the state is a third state and the data interaction direction is the requested service type;
the searched return data is inversely sequenced into a return object, and a service processing class corresponding to the service type is obtained according to the searched service type;
and calling a first interface to execute first processing logic according to the returned object and the service processing class.
After receiving the receipt file of the second network, the first network analyzes the receipt file and stores the analyzed receipt file into a first database.
And under the condition that the state of the task is a receipt state and the data interaction direction is the request sending, the local terminal is indicated to initiate a service call request and a receipt file is received.
The first network searches the state of the task from the first database at regular time to be the returned receipt state, and the data interaction direction is the returned data corresponding to the task requested to be sent and the service type of the request. And de-serializing the return data into a return object, finding out the corresponding service processing class according to the service type, triggering a local method, and calling a receipt interface to execute first processing logic.
A cross-network service invocation method of the present invention is described below in conjunction with fig. 6, and is applied to a second network, and includes:
step 601, a request file of a first network based on file ferrying strategy ferrying of an optical gate is received at fixed time, the state of a task corresponding to the request file is set to be a first state, and the request file is analyzed to obtain request data;
the first state is an initialized state.
Step 602, a second interface is called to execute second processing logic according to request data corresponding to a task with a first state and service processing class associated with a service type corresponding to the task at regular time, and the state of the task is updated to a second state;
As shown in fig. 4, the second network sequentially reads the request data corresponding to the initialized task in the task record table through the timing task, inversely sequences the request data into the request object, searches the corresponding service processing class according to the service type and triggers the local method, calls the request interface to execute the service logic, sequences the returned object, and updates the task record table. After the service call execution is completed, the state of the task is updated to a second state, i.e. in process. To this end, the service asynchronous request from the first network to the second network is completed.
And step 603, generating a receipt file according to an execution result corresponding to the task with the second state at regular time, updating the state of the task into a fourth state, and ferrying the receipt file corresponding to the task with the fourth state to the first network based on the file ferrying strategy.
As shown in fig. 5, the second network reads the record in the task record table with status being processed in a timed task and timing sequence, converts the record into a receipt message according to the service call execution result in the record, encrypts the receipt message and stores the receipt message in a text file, stores the receipt message in a file server file placing directory, and places the receipt file in the file server file placing directory of the first network through a shutter ferrying function.
The embodiment adopts a multi-stage processing mechanism in an asynchronous mode, in the process of cross-network service call, service requests and service responses are tasked, the state of the tasks is updated, the service is asynchronously called according to the circulation of the task state, a service call flow is reconstructed by combining a file ferry strategy, the cross-network service call in the asynchronous mode is supported, and the data security transmission under the condition of network isolation is realized.
On the basis of the foregoing embodiment, in this embodiment, the timing calls a second interface to execute a second processing logic according to the request data corresponding to the task whose state is the first state and the service processing class associated with the service type corresponding to the task, where the second processing logic includes:
storing the data interaction directions of the request data and the task into a second database;
searching request data corresponding to a task and a service type corresponding to the task, wherein the request data corresponds to the task and the service type corresponds to the task, and the data interaction direction is the request;
the searched request data is inversely sequenced into a request object, and a service processing class corresponding to the service type is obtained according to the searched service type of the request;
And calling a second interface to execute second processing logic according to the request object and the service processing class.
And the opposite terminal initiates a service call request, and the data interaction direction is the request receiving direction. And distinguishing the data when the local terminal initiates the service call request from the data when the opposite terminal initiates the service call request according to the data interaction direction.
The second interface is a request interface, the second processing logic is service logic, and service data requested by the opposite terminal network is obtained by executing the second processing logic.
The second network sequentially reads request data with the data interaction direction of the request received and the initialized state in the task record table through the timing task, inversely sequences the request data into a request object, searches the corresponding service processing class according to the service type and triggers the local method, and after the request interface is called to execute service logic, sequences the returned object, and then updates the request object into the task record table.
Based on the above embodiment, in this embodiment, the generating, at the timing, a receipt file according to an execution result corresponding to the task whose state is the second state includes:
storing the execution result into the second database;
searching the second database at regular time, wherein the state is a second state, and the data interaction direction is an execution result corresponding to the task requested to be received;
And generating a receipt message according to the searched execution result, and storing the receipt message to a second text file to obtain the receipt file.
The second network reads the request receiving records in the task record list with the status being processed in a timing task timing sequence, converts the request receiving records into receipt messages according to service calling execution results in the request receiving records, encrypts the receipt messages and stores the receipt messages in a text file, stores the receipt messages in a file server file placing directory, and places the receipt files in the file server file placing directory of the first network through a shutter ferrying function.
The cross-network service calling device provided by the invention is described below, and the cross-network service calling device described below and the cross-network service calling method described above can be referred to correspondingly.
As shown in fig. 7, the apparatus includes a service acceptance module 701, a first file creation module 702, and a first service invocation module 703, wherein:
the service acceptance module 701 is configured to establish a task after the first network successfully accepts a request of a terminal device, and set a state of the task to a first state;
the first file creation module 702 is configured to generate a request file at regular time according to a request corresponding to a task whose state is a first state, update the state of the task to a second state, and ferry the request file corresponding to the task whose state is the second state to a second network based on a file ferrying policy of an optical gate;
The first service calling module 703 is configured to receive a receipt file ferred by the second network based on the file ferrying policy at regular time, parse the receipt file to obtain return data, update the state of the task to a third state, and call the first interface to execute the first processing logic according to the return data corresponding to the task whose state is the third state and a service processing class associated with a service type corresponding to the task at regular time.
The embodiment adopts a multi-stage processing mechanism in an asynchronous mode, in the process of cross-network service call, service requests and service responses are tasked, the state of the tasks is updated, the service is asynchronously called according to the circulation of the task state, a service call flow is reconstructed by combining a file ferry strategy, the cross-network service call in the asynchronous mode is supported, and the data security transmission under the condition of network isolation is realized.
As shown in fig. 8, the cross-network service calling device is deployed in the form of a service to two networks to be accessed by the cross-network, and includes:
the service registration module is used for binding the service type with the service processing class, and the corresponding service processing class can be found out through the service type;
The service acceptance module is used for accepting flow conversion control when initiating remote service call, accepting service call requests according to service types, and converting request information into service call task records;
the service calling module is used for regularly extracting a request receiving record of an initial state and a request sending record of a returned receipt state from the task record table, finding a corresponding service processing class from the service registration module according to the service type, triggering a request method in the processing class for the request receiving record, and triggering a returned receipt method in the processing class for the request sending returned receipt record;
the data storage module is used for storing a request message and a receipt message generated in the service calling process and meeting service processing requirements under different conditions by recording serial numbers and task states;
and the data security module is used for providing digital signature, signature verification and data encryption and decryption services for the transmission data. The method of signing and then encrypting is adopted, so that the integrity of data and the transmission safety are ensured, the data can be effectively prevented from being tampered and the data leakage is avoided; meanwhile, after data decryption, the message needs to be scanned safely, so that malicious data such as cross-site scripts, SQL (Structured Query Language) injection scripts and the like are prevented from being mixed;
The file creation module is used for regularly extracting a request sending record of an initial state and a request receiving record of a state in process from the task record table, processing the extracted data through the data security module, writing the data into a request file or a receipt file in a data line form, and storing the data into a file layout directory;
the file analysis module is used for regularly reading the receipt file from the file arrangement directory, reading the data lines processed by the data security module line by line and storing the data lines in the database task record table;
the file transmission module is used for transmitting the text file carrying the message data between different networks based on the optical gate file ferrying function;
the file cleaning module is used for regularly cleaning files generated in the files put in and put out of the catalogue, and the storage capacity is prevented from exceeding the limit.
The embodiment provides a modularized design method for data driving and file processing in a file exchange scene, which constructs a processing module around the processing flow of data and files, converts service call into task scheduling and file management, and advances service circulation according to task state change, thereby avoiding the problems of high coupling degree and poor expansibility between modules, and simultaneously being capable of better adapting to the characteristic of weak real-time of file transmission.
The embodiment also provides a set of asynchronous call service specifications, including:
service definition, defining an abstract service class, including service type definition, task execution and task receipt; defining a service registration class for realizing the binding of the service class and a specific service;
the method comprises the steps of defining a data task, converting a traditional service calling mode into a task execution mode, defining a data task and storing the data task in a database, wherein each piece of data in the database represents a request and receipt of one service call, and the data task comprises a task number, an access direction, an access source, a request message, a receipt message, a task state, task creation time, task update time and the like;
the data exchange format takes a lightweight JSON format as the data exchange format, realizes serialization and deserialization of a request object and a return object, performs serialization operation when a request and a call receipt are initiated, and performs deserialization operation when a service interface is called;
Signing the transmission data by adopting an SM2 national encryption algorithm, and then encrypting the signed data by adopting an SM4 national encryption algorithm; after decryption is successful, signature verification is carried out, and data processing operation can be executed after error-free;
the file specification is that the file storage of the exchanged message information is unified by adopting a text format, the file name naming grid adopts a format of time plus sequence number, the file creation time and the file sequence can be clearly identified, wherein the time comprises time, month, day, minute, second and 6 bits of sequence number, and the file is realized by a self-increasing mode;
the optical gate ferrying strategy adopts a double unidirectional ferrying strategy, two networks are respectively configured with a ferrying-out directory and a ferrying-in directory, and the ferrying frequency is configurable; the access authority is set by adopting a minimization principle, and the authority authorized for the ferrying task is strictly controlled;
and 3 timing tasks are respectively used for file creation, file analysis and service scheduling execution, the 3 timing tasks are decoupled from each other, and the timing task execution frequency can be dynamically adjusted according to the service condition. When two timing tasks are created and scheduled by the service, the task list is queried in a mode of ascending task numbers, and when the timing tasks are analyzed by the file, the files are analyzed in an ascending order of file names, so that the execution sequence of the tasks is ensured.
And the concurrent execution specification is used for grouping the tasks according to the service types in order to ensure the sequential execution of each type of service and improve the task execution concurrency, and each group of tasks is executed by a thread pool executor.
The embodiment provides an asynchronous call service specification based on a file ferrying strategy in a network isolation environment, and makes standardized convention from the technical perspective, so that dependence on service scenes is reduced, and universality is realized.
Another cross-network service invocation apparatus provided by the present invention is described below, and the cross-network service invocation apparatus described below and the cross-network service invocation method described above may be referred to correspondingly to each other.
As shown in fig. 9, the apparatus includes a service file transmission module 901, a second service call module 902, and a second file creation module 903, wherein:
the file transmission module 901 is configured to receive a request file of a first network based on ferrying policy ferrying of a file optical gate at regular time, set a state of a task corresponding to the request file as a first state, and parse the request file to obtain request data;
the second service calling module 902 is configured to periodically call a second interface to execute second processing logic according to the request data corresponding to the task whose state is the first state and the service processing class associated with the service type corresponding to the task, and update the state of the task to the second state;
The second file creating module 903 is configured to generate a response piece file at regular time according to an execution result corresponding to the task with the second state, update the state of the task to the fourth state, and ferry the response piece file corresponding to the task with the fourth state to the first network based on the file ferrying policy.
According to the method, the service request and the service response are tasked in the process of cross-network service call by adopting a multi-stage processing mechanism in an asynchronous mode, the state of the task is updated, the service is asynchronously called according to the circulation of the task state, the service call flow is reconstructed by combining a file ferrying strategy, the cross-network service call in the asynchronous mode is supported, and the data security transmission under the condition of network isolation is realized.
The invention has the following advantages:
1. a scenario-independent service invocation method: the existing file ferrying strategy can only meet the data synchronization in a data archiving scene, and the scheme supports network asynchronous service call based on data storage, file transmission and timing tasks, and has universality. The service coordination of the cross-network is satisfied, the application range of the ferrying function of the traditional optical gate file is widened, and the solution of the cross-network service call under the strong security requirement is supplemented; the scheme is not limited to a specific scene, and can meet the requirements of cross-network asynchronous call services in various service scenes.
2. Flexible service invocation policy: the existing file ferry strategy does not support a service calling mode and does not have a flexible service calling strategy. The scheme defines the data exchange format, the data encryption and decryption method and the timing task execution frequency in the service call specification, supports parameterized configuration, and can be expanded according to different service scenes. At present, the data exchange format is JSON, and can be conveniently expanded into XML (EXtensible Markup Language ), protobuf and other formats; the encryption and decryption of the data adopts a national encryption algorithm SM4, and encryption algorithms such as DES (Data Encryption Standard ), AES (Advanced Encryption Standard, symmetric encryption algorithm) and the like can be expanded and supported; the timing task is executed once in 10 minutes by default, and the frequency can be flexibly configured according to the actual scene. In addition, the main flow is realized by adopting a template design mode, and is not influenced when the service call strategy is adjusted. Meanwhile, pre-execution interfaces and post-execution interfaces are reserved in service calling and receipt processing flows, and the interfaces are implemented by each service scene and expanded as required.
3. Transparent service call flow: through service registration, data encapsulation and flow abstraction, the purposes of transparent use of an application without sense and both a service end and a calling end can be achieved by adopting data driving and timing automatic execution. The service end defines new service in the form of inheriting predefined abstract service processing class, sets service type, then realizes calling and receipt interface, and agrees to enter and exit parameter data types, finally registers service to service register in the device, and realizes binding of service type and service class. The calling end designates the service type and the incoming parameter data type to initiate service call and wait for receipt. The data processing and file processing flow in the service calling process can be automatically realized without perception.
4. The modularized design with strong independence is provided, loose coupling among modules is realized through data driving and state circulation, so that the maintenance cost is reduced, and the maintenance is easy. The maintainability is realized by reconstructing the traditional service calling mode through good modularized design, and constructing each service module for carrying out service calling based on file transmission, wherein each module has clear boundary and high cohesion of service logic.
Fig. 10 illustrates a physical structure diagram of an electronic device, as shown in fig. 10, which may include: a processor 1010, a communication interface (Communications Interface) 1020, a memory 1030, and a communication bus 1040, wherein the processor 1010, the communication interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. Processor 1010 may invoke logic instructions in memory 1030 to perform a cross-web service invocation method comprising: after the first network successfully accepts the request of the terminal equipment, a task is established, and the state of the task is set to be a first state; generating a request file at fixed time according to a request corresponding to a task with the state being a first state, updating the state of the task into a second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate; and regularly receiving a receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute a first processing logic according to the return data corresponding to the task in the third state and a service processing class associated with the service type corresponding to the task.
Further, the logic instructions in the memory 1030 described above may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being storable on a non-transitory computer readable storage medium, the computer program, when executed by a processor, being capable of executing the method of cross-network service invocation provided by the methods described above, the method comprising: after the first network successfully accepts the request of the terminal equipment, a task is established, and the state of the task is set to be a first state; generating a request file at fixed time according to a request corresponding to a task with the state being a first state, updating the state of the task into a second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate; and regularly receiving a receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute a first processing logic according to the return data corresponding to the task in the third state and a service processing class associated with the service type corresponding to the task.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform a method of cross-network service invocation provided by the above methods, the method comprising: after the first network successfully accepts the request of the terminal equipment, a task is established, and the state of the task is set to be a first state; generating a request file at fixed time according to a request corresponding to a task with the state being a first state, updating the state of the task into a second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate; and regularly receiving a receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute a first processing logic according to the return data corresponding to the task in the third state and a service processing class associated with the service type corresponding to the task.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A cross-network service invocation method, applied to a first network, comprising:
after the first network successfully accepts the request of the terminal equipment, a task is established, and the state of the task is set to be a first state;
generating a request file at fixed time according to a request corresponding to a task with the state being a first state, updating the state of the task into a second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate;
and regularly receiving a receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute a first processing logic according to the return data corresponding to the task in the third state and a service processing class associated with the service type corresponding to the task.
2. The method of claim 1, wherein the generating a request file at the timing according to the request corresponding to the task whose state is the first state includes:
storing the state of the task, the data interaction direction, the request and the service type of the request into a first database;
Searching a request corresponding to a task of which the state is a first state and the data interaction direction is a request sending and the service type of the request from the first database at regular time;
generating a request message according to the searched request and the service type of the request, and storing the request message into a first text file to obtain the request file.
3. The method of claim 2, wherein the timing calls a first interface to execute a first processing logic according to the returned data corresponding to the task whose state is the third state and a service processing class associated with a service type corresponding to the task, and the method comprises:
storing the return data into the first database;
searching returned data and a requested service type corresponding to a task which is requested to be sent from the first database in a timing way, wherein the state is a third state and the data interaction direction is the requested service type;
the searched return data is inversely sequenced into a return object, and a corresponding service processing class is obtained according to the searched service type;
and calling a first interface to execute first processing logic according to the returned object and the service processing class.
4. A cross-network service invocation method, applied to a second network, comprising:
the method comprises the steps of receiving a request file of a first network based on file ferrying strategy ferrying of an optical gate at fixed time, setting a state of a task corresponding to the request file as a first state, and analyzing the request file to obtain request data;
the method comprises the steps of calling a second interface to execute second processing logic according to request data corresponding to a task with a first state and service processing classes associated with service types corresponding to the task at regular time, and updating the state of the task into a second state;
and generating a receipt file at regular time according to an execution result corresponding to the task with the second state, updating the state of the task into the fourth state, and ferrying the receipt file corresponding to the task with the fourth state to the first network based on the file ferrying strategy.
5. The method for invoking a cross-network service according to claim 4, wherein said timing invokes a second interface to execute a second processing logic according to the request data associated with the task in the first state and the service class associated with the service type corresponding to the task, comprising:
Storing the data interaction directions of the request data and the task into a second database;
searching request data corresponding to a task and a service type corresponding to the task, wherein the request data corresponds to the task and the service type corresponds to the task, and the data interaction direction is the request;
the searched request data is inversely sequenced into a request object, and a service processing class corresponding to the service type is obtained according to the searched service type;
and calling a second interface to execute second processing logic according to the request object and the service processing class.
6. The method for invoking a cross-web service according to claim 5, wherein the generating a receipt file at the timing according to the execution result corresponding to the task whose state is the second state includes:
storing the execution result into the second database;
searching the second database at regular time, wherein the state is a second state, and the data interaction direction is an execution result corresponding to the task requested to be received;
and generating a receipt message according to the searched execution result, and storing the receipt message to a second text file to obtain the receipt file.
7. A cross-network service invocation apparatus, comprising:
the service acceptance module is used for establishing a task after the first network successfully accepts the request of the terminal equipment and setting the state of the task to be a first state;
the first file creation module is used for generating a request file at fixed time according to a request corresponding to a task with the state being the first state, updating the state of the task into the second state, and ferrying the request file corresponding to the task with the state being the second state to a second network based on a file ferrying strategy of an optical gate;
and the first service calling module is used for regularly receiving the receipt file ferred by the second network based on the file ferrying strategy, analyzing the receipt file to obtain return data, updating the state of the task into a third state, and calling a first interface to execute first processing logic according to the return data corresponding to the task with the state of the third state and the service processing class associated with the service type corresponding to the task.
8. A cross-network service invocation apparatus, comprising:
the file transmission module is used for receiving a request file of the first network based on the file ferrying strategy ferrying of the optical gate at fixed time, setting the state of a task corresponding to the request file as a first state, and analyzing the request file to obtain request data;
The second service calling module is used for calling a second interface to execute second processing logic according to the request data corresponding to the task with the first state and the service processing class associated with the service type corresponding to the task at regular time, and updating the state of the task into a second state;
and the second file creation module is used for generating receipt files at regular time according to the execution result corresponding to the task with the second state, updating the state of the task into the fourth state, and ferrying the receipt files corresponding to the task with the fourth state to the first network based on the file ferrying strategy.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the cross-network service invocation method of any of claims 1 to 6 when the program is executed by the processor.
10. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the cross-network service invocation method of any of claims 1 to 6.
CN202410168982.9A 2024-02-06 2024-02-06 Cross-network service calling method and device Pending CN117714218A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410168982.9A CN117714218A (en) 2024-02-06 2024-02-06 Cross-network service calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410168982.9A CN117714218A (en) 2024-02-06 2024-02-06 Cross-network service calling method and device

Publications (1)

Publication Number Publication Date
CN117714218A true CN117714218A (en) 2024-03-15

Family

ID=90148358

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410168982.9A Pending CN117714218A (en) 2024-02-06 2024-02-06 Cross-network service calling method and device

Country Status (1)

Country Link
CN (1) CN117714218A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109495457A (en) * 2018-10-31 2019-03-19 厦门畅享信息技术有限公司 The business process engine and business of across a network limitation execute method
CN113645248A (en) * 2021-08-17 2021-11-12 公安部交通管理科学研究所 Data exchange system and method under cross-network environment
CN114221785A (en) * 2021-11-17 2022-03-22 佛山市宏图数据有限公司 Non-inductive boundary data exchange method
CN116032643A (en) * 2023-01-10 2023-04-28 江苏电力信息技术有限公司 Application layer implicit unidirectional isolation device penetration method for national network chain service call
CN116094828A (en) * 2023-02-14 2023-05-09 深圳市利谱信息技术有限公司 Dynamic protocol gateway system based on physical isolation
CN116633993A (en) * 2023-07-25 2023-08-22 中邮消费金融有限公司 Cross-network micro-service calling method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109495457A (en) * 2018-10-31 2019-03-19 厦门畅享信息技术有限公司 The business process engine and business of across a network limitation execute method
CN113645248A (en) * 2021-08-17 2021-11-12 公安部交通管理科学研究所 Data exchange system and method under cross-network environment
CN114221785A (en) * 2021-11-17 2022-03-22 佛山市宏图数据有限公司 Non-inductive boundary data exchange method
CN116032643A (en) * 2023-01-10 2023-04-28 江苏电力信息技术有限公司 Application layer implicit unidirectional isolation device penetration method for national network chain service call
CN116094828A (en) * 2023-02-14 2023-05-09 深圳市利谱信息技术有限公司 Dynamic protocol gateway system based on physical isolation
CN116633993A (en) * 2023-07-25 2023-08-22 中邮消费金融有限公司 Cross-network micro-service calling method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2020062793A1 (en) Message queue-based request processing method, apparatus and device, and storage medium
US8813243B2 (en) Reducing a size of a security-related data object stored on a token
CN101820449B (en) Cross-safety zone application service isolation platform
US6665674B1 (en) Framework for open directory operation extensibility
US7934252B2 (en) Filtering technique for processing security measures in web service messages
CN110009201B (en) Electric power data link system and method based on block chain technology
CN105187372A (en) Method for data processing based on mobile application entrance, device and system
CN112612629A (en) Method and system for realizing component type data interface
CN104796389A (en) Basic data sharing system and method thereof
CN1973282A (en) System and method for managing a change to a cluster configuration
CN115242644A (en) Micro-service development and management system
CN114240409A (en) Cross-chain asset interaction method based on improved Hash time lock
CN113467972A (en) Communication interface construction method, communication interface construction device, computer equipment and storage medium
US8891524B2 (en) Method and apparatus of automatically providing registration information
CN116489214A (en) Unified service scheduling method, device, medium and equipment based on micro service gateway
CN109819020A (en) Third-party platform based on configurationization logs in interconnection method, storage medium
CN112134707B (en) Concurrent access method and device for multiple KERBEROS clusters
CN105955790A (en) Data processing method and apparatus
CN117714218A (en) Cross-network service calling method and device
CN101527646A (en) System and method for WEB network management
US20080086472A1 (en) Supporting Multiple Security Mechanisms in a Database Driver
CN116095081A (en) Event processing method and device based on block chain system, equipment and medium
AU743834B2 (en) A control type or service independent building block
CN112165529A (en) Method, device, equipment and medium for low-cost cross-network data exchange
CN113067951B (en) Terminal communication management method and device, computer equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination