CN117785155A - Method, system and device for generating and executing source code of configured external system interface - Google Patents

Method, system and device for generating and executing source code of configured external system interface Download PDF

Info

Publication number
CN117785155A
CN117785155A CN202311833022.1A CN202311833022A CN117785155A CN 117785155 A CN117785155 A CN 117785155A CN 202311833022 A CN202311833022 A CN 202311833022A CN 117785155 A CN117785155 A CN 117785155A
Authority
CN
China
Prior art keywords
external system
source code
system interface
interface
information
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
CN202311833022.1A
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.)
Hangzhou Bangrui Technology Co ltd
Zhejiang Bangsheng Technology Co ltd
Original Assignee
Hangzhou Bangrui Technology Co ltd
Zhejiang Bangsheng 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 Hangzhou Bangrui Technology Co ltd, Zhejiang Bangsheng Technology Co ltd filed Critical Hangzhou Bangrui Technology Co ltd
Priority to CN202311833022.1A priority Critical patent/CN117785155A/en
Publication of CN117785155A publication Critical patent/CN117785155A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a method, a system and a device for generating and executing source codes by a configured external system interface, wherein external resources are acquired firstly based on manufacturer information of the external system interface; then newly building an external system interface under an external system interface manufacturer, and configuring interface information; submitting the interface information which is configured to the server-side master node, rendering an executable source code file of corresponding logic based on a source code text template file in a text rendering mode, and synchronizing the executable source code file to the server-side slave node; and the server-side master node and the slave node expose the source code execution interface at the same time, provide external system interface access and debugging service, dynamically compile and execute the source code file when the server-side master node and the slave node run, and output generated error information of the source code execution result. The invention supports multi-language source codes, can realize configuration debugging, supports additional resource expansion depending on an execution environment and supports transverse expansion and resource isolation of a source code execution end.

Description

Method, system and device for generating and executing source code of configured external system interface
Technical Field
The invention relates to the technical field of computers, in particular to a method, a system and a device for generating and executing source codes of a configured external system interface.
Background
With the continuous advancement of enterprise informatization, the importance of an information system as a core support for enterprise operation is increasingly highlighted. However, in the rapidly evolving information age, businesses need to interface with an increasing number of external interfaces in order to meet increasingly complex business needs. With this, the labor costs caused by docking and the maintenance costs are constantly increasing. Based on the above, the configuration is needed to generate the interfacing source code, so that the labor cost of developers is saved, the interfaces are uniformly managed, the thermal deployment is performed, the maintainability is increased, and the cost of operation and maintenance personnel is increased.
At present, the conventional external interface data adopts a Java-based hard coding mode, namely, the external interface data is directly embedded into source codes of programs or other executable objects to carry out software development practice. Hard-coded data can typically only be modified by editing the source code and recompiling the executable, resulting in inefficient data access.
Any of the following disadvantages after the current interface configuration on the market
1. After interface information is configured on a page, the generated source code file depends on a single language;
2. after interface information is configured on a page, generating a source code without a debugging scheme, if the configuration is wrong, a responsibility chain for locating an error reason is complex, and the locating error reason is a large ring in a butt joint external system interface;
3. insufficient support for external interfaces that need to be requested through an SDK (software development kit);
4. the system resources required by the execution of the generated source codes cannot be configured, and the system cannot support transverse expansion;
5. interface resource isolation, traffic monitoring, data caching and charging module deletion.
Disclosure of Invention
The invention aims at overcoming the defects of the prior art and provides a method, a system and a device for generating and executing source codes by a configured external system interface.
The aim of the invention is realized by the following technical scheme: in a first aspect, the present invention provides a method for generating and executing source codes by using a configured external system interface, the method comprising the following steps:
(1) Acquiring external resources based on external system interface manufacturer information;
(2) Newly creating an external system interface under an external system interface manufacturer, and configuring external system interface information;
(3) Submitting the configured external system interface information to a server-side master node, rendering an executable source code file of corresponding logic based on a source code text template file in a text rendering mode by the interface information, and synchronizing the executable source code file to a server-side slave node;
(4) The server side master node and the slave node simultaneously expose a source code execution interface to the enterprise service bus ESB, provide external system interface access and debugging service, dynamically compile and execute source code files when the server side master node and the slave node run, and output error information of generated source code execution results.
Further, the external resources include an external system SDK, external interface parameter key information, and external interface authentication information.
Further, the configuration external system interface information includes an external system request address, an external system interface request parameter value mapping relation, an external system interface request header information value mapping relation, an external system interface request and return data format, and a return value mapping relation.
Further, the configuration external system interface information also comprises authentication encryption, parameter encryption and request head encryption modes, and a resource pool executed by the current source code.
Further, after the configuration of the external system interface information is completed, the interface charging and caching related information can be configured, and the corresponding interface charging rule and interface caching duration are set.
Further, the master node and the slave node of the server can execute corresponding source code logic, so that the flow pressure of the external interface is shared, when the source code is executed, the current node is appointed to apply for a resource pool for execution, and the resource isolation of different source code execution among different external interfaces is realized.
In a second aspect, the invention also provides a system for generating and executing the interface of the configured external system to the source code, wherein the system comprises an external resource acquisition module, an interface information configuration module, a source code file generation module and an access and debugging module;
the external resource acquisition module is used for acquiring external resources based on external system interface manufacturer information;
the interface information configuration module is used for creating an external system interface under an external system interface manufacturer and configuring external system interface information;
the source code file generation module is used for submitting the configured external system interface information to a server-side master node, rendering an executable source code file of corresponding logic based on a source code text template file in a text rendering mode of the interface information, and synchronizing the executable source code file to a server-side slave node;
the access and debugging module is used for providing external system interface access and debugging service, the server side master node and the slave node expose a source code execution interface to the enterprise service bus at the same time, and the server side master node and the slave node dynamically compile and execute the source code file during running and output error information of the generated source code execution result.
In a third aspect, the present invention further provides a device for generating and executing the source code by using the configured external system interface, which includes a memory and one or more processors, where the memory stores executable codes, and when the processor executes the executable codes, the method for generating and executing the source code by using the configured external system interface is implemented.
In a fourth aspect, the present invention further provides a computer readable storage medium, where a program is stored, where the program, when executed by a processor, implements a method for generating and executing source codes by using a configured external system interface.
The invention has the beneficial effects that:
1. support for multilingual source code: the scheme of generating the source code needs decoupling and does not depend strongly on the language operated by the current server; the source code generating means of the invention uses the template file as the blue book, renders the source code file meeting the requirements according to the page configuration data information, and the generated source code file does not need to be written based on any language, so the source code file generated by the invention supports multiple languages.
2. Adding a configuration debugging module: after the page configuration is completed, the source code file is output to a specific position on the server of the server, the current server dynamically compiles and executes the source code file in running, the generated error information of the source code execution result is output, and the returned result of the external system interface or the error information is output to the front-end page for display, so that the user is assisted to conveniently, simply and rapidly achieve the purpose of obtaining the source code when configuring the external system interface.
3. Support additional resource extensions that are dependent on the execution environment: the invention supports the user to upload SDK (software development kit), encryption key, authentication certificate and other files at the interface end; and when the source code is produced, the additional resources uploaded by the user are packaged together to be generated under a server end directory, and when the source code is required to be compiled or executed, the SDK (software development kit) and the source code package are loaded and compiled together, so that the source code can be conveniently called and read when being executed.
4. The source code execution end supports the lateral expansion and the resource isolation: the invention is divided into a master node and N (N > =0) slave node modes at the server side, and the slave nodes can be dynamically and transversely expanded. The method comprises the steps that a master node receives a source code generation request, and after a file is generated, a slave node subscribes to the master node to synchronously generate a source code file; the master node and the slave node can execute corresponding source code logic to share the flow pressure of the external interface; the slave node and the master node expose a source code execution interface to the enterprise service bus at the same time; when the source code is executed, the current node can be appointed to apply for a resource pool to execute (appointed in configuration), and the resource isolation of different source code executions between different external interfaces is realized.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an uploading external system SDK;
FIG. 2 is a schematic diagram of uploading external interface parameter keys;
FIG. 3 is a diagram of uploading external interface authentication information;
FIG. 4 is a schematic diagram of a service end master node workflow;
FIG. 5 is a schematic diagram of a request receiving flow between a master node and a slave node at a server;
FIG. 6 is a diagram of an overall architecture;
FIG. 7 is an overall flow chart for source code generation;
FIG. 8 is a block diagram of a source code generation and execution device configured for external system interfaces in accordance with the present invention.
Detailed Description
The following describes the embodiments of the present invention in further detail with reference to the drawings.
As shown in fig. 6, the method for generating and executing the source code by the configured external system interface provided by the invention specifically includes the following steps:
1. and creating manufacturer information of the external system interface, and carrying out aggregation management on the external system interface by providing manufacturer dimensions of the external system interface. The server is divided into a master node and N (N > =0) slave node modes, and the slave nodes can be dynamically and transversely expanded. The method comprises the steps that a master node receives a source code generation request, and after a file is generated, a slave node subscribes to the master node to synchronously generate a source code file; the dynamic lateral expansion is specifically as follows: the master node opens a specific port to receive a request of the slave node to join the cluster, and the slave node is added into the cluster after successful communication; the master node maintains all the link information of the slave nodes, sends heartbeat messages to the slave nodes through link timing, and if the continuous 3 times of heartbeat messages are failed to be sent, the slave nodes kick out the cluster;
2. external system interface manufacturer external resource preparation (when external system interface needs additional resource, it needs to execute) can select one or more of the following resources, when producing source code, packaging the above additional resource uploaded by user together to generate under server catalog, and loading and compiling together with source code file;
2.1 Uploading an external system SDK (software development kit), storing a server-side main node after uploading, and putting a file analysis entity and a file analysis method read by the server-side main node back to a front-end page for display for subsequent interface configuration selection (as shown in figure 1);
2.2 Uploading the external interface parameter key information file, and storing the uploaded external interface parameter key information file in a server-side main node (as shown in figure 2);
2.3 Uploading the related files of the external interface authentication information, and storing the uploaded files in a server-side main node (as shown in figure 3).
3. Newly-built external system interfaces under external system interface manufacturers, and configuring specific information of external system interface information, wherein the specific information comprises the following steps:
3.1 External system request address (must fill);
3.2 The external system interface requests the parameter value mapping relation (need to be filled);
3.3 The external system interface requests the head information value mapping relation (need to be filled);
3.4 External system interface authentication encryption mode (SM 2/SM3/SM4/AES/DES/3DES/RC5 optionally filled with one or not filled);
3.5 External system interface parameter encryption mode (SM 2/SM3/SM4/AES/DES/3DES/RC5 optionally filled with one or not filled with another);
3.6 An external system interface requests a header encryption mode (SM 2/SM3/SM4/AES/DES/3DES/RC5 optional padding or not);
3.7 An external system interface SDK (software development kit) construction mode (filled or not filled from the method and entity parsed in 2.1);
3.8 External system interface request data format (JSON/XML/TXT/HTML optional padding);
3.9 External system interface return data format (JSON/XML/TXT/HTML optional padding);
3.10 The external system interface returns a value mapping relation (necessary to be filled);
3.11 A resource pool (optional fill, not common resource pool) for the current source code execution is specified.
4. Configuring interface charging and caching related information, including:
4.1 Interface charging rules (one of charging according to the strip/month charging or not charging);
4.2 Interface buffer time (unit seconds, optional fill).
5. Clicking and saving the interface information configured above, and submitting the interface information to a server-side main node in a JSON format; the server master node performs the following operations (as in fig. 4):
5.1 Storing the interface information in a database;
5.2 The server-side master node analyzes the message, takes the built-in source code text template file as a prototype in a text rendering mode, renders an executable source code file of corresponding logic according to page configuration data information, and places the executable source code file under the directory of the server-side master node (as shown in figure 7); the content is a female parent of a source code file, and the java language template file is taken as an example, wherein the main content in the template file contains java keyword codes such as file name package name class names and the like necessary for the source code, and the user self-defines code content to be executed uniformly according to requirements; different users can customize template files of different languages according to own requirements; the generated source code file does not need to be written based on any language, so the source code file generated by the method supports multiple languages;
the main processing flow of the rendering process is as follows:
(1) After receiving the request, executing request address source code rendering in the basic information processing module, requesting body mapping relation source code relation rendering, and judging whether authentication encryption is needed;
(2) If authentication encryption is needed, an authentication encryption rendering module is entered, and authentication encryption source codes are rendered according to configuration; otherwise, skipping the step;
(3) Judging whether to encrypt parameters or not in a basic information processing module;
(4) If the parameter encryption is needed, encrypting the source code according to the configuration rendering parameter at the request encryption rendering module; otherwise, skipping the step;
(5) Judging whether to encrypt the request header or not in the basic information processing module;
(6) If the parameter encryption is needed, the request head encryption rendering module performs request head encryption source code rendering; otherwise, skipping the step;
(7) In the basic information processing module, judging whether to configure SDK (software development kit) construction mode
(8) If the SDK (software development kit) construction mode is configured, SDK (software development kit) construction source code rendering is carried out; otherwise, skipping the step;
(9) The interface requests the rendering of the data format;
(10) The interface returns to the data format for rendering;
(11) Rendering the external system return value mapping source code;
(12) The source code generation is completed to output the specified directory.
5.3 The executable source code file is sent to the slave node of the server through the link information between the master node and the slave node.
6. The method comprises the steps that a master node and a slave node of a server side expose source code execution interfaces to an enterprise service bus at the same time, external system interface access and debugging services are provided for other systems in an enterprise, and the master node and the slave node can execute corresponding source code logic to share flow pressure of requesting external interfaces; when the source code is executed, the current node can be appointed to apply for a resource pool to execute (appointed in configuration), so that the resource isolation of different source code executions among different external interfaces is realized; the overall flow of accept requests includes the following steps (see fig. 5):
6.1 Receiving a JSON format message of an external system interface, and analyzing the message to obtain interface information configured in the system;
6.2 Judging a caching rule and whether caching information can be acquired or not;
6.3 Obtaining source code compiled class information in the memory, (if the obtaining fails, loading the compiled source code file under the catalog to generate class information, and putting the class information into the memory);
6.4 The server side compiles and executes the source code file dynamically during operation and outputs error information of the generated source code execution result;
6.5 Sending a calling record and accumulating charging information;
6.6 And (3) returning a result to the calling end, and assisting a user in conveniently, simply and rapidly achieving the purpose of what you see is what you get when configuring an external system interface.
The invention also provides a system for generating and executing the source code of the interface of the configured external system, which comprises an external resource acquisition module, an interface information configuration module, a source code file generation module and an access and debugging module; the implementation process of each module refers to the specific process of the method for generating and executing the source code by the configured external system interface.
The external resource acquisition module is used for acquiring external resources based on external system interface manufacturer information;
the interface information configuration module is used for creating an external system interface under an external system interface manufacturer and configuring external system interface information;
the source code file generation module is used for submitting the configured external system interface information to a server-side master node, rendering an executable source code file of corresponding logic based on a source code text template file in a text rendering mode of the interface information, and synchronizing the executable source code file to a server-side slave node;
the access and debugging module is used for providing external system interface access and debugging service, the server side master node and the slave node expose a source code execution interface to the enterprise service bus at the same time, and the server side master node and the slave node dynamically compile and execute the source code file during running and output error information of the generated source code execution result.
Corresponding to the embodiment of the method for generating and executing the source code by the configured external system interface, the invention also provides an embodiment of a device for generating and executing the source code by the configured external system interface.
Referring to fig. 8, a device for generating and executing source codes by using a configured external system interface according to an embodiment of the present invention includes a memory and one or more processors, where the memory stores executable codes, and the processor is configured to implement a method for generating and executing source codes by using a configured external system interface according to the above embodiment when executing the executable codes.
The embodiment of the source code generating and executing device of the configured external system interface can be applied to any equipment with data processing capability, and the equipment with data processing capability can be equipment or a device such as a computer. The apparatus embodiments may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions in a nonvolatile memory into a memory by a processor of any device with data processing capability. In terms of hardware, as shown in fig. 8, a hardware structure diagram of an apparatus with optional data processing capability where a configuration external system interface pair source code generating and executing device provided by the present invention is shown, except for a processor, a memory, a network interface, and a nonvolatile memory shown in fig. 8, where the apparatus with optional data processing capability in an embodiment is generally according to an actual function of the apparatus with optional data processing capability, and may further include other hardware, which will not be described herein.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. 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 purposes of the present invention. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The embodiment of the invention also provides a computer readable storage medium, on which a program is stored, which when executed by a processor, implements a method for generating and executing source codes by configuring an external system interface in the above embodiment.
The computer readable storage medium may be an internal storage unit, such as a hard disk or a memory, of any of the data processing enabled devices described in any of the previous embodiments. The computer readable storage medium may be any external storage device that has data processing capability, such as a plug-in hard disk, a Smart Media Card (SMC), an SD Card, a Flash memory Card (Flash Card), or the like, which are provided on the device. Further, the computer readable storage medium may include both internal storage units and external storage devices of any data processing device. The computer readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing apparatus, and may also be used for temporarily storing data that has been output or is to be output.
The above-described embodiments are intended to illustrate the present invention, not to limit it, and any modifications and variations made thereto are within the spirit of the invention and the scope of the appended claims.

Claims (9)

1. The method for generating and executing the source code of the configured external system interface is characterized by comprising the following steps:
(1) Acquiring external resources based on external system interface manufacturer information;
(2) Newly creating an external system interface under an external system interface manufacturer, and configuring external system interface information;
(3) Submitting the configured external system interface information to a server-side master node, rendering an executable source code file of corresponding logic based on a source code text template file in a text rendering mode by the interface information, and synchronizing the executable source code file to a server-side slave node;
(4) The server side master node and the slave node simultaneously expose a source code execution interface to the enterprise service bus ESB, provide external system interface access and debugging service, dynamically compile and execute source code files when the server side master node and the slave node run, and output error information of generated source code execution results.
2. The method for generating and executing source codes by a configured external system interface according to claim 1, wherein the external resources comprise an external system SDK, external interface parameter key information, and external interface authentication information.
3. The method for generating and executing source codes by a configured external system interface according to claim 1, wherein the configured external system interface information includes an external system request address, an external system interface request parameter value mapping relationship, an external system interface request header information value mapping relationship, an external system interface request and return data format, and a return value mapping relationship.
4. A method for generating and executing source codes by a configured external system interface according to claim 3, wherein the configuration external system interface information further comprises authentication encryption, parameter encryption and request header encryption modes, and a resource pool for executing the current source code.
5. The method for generating and executing the source code by the interface of the configured external system according to claim 1, wherein after the configuration of the interface information of the external system is completed, the related information of the interface charging and the caching can be configured, and the corresponding interface charging rule and the corresponding interface caching duration are set.
6. The method for generating and executing source codes by using a configured external system interface according to claim 1, wherein the server master node and the slave node can execute corresponding source code logic, so as to share the flow pressure of the external interface, and when the source codes are executed, a resource pool is applied to the current node for execution, and the resource isolation of different source code execution among different external interfaces is realized.
7. The system is characterized by comprising an external resource acquisition module, an interface information configuration module, a source code file generation module and an access and debugging module;
the external resource acquisition module is used for acquiring external resources based on external system interface manufacturer information;
the interface information configuration module is used for creating an external system interface under an external system interface manufacturer and configuring external system interface information;
the source code file generation module is used for submitting the configured external system interface information to a server-side master node, rendering an executable source code file of corresponding logic based on a source code text template file in a text rendering mode of the interface information, and synchronizing the executable source code file to a server-side slave node;
the access and debugging module is used for providing external system interface access and debugging service, the server side master node and the slave node expose a source code execution interface to the enterprise service bus at the same time, and the server side master node and the slave node dynamically compile and execute the source code file during running and output error information of the generated source code execution result.
8. A device for generating and executing source codes by a configured external system interface, comprising a memory and one or more processors, wherein executable codes are stored in the memory, and the method for generating and executing source codes by the configured external system interface is realized by the processor when the executable codes are executed.
9. A computer readable storage medium having a program stored thereon, wherein the program when executed by a processor implements a method of generating and executing source code for a configured external system interface as claimed in any one of claims 1 to 6.
CN202311833022.1A 2023-12-28 2023-12-28 Method, system and device for generating and executing source code of configured external system interface Pending CN117785155A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311833022.1A CN117785155A (en) 2023-12-28 2023-12-28 Method, system and device for generating and executing source code of configured external system interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311833022.1A CN117785155A (en) 2023-12-28 2023-12-28 Method, system and device for generating and executing source code of configured external system interface

Publications (1)

Publication Number Publication Date
CN117785155A true CN117785155A (en) 2024-03-29

Family

ID=90379794

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311833022.1A Pending CN117785155A (en) 2023-12-28 2023-12-28 Method, system and device for generating and executing source code of configured external system interface

Country Status (1)

Country Link
CN (1) CN117785155A (en)

Similar Documents

Publication Publication Date Title
US11163671B2 (en) Automatically executing stateless transactions with data dependency in test cases
US7779036B2 (en) Integration functionality for a test tool for application programming interfaces
Honda et al. Scribbling interactions with a formal foundation
De Santis et al. Zero-knowledge proofs of knowledge without interaction
US7890659B2 (en) Conforming web services to an updated contract
US9916137B2 (en) Rest service source code generation
US10534698B2 (en) Stateless self-sufficient test agents
CN108280023B (en) Task execution method and device and server
Jongmans et al. Automatic code generation for the orchestration of web services with Reo
CN109445837B (en) Application program publishing method and device
Ranabahu et al. Application portability in cloud computing: an abstraction-driven perspective
CN108984202B (en) Electronic resource sharing method and device and storage medium
CN116089126A (en) Method, device and equipment for acquiring data in real time and readable storage medium
CN113225379A (en) Method and device for sending HTTP request message
CN113010607A (en) Method, device, computer system and storage medium for data synchronization between systems
US20220365759A1 (en) Dynamic web-based integrated development environment
CN113467972A (en) Communication interface construction method, communication interface construction device, computer equipment and storage medium
Al-Zoubi et al. Distributed simulation using restful interoperability simulation environment (rise) middleware
CN109491802A (en) A kind of method and adapter of the RESTFul network request based on Unity
Cesari et al. A tool for rapid development of WS-BPEL applications
Herbold et al. Combining usage-based and model-based testing for service-oriented architectures in the industrial practice
US10725744B2 (en) Method for adapting to blockchain and device, terminal and medium performing the same
CN117785155A (en) Method, system and device for generating and executing source code of configured external system interface
CN113495723B (en) Method, device and storage medium for calling functional component
CN112506943B (en) Heterogeneous data service providing method, device, equipment and medium

Legal Events

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