Software development kit calling method, device and equipment and readable storage medium
By automatically generating the target middleware adaptive to the target software development toolkit, the problem of low development efficiency and high docking costs caused by frequent docking of multiple third-party SDKs in the business system is solved, and fast and low-cost SDK access and use.
Patent Information
- Application Number
- CN202411760828.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-12-02
AI Technical Summary
In the development of business system projects, it is necessary to frequently introduce and connect multiple third-party SDKs, resulting in low development efficiency and high docking costs. Especially with the increase in the number of third-party SDKs, the complexity and cost are linearly increasing.
By automatically generating the target software development toolkit adaptive target middleware, using this middleware to quickly access the target software development toolkit, without the need to customize code with third-party SDK providers. The method includes obtaining the configuration file of the middleware proxy layer, data binding of the target middleware and the target software development toolkit, and generating the target middleware based on the bound configuration file.
It greatly reduces the cost of development and docking communication, improves the efficiency of calling third-party SDKs, and reduces the complexity and time of docking.
Smart Images

Figure CN119512659A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of development assistance technology, and in particular to a method, device, computer equipment and readable storage medium for calling a software development toolkit. Background Art
[0002] In the project development process of most business systems (insurance, banking, and medical care), it is necessary to globally introduce a third-party SDK (Software Development Kit) into the project, and the business layer of the project and the third-party SDK communicate with each other through the middleware proxy layer. Among them, the middleware proxy layer encapsulates the calling methods of the third-party SDK required by the business layer. These calling methods need to be docked and debugged with the third-party SDK. In complex cases, the middleware proxy layer must be customized. If the business layer needs to access N sets of third-party SDKs, it is necessary to create N middleware in the middleware proxy layer to introduce N sets of third-party SDKs, and each calling method encapsulated by the middleware needs to be docked, debugged, and verified one by one. The whole process is extremely complicated and time-consuming. Not only is the R&D efficiency low, but the docking 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 an urgent problem to be solved. Summary of the invention
[0004] The present application provides a method, apparatus, computer device and readable storage medium for calling a software development kit, which can automatically generate target middleware that is adaptive to the target software development kit and quickly access the target software development kit without the need to customize the code with a third-party SDK provider. This can greatly reduce the development and docking communication costs and improve the efficiency of calling the third-party SDK.
[0005] In a first aspect, the present application provides a method for calling a software development kit, which is 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, and the third-party tool library includes at least one software development kit, and the method includes:
[0006] Obtain a configuration file corresponding to the target middleware to be generated in the middleware proxy layer; in the configuration file, perform data binding on the target software development toolkit corresponding to the target middleware and the target middleware, wherein the data binding includes attribute binding, call method binding and communication object binding; generate the target middleware according to the configuration file after data binding, and the target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
[0007] In a second aspect, the present application further provides a software development kit calling device, the software development kit calling device comprising:
[0008] A configuration file acquisition module, used to acquire a configuration file corresponding to the target middleware to be generated in the middleware proxy layer;
[0009] A data binding module, used for performing 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, call method binding and communication object binding;
[0010] The middleware generation module is used to generate the target middleware according to the configuration file after data binding, and the target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
[0011] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;
[0012] The memory is used to store computer programs;
[0013] The processor is used 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 further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the calling method of the software development kit as described above.
[0015] The present application discloses a method, device, computer equipment and readable storage medium for calling a software development kit, the method comprising: obtaining a configuration file corresponding to the target middleware to be generated in the middleware proxy layer; in the configuration file, data binding is performed on the target software development kit corresponding to the target middleware and the target middleware, wherein the data binding includes attribute binding, calling method binding and communication object binding; according to the configuration file after data binding, the target middleware is generated, and the target middleware is used to access the target software development kit for the business layer to call the target software development kit. The embodiment of the present application can realize automatic generation of the target software development kit adaptive target middleware by data binding the target software development kit corresponding to the target middleware and the target middleware in the configuration file, and generating the target middleware according to the configuration file after data binding, and using the target middleware to quickly access the target software development kit, without the need to customize the code with the third-party SDK provider, which can greatly reduce the development and docking communication costs and improve the efficiency of calling the third-party SDK. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 It is a structural diagram of a business project system in the prior art;
[0018] Figure 2 is a structural schematic diagram of a computer device provided in an embodiment of the present application;
[0019] Figure 3 is a schematic flow chart of a method for calling a software development kit provided in an embodiment of the present application;
[0020] Figure 4 It is a structural diagram of another business project system provided in an embodiment of the present application;
[0021] Figure 5 is a schematic flow chart of another method for calling a software development kit provided in an embodiment of the present application;
[0022] Figure 6 is a schematic flow chart of sub-steps for generating target middleware provided in an embodiment of the present application;
[0023] Figure 7 is a schematic flow chart of generating target middleware provided in an embodiment of the present application;
[0024] Figure 8 It is a schematic block diagram of a calling device for a software development kit provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0027] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0028] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0029] Currently, if Figure 1As shown, the related technology requires the global introduction of a third-party SDK (Software Development Kit) in the project, and the business layer of the project and the third-party SDK communicate with each other through 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 docked and debugged with the third-party SDK. In complex cases, the middleware proxy layer 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 and call method a provided by the third-party SDK (1); for another example, when the business layer obtains attribute b, it needs to access the third-party SDK (2) through middleware 2 and call attribute b provided by the third-party SDK (1). If the business layer needs to access N sets of third-party SDKs, it is necessary to create N middlewares in the middleware proxy layer to introduce N sets of third-party SDKs, and each calling method encapsulated by the middleware needs to be docked, debugged and verified one by one. The whole process is extremely complicated and time-consuming. Not only is the R&D efficiency low, but the docking and communication costs will increase linearly with the number of third-party SDKs.
[0030] To this end, the embodiments of the present application provide a method, device, computer equipment and readable storage medium for calling a software development kit. Among them, the method for calling the software development kit can be applied to a computer device, by data binding the target software development kit corresponding to the target middleware with the target middleware in the configuration file, and generating the target middleware according to the configuration file after data binding, it is possible to automatically generate the target middleware adaptive to the target software development kit, use the target middleware to quickly access the target software development kit, without the need to customize the code with the third-party SDK provider, which can greatly reduce the development and docking communication costs and improve the efficiency of calling the third-party SDK.
[0031] Exemplarily, the computer device can be a server or a terminal. The server can be an independent 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 communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal can be an electronic device such as a smartphone, tablet computer, laptop computer, and desktop computer.
[0032] See also Figure 2 , Figure 21 is a schematic diagram of a computer device provided in an embodiment of the present application. The computer device may include a processor and a memory, wherein the processor and the memory may be connected via a bus, and the bus may be any applicable bus such as an Inter-integrated Circuit (I2C) bus.
[0033] The memory may include a storage medium and an internal memory. The storage medium may be a non-volatile storage medium or a volatile storage medium. The storage medium may store an operating system and a computer program, and the internal memory provides an environment for the operation of the computer program in the storage medium. The computer program includes program instructions, and when the program instructions are executed, the processor may execute the calling method of the software development kit described in any embodiment.
[0034] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0035] The processor may be a central processing unit (CPU), 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. The general-purpose processor may be a microprocessor, or any conventional processor.
[0036] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0037] Obtain a configuration file corresponding to the target middleware to be generated in the middleware proxy layer; in the configuration file, perform data binding on the target software development toolkit corresponding to the target middleware and the target middleware, wherein the data binding includes attribute binding, call method binding and communication object binding; generate the target middleware according to the configuration file after data binding, and the target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
[0038] In one embodiment, the configuration file includes a first SDK environment determination method, and the first SDK environment determination method is used to indicate the operating environment required by the business layer; after the processor is implemented in the configuration file, after data binding the target software development kit corresponding to the target middleware with the target middleware, it is also used to implement:
[0039] Obtain a second SDK environment judgment method corresponding to each software development kit in a third-party tool library, where the second SDK environment judgment method is used to indicate the operating environment of the software development kit; match the operating environment according to the first SDK environment judgment method and the second SDK environment judgment method corresponding to each software development kit; and determine the target software development kit based on the software development kit with which the operating environment is successfully matched.
[0040] In one embodiment, when the processor is implemented in the configuration file and data is bound between the target software development kit corresponding to the target middleware and the target middleware, it is used to implement:
[0041] A first attribute provided by a target software development kit is obtained; based on a key-value pair format, the first attribute is associated and bound with a second attribute in a configuration file, where the second attribute is an attribute required by a business layer.
[0042] In one embodiment, when the processor is implemented in the configuration file and data is bound between the target software development kit corresponding to the target middleware and the target middleware, it is used to implement:
[0043] Obtain a first calling method provided by the target software development kit, where the first calling method is a method for the target middleware to call the target software development kit; associate and bind the first calling method with a second calling method in the configuration file based on a key-value pair, where the second calling method is a method for the business layer to call the target middleware.
[0044] In one embodiment, when the processor is implemented in the configuration file and data is bound between the target software development kit corresponding to the target middleware and the target middleware, it is used to implement:
[0045] Obtain a first communication object provided by the target software development kit, the first communication object including a method for communicating with the target software development kit; associate and bind the first communication object with a second communication object in a configuration file so that the business layer can communicate with the target software development kit 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 via the second communication object.
[0046] In one embodiment, when the processor generates the target middleware according to the configuration file after data binding, it is used to implement:
[0047] The data-bound configuration file is parsed into a tree data structure to obtain the parsed configuration file; a description file is generated according to the associated binding information in the parsed configuration file; and a target middleware is generated according to the description file.
[0048] In one embodiment, when the processor generates the target middleware according to 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] Some embodiments of the present application are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features of the embodiments can be combined with each other. Figure 3 , Figure 3 is a schematic flow chart of a method for calling a software development kit provided in an embodiment of the present application. Figure 3 As shown, the calling method of the software development kit may include steps S101 to S103.
[0051] Step S101: Obtain a configuration file corresponding to the target middleware to be generated in the middleware proxy layer.
[0052] The calling method of the software development kit provided in the embodiment of the present application can be 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, and the third-party tool library includes at least one software development kit. The business project system may include but is not limited to an insurance system, a banking system, a trading system, a claims system, a medical system, and the like.
[0053] Exemplarily, a configuration file corresponding to the target middleware to be generated in the middleware proxy layer is automatically generated through an executable script.
[0054] Exemplarily, the configuration file may include, but is not limited to, a unique identifier corresponding to the target middleware (e.g., a key value or number, etc.), an SDK environment judgment method, as well as attributes, calling methods, etc. Among them, the SDK environment judgment method is used to determine whether the operating 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 the B operating environment, the SDK environment judgment method can be defined as isBEnv (the return value true indicates that it is in the B operating environment, and false indicates that it is not in the B operating environment). Business A can call the isBEnv method to determine whether the current third-party SDK is running in the B operating environment.
[0055] like Figure 4 As shown, when the business layer is H5 web page code and needs to be run in the bank APP / financial manager APP / applet environment at the same time, middleware 3 can be introduced between the H5 web page and the third-party SDK (3) to proxy communication. At this time, the configuration file corresponding to the middleware 3 can be automatically generated through the executable script. For example: the H5 web page wants to obtain the current SDK version information, current user information, etc., the SDK version information attribute, current user information attribute, SDK version information acquisition method, and user information acquisition method corresponding to the middleware 3 can be defined in the configuration file.
[0056] In an embodiment of the present application, by automatically generating a 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, and the mutual influence between SDK environments can be isolated, thereby improving the safety factor of the program.
[0057] Step S102: 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, call method binding and communication object binding.
[0058] In an embodiment of the present application, when accessing a third-party SDK, the developer only needs to maintain the configuration file and perform data association binding in the configuration file. The script will automatically generate the third-party SDK adaptive middleware, and there is no need to customize the code with the third-party SDK provider, which greatly reduces the development and docking communication costs and improves R&D efficiency.
[0059] Exemplarily, after obtaining the configuration file corresponding to the target middleware to be generated in the middleware proxy layer, the target software development kit corresponding to the target middleware can be data-bound with the target middleware in the configuration file, wherein the data binding includes attribute binding, call method binding, and communication object binding. Attribute binding is a one-to-one binding, and call method binding can be a one-to-many combination association binding.
[0060] The following will explain in detail the attribute binding, call method binding and communication object binding.
[0061] In some embodiments, the configuration file may include a first SDK environment judgment method, which is used to indicate the operating environment required by the business layer. Before data binding, it is necessary to first determine the target software development kit corresponding to the target middleware. The following will explain how to determine the target software development kit corresponding to the target middleware based on the first SDK link judgment method.
[0062] See also Figure 5 , Figure 5 FIG. 1 is a schematic flow chart of another method for calling a software development kit provided in an embodiment of the present application. Figure 5 As shown, it may include steps S201 to S203.
[0063] Step S201: Obtain a second SDK environment determination method corresponding to each software development kit in a third-party tool library, where the second SDK environment determination method is used to indicate the operating environment of the software development kit.
[0064] Exemplarily, the SDK environment determination method provided by each software development kit in the third-party tool library may be obtained and recorded as the second SDK environment determination method, wherein the second SDK environment determination method is used to indicate the operating environment of the software development kit.
[0065] Step S202: Match the operating 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 according to the software development kit that successfully matches the operating environment.
[0067] Exemplarily, the operating environment can be matched according to the first SDK environment judgment method and the second SDK environment judgment method corresponding to each software development kit. For example, the operating environment required by the business layer can be determined according to the first SDK environment judgment method, and the operating environment provided by the software development kit can be determined according to the second SDK environment judgment method. When the operating environment required by the business layer is the same or consistent with the operating environment provided by a certain software development kit, the software development kit is determined as the target software development kit.
[0068] It should be noted that the operating environments provided by different software development kits may be different or the same.
[0069] The above embodiment matches the operating environment according to the first SDK environment judgment method and the second SDK environment judgment method corresponding to each software development kit, and determines the target software development kit according to the software development kit with which the operating environment is successfully matched, thereby ensuring that the operating environment provided by the connected target software development kit is the operating environment required by the business layer.
[0070] In other embodiments, in the configuration file, data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, which 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 a key-value pair format, wherein the second attribute is an attribute required by the business layer.
[0071] For example, the properties provided by the target software toolkit can be queried and recorded as the first property. It should be noted that when a third-party SDK is provided to the outside, some commonly used properties and methods will be customized, mounted on a certain communication object, and the communication object will be provided to the outside. For example: user information properties, SDK version information, new opening / closing window methods, etc.
[0072] Exemplarily, based on the form of key-value pairs, the first attribute is associated and bound with the second attribute in the configuration file, where the second attribute is the attribute required by the business layer, and the attributes required by the business layer can be pre-defined in the configuration file, the key is the second attribute, and the value is the first attribute corresponding to the target software toolkit, and the attributes need to be associated one-to-one. For example, for the "user ID" attribute, if it is defined as userId in the target middleware and expressed by userInfo.Id in the target software toolkit, the key in the configuration file is userId and the value is userInfo.
[0073] In the above embodiment, the first attribute is associated and bound with the second attribute in the configuration file in the form of a key-value pair, and subsequently the business layer can 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, in the configuration file, data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, which 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 the second calling method in the configuration file based on a key-value pair format, the second calling method being a method for the business layer to call the target middleware.
[0075] Exemplarily, the calling method provided by the target software toolkit can be queried and recorded as the first calling method. Then, based on the key-value pair format, the first calling method is associated and bound with the second calling method in the configuration file. For example, for the "open a new window with a navigation bar" method, if it is defined as openView in the target middleware, openWebview in the target software toolkit is a newly opened Webview window, and showWebNavBar is a displayed navigation bar, then the key in the configuration file is openView, and the value is a function expression. The third-party combination method called in the function body is openWebview+showWebNavBar.
[0076] In the above embodiment, the first calling method is associated and bound with the second calling method in the configuration file based on a key-value pair format, and subsequently the business layer can 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, in the configuration file, data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, which may include: obtaining a first communication object provided by the target software development kit, the first communication object including a method for communicating with the target software development kit; associating and binding the first communication object with the 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 communicates with the target middleware via the second communication object.
[0078] In an embodiment of the present application, while performing attribute binding and call method binding, communication object binding also needs to be performed. It should be noted that when the third-party SDK is provided to the outside, some commonly used attributes and methods will be customized, mounted on a certain communication object, and the communication object will be provided to the outside. It can be understood that the communication object is a communication bridge between the third-party SDK and the middleware. In an embodiment of the present application, according to the configuration file, the first communication object provided by the third-party SDK can be assigned to the second communication object specified by the middleware, so as to achieve a method call bridge between the third-party SDK and the middleware.
[0079] Exemplarily, 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 the embodiment of the present application, H5 in the business layer and Native in the software development kit are taken as examples to illustrate how to associate and bind communication objects. Among them, H5 is the SDK access party (i.e., the business layer), Native is the SDK provider, and 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(). Among them, when the middleware calls the communication object of Native, it is necessary to obtain it according to the first communication object provided to the outside 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 to the outside by the Native SDK.
[0081] It should be noted that the principle of interaction between Native and H5 is usually through WebView as a bridge, where WebView is a kind of UI component in Native and a container for web page display. You can define a JavaScript interface class (such as JavaScriptInterface) in Native, which contains methods for communicating with H5; add the JavaScript interface class instance to WebView; use JavaScript code in the H5 page to access Native methods through the window object of WebView. For example, if Native adds communication object A to WebView, the H5 page opened by WebView can access the properties and call methods provided by the Native SDK through window.A.
[0082] In the above embodiment, by obtaining the first communication object provided by the target software development kit and associating and binding the first communication object with the 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 target middleware according to the configuration file after data binding, and the target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
[0084] Exemplarily, after data binding the target software development kit corresponding to the target middleware with the target middleware, the target middleware can be generated according to the configuration file after data binding. The target middleware can be generated according to the configuration file after data binding using an executable script.
[0085] See also Figure 6 , Figure 6 is a schematic flow chart of sub-steps for generating target middleware provided by an embodiment of the present application. 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 a 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. In order to facilitate the use of the configuration file in the program, the configuration file is parsed into a tree data structure, which is convenient for finding a certain configuration attribute in the subsequent generation of the target middleware, and for finding the related attributes of a certain configuration in the parent, sibling or child level.
[0088] Step S1032: Generate a description file according to the associated binding information in the parsed configuration file.
[0089] Exemplarily, the description file may be generated based on preset grammar rules and the associated binding information in the parsed configuration file. The associated binding information may include attribute associated binding information, call method associated binding information, communication object associated binding information, and the like.
[0090] It should be noted that the syntax rules specify the communication method between the third-party SDK and the middleware, the middleware language and other information; the communication method refers to the communication method that can transmit information across the browser and SDK, such as mounting the js method under WebView, intercepting the URL address or monitoring the message. The middleware language can include but is not limited to Java, Swift, Object-C, JavaScript and other common languages for SDK development.
[0091] Exemplarily, the grammatical rule is that each sentence is a statement about the binding method of the third-party SDK and the middleware, ending with an English semicolon. H5 is the prefix of the specified middleware, Native is the prefix of the specified 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 specification rule of the middleware language is: set(H5,language)=javascript. Optionally, you can specify the language of the middleware by modifying the description file. If you do not specify, you can use the default language.
[0092] Step S1033: Generate target middleware according to the description file.
[0093] After the description file is generated according to the associated binding information in the parsed configuration file, the target middleware can be generated according to the description file using an executable script.
[0094] In some embodiments, generating a target middleware according to a description file may include: parsing the description file to obtain an abstract syntax tree and syntax of a communication method corresponding to the target middleware; reading a target template file corresponding to the syntax from a preset template library; converting the abstract syntax tree into a 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] Exemplarily, the description file can be parsed to obtain the abstract syntax tree and syntax of the communication method corresponding to the target middleware; then, according to the syntax, the template file corresponding to the syntax is read from the preset template library and loaded into the memory as the target template file. Among them, the template file is a code template block with attributes and calling method placeholders that conforms to the syntax form of the middleware. Finally, the abstract syntax tree is converted into the 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 be composed of three parts: (1) metadata of the template file, such as the programming language of the template file, applicable language version, etc.; (2) common code required by the middleware; (3) unimplemented middleware bridging methods, which are represented by placeholders in the template file. What needs to be done in this step is to generate the corresponding method required by part (3). Exemplarily, the abstract syntax tree of the middleware bridging method can be obtained from the description file, and according to the syntax required by the middleware (for example, the Java language is specified in the description file), the abstract syntax tree is converted into code (Java code) with the syntax specified in the description file.
[0098] See also Figure 7 , Figure 7 is a schematic flow chart of generating target middleware provided by an embodiment of the present application. Figure 7 As shown, the following steps may be included:
[0099] Step S301: Generate a configuration file using the newly added executable script.
[0100] Exemplarily, the configuration file may include, but is not limited to, a unique identifier corresponding to the target middleware (eg, a key value or a number, etc.), an SDK environment determination method, and properties, a calling method, etc.
[0101] Step S302: perform data binding in the configuration file.
[0102] Wherein, step S302 corresponds to the above step S102, and data binding may include attribute binding, call method binding and communication object binding. Step S302 may include step S303 and step S304.
[0103] Step S303: Bind the target software development kit corresponding to the target middleware to the target middleware through attribute binding and call method binding.
[0104] Exemplarily, when performing attribute binding in step S303, it may include: obtaining a first attribute provided by the target software development kit; associating and binding the first attribute with a second attribute in the configuration file based on a key-value pair, where the second attribute is an attribute required by the business layer.
[0105] Exemplarily, when performing calling method binding in step S303, it can 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 the second calling method in the configuration file based on a key-value pair format, 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] Exemplarily, binding a target software development kit corresponding to the target middleware to the target middleware as a communication object may include: obtaining a first communication object provided by the target software development kit, the first communication object including a method for communicating with the target software development kit; associating and binding the first communication object with a second communication object in a configuration file so that the business layer communicates 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 communicates with the target middleware via the second communication object.
[0108] Step S305: read the configuration file to check whether the configuration file is correctly configured.
[0109] It should be noted that step S305 is optional. If the configuration file is correctly configured, then step S306 to step S307 are executed. If the configuration file is not correctly configured, then return to step S302. Specifically, checking whether the configuration file is correctly configured may include: checking whether all required key items in the configuration file are configured with values. If the non-required items are not configured with values, then fill in the default attributes and calling methods; if there are configured values, then determine whether there are corresponding attributes and calling methods in the third-party SDK. If not, output an error prompt.
[0110] By using scripts to verify whether the configuration files are correctly configured during the generation of the target middleware, the accuracy of calling third-party SDK methods can be identified in a timely manner to eliminate potential risks in program operation.
[0111] Step S306: Generate a description file by binding the configuration file with data.
[0112] Exemplarily, the data-bound configuration file is parsed into a tree data structure to obtain the parsed configuration file, and a description file is generated according to the associated binding information in the parsed configuration file. The specific process can be referred to in the above step 1032, which will not be described here.
[0113] Step S307: Generate target middleware according to the description file.
[0114] Exemplarily, 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 is read from a preset template library; the abstract syntax tree is converted into target code and inserted into the target template file to obtain the target middleware.
[0115] The embodiment of the present application provides a method for calling a software development kit. By data binding the target software development kit corresponding to the target middleware and the target middleware in the configuration file, and generating the target middleware according to the data-bound configuration file, the target middleware that is adaptive to the target software development kit can be automatically generated. The target middleware can be used to quickly access the target software development kit without code customization with a third-party SDK provider. This can greatly reduce the development and docking communication costs and improve the efficiency of calling the third-party SDK.
[0116] See also Figure 8 , Figure 8 The embodiment of the present application also provides a schematic block diagram of a software development kit calling device 1000, which is used to execute the aforementioned software development kit calling method. The software development kit calling device 1000 can be configured in a computer device.
[0117] like Figure 8 As shown, the calling device 1000 of the software development kit 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 acquire 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 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, call method binding and communication object binding.
[0120] The middleware generation module 1003 is used to generate target middleware according to the configuration file after data binding. The target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
[0121] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0122] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program. The computer program includes program instructions. The processor executes the program instructions to implement a calling method of any software development tool kit provided in an embodiment of the present application.
[0123] For example, the program is loaded by the processor and may execute the following steps:
[0124] Obtain a configuration file corresponding to the target middleware to be generated in the middleware proxy layer; in the configuration file, perform data binding on the target software development toolkit corresponding to the target middleware and the target middleware, wherein the data binding includes attribute binding, call method binding and communication object binding; generate the target middleware according to the configuration file after data binding, and the target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
[0125] The computer-readable storage medium may be an internal storage unit of the computer device of the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital card (Secure Digital Card, SD Card), a flash card (Flash Card), etc. equipped on the computer device.
[0126] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0127] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0128] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for calling a software development kit, characterized in that: Applied to a business project system, 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 tool kit, including: Obtaining a 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, call method binding and communication object binding; The target middleware is generated according to the configuration file after data binding, and the target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
2. The calling method of the software development kit according to claim 1, characterized in that: The configuration file includes a first SDK environment determination method, and the first SDK environment determination method is used to indicate the operating environment required by the business layer; in the configuration file, after data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, the method further includes: Obtaining a second SDK environment determination method corresponding to each of the software development kits in the third-party tool library, where the second SDK environment determination method is used to indicate an operating environment of the software development kit; Matching the operating environment according to the first SDK environment judgment method and the second SDK environment judgment method corresponding to each of the software development kits; The target software development kit is determined according to the software development kit that successfully matches the operating environment.
3. The calling method of the software development kit according to claim 1, characterized in that: In the configuration file, data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, including: Obtaining a first attribute provided by the target software development kit; Based on the key-value pair form, the first attribute is associated and bound with the second attribute in the configuration file, and the second attribute is the attribute required by the business layer.
4. The calling method of the software development kit according to claim 1, characterized in that: In the configuration file, data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, including: Acquire a first calling method provided by the target software development kit, where the first calling method is a method for the target middleware to call the target software development kit; Based on the key-value pair form, the first calling method is associated and bound with the second calling method in the configuration file, and the second calling method is a method for the business layer to call the target middleware.
5. The method for calling a software development kit according to claim 1, characterized in that: In the configuration file, data binding is performed between the target software development kit corresponding to the target middleware and the target middleware, including: Acquire a first communication object provided by the target software development kit, wherein the first communication object includes a method for communicating with the target software development kit; The first communication object is associated and bound with the 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 is a communication object provided by the target middleware to the business layer, and the business layer communicates with the target middleware via the second communication object.
6. The calling method of the software development kit according to claim 1, characterized in that: The step of generating the target middleware according to the configuration file after data binding includes: Parsing the data-bound configuration file into a tree data structure to obtain a parsed configuration file; Generate a description file according to the associated binding information in the parsed configuration file; The target middleware is generated according to the description file.
7. The calling method of the software development kit according to claim 6, characterized in that: The step of generating the target middleware according to the description file includes: Parsing the description file to obtain an abstract syntax tree and a syntax of the communication method corresponding to the target middleware; Reading a target template file corresponding to the grammar from a preset template library; The abstract syntax tree is converted into target code and inserted into the target template file to obtain the target middleware.
8. A calling device for a software development kit, characterized in that: include: A configuration file acquisition module, used to acquire a configuration file corresponding to the target middleware to be generated in the middleware proxy layer; A data binding module, used for performing 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, call method binding and communication object binding; The middleware generation module is used to generate the target middleware according to the configuration file after data binding, and the target middleware is used to access the target software development toolkit so that the business layer can call the target software development toolkit.
9. 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 used to execute the computer program and implement the calling method of the software development tool kit according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the calling method of the software development tool kit according to any one of claims 1 to 7.
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
Information calling compliance processing method and device, equipment and storage medium
CN118733132A
Contact information bridge / middleware / platform
WO2017149533A1
Cited By
Method and device for calling software development kit by host application
CN120610831A
Method and apparatus for host application invoking software development kit
CN120610831B