Method, device and readable storage medium for invoking software development kit

By binding the target middleware and the target software development kit in the configuration file, adaptive middleware is automatically generated, which solves the problem of complex integration of multiple third-party SDKs in the existing technology, improves R&D efficiency and reduces communication costs.

CN119512659BActive Publication Date: 2025-11-18PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411760828.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-11-18
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

When multiple third-party SDKs are introduced into a business system, existing technologies require each one to be connected to and verified as a middleware proxy layer, resulting in low development efficiency and high communication costs.

Method used

By binding the target middleware and the target software development kit in the configuration file, an adaptive target middleware is generated, enabling rapid integration with third-party SDKs without the need for code customization.

Benefits of technology

It reduces development and integration communication costs and improves the efficiency of calling third-party SDKs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512659B_ABST
    Figure CN119512659B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of development assistance, and can automatically generate target middleware adaptive to a target software development kit, quickly access the target software development kit, and greatly reduce development and docking communication costs and improve the efficiency of calling a third-party SDK. The application relates to a software development kit calling method and device, a computer device and a readable storage medium. The software development kit calling method comprises the following steps: obtaining a configuration file corresponding to target middleware to be generated in a middleware proxy layer; in the configuration file, performing data binding on a target software development kit corresponding to the target middleware and the target middleware, wherein the data binding comprises attribute binding, calling method binding and communication object binding; and generating the target middleware according to the configuration file after the data binding, so that the target middleware is used for accessing the target software development kit, and a business layer calls the target software development kit.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of development assistance, and in particular to a software development kit calling method and device, a computer device and a readable storage medium. BACKGROUND

[0002] In the project development process of most business systems (insurance, banking, medical care), a third-party SDK (Software Development Kit) needs to be introduced globally in the project, and the business layer of the project and the third-party SDK communicate through a middleware proxy layer. The middleware proxy layer encapsulates the calling methods of the third-party SDK required by the business layer, and these calling methods all need to be connected and debugged with the third-party SDK, and in complex cases, the middleware proxy layer needs to be customized. If the business layer needs to access N sets of third-party SDKs, N middleware implementations need to be created in the middleware proxy layer to introduce N sets of third-party SDKs, and the calling methods encapsulated by each middleware need to be connected, debugged and verified one by one. The whole process is extremely complex and time-consuming, not only the development efficiency is low, but also the connection and communication costs will increase linearly with the number of third-party SDKs.

[0003] Therefore, how to improve the efficiency of calling third-party SDKs has become a problem to be solved. SUMMARY

[0004] The present application provides a software development kit calling method and device, a computer device and a readable storage medium, which can automatically generate a target middleware adaptive to a target software development kit, quickly access the target software development kit, and greatly reduce the development, connection and communication costs, thereby improving the efficiency of calling third-party SDKs.

[0005] In a first aspect, the present application provides a software development kit calling method applied to a business project system, wherein the business project system includes a business layer, a middleware proxy layer and a third-party tool library, the third-party tool library includes at least one software development kit, and the method includes:

[0006] obtaining a configuration file corresponding to a target middleware to be generated in the middleware proxy layer; in the configuration file, a target software development kit corresponding to the target middleware is data-bound with the target middleware, wherein the data binding includes attribute binding, calling method binding and communication object binding; and generating the target middleware according to the data-bound configuration file, the target middleware being used to access the target software development kit, so that the business layer can call the target software development kit.

[0007] In a second aspect, the present application provides a calling device of a software development kit, comprising:

[0008] a configuration file obtaining module, configured to obtain a configuration file corresponding to a target middleware to be generated in the middleware proxy layer;

[0009] a data binding module, configured to perform data binding between a target software development kit corresponding to the target middleware and the target middleware in the configuration file, wherein the data binding comprises attribute binding, calling method binding and communication object binding;

[0010] a middleware generating module, configured to generate the target middleware according to the data-bound configuration file, wherein the target middleware is configured to access the target software development kit, so that the business layer calls the target software development kit.

[0011] In a third aspect, the present application provides a computer device, comprising a memory and a processor;

[0012] the memory, configured to store a computer program;

[0013] the processor, configured to execute the computer program and implement the calling method of the software development kit as described above when executing the computer program.

[0014] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to make the processor implement the calling method of the software development kit as described above.

[0015] The application discloses a calling method and device of a software development kit, a computer device and a readable storage medium. The method comprises the following steps: obtaining a configuration file corresponding to a target middleware to be generated in a middleware proxy layer; performing data binding on a target software development kit corresponding to the target middleware and the target middleware in the configuration file, wherein the data binding comprises attribute binding, calling method binding and communication object binding; and generating the target middleware according to the configuration file after data binding, so that the target middleware is used for accessing the target software development kit, and the target software development kit is called by the business layer. According to the application, the target software development kit corresponding to the target middleware and the target middleware are data-bound in the configuration file, and the target middleware is generated according to the configuration file after data binding, so that the target middleware adaptive to the target software development kit can be automatically generated, the target software development kit is quickly accessed by using the target middleware, code customization with a third-party SDK provider is not needed, development and docking communication costs can be greatly reduced, and the efficiency of calling the third-party SDK is improved. BRIEF DESCRIPTION OF DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0017] Figure 1 is a structural schematic diagram of a business project system in the prior art;

[0018] Figure 2 is a structural schematic diagram of a computer device provided by the embodiments of the present application;

[0019] Figure 3 is a schematic flow chart of a calling method of a software development kit provided by the embodiments of the present application;

[0020] Figure 4 is a structural schematic diagram of another business project system provided by the embodiments of the present application;

[0021] Figure 5 is a schematic flow chart of another calling method of a software development kit provided by the embodiments of the present application;

[0022] Figure 6 is a schematic flow chart of a sub-step of generating a target middleware provided by the embodiments of the present application;

[0023] Figure 7 is a schematic flow chart of generating a target middleware provided by the embodiments of the present application;

[0024] Figure 8 This is a schematic block diagram of a software development kit (SDK) invocation device provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0026] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.

[0027] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0028] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0029] Currently, such as Figure 1As shown, the relevant technology requires the global introduction of a third-party SDK (Software Development Kit) in the project, and the communication between the project's business layer and the third-party SDK is handled by a middleware proxy layer. The middleware proxy layer encapsulates the calling methods of the third-party SDK required by the business layer. These calling methods need to be integrated and debugged with the third-party SDK, and in complex cases, the middleware proxy layer also needs to be customized. For example, when the business layer calls method a, it needs to access the third-party SDK (1) through middleware 1 to call method a provided by the third-party SDK (1); similarly, when the business layer obtains attribute b, it needs to access the third-party SDK (2) through middleware 2 to call attribute b provided by the third-party SDK (1). If the business layer needs to access N sets of third-party SDKs, N middlewares need to be created in the middleware proxy layer to implement the introduction of N sets of third-party SDKs, and the calling methods encapsulated by each middleware need to be connected, debugged, and verified one by one. The entire process is extremely complex and time-consuming, resulting in low development efficiency and a linear increase in the cost of integration and communication with the number of third-party SDKs.

[0030] Therefore, embodiments of this application provide a method, apparatus, computer device, and readable storage medium for invoking a software development kit (SDK). The method for invoking the SSD can be applied to a computer device. By binding the target SSD to the target middleware in a configuration file, and generating the target middleware based on the data-bound configuration file, it is possible to automatically generate adaptive target middleware for the target SSD. This allows for rapid integration of the target SSD using the target middleware without requiring code customization with third-party SDK providers, significantly reducing development and integration costs and improving the efficiency of invoking third-party SDKs.

[0031] For example, a computer device can be a server or a terminal. The server can be a standalone server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal can be an electronic device such as a smartphone, tablet, laptop, or desktop computer.

[0032] Please see Figure 2 , Figure 2This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device may include a processor and a memory, wherein the processor and the memory can be connected via a bus, which can be any applicable bus such as an Inter-integrated Circuit (I2C) bus.

[0033] The memory may include a storage medium and internal memory. The storage medium may be a non-volatile storage medium or a volatile storage medium. The storage medium may store the operating system and computer programs, while the internal memory provides an environment for the execution of the computer programs stored in the storage medium. The computer programs include program instructions that, when executed, cause the processor to perform the invocation method of the software development kit described in any of the embodiments.

[0034] The processor provides computing and control capabilities, supporting the operation of the entire computer device.

[0035] The processor can be a Central Processing Unit (CPU), but it can also be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor, or it can be any conventional processor.

[0036] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps:

[0037] Obtain the configuration file corresponding to the target middleware to be generated in the middleware proxy layer; in the configuration file, perform data binding between the target software development kit (SDK) and the target middleware, including attribute binding, method call binding, and communication object binding; generate the target middleware based on the data-bound configuration file, which is used to access the target SSD so that the business layer can call the target SSD.

[0038] In one embodiment, the configuration file includes a first SDK environment determination method, which is used to indicate the runtime environment required by the business layer; after the processor implements data binding between the target software development kit corresponding to the target middleware and the target middleware in the configuration file, it is also used to implement:

[0039] Obtain the second SDK environment determination method corresponding to each software development kit in the third-party tool library. The second SDK environment determination method is used to indicate the runtime environment of the software development kit. Match the runtime environment according to the first SDK environment determination method and the second SDK environment determination method corresponding to each software development kit. Determine the target software development kit based on the software development kit whose runtime environment is successfully matched.

[0040] In one embodiment, when the processor implements data binding between the target software development kit (SDK) and the target middleware in the configuration file, it is used to:

[0041] Obtain the first attribute provided by the target software development kit; based on key-value pairs, associate and bind the first attribute with the second attribute in the configuration file, where the second attribute is the attribute required by the business layer.

[0042] In one embodiment, when the processor implements data binding between the target software development kit (SDK) and the target middleware in the configuration file, it is used to:

[0043] Obtain the first calling method provided by the target software development kit (SDK). The first calling method is the method by which the target middleware calls the target SSD. Based on key-value pairs, associate and bind the first calling method with the second calling method in the configuration file. The second calling method is the method by which the business layer calls the target middleware.

[0044] In one embodiment, when the processor implements data binding between the target software development kit (SDK) and the target middleware in the configuration file, it is used to:

[0045] Obtain a first communication object provided by the target software development kit (SDK). The first communication object contains methods for communicating with the target SSD. Associate and bind the first communication object with a second communication object in the configuration file so that the business layer can communicate with the target SSD through the first communication object. The second communication object is a communication object provided by the target middleware to the business layer, and the business layer communicates with the target middleware through the second communication object.

[0046] In one embodiment, when the processor generates the target middleware based on the data-bound configuration file, it is used to:

[0047] The data-bound configuration file is parsed into a tree data structure to obtain the parsed configuration file; a description file is generated based on the association binding information in the parsed configuration file; and the target middleware is generated based on the description file.

[0048] In one embodiment, when the processor generates the target middleware based on the description file, it is used to implement:

[0049] Parse the description file to obtain the abstract syntax tree and syntax of the communication method corresponding to the target middleware; read the target template file corresponding to the syntax from the preset template library; convert the abstract syntax tree into target code and insert it into the target template file to obtain the target middleware.

[0050] The following detailed description, in conjunction with the accompanying drawings, outlines some embodiments of this application. Unless otherwise specified, the following embodiments and features described herein can be combined with each other. Please refer to... Figure 3 , Figure 3 This is a schematic flowchart illustrating a method for calling a software development kit (SDK) according to an embodiment of this application. Figure 3 As shown, the method for calling the software development kit may include steps S101 to S103.

[0051] Step S101: Obtain the configuration file corresponding to the target middleware to be generated in the middleware proxy layer.

[0052] The software development kit (SDK) invocation method provided in this application embodiment can be applied to business project systems. These business project systems include a business layer, a middleware proxy layer, and a third-party tool library. The third-party tool library includes at least one SSD. The business project system may include, but is not limited to, insurance systems, banking systems, transaction systems, claims systems, medical systems, etc.

[0053] For example, an executable script can be used to automatically generate the configuration file corresponding to the target middleware to be generated in the middleware proxy layer.

[0054] For example, the configuration file may include, but is not limited to, a unique identifier corresponding to the target middleware (e.g., a key-value pair or a number), an SDK environment determination method, and attributes, calling methods, etc. The SDK environment determination method is used to determine whether the runtime environment of the third-party SDK meets the requirements of the business layer. Attributes and calling methods are information that the business layer needs to obtain from the third-party SDK. The attributes and calling methods of the target middleware can be defined according to the attributes and calling methods required by the business layer. For example, when business A in the business layer needs to access runtime environment B, the SDK environment determination method can be defined as isBEnv (returning true if it is in runtime environment B, false if it is not in runtime environment B). Business A can call the isBEnv method to determine whether the current third-party SDK is running in runtime environment B.

[0055] like Figure 4 As shown, when the business layer is H5 webpage code, and it needs to run simultaneously in the environment of bank APP / financial manager APP / mini-program, middleware 3 can be introduced between the H5 webpage and the third-party SDK (3) to proxy communication. At this time, the configuration file corresponding to middleware 3 can be automatically generated by the executable script. For example, if the H5 webpage wants to obtain the current SDK version information, current user information, etc., it can define the SDK version information attribute, current user information attribute, method to obtain SDK version information, and method to obtain user information corresponding to middleware 3 in the configuration file.

[0056] In this embodiment, by automatically generating the configuration file corresponding to the target middleware to be generated in the middleware proxy layer, the target middleware can be quickly generated through the configuration file. The target middlewares are independent of each other, which can isolate the mutual influence between SDK environments and improve the program security factor.

[0057] Step S102: In the configuration file, perform data binding between the target software development kit corresponding to the target middleware and the target middleware. The data binding includes attribute binding, method call binding, and communication object binding.

[0058] In this embodiment of the application, when integrating a third-party SDK, developers only need to maintain a configuration file and perform data association and binding in the configuration file. The script automatically generates middleware that adapts to the third-party SDK, eliminating the need for code customization with the third-party SDK provider, which greatly reduces development and integration communication costs and improves R&D efficiency.

[0059] For example, after obtaining the configuration file corresponding to the target middleware to be generated in the middleware proxy layer, data binding can be performed between the target software development kit (SDK) and the target middleware in the configuration file. This data binding includes attribute binding, method call binding, and communication object binding. Attribute binding is a one-to-one binding, while method call binding can be a one-to-many composite association binding.

[0060] The following sections will provide detailed explanations of property binding, method binding, and communication object binding.

[0061] In some embodiments, the configuration file may include a first SDK environment determination method, which indicates the runtime environment required by the business layer. Before data binding, it is necessary to determine the target software development kit (SDK) corresponding to the target middleware. The following will explain how to determine the target SSD corresponding to the target middleware based on the first SDK environment determination method.

[0062] Please see Figure 5 , Figure 5 This is a schematic flowchart illustrating another method for calling a software development kit provided in this application embodiment. For example... Figure 5 As shown, it may include steps S201 to S203.

[0063] Step S201: Obtain the second SDK environment determination method corresponding to each software development kit in the third-party tool library. The second SDK environment determination method is used to indicate the running environment of the software development kit.

[0064] For example, the SDK environment determination method provided by each software development kit in a third-party tool library can be obtained, denoted as the second SDK environment determination method. The second SDK environment determination method is used to indicate the runtime environment of the software development kit.

[0065] Step S202: Match the runtime environment according to the first SDK environment judgment method and the second SDK environment judgment method corresponding to each software development kit.

[0066] Step S203: Determine the target software development kit based on the software development kit that has been successfully matched with the operating environment.

[0067] For example, the runtime environment can be matched using the first SDK environment determination method and the second SDK environment determination method corresponding to each software development kit. For instance, the runtime environment required by the business layer can be determined using the first SDK environment determination method, and the runtime environment provided by the software development kit can be determined using the second SDK environment determination method. When the runtime environment required by the business layer is the same as or consistent with the runtime environment provided by a certain software development kit, that software development kit is determined as the target software development kit.

[0068] It should be noted that different software development kits may provide different or the same runtime environment.

[0069] In the above embodiments, by matching the runtime environment according to the first SDK environment judgment method and the second SDK environment judgment method corresponding to each software development kit, and determining the target software development kit based on the successfully matched runtime environment, it can be ensured that the runtime environment provided by the target software development kit is the runtime environment required by the business layer.

[0070] In other embodiments, data binding between the target software development kit (SDK) corresponding to the target middleware and the target middleware in the configuration file may include: obtaining a first attribute provided by the target SSD; and associating and binding the first attribute with a second attribute in the configuration file based on key-value pairs, wherein the second attribute is an attribute required by the business layer.

[0071] For example, you can query the attributes provided by the target software toolkit, denoted as the first attribute. It should be noted that when a third-party SDK is provided externally, it will define some commonly used attributes and methods, attach them to a communication object, and then expose that communication object externally. Examples include: user information attributes, SDK version information, and methods for opening / closing windows.

[0072] For example, based on key-value pairs, the first attribute is associated and bound to the second attribute in the configuration file. The second attribute is the attribute required by the business layer, which can be predefined in the configuration file. The key is the second attribute, and the value is the corresponding first attribute in the target software toolkit. The attributes need to be associated one-to-one. For instance, for the "User ID" attribute, if it is defined as userId in the target middleware and userInfo.Id is used in the target software toolkit, then the key in the configuration file is userId, and the value is userInfo.

[0073] In the above embodiments, by associating and binding the first attribute with the second attribute in the configuration file based on key-value pairs, the business layer can subsequently indirectly call the first attribute provided by the target software development kit by calling the second attribute defined by the target middleware.

[0074] In other embodiments, data binding between the target software development kit (SDK) corresponding to the target middleware and the target middleware in the configuration file may include: obtaining a first calling method provided by the target SSD, wherein the first calling method is a method for the target middleware to call the target SSD; and associating and binding the first calling method with a second calling method in the configuration file based on key-value pairs, wherein the second calling method is a method for the business layer to call the target middleware.

[0075] For example, the calling method provided by the target software toolkit can be queried and denoted as the first calling method. Then, based on key-value pairs, the first calling method is associated and bound with the second calling method in the configuration file. For example, for the method "open a new window with a navigation bar", if it is defined as openView in the target middleware, openWebview in the target software toolkit is the newly opened Webview window, and showWebNavBar is the display of the navigation bar, then the key in the configuration file is openView, the value is a function expression, and the function body calls the third-party composite method openWebview+showWebNavBar.

[0076] In the above embodiments, by associating and binding the first calling method with the second calling method in the configuration file based on key-value pairs, the business layer can subsequently indirectly call the first calling method provided by the target software development kit by calling the second calling method defined by the target middleware.

[0077] In other embodiments, data binding between the target software development kit (SDK) corresponding to the target middleware and the target middleware in the configuration file may include: obtaining a first communication object provided by the target SSD, the first communication object containing a method for communicating with the target SSD; associating the first communication object with a second communication object in the configuration file, so that the business layer can communicate with the target SSD through the first communication object, the second communication object being a communication object provided by the target middleware to the business layer, and the business layer communicating with the target middleware through the second communication object.

[0078] In this embodiment, in addition to attribute binding and method call binding, communication object binding is also required. It should be noted that when a third-party SDK is provided externally, it defines some commonly used attributes and methods, which are then attached to a communication object, making the communication object available externally. It can be understood that the communication object serves as a communication bridge between the third-party SDK and the middleware. In this embodiment, according to the configuration file, the first communication object provided by the third-party SDK can be assigned to a second communication object specified by the middleware, thereby establishing a method call bridge between the third-party SDK and the middleware.

[0079] For example, a first communication object (e.g., communication object A) provided by the target software development kit can be obtained, and the first communication object can be associated and bound with a second communication object (e.g., communication object B) in the configuration file so that the business layer can communicate with the target software development kit through the first communication object.

[0080] In this embodiment, taking H5 in the business layer and Native in the software development kit as an example, the method of associating and binding communication objects is explained. H5 is the SDK access party (i.e., the business layer), and Native is the SDK provider. A middleware proxy layer is introduced between H5 and Native. H5 calls the second communication object in the middleware to obtain user information; for example, the second communication object is nativeBridge.getUserInfo(). When the middleware calls the Native communication object, it needs to obtain the information according to the first communication object provided by the Native SDK. Therefore, in the configuration file, the second communication object nativeBridge provided by the middleware to H5 needs to be associated and bound with the first communication object provided by the Native SDK.

[0081] It's important to note that the interaction between Native and HTML5 typically uses WebView as a bridge. WebView is a UI component in Native, serving as a container for webpage display. A JavaScript interface class (such as JavaScriptInterface) can be defined in Native, containing methods for communicating with HTML5. An instance of this JavaScript interface class is then added to the WebView. JavaScript code on the HTML5 page accesses Native methods through the WebView's window object. For example, if Native adds communication object A to the WebView, the HTML5 page opened by the WebView can access properties and methods provided by the Native SDK through window.A.

[0082] In the above embodiments, by obtaining a first communication object provided by the target software development kit and associating and binding the first communication object with a second communication object in the configuration file, the business layer can access the first communication object through the second communication object, and then communicate with the target software development kit through the first communication object.

[0083] Step S103: Generate the target middleware based on the configuration file after data binding. The target middleware is used to access the target software development kit so that the business layer can call the target software development kit.

[0084] For example, after data binding between the target software development kit (SDK) and the target middleware, the target middleware can be generated based on the data-bound configuration file. This can be achieved using an executable script to generate the target middleware from the data-bound configuration file.

[0085] Please see Figure 6 , Figure 6 This is a schematic flowchart illustrating a sub-step for generating target middleware, provided in an embodiment of this application. For example... Figure 6 As shown, step S103 may include steps S1031 to S1033.

[0086] Step S1031: Parse the data-bound configuration file into a tree data structure to obtain the parsed configuration file.

[0087] It should be noted that when the program reads the configuration file, it reads it in text form without any format. To facilitate the use of the configuration file in the program, it parses the configuration file into a tree data structure, which makes it easier to find a specific configuration attribute and related attributes in the parent, sibling, or child levels of a specific configuration during the subsequent generation of the target middleware.

[0088] Step S1032: Generate a description file based on the association binding information in the parsed configuration file.

[0089] For example, a description file can be generated based on preset syntax rules and the association binding information in the parsed configuration file. Association binding information may include attribute association binding information, method call association binding information, and communication object association binding information, etc.

[0090] It should be noted that the syntax rules specify the communication methods between the third-party SDK and the middleware, the middleware language, and other information. The communication methods refer to methods that enable information transfer between the browser and the SDK, such as embedding JavaScript methods under the WebView, intercepting URLs, or listening for messages. The middleware language can include, but is not limited to, commonly used SDK development languages ​​such as Java, Swift, Objective-C, and JavaScript.

[0091] For example, the syntax rule is that each sentence is a declaration about the binding method of the third-party SDK and middleware, ending with a semicolon. `H5` is the prefix specifying the middleware, and `Native` is the prefix specifying the third-party SDK-related content, followed by the properties to be bound, the calling method, and the communication object. For example, an example of a description file is: `H5 method A(param1,param2)=Native method X(params1)+Y(params2)`. The rule for specifying the middleware language is: `set(H5,language)=javascript`. Optionally, the middleware language can be specified by modifying the description file; if not specified, the default language can be used.

[0092] Step S1033: Generate the target middleware based on the description file.

[0093] After generating a description file based on the association and binding information in the parsed configuration file, an executable script can be used to generate the target middleware based on the description file.

[0094] In some embodiments, generating target middleware based on a description file may include: parsing the description file to obtain an abstract syntax tree and syntax of the communication method corresponding to the target middleware; reading the target template file corresponding to the syntax from a preset template library; converting the abstract syntax tree into target code and inserting it into the target template file to obtain the target middleware.

[0095] It should be noted that the description file is a custom programming language, and the parsing process is the compilation and parsing process of the language, which may include, but is not limited to, word segmentation, lexical analysis, syntax analysis steps, and conversion into executable code.

[0096] For example, the description file can be parsed to obtain the abstract syntax tree and syntax of the communication methods corresponding to the target middleware. Then, based on the syntax, the template file corresponding to the syntax is read from a preset template library and loaded into memory as the target template file. The template file is a code template block that conforms to the middleware's syntax and includes attributes and method call placeholders. Finally, the abstract syntax tree is converted into target code and inserted into the target template file to obtain the target middleware.

[0097] It should be noted that the template file can be considered to consist of three parts: (1) the template file's metadata, such as the programming language and applicable language version; (2) the general code required by the middleware; and (3) the unimplemented middleware bridging methods, which are represented by placeholders in the template file. The task in this step is to generate the corresponding methods required in part (3). For example, the abstract syntax tree of the middleware bridging methods can be obtained from the description file, and the abstract syntax tree can be converted into code (Java code) based on the syntax required by the middleware (e.g., Java language specified in the description file).

[0098] Please see Figure 7 , Figure 7 This is a schematic flowchart illustrating the generation of target middleware provided in an embodiment of this application. For example... Figure 7 As shown, the following steps may be included:

[0099] Step S301: Generate a configuration file using the newly added executable script.

[0100] For example, the configuration file may include, but is not limited to, a unique identifier (e.g., a key or number) corresponding to the target middleware, SDK environment determination methods, as well as properties, calling methods, etc.

[0101] Step S302: Perform data binding in the configuration file.

[0102] Step S302 corresponds to step S102 above, and data binding can include attribute binding, method call binding, and communication object binding. Step S302 can include steps S303 and S304.

[0103] Step S303: Bind the target software development kit corresponding to the target middleware to the target middleware in terms of attributes and call methods.

[0104] For example, when performing attribute binding in step S303, it may include: obtaining a first attribute provided by the target software development kit; and associating and binding the first attribute with a second attribute in the configuration file based on key-value pairs, wherein the second attribute is an attribute required by the business layer.

[0105] For example, when binding the calling method in step S303, it may include: obtaining a first calling method provided by the target software development kit, the first calling method being a method for the target middleware to call the target software development kit; and associating and binding the first calling method with a second calling method in the configuration file based on key-value pairs, the second calling method being a method for the business layer to call the target middleware.

[0106] Step S304: Bind the target software development kit corresponding to the target middleware to the target middleware as a communication object.

[0107] For example, binding a communication object between the target software development kit (SDK) corresponding to the target middleware and the target middleware may include: obtaining a first communication object provided by the target SSD, the first communication object containing a method for communicating with the target SSD; associating the first communication object with a second communication object in a configuration file, so that the business layer can communicate with the target SSD through the first communication object, the second communication object being a communication object provided by the target middleware to the business layer, and the business layer communicating with the target middleware through the second communication object.

[0108] Step S305: Read the configuration file and verify whether the configuration file is configured correctly.

[0109] It should be noted that step S305 is optional. If the configuration file is configured correctly, steps S306 to S307 are executed; if the configuration file is not configured accurately, the process returns to step S302. Specifically, verifying the correctness of the configuration file may include: checking whether all required fields (keys) in the configuration file have been configured with values; for non-required fields, if no value is configured, then default attributes and methods are filled in; if values ​​are configured, then it is determined whether the corresponding attributes and methods exist in the third-party SDK; if not, an error message is output.

[0110] By using scripts to verify the correct configuration of the configuration file during the generation of the target middleware, the accuracy of calling third-party SDK methods can be identified in a timely manner, eliminating potential risks during program execution.

[0111] Step S306: Generate a description file from the configuration file after data binding.

[0112] For example, the data-bound configuration file is parsed into a tree data structure to obtain the parsed configuration file. Based on the association binding information in the parsed configuration file, a description file is generated. The specific process can be found in step 1032 above, and will not be repeated here.

[0113] Step S307: Generate the target middleware based on the description file.

[0114] For example, the description file can be parsed to obtain the abstract syntax tree and syntax of the communication method corresponding to the target middleware; the target template file corresponding to the syntax can be read from a preset template library; the abstract syntax tree can be converted into target code and inserted into the target template file to obtain the target middleware.

[0115] This application provides a method for calling a software development kit (SDK). By binding the target SSD to the target middleware in a configuration file and generating the target middleware based on the data-bound configuration file, an adaptive target middleware for the target SSD can be automatically generated. The target middleware can then be used to quickly access the target SSD. This eliminates the need for code customization with third-party SDK providers, significantly reducing development and communication costs and improving the efficiency of calling third-party SDKs.

[0116] Please see Figure 8 , Figure 8 This application also provides a schematic block diagram of a software development kit (SDK) invocation device 1000, which is used to execute the aforementioned SSD invocation method. The SSD invocation device 1000 can be configured in a computer device.

[0117] like Figure 8 As shown, the software development kit calling device 1000 includes: a configuration file acquisition module 1001, a data binding module 1002, and a middleware generation module 1003.

[0118] The configuration file acquisition module 1001 is used to obtain the configuration file corresponding to the target middleware to be generated in the middleware proxy layer.

[0119] The data binding module 1002 is used to bind the target software development kit and the target middleware in the configuration file. The data binding includes attribute binding, method call binding and communication object binding.

[0120] The middleware generation module 1003 is used to generate target middleware based on the configuration file after data binding. The target middleware is used to access the target software development kit so that the business layer can call the target software development kit.

[0121] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the above-described apparatus and modules can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0122] The embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions, and a processor executing the program instructions to implement the calling method of any of the software development kits provided in the embodiments of this application.

[0123] For example, when the program is loaded by the processor, it can perform the following steps:

[0124] Obtain the configuration file corresponding to the target middleware to be generated in the middleware proxy layer; in the configuration file, perform data binding between the target software development kit (SDK) and the target middleware, including attribute binding, method call binding, and communication object binding; generate the target middleware based on the data-bound configuration file, which is used to access the target SSD so that the business layer can call the target SSD.

[0125] The computer-readable storage medium can be an internal storage unit of the computer device described in the foregoing embodiments, such as a hard disk or memory of the computer device. The computer-readable storage medium can also be an external storage device of the computer device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD card), flash card, etc., provided on the computer device.

[0126] Furthermore, the computer-readable storage medium may primarily include a stored program area and a stored data area, wherein the stored program area may store the operating system, an application program required for at least one function, etc.; and the stored data area may store data created based on the use of blockchain nodes, etc.

[0127] The blockchain referred to in this application is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying blockchain platform, a platform product service layer, and an application service layer.

[0128] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for calling a software development kit, characterized in that, This is applied to a business project system, which includes a business layer, a middleware proxy layer, and a third-party tool library. The third-party tool library includes at least one software development kit (SDK), comprising: Obtain the configuration file corresponding to the target middleware to be generated in the middleware proxy layer; In the configuration file, data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, wherein the data binding includes attribute binding, method calling binding, and communication object binding; Based on the configuration file after data binding, the target middleware is generated. The target middleware is used to access the target software development kit so that the business layer can call the target software development kit. The step of data binding between the target software development kit (SDK) corresponding to the target middleware and the target middleware in the configuration file includes: Obtain the first attribute provided by the target software development kit; based on key-value pairs, associate and bind the first attribute with the second attribute in the configuration file, wherein the second attribute is the attribute required by the business layer; Obtain a first invocation method provided by the target software development kit, wherein the first invocation method is a method by which the target middleware invokes the target software development kit; based on key-value pairs, associate and bind the first invocation method with a second invocation method in the configuration file, wherein the second invocation method is a method by which the business layer invokes the target middleware; Obtain a first communication object provided by the target software development kit, the first communication object containing a method for communicating with the target software development kit; associate and bind the first communication object with a second communication object in the configuration file, so that the business layer can communicate with the target software development kit through the first communication object, the second communication object being a communication object provided by the target middleware to the business layer, and the business layer communicating with the target middleware through the second communication object; The step of generating the target middleware based on the data-bound configuration file includes: The configuration file after data binding is parsed into a tree data structure to obtain the parsed configuration file; a description file is generated based on the association binding information in the parsed configuration file; and the target middleware is generated based on the description file.

2. The method for calling the software development kit according to claim 1, characterized in that, The configuration file includes a first SDK environment determination method, which indicates the operating environment required by the business layer; after data binding between the target software development kit corresponding to the target middleware and the target middleware in the configuration file, the method further includes: A second SDK environment determination method is obtained for each software development kit in the third-party tool library, and the second SDK environment determination method is used to indicate the running environment of the software development kit; The runtime environment is matched according to the first SDK environment determination method and the second SDK environment determination method corresponding to each software development kit; The target software development kit is determined based on the software development kit that is successfully matched to the operating environment.

3. The method for calling the software development kit according to claim 1, characterized in that, The step of generating the target middleware based on the description file includes: Parse the description file to obtain the abstract syntax tree and syntax of the communication method corresponding to the target middleware; Read the target template file corresponding to the syntax from the preset template library; The abstract syntax tree is converted into target code and inserted into the target template file to obtain the target middleware.

4. A device for calling a software development kit, characterized in that, A method for invoking the software development kit according to any one of claims 1 to 3, the invoking device comprising: The configuration file acquisition module is used to acquire the configuration file corresponding to the target middleware to be generated in the middleware proxy layer. The data binding module is used to perform data binding between the target software development kit corresponding to the target middleware and the target middleware in the configuration file, wherein the data binding includes attribute binding, method call binding and communication object binding; The middleware generation module is used to generate the target middleware based on the configuration file after data binding. The target middleware is used to access the target software development kit (SDK) so that the business layer can call the target SSD.

5. A computer device, characterized in that, The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and, while executing the computer program, implement the method for invoking the software development kit as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to implement the method for invoking the software development kit as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Cross-platform and equipment middleware, implementation method, upper-layer application and medium

    CN117118959A

  • Three-party data calling method and system based on SDK (Software Development Kit)

    CN117149458A