CN107483559B - SDK service providing method and device - Google Patents

SDK service providing method and device Download PDF

Info

Publication number
CN107483559B
CN107483559B CN201710622478.1A CN201710622478A CN107483559B CN 107483559 B CN107483559 B CN 107483559B CN 201710622478 A CN201710622478 A CN 201710622478A CN 107483559 B CN107483559 B CN 107483559B
Authority
CN
China
Prior art keywords
sdk
http request
service
determining
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710622478.1A
Other languages
Chinese (zh)
Other versions
CN107483559A (en
Inventor
舒晓晖
戚辅光
秦碧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201710622478.1A priority Critical patent/CN107483559B/en
Publication of CN107483559A publication Critical patent/CN107483559A/en
Application granted granted Critical
Publication of CN107483559B publication Critical patent/CN107483559B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Abstract

The disclosure relates to a method and a device for providing an SDK service. The method comprises the following steps: under the condition of receiving an HTTP request, determining an SDK service corresponding to the HTTP request; acquiring the service logic of the SDK service from an SDK container; responding to the HTTP request according to the service logic. According to the method and the device, under the condition that the HTTP request is received, the SDK service corresponding to the HTTP request is determined, the service logic of the SDK service is obtained from the SDK container, and the HTTP request is responded according to the service logic, so that only one interface is exposed outwards by the SDK, the SDK is simpler, lighter and more efficient, and the management and maintenance of the SDK service are facilitated.

Description

SDK service providing method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for providing an SDK service.
Background
SDK (Software Development Kit) generally refers to a collection of Development tools used by a Software engineer to build application Software for a particular Software package, Software framework, hardware platform, or operating system. In the related art, an Application Programming Interface (API) provided by the SDK is generally required to be accessed in an HTTP (HyperText Transfer Protocol) manner to obtain a service provided by the SDK. When the number of APIs provided by the SDK is too large, management and maintenance of the SDK service will not be easy, and the SDK will become bloated and complex.
Disclosure of Invention
In order to overcome the problems in the related art, the present disclosure provides a method and an apparatus for providing an SDK service.
According to a first aspect of the embodiments of the present disclosure, there is provided a method for providing an SDK service, including:
under the condition of receiving an HTTP request, determining an SDK service corresponding to the HTTP request;
acquiring the service logic of the SDK service from an SDK container;
responding to the HTTP request according to the service logic.
For the above method, in a possible implementation manner, before obtaining the service logic of the SDK service from the SDK container, the method further includes:
and storing each SDK service in the SDK container according to the module name, the method name and the service logic of each SDK service.
For the above method, in a possible implementation manner, in a case that an HTTP request is received, determining a service corresponding to the HTTP request includes:
in the case of receiving an HTTP request, encapsulating the HTTP request as an HTTP request context object;
and determining the SDK service corresponding to the HTTP request context object.
For the above method, in a possible implementation manner, determining the SDK service corresponding to the HTTP request context object includes:
determining a module name and a method name corresponding to the HTTP request context object through an object request proxy;
and determining the SDK service corresponding to the HTTP request context object according to the module name and the method name corresponding to the HTTP request context object.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for providing an SDK service, including:
the determining module is used for determining the SDK service corresponding to the HTTP request under the condition of receiving the HTTP request;
the acquisition module is used for acquiring the service logic of the SDK service from the SDK container;
and the response module is used for responding the HTTP request according to the service logic.
For the above apparatus, in one possible implementation manner, the apparatus further includes:
and the storage module is used for storing each SDK service in the SDK container according to the module name, the method name and the service logic of each SDK service.
For the apparatus, in one possible implementation manner, the determining module includes:
the packaging sub-module is used for packaging the HTTP request into an HTTP request context object under the condition that the HTTP request is received;
and the determining submodule is used for determining the SDK service corresponding to the HTTP request context object.
For the apparatus, in a possible implementation manner, the determining sub-module includes:
the module name and method name determining submodule is used for determining the module name and method name corresponding to the HTTP request context object through an object request proxy;
and the SDK service determining submodule is used for determining the SDK service corresponding to the HTTP request context object according to the module name and the method name corresponding to the HTTP request context object.
According to a third aspect of the embodiments of the present disclosure, there is provided an apparatus for providing an SDK service, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of the above method.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above method.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: under the condition of receiving the HTTP request, determining the SDK service corresponding to the HTTP request, acquiring the service logic of the SDK service from the SDK container, and responding the HTTP request according to the service logic, so that only one interface is exposed outwards by the SDK, and the SDK is simpler, lighter, more efficient and easy to manage and maintain.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
Fig. 1 is a flowchart illustrating a method of providing an SDK service according to an exemplary embodiment.
Fig. 2 is a flowchart illustrating a method of providing SDK services according to an example of an exemplary embodiment.
Fig. 3 is a flowchart illustrating a method step S11 for providing SDK services according to an example of an exemplary embodiment.
Fig. 4 is a flowchart illustrating a method step S112 of providing an SDK service according to an example of an exemplary embodiment.
Fig. 5 is a block diagram illustrating an apparatus for providing an SDK service according to an exemplary embodiment.
Fig. 6 is a block diagram illustrating an apparatus for providing an SDK service according to an example of an exemplary embodiment.
Fig. 7 is a block diagram illustrating an apparatus 1900 for provision of SDK services according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flowchart illustrating a method of providing an SDK service according to an exemplary embodiment. The method can be applied to a server. As shown in fig. 1, the method includes steps S11 through S13.
In step S11, when the HTTP request is received, the SDK service corresponding to the HTTP request is determined.
In the present embodiment, the HTTP request refers to an HTTP request requesting the SDK service.
As an example of this embodiment, the form of the SDK service may include one or more of related documents, paradigms, tools, and the like that assist in developing a certain type of software.
As one example of this embodiment, the types of SDK services may include one or more of a software requirements tool, a software design tool, a software construction tool, a software testing tool, a software maintenance tool, a software configuration management tool, a software engineering process tool, and a software quality tool. Wherein the software requirements tool may include one or both of a requirements modeling tool and a requirements tracking tool. Software design tools may be used to create and examine software designs. The software construction tool may include one or more of a program editor, a compiler, a code generator, an interpreter, and a debugger. The software testing tool may include one or more of a test generator, a test execution framework, a test evaluation tool, a test management tool, and a performance analysis tool. The software maintenance tool may include one or both of an understanding tool (e.g., a visualization tool) and a reconstruction tool (e.g., a reconstruction tool). The software configuration management tool may include one or more of a tracking tool, a version management tool, and a publishing tool. The software engineering management tool may include one or more of a project planning and tracking tool, a risk management tool, and a metrology tool. The software engineering process tool may include one or more of a modeling tool, a management tool, and a software development environment. The software quality tool may include one or both of an inspection tool and an analysis tool.
In step S12, the service logic of the SDK service is acquired from the SDK container.
Wherein, the SDK container can be used for storing each SDK service. In this embodiment, each SDK service is managed and maintained by the SDK container, and the SDK only needs to expose one interface to the outside, and does not need to generate interfaces for each SDK service.
In step S13, the HTTP request is responded to according to the business logic.
In this embodiment, after acquiring the service logic of the SDK service corresponding to the HTTP request, the server may send the service logic to the client that sends the HTTP request.
In this embodiment, the SDK service corresponding to the HTTP request is determined when the HTTP request is received, the service logic of the SDK service is obtained from the SDK container, and the HTTP request is responded according to the service logic, so that the SDK only needs to expose one interface to the outside, and thus the SDK is simpler, lighter, more efficient, and easy to manage and maintain the SDK service.
Fig. 2 is a flowchart illustrating a method of providing SDK services according to an example of an exemplary embodiment. As shown in fig. 2, the method may include steps S10 through S13.
In step S10, the SDK services are stored in the SDK container according to their module names, method names, and service logic.
In this embodiment, the module names, the method names and the service logics of the SDK services, and the mapping relationship among the module names, the method names and the service logics of the SDK services may be stored in the SDK container. One module name may correspond to a plurality of method names, or may correspond to only one method name. According to the module name and the method name, an SDK service and the service logic of the SDK service can be uniquely determined.
As an example of this embodiment, before storing the SDK services in the SDK container according to the module names, the method names, and the service logic of the SDK services, the method may further include: the SDK container is initialized according to the specified configuration information. The specific configuration information may conform to the RESTful API specification, and may further include a format specification of the SDK service stored in the SDK container, and the like, which is not limited herein. Those skilled in the art can flexibly set the specific configuration information according to the actual application requirements.
In step S11, when the HTTP request is received, the SDK service corresponding to the HTTP request is determined.
In step S12, the service logic of the SDK service is acquired from the SDK container.
In step S13, the HTTP request is responded to according to the business logic.
Fig. 3 is a flowchart illustrating a method step S11 for providing SDK services according to an example of an exemplary embodiment. As shown in fig. 3, step S11 may include step S111 and step S112.
In step S111, in the case where an HTTP request is received, the HTTP request is encapsulated as an HTTP request context object.
Net may include information of most objects in the HTTP Request, such as Request, Response, Server, and Modules.
In step S112, the SDK service corresponding to the HTTP request context object is determined.
As an example of this embodiment, the module name and the method name corresponding to the HTTP request context object may be determined according to the content of the HTTP request context object, so as to determine the SDK service corresponding to the HTTP request context object.
Fig. 4 is a flowchart illustrating a method step S112 of providing an SDK service according to an example of an exemplary embodiment. As shown in fig. 4, step S112 may include step S1121 and step S1122.
In step S1121, the module name and the method name corresponding to the HTTP request context object are determined by the object request broker.
Among them, the Object Request Broker (ORB) is the middleware that establishes the relationship between the client and the server between the objects. Using the object request broker, the client can transparently invoke SDK services in the SDK container.
As an example of this embodiment, the object request proxy may intercept an HTTP request context object, and may determine a module name and a method name corresponding to the HTTP request context object according to the content of the HTTP request context object.
In step S1122, the SDK service corresponding to the HTTP request context object is determined according to the module name and the method name corresponding to the HTTP request context object.
In this example, the SDK service corresponding to the HTTP request context object is determined by the object request broker, thereby enabling a simpler and lighter SDK.
Fig. 5 is a block diagram illustrating an apparatus for providing an SDK service according to an exemplary embodiment. Referring to fig. 5, the apparatus includes a determination module 51, an acquisition module 52, and a response module 53.
The determining module 51 is configured to determine, in case an HTTP request is received, an SDK service to which the HTTP request corresponds.
The obtaining module 52 is configured to obtain the service logic of the SDK service from the SDK container.
The response module 53 is configured to respond to the HTTP request according to business logic.
Fig. 6 is a block diagram illustrating an apparatus for providing an SDK service according to an example of an exemplary embodiment. Referring to fig. 6:
in one possible implementation, the apparatus further includes a storage module 54.
The storage module 54 is configured to store the SDK services in SDK containers according to module names, method names, and business logic of the SDK services.
In one possible implementation, the determination module 51 includes an encapsulation submodule 511 and a determination submodule 512.
The encapsulation sub-module 511 is configured to encapsulate the HTTP request as an HTTP request context object in case the HTTP request is received.
The determining sub-module 512 is configured to determine the SDK service to which the HTTP request context object corresponds.
In one possible implementation, the determining sub-module 512 includes a module name and method name determining sub-module and an SDK service determining sub-module.
The module name and method name determination submodule is configured to determine, by the object request broker, a module name and method name corresponding to the HTTP request context object.
The SDK service determining submodule is configured to determine the SDK service corresponding to the HTTP request context object according to the module name and the method name corresponding to the HTTP request context object.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In this embodiment, the SDK service corresponding to the HTTP request is determined when the HTTP request is received, the service logic of the SDK service is obtained from the SDK container, and the HTTP request is responded according to the service logic, so that the SDK only needs to expose one interface to the outside, and thus the SDK is simpler, lighter, more efficient, and easy to manage and maintain the SDK service.
Fig. 7 is a block diagram illustrating an apparatus 1900 for provision of SDK services according to an example embodiment. For example, the apparatus 1900 may be provided as a server. Referring to fig. 7, the device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by the processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The device 1900 may also include a power component 1926 configured to perform power management of the device 1900, a wired or wireless network interface 1950 configured to connect the device 1900 to a network, and an input/output (I/O) interface 1958. The device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, MacOS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided that includes instructions, such as the memory 1932 that includes instructions, which are executable by the processing component 1922 of the apparatus 1900 to perform the above-described method. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for providing an SDK service, comprising:
under the condition of receiving an HTTP request, determining an SDK service corresponding to the HTTP request;
acquiring the service logic of the SDK service from an SDK container; wherein, the SDK exposes an interface to the outside;
responding to the HTTP request according to the service logic.
2. The method of claim 1, wherein prior to obtaining the service logic for the SDK service from an SDK container, the method further comprises:
and storing each SDK service in the SDK container according to the module name, the method name and the service logic of each SDK service.
3. The method of claim 1, wherein determining the service corresponding to the HTTP request in case of receiving the HTTP request comprises:
in the case of receiving an HTTP request, encapsulating the HTTP request as an HTTP request context object;
and determining the SDK service corresponding to the HTTP request context object.
4. The method of claim 3, wherein determining the SDK service corresponding to the HTTP request context object comprises:
determining a module name and a method name corresponding to the HTTP request context object through an object request proxy;
and determining the SDK service corresponding to the HTTP request context object according to the module name and the method name corresponding to the HTTP request context object.
5. An apparatus for providing an SDK service, comprising:
the determining module is used for determining the SDK service corresponding to the HTTP request under the condition of receiving the HTTP request;
the acquisition module is used for acquiring the service logic of the SDK service from the SDK container; wherein, the SDK exposes an interface to the outside;
and the response module is used for responding the HTTP request according to the service logic.
6. The apparatus of claim 5, further comprising:
and the storage module is used for storing each SDK service in the SDK container according to the module name, the method name and the service logic of each SDK service.
7. The apparatus of claim 5, wherein the determining module comprises:
the packaging sub-module is used for packaging the HTTP request into an HTTP request context object under the condition that the HTTP request is received;
and the determining submodule is used for determining the SDK service corresponding to the HTTP request context object.
8. The apparatus of claim 7, wherein the determination submodule comprises:
the module name and method name determining submodule is used for determining the module name and method name corresponding to the HTTP request context object through an object request proxy;
and the SDK service determining submodule is used for determining the SDK service corresponding to the HTTP request context object according to the module name and the method name corresponding to the HTTP request context object.
9. An apparatus for providing an SDK service, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the steps of the method of any one of claims 1 to 4.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 4.
CN201710622478.1A 2017-07-27 2017-07-27 SDK service providing method and device Active CN107483559B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710622478.1A CN107483559B (en) 2017-07-27 2017-07-27 SDK service providing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710622478.1A CN107483559B (en) 2017-07-27 2017-07-27 SDK service providing method and device

Publications (2)

Publication Number Publication Date
CN107483559A CN107483559A (en) 2017-12-15
CN107483559B true CN107483559B (en) 2020-09-11

Family

ID=60598466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710622478.1A Active CN107483559B (en) 2017-07-27 2017-07-27 SDK service providing method and device

Country Status (1)

Country Link
CN (1) CN107483559B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111552464A (en) * 2020-04-27 2020-08-18 上海鸿翼软件技术股份有限公司 SDK generation method, device, equipment and medium
CN111654495B (en) * 2020-06-03 2023-06-27 百度在线网络技术(北京)有限公司 Method, apparatus, device and storage medium for determining traffic generation source
CN113419750B (en) * 2021-08-24 2021-11-02 北京华品博睿网络技术有限公司 Model reasoning service calling system and method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104639539A (en) * 2015-01-27 2015-05-20 深圳市汇朗科技有限公司 Method and device for interface calling
CN105760151A (en) * 2014-12-19 2016-07-13 深圳市金蝶中间件有限公司 Method and device for developing application
CN106603593A (en) * 2015-10-15 2017-04-26 北京京东尚科信息技术有限公司 HTTP calling method and device based on adaption
CN106775702A (en) * 2016-12-09 2017-05-31 中电科华云信息技术有限公司 Service internal interface based on container finds method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9645861B2 (en) * 2014-04-29 2017-05-09 Good Technology Holdings Limited Method and system for managing and presenting multiple application containers as a single logical container

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105760151A (en) * 2014-12-19 2016-07-13 深圳市金蝶中间件有限公司 Method and device for developing application
CN104639539A (en) * 2015-01-27 2015-05-20 深圳市汇朗科技有限公司 Method and device for interface calling
CN106603593A (en) * 2015-10-15 2017-04-26 北京京东尚科信息技术有限公司 HTTP calling method and device based on adaption
CN106775702A (en) * 2016-12-09 2017-05-31 中电科华云信息技术有限公司 Service internal interface based on container finds method

Also Published As

Publication number Publication date
CN107483559A (en) 2017-12-15

Similar Documents

Publication Publication Date Title
CN110275831B (en) Mock data verification method and device of protocol interface
CN107483559B (en) SDK service providing method and device
CN106648556B (en) Method and device for front-end and back-end integrated development test
CN110058864B (en) Micro-service deployment method and device
Szydlo et al. Flow-based programming for IoT leveraging fog computing
CN104156313A (en) Method for automatically generating Web service testing case
CN104683180A (en) Performance monitoring method and system as well as application server
CN107092489B (en) Processing method and system based on application version release
CN110647332A (en) Software deployment method and device based on container cloud
CN108965375B (en) Service call proxy control system, method, server and readable storage medium
CN108694120B (en) Method and device for testing service component
CN113225379A (en) Method and device for sending HTTP request message
CN115309562A (en) Operator calling system, operator generating method and electronic equipment
WO2019117767A1 (en) Method, function manager and arrangement for handling function calls
CN116668520A (en) Gateway-based service arrangement method, system, equipment and storage medium
CN115629976A (en) Kernel testing method and device and storage medium
CN112073462B (en) Positioning method and device
CN113918245A (en) Data calling method, device, equipment and computer readable storage medium
CN113434435A (en) Test case logic automatic generation method and device
Siddiqui et al. Non-functional testing framework for container-based applications
CN111198679B (en) Fusion method and device of multi-language health management model
CN110780937A (en) Task issuing method and device, computer readable storage medium and equipment
CN112217852A (en) Platform-as-a-service system and method based on workflow engine
CN110413502A (en) Program testing method and system, computer system and computer readable storage medium storing program for executing
CN113342633B (en) Performance test method and device

Legal Events

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