Methods, devices, computer equipment, and storage media for invoking WebService interfaces

By using input parameter configuration rules and interface configuration libraries, the remote call process of WebService interfaces is simplified, solving the problems of repetitive coding and poor adaptability in existing technologies, and realizing efficient and flexible WebService interface calls.

CN116016625BActive Publication Date: 2025-12-02ZHONGKE YUNGU TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211676110.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2025-12-02
Estimated Expiration
2042-12-26

AI Technical Summary

Technical Problem

Existing methods for remotely invoking WebService interfaces suffer from problems such as repetitive coding, low development efficiency, poor sensitivity, poor adaptability, and the generation of redundant files. Furthermore, they do not conform to coding standards and are difficult to read.

Method used

The configuration information of the WebService interface is encapsulated into the interface configuration library by encapsulating the input parameter configuration rules. The CloseableHttpClient object is used to perform call processing, and the interface configuration library is used for matching and rate limiting protection, which simplifies the remote call process.

Benefits of technology

It lowers the technical threshold, improves the adaptability, versatility and flexibility of WebService interfaces, simplifies the remote call process, reduces hard coding, improves development efficiency, and provides maximum service capacity and security protection when resources are scarce.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116016625B_ABST
    Figure CN116016625B_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, computer device, and storage medium for invoking a WebService interface. The method includes: receiving request information from a WebService interface; generating input parameter invocation information based on the request information and preset input parameter configuration rules; using a pre-created CloseableHttpClient object to execute the invocation processing of the WebService interface based on the input parameter invocation information; and obtaining the return result of the WebService interface invocation upon successful invocation. This method encapsulates the configuration information of the WebService interface into an interface configuration library through input parameter configuration rules, solving the problem of adaptability and universality of WebService interfaces, lowering the technical threshold of WebService, and simplifying the remote invocation process of WebService.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of WebService communication technology, and in particular to a method, apparatus, computer device, and storage medium for invoking a WebService interface. Background Technology

[0002] Web Services are a cross-programming language and cross-operating system platform remote invocation technology that enables different applications on different machines to exchange data or integrate with each other, regardless of language, platform, or internal protocol, without the need for third-party software / hardware, according to the Web Service implementation specification. Cross-operating system platform compatibility means that the server and client can run on different operating systems.

[0003] Currently, the three main methods for implementing remote calls using WebService interfaces include: using AXIS to make remote WebService calls, integrating CXF with Spring to make remote WebService calls, and compiling the WSDL of the WebService interface into a local entity class using wsimport, and then calling the methods of the local entity class to make remote WebService calls. However, the existing mainstream methods have some drawbacks.

[0004] For example, in the methods of remotely calling web services through AXIS and remotely calling web services through Spring integration with CXF, each additional remote call to a web service interface requires hard-coding in the program based on the differences in the web service interface address, input parameters, and output parameters. This results in a large amount of repetitive coding, low development efficiency, poor responsiveness, and an inability to meet the requirements for adapting web services to quickly respond.

[0005] For example, the approach of compiling the WSDL of the web service interface into a local entity class via wsimport and then calling the methods of the local entity class to implement remote web service calls is relatively straightforward and simple, but the operation is cumbersome. Each completed web service call generates a set of local files related to the web service. As the number of web services increases, a large number of redundant files unrelated to business logic will appear in the project, seriously intruding on the project's code. Furthermore, the naming rules of the file names, variables, and methods of these files do not conform to Java coding standards, making them difficult to read. Summary of the Invention

[0006] Therefore, it is necessary to provide a method, device, computer equipment, and storage medium for invoking WebService interfaces to address the aforementioned technical issues. By configuring input parameters and rules, the configuration information of the WebService interface is encapsulated into an interface configuration library, thereby solving the problem of adaptability and universality of WebService interfaces, lowering the technical threshold of WebService, and simplifying the remote invocation process of WebService.

[0007] This application provides a method for invoking a WebService interface, the method including:

[0008] Receive request information from the WebService interface;

[0009] Based on the request information and the preset input parameter configuration rules, generate input parameter call information;

[0010] Using a pre-created CloseableHttpClient object, the WebService interface is executed based on the input parameters, and the return result of the WebService interface call is obtained upon successful execution.

[0011] In one embodiment, the step of receiving request information from the WebService interface includes:

[0012] By calling the unified API configuration, it can be determined whether the current WebService interface has rate limiting protection enabled;

[0013] If rate limiting protection is enabled, the system will determine whether the current WebService interface complies with the preset rate limiting strategy based on the preset interface configuration library.

[0014] If the preset rate limiting policy is met, the request information of the current WebService interface is executed; otherwise, the execution of the WebService interface call service is terminated.

[0015] In one embodiment, the step of generating input parameter call information based on the request information and preset input parameter configuration rules includes:

[0016] Based on the request information and the preset input parameter configuration rules, the preset input parameter configuration items and the SOAP-based XML string message in the WebService interface are obtained. Then, the CloseableHttpClient object is used to process the call to the WebService interface on the input parameter configuration items and the SOAP XML string message.

[0017] In one embodiment, the input parameter configuration rules include a first input parameter configuration strategy and a second input parameter configuration strategy; the request information includes first input parameter information and second input parameter information.

[0018] The steps for obtaining the preset input parameter configuration items and the SOAP-based XML string message from the WebService interface based on the request information and preset input parameter configuration rules include:

[0019] Based on the first input parameter information and the first input parameter configuration strategy, obtain the input parameter configuration items and interface configuration items of the WebService interface; and,

[0020] Using the second input parameter information and the second input parameter configuration strategy, obtain the input parameter JSON string of the WebService interface;

[0021] The interface configuration items are dynamically concatenated with the input JSON string to form an XML string message based on the SOAP protocol.

[0022] In one embodiment, the first input parameter information is represented as the interface code of the WebService interface;

[0023] The steps for obtaining input parameter configuration items and interface configuration items based on the first input parameter information and the first input parameter configuration strategy include:

[0024] Based on the interface code of the WebService interface, query the current interface configuration library;

[0025] Determine if the interface configuration library contains the interface code;

[0026] If an interface code exists, retrieve the input parameter configuration items and interface configuration items of the current WebService interface;

[0027] If no interface code exists, the current WebService interface call service will be terminated.

[0028] In one embodiment, before the step of receiving request information from the WebService interface, the method includes: preparing configuration information for the WebService interface using an automatic WSDL parsing algorithm;

[0029] The configuration information of the WebService interface includes: interface code, input parameter configuration items, interface configuration items, and rate limiting strategy.

[0030] In one embodiment, the step of using a pre-created CloseableHttpClient object to process the WebService interface call information based on the input parameters further includes: recording the WebService interface call log, and receiving request information again based on the call log when the WebService interface call fails.

[0031] This application provides a device for invoking a WebService interface, the device comprising: an information receiving module, an information generating module, and an interface invocation module, wherein:

[0032] The information receiving module is used to receive request information from the WebService interface;

[0033] The information generation module is used to generate input parameter call information based on the request information and the preset input parameter configuration rules;

[0034] The interface invocation module is used to execute the WebService interface invocation process based on the input parameter invocation information using a pre-created CloseableHttpClient object, and to obtain the return result of the WebService interface invocation when the invocation is successful.

[0035] This application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0036] Receive request information from the WebService interface;

[0037] Based on the request information and the preset input parameter configuration rules, generate input parameter call information;

[0038] Using a pre-created CloseableHttpClient object, the WebService interface is invoked based on the input parameter call information, and the return result of the WebService interface call is obtained upon successful invocation.

[0039] This application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the following steps:

[0040] Receive request information from the WebService interface;

[0041] Based on the request information and the preset input parameter configuration rules, generate input parameter call information;

[0042] Using a pre-created CloseableHttpClient object, the WebService interface is invoked based on the input parameter call information, and the return result of the WebService interface call is obtained upon successful invocation.

[0043] The above-mentioned WebService interface invocation methods, devices, computer equipment, and storage media have the following technical effects:

[0044] (1) Since the input parameter call information is generated based on the request information and the preset input parameter configuration rules, and then the CloseableHttpClient object is used to execute the WebService interface call processing based on the input parameter call information, it can be understood that the input parameter configuration rules are pre-encapsulated. There is no need to understand the relevant technologies of WebService services. Based on the request information of WebService interface and the preset encapsulation, the remote call of WebService interface can be completed quickly, which greatly reduces the technical threshold.

[0045] (2) Since the interface configuration library is used, there is no need to consider the WebService interface type, which solves the problem of the adaptability and universality of the WebService interface. The request information of the WebService interface is matched through the interface configuration library. When the match is successful, the WebService interface can be called.

[0046] (3) Because of the use of the interface configuration library, the configuration information of several possible WebService interfaces can be pre-deployed through the interface configuration library. Among them, the automatic resolution mechanism of WSDL address is adopted. Therefore, the configuration and deployment of WebService interfaces using the interface configuration library supports the flexible configuration of WebService interfaces and greatly improves the flexibility of WebService interface configuration.

[0047] (4) Since the unified API configuration is used to determine whether the current WebService interface has rate limiting protection enabled, the unified API configuration is provided to complete the remote call of the WebService interface, realizing unified adaptation of the WebService interface, greatly simplifying the remote call process of the WebService interface, reducing the hard coding of business systems, improving development efficiency, avoiding the generation of local entity classes, and thus avoiding code intrusion.

[0048] (5) Because the rate limiting rule is used to determine whether the current WebService interface needs to be called, the limited resources can provide the maximum service capacity when resources are scarce, and the purpose of security protection can be achieved. Attached Figure Description

[0049] Figure 1 This is a flowchart illustrating how AXIS is used to call a remote Web Service in the background technology.

[0050] Figure 2 This is a flowchart illustrating how Spring integrates with CXF to implement remote WebService calls in the background technology.

[0051] Figure 3 The flowchart below illustrates how the WSDL of a WebService interface is compiled into a local entity class using wsimport, and then the methods of the local entity class are called to implement remote WebService calls.

[0052] Figure 4 This is a diagram illustrating the application environment of a WebService interface invocation method in one embodiment.

[0053] Figure 5 This is a flowchart illustrating the calling method of a WebService interface in one embodiment;

[0054] Figure 6 This is a schematic diagram illustrating the detailed process of calling a WebService interface in one embodiment;

[0055] Figure 7 This is a flowchart illustrating the configuration method of a WebService interface in one embodiment;

[0056] Figure 8 This is a structural block diagram of a device for invoking a WebService interface in one embodiment;

[0057] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0058] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0059] like Figure 1-3 As shown, these are three mainstream methods for implementing remote calls using WebService interfaces in the background technology. Among them, Figure 1This flowchart illustrates a remote WebService call implemented via AXIS, including the following steps: S101: Pre-instantiate the access object (Service); S102: Instantiate the call object (Call) using the createCall method on the access object instance; S103: Set the WebService address and method of the call object, set the input parameters and their types, and set the return type of the call object; S104: Execute the remote WebService call by calling the invoke method of the object; S105: Obtain the return result of the WebService call. Figure 2 This flowchart illustrates how to implement remote WebService calls via Spring integration with CXF. It includes the following steps: S201: Add the CXF Maven dependency package to the project beforehand; S202: Instantiate JaxWsDynamicClientFactory as a dynamic client factory; S203: Use the client factory object instance to create a client object (Client) via the WSDL address; S204: Execute the invoke method of the client object, passing in the method name and parameters of the webservice interface; S205: Obtain the return result of the WebService call. Figure 3 This flowchart illustrates how to compile the WSDL of a WebService interface into a local entity class using wsimport, and then call methods of the local entity class to implement a remote WebService call. The steps include: S301: Pre-check and confirm that the WebService server is running; S302: Use the JDK's built-in wsimport tool to generate the corresponding class file based on the WSDL address; S303: Copy the generated class file code to the project, creating a local file; S304: Complete the WebService call by calling methods of the project's local entity class; S305: Obtain the return result of the WebService call.

[0060] As can be seen from the three mainstream methods of implementing remote calls through the WebService interface mentioned above, there are many defects such as repetitive coding, low development efficiency, poor sensitivity and adaptability, a large number of redundant files, and non-standard file storage.

[0061] Further explanation: The terminology used in this embodiment is defined as follows: WebService represents a remote invocation technology that spans programming languages ​​and operating system platforms; XML represents a subset of Standard Generalized Markup Language (SGML) used to mark up data and define data types; it is a source language that allows users to define their own markup languages; WSDL (WebServiceDefinition Language) represents an XML-based language that provides a formal description document in a machine-readable format, used to describe Web Services, their functions, parameters, and return values; SOAP (Simple Object Access Protocol) represents a protocol specification for exchanging data, characterized by its lightweight nature and XML-based nature; Axis (Apache Extensible Interaction System) represents a SOAP engine that provides a basic framework for creating Web services; JDK (Java Development Kit) represents a software development kit for Java developers; the wsimport command represents a command included in the JDK that can generate corresponding native Java code based on the server-side specification (WSDL); CXF represents an open-source, full-featured, and easy-to-use web service framework; HttpClient represents Apache Jakarta... The Common sub-projects provide efficient, up-to-date, and feature-rich client programming toolkits that support the HTTP protocol, and they support the latest versions and recommendations of the HTTP protocol; CloseableHttpClient represents an extension of HttpClient, implementing the HttpClient and Closeable interfaces.

[0062] The WebService interface calling method provided in this application can be applied to, for example... Figure 4 The application environment shown is as follows. Terminal 101 is used to run Java Virtual Machine 102 and configure PC program 103. Java Virtual Machine 102 is used to compile and run Java programs. Terminal 101 can be, but is not limited to, various servers, personal computers, laptops, smartphones, and tablets.

[0063] In one embodiment, such as Figure 5-7 As shown, a method for calling a WebService interface is provided, which can be applied to... Figure 4 Taking the terminal in the example, the explanation includes the following steps:

[0064] Step S401: Receive request information from the WebService interface.

[0065] Step S402: Generate input parameter call information based on the request information and the preset input parameter configuration rules.

[0066] Step S403: Using the pre-created CloseableHttpClient object, execute the WebService interface call processing based on the input parameter call information, and obtain the return result of the WebService interface call when the call is successful.

[0067] Before performing step S401, which involves receiving request information from the WebService interface, the method includes: preparing configuration information for at least one of the WebService interfaces using an automatic WSDL parsing algorithm.

[0068] The configuration information of the WebService interface includes: interface code, input parameter configuration items, interface configuration items, and rate limiting strategy.

[0069] In one implementation, preparing the configuration information for the WebService interface can be understood as adding at least one set of WebService interfaces and their configuration information to the interface configuration library. Further, the configuration information for the WebService interface includes: interface code, interface name, input parameter configuration items, interface configuration items, and rate limiting policy.

[0070] In one implementation, the input parameter configuration items include the request address and authentication information; the interface configuration items include: the called method, namespace, request body root field, response body root field, and response body array field set. (See attached document) Figure 6 As shown, the steps for customizing and adding at least one set of WebService interfaces and their configuration information in the interface configuration library include:

[0071] Obtain input data from the WebService interface, including interface code, interface name, authentication information, and WSDL address; based on the WSDL address, use a preset automatic WSDL parsing algorithm to parse configuration information including request address, called method name, namespace, request body root field, response body root field, and response body array field set.

[0072] In another implementation, the configuration process of the WebService interface includes the following steps: responding to the WebService interface triggering a new configuration, outputting a configuration form; obtaining and saving configuration data according to the configuration form; and obtaining the current rate limiting policy of the WebService interface.

[0073] In the step of obtaining and saving configuration data, the interface code, interface name, authentication information, and WSDL address are obtained from the configuration form. Based on the WSDL address and a preset automatic WSDL parsing algorithm, configuration data including the request address, the called method name, namespace, request body root field, response body root field, and response body array field set are parsed. The rate limiting policy configuration for the current WebService interface is then obtained.

[0074] Therefore, it can be seen that the WebService interface invocation method in this embodiment is based on the pre-prepared configuration information of the WebService interface. The configuration information of at least one WebService interface is encapsulated in the interface configuration library. By encapsulating the invocation logic of the WebService interface, the technical threshold is reduced. It is not necessary to understand the relevant technologies of WebService services to quickly complete the remote invocation of WebService interfaces. According to the configuration deployment of WebService interfaces, it supports the flexible configuration of WebService interfaces, provides automatic resolution of the WSDL address of WebService interfaces, and solves the problem of the adaptability and universality of WebService interfaces.

[0075] Step S401, the step of receiving request information from the WebService interface, includes:

[0076] By calling the unified API configuration, it can be determined whether the current WebService interface has rate limiting protection enabled;

[0077] If rate limiting protection is enabled, the system will determine whether the current WebService interface complies with the preset rate limiting strategy based on the preset interface configuration library.

[0078] If the preset rate limiting policy is met, the request information of the current WebService interface is executed; otherwise, the execution of the WebService interface call service is terminated.

[0079] If rate limiting protection is not enabled, the request information of the WebService interface will be executed directly.

[0080] To further explain, by calling the unified API configuration, it is determined whether the current WebService interface has rate limiting protection enabled. If rate limiting protection is enabled, the WebService interface is deemed to meet the requirements for executing the request information if it meets the preset rate limiting policy according to the interface configuration library. If rate limiting protection is not enabled, the request information of the WebService interface is executed directly.

[0081] By providing a unified API configuration to complete remote calls to WebService interfaces, unified adaptation of WebService interfaces is achieved, which greatly simplifies the remote call process of WebService interfaces, reduces hard coding in business systems, improves development efficiency, avoids the generation of local entity classes, and thus avoids code intrusion.

[0082] In other words, when rate limiting protection is enabled, the request information of the WebService interface is executed if the rate limiting rules are met; otherwise, the execution of the WebService interface call service is terminated.

[0083] In one implementation, the request information in this implementation includes an interface code. Further, when it is determined from the interface configuration library that the current WebService interface conforms to a preset rate limiting policy, the step of determining that the WebService interface satisfies the execution request information includes:

[0084] Based on the interface code and the preset interface configuration library, obtain the WebService interface corresponding to the interface code and the configuration information of the WebService interface; based on the configuration information of the WebService interface, query the preset rate limiting policy in the current interface configuration library; if the current WebService interface meets the preset rate limiting policy configuration, then execute the request information of the current WebService interface; otherwise, stop executing the request information of the WebService interface.

[0085] Therefore, it can be seen that if rate limiting protection is not enabled, the request information of the current WebService interface is executed directly; if rate limiting protection is enabled, the interface code is obtained based on the request information, and the preset rate limiting policy in the interface configuration library is queried based on the interface code and the preset interface configuration library. The rate limiting control operation is executed according to the rate limiting policy. If the rate limiting control is successful, the request information of the current WebService interface continues to be executed; if the rate limiting policy fails, the execution of the request information of the WebService interface ends.

[0086] In this embodiment, a rate limiting mechanism is used to provide maximum service capacity with limited resources when resources are scarce, while also achieving the purpose of security protection.

[0087] In one implementation, step S402, the step of generating input parameter call information based on the request information and preset input parameter configuration rules, includes:

[0088] Based on the request information and the preset input parameter configuration rules, the preset input parameter configuration items and the SOAP-based XML string message in the WebService interface are obtained. Then, the CloseableHttpClient object is used to process the call to the WebService interface on the input parameter configuration items and the SOAP XML string message.

[0089] In one implementation, the input parameter configuration rules include a first input parameter configuration strategy and a second input parameter configuration strategy; the request information includes first input parameter information and second input parameter information.

[0090] The steps for obtaining the preset input parameter configuration items and the SOAP-based XML string message from the WebService interface based on the request information and preset input parameter configuration rules include:

[0091] Based on the first input parameter information and the first input parameter configuration strategy, obtain the input parameter configuration items and interface configuration items of the WebService interface; and, using the second input parameter information and the second input parameter configuration strategy, obtain the input parameter JSON string of the WebService interface; dynamically concatenate the interface configuration items and the input parameter JSON string to form an XML string message based on the SOAP protocol.

[0092] The first input parameter is represented by the interface code of the WebService interface;

[0093] The steps for obtaining input parameter configuration items and interface configuration items based on the first input parameter information and the first input parameter configuration strategy include:

[0094] Based on the interface code of the WebService interface, query the interface configuration library; determine if the interface code exists in the interface configuration library; if the interface code exists, obtain the input parameter configuration items and interface configuration items of the current WebService interface; if the interface code does not exist, terminate the call service of the current WebService interface.

[0095] In one implementation, step S403, which involves using a pre-created CloseableHttpClient object to process the WebService interface call based on the input parameter call information and obtaining the return result of the WebService interface call upon successful call, requires pre-creating a CloseableHttpClient object and setting the request address, authentication information, and SOAP XML string message of the webservice interface, and then completing the call through CloseableHttpClient.

[0096] In one implementation, step S403, which involves using a pre-created CloseableHttpClient object to process the WebService interface call based on the input parameter call information, and obtaining the return result of the WebService interface call upon successful completion, further includes: recording a call log, and re-receiving request information based on the call log when the WebService interface call fails. The call log includes, but is not limited to, information such as the request address of the WebService interface, authentication information, and SOAP XML string messages. Therefore, it can be seen that the retry mechanism improves the fault tolerance of the system call.

[0097] In the aforementioned WebService interface invocation method, the input parameter invocation information is generated based on the request information and preset input parameter configuration rules. Then, the CloseableHttpClient object is used to process the WebService interface invocation based on this information. Therefore, it can be understood that by pre-encapsulating the input parameter configuration rules, it eliminates the need for knowledge of WebService-related technologies. Remote invocation of the WebService interface can be quickly completed based on the request information and the preset encapsulation, significantly lowering the technical threshold. Because an interface configuration library is used, the WebService interface type does not need to be considered, solving the problem of WebService interface adaptability and universality. The interface configuration library matches the request information of the WebService interface; when a match is successful, the WebService interface invocation service can be executed. Furthermore, the interface configuration library allows for the pre-deployment of configuration information for several potentially needed WebService interfaces. It also employs an automatic WSDL address resolution mechanism. Therefore, using the interface configuration library for WebService interface configuration and deployment supports flexible configuration of WebService interfaces, greatly improving the flexibility of WebService interface configuration. By employing a unified API configuration to determine whether rate limiting protection is enabled for the current WebService interface, remote calls to WebService interfaces are completed through a unified API configuration. This achieves unified adaptation of WebService interfaces, greatly simplifies the remote call process, reduces hard coding in business systems, improves development efficiency, and avoids the generation of local entity classes, thereby preventing code intrusion. By using rate limiting rules to determine whether to execute the current WebService interface call, limited resources are maximized to provide service capacity in resource-scarce situations, while also achieving security protection goals.

[0098] It should be understood that, although Figure 5-7 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 5-7 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0099] In one embodiment, such as Figure 8 As shown, a device for invoking a WebService interface is provided, comprising: an information receiving module 501, an information generating module 502, and an interface invocation module 503, wherein:

[0100] The information receiving module 501 is used to receive request information from the WebService interface.

[0101] The information generation module 502 is used to generate input parameter call information based on the request information and the preset input parameter configuration rules.

[0102] The interface call module 503 is used to execute the WebService interface call processing based on the input parameter call information using a pre-created CloseableHttpClient object, and to obtain the return result of the WebService interface call when the call is successful.

[0103] For specific limitations regarding the invocation device for the WebService interface, please refer to the limitations on the invocation methods for the WebService interface mentioned above, which will not be repeated here. Each module in the aforementioned invocation device for the WebService interface can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can invoke and execute the operations corresponding to each module.

[0104] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores call data for the WebService interface. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a method for calling the WebService interface.

[0105] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0106] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0107] Receive request information from the WebService interface; generate input parameter call information based on the request information and preset input parameter configuration rules; use a pre-created CloseableHttpClient object to execute the WebService interface call processing on the input parameter call information, and obtain the return result of the WebService interface call when the call is successful.

[0108] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0109] Receive request information from the WebService interface; generate input parameter call information based on the request information and preset input parameter configuration rules; use a pre-created CloseableHttpClient object to execute the WebService interface call processing on the input parameter call information, and obtain the return result of the WebService interface call when the call is successful.

[0110] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0111] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0112] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for invoking a WebService interface, characterized in that, The method includes: Receive request information from the WebService interface; Based on the request information and the preset input parameter configuration rules, generate input parameter call information; Using a pre-created CloseableHttpClient object, the WebService interface is processed based on the input parameter call information, and the return result of the WebService interface call is obtained upon successful call. The step of generating input parameter call information based on the request information and preset input parameter configuration rules includes: Based on the request information and the preset input parameter configuration rules, the preset input parameter configuration items and the SOAP-based XML string message in the WebService interface are obtained, so as to use the CloseableHttpClient object to perform the call processing of the WebService interface on the input parameter configuration items and the SOAP XML string message; The input parameter configuration rules include a first input parameter configuration strategy and a second input parameter configuration strategy; the request information includes first input parameter information and second input parameter information. The steps for obtaining the preset input parameter configuration items and the SOAP-based XML string message from the WebService interface based on the request information and preset input parameter configuration rules include: Based on the first input parameter information and the first input parameter configuration strategy, obtain the input parameter configuration items and interface configuration items of the WebService interface; and, Using the second input parameter information and the second input parameter configuration strategy, obtain the input parameter JSON string of the WebService interface; The interface configuration items are dynamically concatenated with the input JSON string to form an XML string message based on the SOAP protocol.

2. The method for invoking a WebService interface according to claim 1, characterized in that, The step of receiving request information from the WebService interface includes: By calling the unified API configuration, it can be determined whether the current WebService interface has rate limiting protection enabled; If rate limiting protection is enabled, the system will determine whether the current WebService interface complies with the preset rate limiting strategy based on the preset interface configuration library. If the preset rate limiting policy is met, the request information of the current WebService interface is executed; otherwise, the execution of the WebService interface call service is terminated. If rate limiting protection is not enabled, the request information of the WebService interface will be executed directly.

3. The method for invoking the WebService interface according to claim 2, characterized in that, The first input parameter information is represented as the interface code of the WebService interface; The step of obtaining the input parameter configuration item and the interface configuration item based on the first input parameter information and the first input parameter configuration strategy includes: Based on the interface code of the WebService interface, query the current interface configuration library; Determine whether the interface configuration library contains the interface code; If the interface encoding exists, then obtain the input parameter configuration items and interface configuration items of the current WebService interface; If the interface code does not exist, the current WebService interface call service will be terminated.

4. The method for invoking a WebService interface according to claim 1, characterized in that, Before the step of receiving the request information from the WebService interface, the method includes: preparing the configuration information of the WebService interface using an automatic WSDL parsing algorithm; The configuration information of the WebService interface includes: interface code, input parameter configuration items, interface configuration items, and rate limiting strategy.

5. The method for invoking a WebService interface according to claim 1, characterized in that, The step of using a pre-created CloseableHttpClient object to process the WebService interface call based on the input parameter call information further includes: recording the WebService interface call log, and receiving the request information again based on the call log when the WebService interface call fails.

6. A device for invoking a WebService interface, characterized in that, The device includes: The information receiving module is used to receive request information from the WebService interface; An information generation module is used to obtain preset input parameter configuration items and SOAP-based XML string messages from a WebService interface based on the request information and preset input parameter configuration rules. This is then used to execute the WebService interface call processing using a pre-created CloseableHttpClient object on the input parameter configuration items and the SOAP XML string messages. The input parameter configuration rules include a first input parameter configuration strategy and a second input parameter configuration strategy. The request information includes first input parameter information and second input parameter information. The step of obtaining the preset input parameter configuration items and SOAP-based XML string messages from the WebService interface based on the request information and preset input parameter configuration rules includes: obtaining the input parameter configuration items and interface configuration items of the WebService interface based on the first input parameter information and the first input parameter configuration strategy; obtaining the input parameter JSON string of the WebService interface using the second input parameter information and the second input parameter configuration strategy; and dynamically concatenating the interface configuration items and the input parameter JSON string to form an SOAP-based XML string message. The interface invocation module is used to execute the WebService interface invocation process based on the input parameter invocation information using a pre-created CloseableHttpClient object, and to obtain the return result of the WebService interface invocation when the invocation is successful.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Uniform interface management method and system

    CN107918562A

  • API interface access method and device, API interface conversion method and device, equipment and storage medium

    CN115509647A