A kind of SDK automatic packaging methods of open platformTechnical field
The present invention relates to open platform SDK technical fields more particularly to a kind of SDK automatic packaging methods of open platform.
Background technology
Currently, financial institution opens financial service by internet open platform, specifically for third-party platform in the form of APIIt calls, realizes that financial service openness is shared.For convenience of, fast access open platform, open platform communicated by SDK abstract APIs,Data transmission etc. reduces difficulty, the complexity of third party's access, shortens third party's turn-on time, and fast-developing business meets mutualThe demand that the development of networked product is maked rapid progress.And SDK encapsulates infrastructure service heavy workload, occupies the open exploitation of this serviceThe one third of time shortens entire production life cycle, needs in business to ensure service of goods high quality, quickly going into operation and reach the standard gradeWork except processing exploitation is by automating, configuration and development task parallel processing solve, allow product development cycle whenBetween be used in business processing develop, ensure quality, meet banking development need.
SDK codes layering at present is not clear enough, public use code, product renewing and the newly-increased communication not influenced, dataClose Deng codes are added and subtracted, causes all SDK codes to be required for being tested after updating and increasing newly, increases code walkthrough and surveyThe work of examination.The SDK development times are too long, occupy product development total time percentage it is excessively high, seriously affected product marketing andIt uses, is unsatisfactory for the demand of internet development.
Also, existing SDK is formed by programmer h coding, causes to increase product or service of goods interface newly every timeIt needs developer to develop and update SDK when changing all, needs to carry out the streams such as Walkthrough, version management, test examination to codeJourney.Existing SDK common codes and interface code safeguard together with, update and exploitation, need to carry out to overall code every timeJoint debugging is tested.
Invention content
It is an object of the invention to:All it is to cause every time to open SDK by h coding to solve SDK in the prior artThe problem of hair and update need a large amount of time and need to expend a large amount of manpowers, the present invention provide a kind of SDK of open platform fromDynamic packaging method.
Of the invention and technical solution is as follows:
A kind of SDK automatic packaging methods of open platform, include the following steps:
S1:The demand information of API administrative centers typing third-party platform, according to demand Automatic generation of information XML file;
S2:XML file is read the number for becoming in memory and being consistent with the data structure of automatic code engine by JAVA codesAccording to;
S3:The data transfer obtained in S2 to automatic code generating engine is generated into SDK interface codes;
S4:SDK interface codes are generated into ant with Java code and are packaged script;
S5:Operation ant, which is sent the commands to, by Java code is packaged script;
S6:The code that entire SDK frameworks are included is compiled by ant scripts, generates .jar packets, wherein SDK frameworks are wrappedThe code contained includes the code and agreement layer identification code and data check layer identification code of the interface sections SDK.
S7:By inside entire SDK frameworks .jar packets and configuration file jointly be packaged claim zip packets;Shown configuration file isThe file .properties needed to configure when third-party platform is using SDK, it includes cryptographic certificate, APPID, network transmissionThe public key of domain name, certificate transport-type, open platform.
Specifically, the interface code includes entity class and class, entity class is called to be connect as the parameter for calling class method, workThe third party entered calls.
The S3 the specific steps are:It is generated according to data relationship in S2 and imports pack arrangement, then according to institute's total in S2According to generation SDK interfaces class and SDK entity class;
Specifically, the generation method of SDK interfaces class is:The tune of SDK interface classes is generated according to the interface name in data in S2With method and call method formal parameter;
The generation method of SDK entity class is:Interface name in S2 in data generates SDK entities class name and according to data in S2In attribute-name generate SDK entity class attribute.
Specifically, the SDK frameworks include:
SDK interface layer units, for realizing the calling of third-party platform;
Customization dispensing unit configures public information for third-party platform;
Interface data verifies regulation engine unit, and data standard and business norms are carried out for the data of third party and inputVerification;
Secure processing units, for the data in transmission process to be signed and encrypted;
Processing unit is configured, for running the public information of customization configuration of described dispensing unit applied to SDK;
Communication processing unit, the transmission communication for handling SDK and open platform.
After adopting the above scheme, beneficial effects of the present invention are as follows:
(1) SDK packets are updated and are increased newly in API and participate in encoding without artificial.After SDK automations, after API is increased newly and is updatedWithout h coding, newly-increased or update interface message is configured in API administrative centers, selects interface to be packaged SDK, can give birth to immediatelyThe quick test etc. for providing test at SDK packets, reducing developer's participation, while can realize interface.On code is at least thousands ofWan Hang is associated between each code, and contiguity is very strong between all codes, and a punctuate error routine all may be usedIt can cause to paralyse, automatic packaging is not necessarily to manual amendment's code, has saved great amount of cost, while improving reliability.
(2) product development cycle is reduced, the product development more time is given.Automatically generating for API is in interface exploitationIt carries out after the completion, former h coding needs 1-3 week exploitation to complete, and can be immediately generated now, reduce non-traffic flowThe time of exploitation, product development cycle is shortened, product development, test more time can be given, ensures that product high quality is reached the standard grade.
Description of the drawings
It in order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, below will be to institute in embodimentAttached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the present inventionExample, for those of ordinary skill in the art, without creative efforts, can also obtain according to these attached drawingsObtain other attached drawings.Shown in attached drawing, above and other purpose of the invention, feature and advantage will be more clear.In wholeIdentical reference numeral indicates identical part in attached drawing.Actual size equal proportion scaling is not pressed deliberately draws attached drawing, emphasisIt is that the purport of the present invention is shown.
Fig. 1 is the flow chart of the present invention.
Specific implementation mode
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present inventionIn attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment isA part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the artThe every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
All it is to cause every time to develop SDK and update to need largely by h coding to solve the total SDK of the prior artTime and the problem of need to expend a large amount of manpowers, in the present invention, excel documents automatically analyze generating structure to code according to demandXml, requirement documents translate into for generate JAVA codes need data (wherein include code between dependence and tuneWith relationship), the structure of API templates and according to template utilize automatic code generating engine automatic code generating.According to automatic rawAt code engine Auto scheme, technology realization is that developer plays an active part in, the achievement of hard-working, cohesionThe painstaking effort of developer.SDK real time workshops can rapidly adapt to what product iteration was maked rapid progress for internet mechanismDemand substantially increases and generates efficiency and value output.It is noted that java codes described in the present invention are one kindCoding mode, method of the invention are not limited to java codes during realization, can also use php, python code, equallyIt can achieve the effect that the present invention.
Specifically, a kind of SDK automatic packaging methods of open platform of the present invention, include the following steps:
S1:The demand information of API administrative centers typing third-party platform, according to demand Automatic generation of information XML file;
S2:XML file is read the number for becoming in memory and being consistent with the data structure of automatic code engine by JAVA codesAccording to;In specific implementation, freemaker template engines may be used in automatic code engine;
The S3 the specific steps are:It is generated according to data relationship in S2 and imports pack arrangement, then according to institute's total in S2According to generation SDK interfaces class and SDK entity class;
Specifically, the generation method of SDK interfaces class is:The tune of SDK interface classes is generated according to the interface name in data in S2With method and call method formal parameter;
The generation method of SDK entity class is:Interface name in S2 in data generates SDK entities class name and according to data in S2In attribute-name generate SDK entity class attribute.
S4:The interface sections SDK code building ant is packaged script with Java code;
S5:Operation ant, which is sent the commands to, by Java code is packaged script;
S6:The code that entire SDK frameworks are included is compiled by ant scripts, generates .jar packets, wherein SDK frameworks are wrappedThe code contained includes the code and agreement layer identification code and data check layer identification code of the interface sections SDK.
The SDK frameworks include:
SDK interface layer units, for realizing the calling of third-party platform;
Customization dispensing unit configures public information for third-party platform;
Interface data verifies regulation engine unit, and data standard and business norms are carried out for the data of third party and inputVerification;
Secure processing units, for the data in transmission process to be signed and encrypted;
Processing unit is configured, for running the public information of customization configuration of described dispensing unit applied to SDK;
Communication processing unit, the transmission communication for handling SDK and open platform.
S7:By inside entire SDK frameworks .jar packets and configuration file jointly be packaged claim zip packets;Shown configuration file isThe file .properties needed to configure when third-party platform is using SDK, it includes cryptographic certificate, APPID, network transmissionThe public key of domain name, certificate transport-type, open platform.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, anyBelong to those skilled in the art in the technical scope disclosed by the present invention, the change or replacement that can be readily occurred in all are answeredIt is included within the scope of the present invention.