External system service calling method and device, equipment and medium
By configuring the information and channel information of external system services, and using the Apache Camel framework to implement service calls between software systems, it solves the problem of frequent code modifications and system restarts in the existing technology, realizes ready-to-use service calls, and simplifies Streamline the development process and support multiple protocols and data processing.
Patent Information
- Application Number
- CN202410597236.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, Java code needs to be modified frequently during service calls between software systems, and when adding or modifying service calls, the system usually needs to be restarted, resulting in a cumbersome and inconvenient process.
Provides an external system service calling method. By configuring the service information of the external service to be called, it generates service ID, channel group and channel information, generates fixed request address and request interface information, uses the Apache Camel framework to implement service calling, and supports REST_API, JDBC, WEB_SERVICE and BEAN types support API interfaces or HTTPS requests, and use Java reflection principles to execute corresponding interface methods to achieve ready-to-use service calls.
Service calls between software systems can be realized without modifying the code, which simplifies the configuration and calling process, improves development efficiency, supports multiple protocols and data processing, and has ready-to-use features for easy integration and debugging.
Smart Images

Figure CN118540375A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an external system service calling method, device, equipment and medium. Background Art
[0002] Service calls between software systems have become a common problem for mutual access between systems. With the continuous update and iteration of software technology, system call methods are becoming more and more diverse, and call writing is becoming more and more simple. For calls between distributed systems in the past, the following common implementation methods are often used:
[0003] 1. RESTful API call based on HTTP:
[0004] Build RESTful APIs using Java web frameworks such as Spring MVC, Spring Boot, JAX-RS, etc.
[0005] Clients can use libraries such as HttpURLConnection, Apache HttpClient, and OkHttp to send HTTP requests.
[0006] The Spring Framework also provides the RestTemplate class, which simplifies interaction with RESTful services.
[0007] 2. RPC-based calls:
[0008] Use Java's RPC framework (such as Apache Thrift, gRPC, Dubbo, etc.) to define service interfaces and implementations.
[0009] The RPC framework is responsible for low-level details such as serialization and deserialization of data, network communication, and service discovery.
[0010] The client calls the remote service through the proxy class, just like calling a local method.
[0011] 3. Message-based calls:
[0012] Use message queues (such as RabbitMQ, Kafka, ActiveMQ, etc.) for asynchronous communication. Java clients can use the corresponding message queue client library to send and receive messages.
[0013] 4. Use Spring Cloud to call services:
[0014] Spring Cloud provides a complete set of microservice solutions, including service discovery (Eureka, Consul), load balancing (Ribbon, LoadBalancer), circuit breaker and degradation (Hystrix) and other functions.
[0015] You can use the @FeignClient annotation to create a declarative REST client, which automatically handles sending and receiving HTTP requests. Spring Cloud OpenFeign and Spring Cloud LoadBalancer can replace RestTemplate for more elegant service calls.
[0016] 5. Use API Gateway:
[0017] As a unified entry point for service calls, API Gateway can handle tasks such as routing, authentication, and current limiting. In Java, Spring Cloud Gateway or Zuul can be used as the implementation of API Gateway. The client calls the backend service through the API Gateway without knowing the specific service address and port.
[0018] In general, for Java developers, frameworks such as Spring Cloud and Spring Boot provide rich functions and tools that can greatly simplify the implementation process of mutual calls between distributed systems. These frameworks provide good integration and scalability, allowing developers to focus more on the implementation of business logic without paying too much attention to the underlying details.
[0019] Deficiencies of existing technologies: These calls still have their drawbacks. They rely heavily on Java code implementation. Every time a call is added or modified between services, the code needs to be modified, and some calls must even be restarted to implement. Summary of the invention
[0020] In order to provide a conveniently configured, ready-to-use solution for a software system to call external services, the present invention provides an external system service calling method, apparatus, device and medium.
[0021] In a first aspect, the present invention provides a method for calling an external system service, the method comprising:
[0022] According to the service information of the external service to be called, the service information includes a request method, a request address and a request parameter, the external service to be called is configured, and an ID of the external service to be called is generated, a channel group and channel information are configured, the ID of the external service to be configured is referenced in the channel information, and according to the request method, request address, the channel group code and the channel code of the external service to be called, a fixed request address and request interface information of the external service to be called are generated;
[0023] When a service call request from a caller is received, the channel group code and the channel code are obtained through the service call request, and the fixed request address, request interface information and request method of the external service to be called by the caller are obtained according to the channel group code and the channel code. After calling the external service to be called according to the request method, the obtained response information is returned to the caller.
[0024] Based on the above technical solution, further, according to the service information of the external service to be called, the service information includes the request method, request address and request parameters, configure the external service to be called, generate the ID of the external service to be called, configure the channel group and channel information, the ID of the external service to be configured is referenced in the channel information, and according to the request method, request address, channel group code and channel code of the external service to be called, generate the fixed request address and request interface information of the external service to be called, specifically including:
[0025] According to the service information of the external service to be called, it is determined that the external service to be called is attached to the channel service of the service set,
[0026] If so, find the channel service and configure and mount the external service to be called.
[0027] If not, add a new service set and channel service for mounting;
[0028] Determine the channel group code and channel code of the external service to be called from the newly added service set;
[0029] The request mode and original address request address information of the external service to be called are stored according to the grammatical rules of camel remote call and combined with the channel configuration parameters of the external service to be called to form an external call address;
[0030] The channel group code and the channel code are written into a preset request address to obtain the fixed request address and the request interface information.
[0031] Based on the above technical solution, further, the request mode and request address of the external service to be called are written into the fields in the Json message, and the fields in the Json message and the channel configuration parameters of the external service to be called are combined into the external call address, specifically including:
[0032] After the request method and request address of the external service to be called are combined into a Json string, it is decoded into a Json format message through unmarshal, and the Json format message is set as the authentication header field through the setHeader component;
[0033] The authentication header field and the channel configuration parameters are combined into the external call address.
[0034] Based on the above technical solution, the method further includes:
[0035] The caller sends a service call request through an API interface or HTTPS request access.
[0036] Based on the above technical solution, further, when receiving the service call request from the caller, obtaining the channel group code and the channel code through the service call request specifically includes:
[0037] Obtaining a service call request from the caller, and obtaining channel configuration data and channel process information from the service call request;
[0038] Load the channel process information into the system context cache of the Camel component in Json format. The cache information format is Map<key,value> Format, key is the channel number, value is the channel process information formatted in Json.
[0039] Based on the above technical solution, further, obtaining the fixed request address, request interface information and request method of the external service to be called by the caller according to the channel group code and the channel code, calling the external service to be called according to the request method, and returning the obtained response information to the caller, specifically includes:
[0040] Routing command name components according to the Json data of the channel process information corresponding to the channel number key in the system context cache, and executing the implementation methods corresponding to the command name components in the order of the channel process information;
[0041] By using the reflection principle of Java, the command name component is mapped to a Java class with a specific name, and then the execution method of the implementation interface is called for execution. After the execution is completed, the obtained response information is returned to the caller.
[0042] Based on the above technical solution, further, the request mode includes REST_API type, JDBC type, WEB_SERVICE type and BEAN type.
[0043] In a second aspect, the present invention further provides an external system service calling device, the device comprising:
[0044] A configuration module, configured to configure the external service to be called according to the service information of the external service to be called, the service information including the request mode, request address and request parameters, and generate the ID of the external service to be called, configure the channel group and channel information, the ID of the external service to be configured is referenced in the channel information, and generate the fixed request address and request interface information of the external service to be called according to the channel group code and the channel code;
[0045] The calling module is used to, when receiving a service calling request from a caller, obtain the channel group code and the channel code through the service calling request, and obtain the fixed request address, request interface information and request method of the external service to be called by the caller according to the channel group code and the channel code, and after calling the external service to be called according to the request method, return the obtained response information to the caller.
[0046] Based on the above technical solution, further, the configuration module is specifically used to determine whether the external service to be called is hung on the channel service of the service set according to the service information of the external service to be called,
[0047] If so, find the channel service and configure and mount the external service to be called.
[0048] If not, add a new service set and channel service for mounting;
[0049] Determine the channel group code and channel code of the external service to be called from the newly added service set;
[0050] The request mode and original address request address information of the external service to be called are stored according to the grammatical rules of camel remote call and combined with the channel configuration parameters of the external service to be called to form an external call address;
[0051] The channel group code and the channel code are written into a preset request address to obtain the fixed request address and the request interface information.
[0052] Based on the above technical solution, further, the configuration module is specifically used for:
[0053] After the request method and request address of the external service to be called are combined into a Json string, it is decoded into a Json format message through unmarshal, and the Json format message is set as the authentication header field through the setHeader component;
[0054] The authentication header field and the channel configuration parameters are combined into the external call address.
[0055] Based on the above technical solution, further, a configuration module is specifically used for the caller to access and send a service call request through an API interface or HTTPS request.
[0056] Based on the above technical solution, further, the calling module is specifically used to obtain the service calling request of the caller, and obtain the channel configuration data and channel process information from the service calling request;
[0057] Load the channel process information into the system context cache of the Camel component in Json format. The cache information format is Map<key,value> Format, key is the channel number, value is the channel process information formatted in Json.
[0058] Based on the above technical solution, further, a calling module is specifically used to route command name components according to the Json data of the channel process information corresponding to the channel number key in the system context cache, and execute the implementation method corresponding to its components in the order of the command name components in the channel process information;
[0059] By using the reflection principle of Java, the command name component is mapped to a Java class with a specific name, and then the execution method of the implementation interface is called for execution. After the execution is completed, the obtained response information is returned to the caller.
[0060] Based on the above technical solution, further, the request mode includes REST_API type, JDBC type, WEB_SERVICE type and BEAN type.
[0061] In a third aspect, the present invention further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the external system service calling method described in any one of the above technical solutions when executing the computer program.
[0062] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the external system service calling method described in any one of the above technical solutions is implemented.
[0063] The present invention provides a method for calling an external system service, including configuring the external service to be called according to the service information of the external service to be called, the service information including the request mode, request address and request parameters, generating the ID of the external service to be called, configuring the channel group and channel information, quoting the ID of the external service to be configured in the channel information, generating the fixed request address and request interface information of the external service to be called according to the channel group code and the channel code; when receiving the service call request of the caller, obtaining the channel group code and the channel code through the service call request, and obtaining the fixed request address, request interface information and request mode of the external service to be called by the caller according to the channel group code and the channel code, calling the external service to be called according to the request mode, and returning the obtained response information to the caller. The present invention provides a convenient configuration and ready-to-use solution for software system calling external services. And basically no code modification is required, and the call can be made after configuration and release. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:
[0065] Figure 1 It is a flowchart of an external system service calling method provided by an embodiment of the present invention;
[0066] Figure 2 An operation flow chart of an external system service calling method provided by an embodiment of the present invention;
[0067] Figure 3 A manufacturer setting diagram of an external system service calling method provided by an embodiment of the present invention;
[0068] Figure 4 An external service setting diagram of an external system service calling method provided by an embodiment of the present invention;
[0069] Figure 5 A service channel service setting diagram of an external system service calling method provided by an embodiment of the present invention;
[0070] Figure 6 A test diagram of a method for calling an external system service provided by an embodiment of the present invention using a service calling tool Postman to call a channel service;
[0071] Figure 7 A channel service calling data flow diagram of an external system service calling method provided in an embodiment of the present invention.
[0072] Figure 8 It is a schematic diagram of an external system service calling device provided by another embodiment of the present invention. DETAILED DESCRIPTION
[0073] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.
[0074] The following detailed description is an exemplary description, which is intended to provide further detailed description of the present invention. Unless otherwise specified, all technical terms used in the present invention have the same meaning as those generally understood by those skilled in the art to which the present invention belongs. The terms used in the present invention are only for describing specific embodiments, and are not intended to limit the exemplary embodiments according to the present invention.
[0075] The following will be combined with the attached Figure 1 , a method for calling an external system service provided by an embodiment of the present invention is described, the method comprising:
[0076] S1. According to the service information of the external service to be called, the service information includes a request method, a request address, and request parameters, the external service to be called is configured, and the ID of the external service to be called is generated, a channel group and channel information are configured, the ID of the external service to be configured is referenced in the channel information, and a fixed request address and request interface information of the external service to be called are generated according to the channel group code and the channel code;
[0077] S2. When a service call request is received from the caller, the channel group code and the channel code are obtained through the service call request, and the fixed request address, request interface information and request method of the external service to be called by the caller are obtained according to the channel group code and the channel code. After calling the external service to be called according to the request method, the obtained response information is returned to the caller.
[0078] Based on the above embodiment, further, step 100 specifically includes:
[0079] According to the service information of the external service to be called, it is determined that the external service to be called is attached to the channel service of the service set,
[0080] If so, find the channel service and configure and mount the external service to be called.
[0081] If not, add a new service set and channel service for mounting;
[0082] Determine the channel group code and channel code of the external service to be called from the newly added service set;
[0083] The request mode and original address request address information of the external service to be called are stored according to the grammatical rules of camel remote call and combined with the channel configuration parameters of the external service to be called to form an external call address;
[0084] The channel group code and the channel code are written into a preset request address to obtain the fixed request address and the request interface information.
[0085] Based on the above embodiment, further, in S1, the request mode and request address of the external service to be called are written into the fields in the Json message, and the fields in the Json message and the channel configuration parameters of the external service to be called are combined into an external call address, specifically including:
[0086] After the request method and request address of the external service to be called are combined into a Json string, it is decoded into a Json format message through unmarshal, and the Json format message is set as the authentication header field through the setHeader component;
[0087] The authentication header field and the channel configuration parameters are combined into the external call address.
[0088] Based on the above embodiment, further, the method also includes:
[0089] The caller sends a service call request through an API interface or HTTPS request access.
[0090] Based on the above embodiment, further, in step 200, when a service call request from a caller is received, obtaining the channel group code and the channel code through the service call request specifically includes:
[0091] Obtaining a service call request from the caller, and obtaining channel configuration data and channel process information from the service call request;
[0092] Load the channel process information into the system context cache of the Camel component in Json format. The cache information format is Map<key,value> Format, key is the channel number, value is the channel process information formatted in Json.
[0093] Based on the above embodiment, further, in step 200, obtaining the fixed request address, request interface information and request method of the external service to be called by the caller according to the channel group code and the channel code, calling the external service to be called according to the request method, and returning the obtained response information to the caller, specifically includes:
[0094] Routing command name components according to the Json data of the channel process information corresponding to the channel number key in the system context cache, and executing the implementation methods corresponding to the command name components in the order of the channel process information;
[0095] By using the reflection principle of Java, the command name component is mapped to a Java class with a specific name, and then the execution method of the implementation interface is called for execution. After the execution is completed, the obtained response information is returned to the caller.
[0096] Based on the above embodiment, further, the request mode includes REST_API type, JDBC type, WEB_SERVICE type and BEAN type.
[0097] The present embodiment provides a method for calling an external system service, including configuring the external service to be called according to the service information of the external service to be called, the service information including the request mode, request address and request parameters, generating the ID of the external service to be called, configuring the channel group and channel information, referencing the ID of the external service to be configured in the channel information, generating the fixed request address and request interface information of the external service to be called according to the channel code; when receiving the service call request of the caller, obtaining the channel group code and the channel code through the service call request, and obtaining the fixed request address, request interface information and request mode of the external service to be called by the caller according to the channel group code and the channel code, calling the external service to be called according to the request mode, and returning the obtained response information to the caller. The present invention provides a convenient configuration and ready-to-use solution for software system calling external services. Basically, no code modification is required, and the call can be made after the configuration and release.
[0098] It should be understood that the invention of external system service calling technology provides a convenient and ready-to-use solution for software systems to call external services. Basically, no code modification is required, and the call can be made after configuration and release.
[0099] The present invention uses Apache Camel, an open source framework based on EIP, to achieve:
[0100] To implement mutual calls between two services, you need to set the following steps. Refer to the operation process as follows Figure 2 shown.
[0101] Step 1: Configure the service provider, that is, the service provider to which the external service to be called belongs, to facilitate service management. Figure 3 shown.
[0102] Step 2: Add external services based on your needs. The service provider selects the "system integration" created in the previous step, such as Figure 4 As shown. Select "System Integration" added in the previous step as the service provider name. We use http to call external system services, so select REST_API as the request method. We also have three other request methods: JDBC, WEB_SERVICE, and BEAN. JDBC is used for database connection and data operation. WEB_SERVICE calls the WEB page data loaded from the WEB address. BEAN is mainly used to call the Java code service inside the system. This method can be used to call the third-party SDK package to send data, or to process the uploaded data in code.
[0103] Technical principle: The request address data configured here will be saved in the eai_ext_service external service main table and the eai_endpoint service endpoint subtable in the database. For example, the eai_endpoin.resource_uri field in the table stores the rest:get: / joys-rest / joys-bpm / taskNotice / byCondition?host=https: / / lss-dev.joysfintech.com&AUTH-TOKEN={AUTH-TOKEN}&pageIndex=1&pageSize=8 address information configured here. Later, a request will be sent to the external system based on this address information.
[0104] Step 3, Service Settings, add a new service set, and you can mount multiple channel services. Figure 5 shown.
[0105] Step 4: Set channel services, channel parameters and channel processes.
[0106] Channel configuration: The channel configuration has a from node by default at the beginning. This node is the node header and the endpoint URL; for example: direct: / egress / f384c9cd-9b1f-4818-8eba-cd56732e24b6_test is the ID of the entire channel. According to the example requirement analysis, we need to decode the sent Json string into a Json format message through unmarshal, and then use setHeader to set the header component to put the data AUTH-TOKEN in the sent body into the AUTH-TOKEN corresponding to the request header header. Then use the toExt command component to call the external service set in step 2.
[0107] Step 6: Use the interface calling tool to call the service we configured.
[0108] We define a fixed request address: / joys-eai / ext / {egressCode} / {channelCode} and a request interface com.joysfintech.eai.core.EgressAccessor.access(String egressCode,StringchannelCode,RequestEntity request) to facilitate other system calls and access.
[0109] As long as other systems use API interfaces or https requests, they can access our services or entry services, and then route them to the specified channel according to the corresponding configured channel group code and configured channel code.
[0110] Parameter description: egressCode: configured channel group code, channelCode: configured channel code
[0111] In the process of calling between network systems, unlike the service calls between previous systems, the main feature of the present invention is that the mutual calls between different system services can be realized through the front-end configuration. Moreover, it uses the principle of distributed SpringCloud microservice architecture, making the system easy to integrate, call and configure.
[0112] It has the following advantages:
[0113] 1. The interface can be called through configuration.
[0114] 2. The data can be processed in the middle, such as verifying the data to see if the input data is compliant.
[0115] 3. Data processing can be performed according to the developed module command components, making data operations more convenient and quick.
[0116] 4. External service calls support multi-protocol File, FTP (SFTP), JDBC, WebService, RestAPI, HTTP calls, and can integrate third-party SDK plug-ins, without intrusion or coupling to the original platform. The principle of integrating SDK components is to create a new plug-in project, whose Java class is injected into the context of Spring's @Service, and implement the process (Exchange exchange) method of org.apache.camel.Processor, so that data can be processed in the process method, or the SDK plug-in interface of the third party can be called. Because this class has been injected into the Spring context, as long as the external service configuration request method in the integration platform is Bean, Bean Name: configure this Service service, you can use the Spring dependency injection method to call the plug-in where the external service Bean is called.
[0117] 5. For channel calls, you can call them after configuration is completed without restarting the service, so you can use them out of the box.
[0118] 6. The system has a dedicated page to support interface debugging, which is convenient and efficient.
[0119] The system has a special log record for call requests, which can view request and response data. The data source is obtained from the request interface parameters and interface return parameters.
[0120] 1. Technical principles of channel configuration and channel content loading:
[0121] (1) Front-end technology: Configure the channel in the vue interface, and drag the integrated command component into the channel details. The Vue.directive method listens to the movement of document.onmousemove to calculate the X-axis and Y-axis of the component movement. That is: the X-axis movement distance distanceX = X-coordinate after movement - X-coordinate before movement. The Y-axis movement distance distanceY = Y-coordinate after movement - Y-coordinate before movement. Then use el.scrollTo (el.scrollLeft-distanceX, el.scrollTop-distanceY) to set the position of the component in the flow chart.
[0122] (2) Backend technology: When saving or publishing a channel, the frontend calls the backend channel saving service through this.$axios.put request. The backend records the channel configuration data in the channel table information, and finally loads the frontend channel process information in the org.apache.camel.model.ModelCamelContext [the interface provided by the apache Camel open source component] system context cache in the Json format. The cache information format is Map<key,value> Format, key is the channel number, value is the process information in Json format.
[0123] 2. Principle of external or internal system calling integrated platform channel service:
[0124] like Figure 6-7 As shown, when using the postman interface to call the tool, or the com.joysfintech.eai.core.EgressAccessor.access(StringegressCode,StringchannelCode,RequestEntity request) system interface to call the service, the channel number of the corresponding channel information is found through the egressCode and channelCode in the request address or interface parameters, and then the different command components are routed according to the process Json data corresponding to the channel number key cached by the system, and the corresponding implementation methods of the components are executed according to the order of the command name components in the process. The reflection principle of Java is used here, and the component name + Cmd corresponds to the Java class with a specific name, and then the execute method of the com.joysfintech.eai.commond.Command interface is called for execution. When the execution is completed, the return value data of the final return method is written into the response exchange.message.body and returned to the caller.
[0125] like Figure 8 As shown, the present invention also provides an external system service calling device, the device comprising:
[0126] A configuration module, configured to configure the external service to be called according to service information of the external service to be called, the service information including a request method, a request address and request parameters, and generate an ID of the external service to be called, configure a channel group and channel information, the ID of the external service to be configured is referenced in the channel information, and generate a fixed request address and request interface information of the external service to be called according to the request method, request address, the channel group code and the channel code of the external service to be called;
[0127] The calling module is used to, when receiving a service calling request from a caller, obtain the channel group code and the channel code through the service calling request, and obtain the fixed request address, request interface information and request method of the external service to be called by the caller according to the channel group code and the channel code, and after calling the external service to be called according to the request method, return the obtained response information to the caller.
[0128] Based on the above embodiment, further, the configuration module is specifically used to determine whether the external service to be called is hung on the channel service of the service set according to the service information of the external service to be called,
[0129] If so, find the channel service and configure and mount the external service to be called.
[0130] If not, add a new service set and channel service for mounting;
[0131] Determine the channel group code and channel code of the external service to be called from the newly added service set;
[0132] The request mode and original address request address information of the external service to be called are stored according to the grammatical rules of camel remote call and combined with the channel configuration parameters of the external service to be called to form an external call address;
[0133] The channel group code and the channel code are written into a preset request address to obtain the fixed request address and the request interface information.
[0134] Based on the above embodiment, further, the configuration module is specifically used for:
[0135] After the request method and request address of the external service to be called are combined into a Json string, it is decoded into a Json format message through unmarshal, and the Json format message is set as the authentication header field through the setHeader component;
[0136] The authentication header field and the channel configuration parameters are combined into the external call address.
[0137] Based on the above embodiment, further, a configuration module is specifically used for the caller to access and send a service call request through an API interface or HTTPS request.
[0138] Based on the above technical solution, further, the calling module is specifically used to obtain the service calling request of the caller, and obtain the channel configuration data and channel process information from the service calling request;
[0139] Load the channel process information into the system context cache of the Camel component in Json format. The cache information format is Map<key,value> Format, key is the channel number, value is the channel process information formatted in Json.
[0140] Based on the above embodiment, further, the calling module is specifically used to route the command name component according to the Json data of the channel process information corresponding to the channel number key in the system context cache, and execute the implementation method corresponding to the command name component in the order of the channel process information;
[0141] By using the reflection principle of Java, the command name component is mapped to a Java class with a specific name, and then the execution method of the implementation interface is called for execution. After the execution is completed, the obtained response information is returned to the caller.
[0142] Based on the above embodiment, further, the request mode includes REST_API type, JDBC type, WEB_SERVICE type and BEAN type.
[0143] The present embodiment provides an external system service calling device, including configuring the external service to be called according to the service information of the external service to be called, the service information including the request mode, request address and request parameters, generating the ID of the external service to be called, configuring the channel group and channel information, referencing the ID of the external service to be configured in the channel information, generating the fixed request address and request interface information of the external service to be called according to the channel group code and the channel code; when receiving the service call request of the caller, obtaining the channel group code and the channel code through the service call request, and obtaining the fixed request address, request interface information and request mode of the external service to be called by the caller according to the channel group code and the channel code, calling the external service to be called according to the request mode, and returning the obtained response information to the caller. The present invention provides a convenient configuration and ready-to-use solution for software system calling external services. And basically no code modification is required, and the call can be made after the configuration and release.
[0144] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the external system service calling method described in any one of the above technical solutions when executing the computer program.
[0145] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the external system service calling method described in any one of the above technical solutions is implemented.
[0146] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, a person skilled in the art should understand that the specific implementation modes of the present invention can still be modified or replaced by equivalents, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for calling external system services, It is characterized in that The method comprises: According to the service information of the external service to be called, the service information includes a request method, a request address and a request parameter, the external service to be called is configured, and an ID of the external service to be called is generated, a channel group and channel information are configured, the ID of the external service to be configured is referenced in the channel information, and according to the request method, request address, the channel group code and the channel code of the external service to be called, a fixed request address and request interface information of the external service to be called are generated; When a service call request from a caller is received, the channel group code and the channel code are obtained through the service call request, and the fixed request address, request interface information and request method of the external service to be called by the caller are obtained according to the channel group code and the channel code. After calling the external service to be called according to the request method, the obtained response information is returned to the caller.
2. The external system service calling method according to claim 1, It is characterized in that The method includes configuring the external service to be called according to the service information of the external service to be called, wherein the service information includes a request method, a request address and a request parameter, generating an ID of the external service to be called, configuring a channel group and channel information, wherein the ID of the external service to be configured is referenced in the channel information, and generating a fixed request address and request interface information of the external service to be called according to the request method, the request address, the channel group code and the channel code of the external service to be called, specifically including: According to the service information of the external service to be called, it is determined that the external service to be called is attached to the channel service of the service set, If yes, find the channel service and configure and mount the external service to be called; If not, add a new service set and channel service for mounting; Determine the channel group code and channel code of the external service to be called from the newly added service set; The request mode and original address request address information of the external service to be called are stored according to the grammatical rules of camel remote call and combined with the channel configuration parameters of the external service to be called to form an external call address; The channel group code and the channel code are written into a preset request address to obtain the fixed request address and the request interface information.
3. The external system service calling method according to claim 2, It is characterized in that The request mode and request address information of the external service to be called are stored according to the grammatical rules of camel remote call and the channel configuration parameters of the external service to be called form the external call address, specifically including: After the request method and request address of the external service to be called are combined into a Json string, it is decoded into a Json format message through unmarshal, and the Json format message is set as the authentication header field through the setHeader component; The authentication header field and the channel configuration parameters are combined into the external call address.
4. The external system service calling method according to claim 1, It is characterized in that The method further comprises: The caller sends a service call request through an API interface or HTTPS request access.
5. The external system service calling method according to claim 1, It is characterized in that When receiving a service call request from a caller, obtaining the channel group code and the channel code through the service call request specifically includes: Obtaining a service call request from the caller, and obtaining channel configuration data and channel process information from the service call request; Load the channel process information into the system context cache of the Camel component in Json format. The cache information format is Map<key,value> Format, key is the channel number, value is the channel process information formatted in Json.
6. The external system service calling method according to claim 5, It is characterized in that The step of obtaining the fixed request address, request interface information and request method of the external service to be called by the caller according to the channel group code and the channel code, and after calling the external service to be called according to the request method, returning the obtained response information to the caller specifically includes: Routing command name components according to the Json data of the channel process information corresponding to the channel number key in the system context cache, and executing the implementation methods corresponding to the command name components in the order of the channel process information; By using the reflection principle of Java, the command name component is mapped to a Java class with a specific name, and then the execution method of the implementation interface is called for execution. After the execution is completed, the obtained response information is returned to the caller.
7. The external system service calling method according to claim 1, It is characterized in that The request methods include REST_API type, JDBC type, WEB_SERVICE type and BEAN type.
8. An external system service calling device, It is characterized in that The device comprises: A configuration module, configured to configure the external service to be called according to the service information of the external service to be called, the service information including the request mode, request address and request parameters, and generate the ID of the external service to be called, configure the channel group and channel information, the ID of the external service to be configured is referenced in the channel information, and generate the fixed request address and request interface information of the external service to be called according to the channel group code and the channel code; The calling module is used to, when receiving a service calling request from a caller, obtain the channel group code and the channel code through the service calling request, and obtain the fixed request address, request interface information and request method of the external service to be called by the caller according to the channel group code and the channel code, and after calling the external service to be called according to the request method, return the obtained response information to the caller.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the external system service calling method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the external system service calling method according to any one of claims 1 to 7 is implemented.
