Embodiment
For making the object of the application, technical scheme and advantage clearly, below in conjunction with drawings and the specific embodiments, the application is described in further detail.
According to the embodiment of the application, provide a kind of method and system of web application interface upgrade.
It is the process flow diagram of the method for the web application interface upgrade that the embodiment of the present application relates to reference to figure 1, Fig. 1.As shown in Figure 1, when carrying out the upgrading of web application interface (Web API), in step S101, in the starting and upgrading stage of upgrading to described Web API, generate second definition information corresponding with the upgraded version of described Web API, wherein, described second definition information is stored in a database; First definition information corresponding with the initial version of Web API is also stored in described database.First, second definition information described at least can comprise respectively: the title of described Web API, major version number, sub-version number, issued state information and routing iinformation etc., namely in described first definition information, record the major version number of the initial version of described Web API, sub-version number, issued state information and routing iinformation etc., such as, first definition information of certain Web API is recorded as: " title: X; major version number: 1.0, sub-version number 0.1, issued state: issue ... ".Wherein, issued state information can represent described Web API initial version or the current issued state of upgraded version, such as, certain Web API initial version is formally issued, currently to use, then the issued state information in first definition information of this Web API can be designated as " issuing ".Such as, Web API upgraded version is current is in the starting and upgrading stage for certain, the issued state information of the described Web API upgraded version in described Web API second definition information can be designated as " initialization ", when the upgrading of described Web API proceeds to test phase on line, the issued state of described Web API can be designated as " line is tested ", to the recording mode of described issued state information, the application does not limit, such as, can also mark with the character such as numeral, letter, symbol.The title of described Web API remains unchanged before and after upgrading, and the major version number of described Web API and sub-version number can be determined according to the upgrading type of described Web API.
Wherein, if the upgrading type of described Web API is compatibility update, then the major version number in described second definition information is generated as the major version number identical with described first definition information, the sub-version number in described second definition information is generated as the sub-version number that sub-version number in described first definition information is different.
Such as: when certain Web API carries out compatibility update, major version number in the first corresponding for the initial version of Web API to be upgraded definition information is designated as 1.0, sub-version number is designated as 0.1, described Web API to be upgraded the upgraded version of the described Web API obtained, then the major version number in second definition information of described Web API is still designated as 1.0, and sub-version number is designated as the sub-version number different from the first definition information, such as, 0.1 can be added up on the basis of original sub-version number 0.1, be designated as 0.2.
When calling described Web API, such as, applications is called described Web API's, due to major version number information in the definition information of Web API, also comprise sub-version number information, and applications is when carrying out the calling of Web API, the general version number information all quoting Web API, namely, major version number information, and in compatibility update, Web API after upgrading, major version number is constant, and be recorded as and originally different sub-version numbers after sub-version number upgrading, therefore, applications is when calling the Web API of compatibility update, do not need to change call parameters (mode), just can call the Web API upgraded version after upgrading, and internal gateway is when receiving the call request of applications, then can distinguish the Web API initial version before and after described Web API upgraded and upgraded version by the sub-version number in the definition information of Web API.
And if the upgrading type of described Web API is incompatibility upgrading, then the major version number in described second definition information is generated as the major version number that major version number in described first definition information is different, the sub-version number in described second definition information is generated as the sub-version number identical with described first definition information.
Such as, when certain Web API carries out incompatibility upgrading, major version number in the first corresponding for the initial version of Web API to be upgraded definition information is designated as 1.0, sub-version number is designated as 0.1, the upgraded version that Web API upgrading obtains described Web API is carried out by described, then the major version number in second definition information of described Web API is designated as different from the first definition information, such as, can add up on the basis of original major version number 1.0 and 1 be designated as 2.0, and sub-version number does not need to change, the sub-version number 0.1 identical with the first definition information can be designated as.
Because applications is when carrying out the calling of Web API, what generally quote is the major version number information of Web API, and when incompatibility is upgraded, the major version number of the upgraded version of the described Web API recorded in second definition information of described Web API is different from the major version number of the initial version of the described Web API recorded in first definition information of described Web API, therefore, applications is when calling the Web API of this upgrading, if when also calling this Web API with original call parameters, the initial version of the still described Web API then obtained, if user wants to use the rear Web API of upgrading, namely, the upgraded version of described Web API, then need the major version number major version number quoted in call request being changed into described Web API upgraded version, user can be made like this to whether using the Web API after upgrading to select.
In step s 102, test phase on the upgrading line carrying out line is tested to the upgraded version of described Web API, the issued state information in described second definition information of upgrading is to mark the current issued state of described Web API upgraded version for test mode on line.Such as, original the second definition information is " title: X, major version number: 1.0, sub-version number: 0.2, issued state: initialization, ", entering on line can be then " line is tested " by issued state information updating after test phase, that is, the second definition information is updated to " title: X, major version number: 1.0, sub-version number: 0.2, issued state: line is tested, " this stage, because the upgraded version of Web API is not formally issued, therefore, the initial version of Web API still uses in formal environments on line, and namely do not have expired, the issued state Information invariability in the first definition information, such as, originally the first definition information of record is " title: X, major version number: 1.0, sub-version number: 0.1, issued state: issue, " and the upgraded version of this Web API is not formally issued, then the initial version remaining this Web API used under formal environments on line, then the issued state information in the first definition information is still " issuing ".
In step s 103, at the upgrading launch phase issued the upgraded version of described Web API, the issued state information in described second definition information of upgrading is to mark the current issued state of described Web API upgraded version for issued state.Such as, on last stage, second definition information be " title: X, major version number: 1.0, sub-version number: 0.2, issued state: on line test ... " enter launch phase then can by issued state information updating for " issuing " namely, the second definition information is updated to " title: X, major version number: 1.0, sub-version number: 0.2, issued state: issue ... ".When compatibility update, at upgrading launch phase, because the upgraded version of Web API is formally issued, therefore, the initial version of Web API is expired, and the issued state information in the first definition information needs to upgrade, to mark the out of date of the initial version of described Web API.Such as, originally record the first definition information for " title: X, major version number: 1.0, sub-version number: 0.1, issued state: issue ... " and the upgraded version of this Web API is formally issued time, then the issued state information updating in the first definition information is " out of date ".
Respectively the first definition information and the second definition information in the escalation process of compatibility update and incompatibility upgrading are described in detail at the update status in each stage of upgrading below in conjunction with Fig. 2, Fig. 3.
When Fig. 2 is for carrying out compatibility update, the first definition information and the second definition information at the update status schematic diagram in each stage of upgrading, as shown in Figure 2:
First, first definition information (R1) of the initial version (upgrading) of record Web API, major version number and sub-version number can be recorded as 1.0 and 0.1 respectively, issued state can be recorded as: issue.
Web API reaches the standard grade go through three processes from being upgraded to issue: starting and upgrading, line test and issuing.In the upgrading flow process of compatibility update, the change of Web API definition information is as follows respectively:
The starting and upgrading stage that Web API is being upgraded, for the upgraded version of Web API, record corresponding second definition information (R2), compared with the first definition information R1, the major version number in the second definition information R2 remains unchanged, and is still 1.0, child release cumulative 0.1, be updated to 0.2, state can be recorded as " initialization ", and any information of the first definition information R1 all remains unchanged.
Test phase on the upgrading line carrying out line is tested to the upgraded version of Web API, the upgraded version of this Web API is not formally issued, initial version also uses in formal environments on line, therefore, information in first definition information R1 all remains unchanged, and status information is still designated as " issue " state identical with the starting and upgrading stage.And the issued state of the upgraded version of Web API becomes test mode on line, therefore, the issued state information in the second definition information R2 can be updated to the state of present stage by original " initialization ", such as, can be designated as " line is tested ".
To the upgrading launch phase that the upgraded version of described Web API is issued, the upgraded version of this Web API is formally issued, therefore, issued state information in R2 is updated to " issuing " by " line is tested ", so, the initial version of Web API is expired, therefore the issued state information in R1 is updated to " out of date " by " issuing ".
When Fig. 3 is for carrying out incompatibility upgrading, the first definition information and the second definition information at the schematic diagram of the update status in each stage of upgrading, as shown in Figure 3:
First, the initial version (upgrading) for Web API records the first definition information (R1), and major version number and sub-version number can be recorded as 1.0 and 0.1 respectively, issued state can be recorded as: issue.
Web API reaches the standard grade go through three processes from being upgraded to issue: starting and upgrading, line test and issuing.In the upgrading flow process of incompatibility upgrading, the change of Web API definition information is as follows respectively:
The starting and upgrading stage that Web API is being upgraded, for the upgraded version of Web API, record corresponding second definition information (R2), compared with the first definition information R1, major version number in second definition information R2 can add up 1, is designated as 2.0, and sub-version number is constant, still be designated as 0.1, issued state can be recorded as " initialization ".And for the first definition information, during upgrading in incompatibility, in the process of whole upgrading, any information of the first definition information R1 all remains unchanged.
Test phase on the upgrading line carrying out line is tested to the upgraded version of Web API, in R1, status information is still designated as " issuing " state.The issued state of the upgraded version of this stage Web API becomes test mode on line, therefore, the issued state information in the second definition information R2 can be updated to the state of present stage by original " initialization ", can be designated as " line is tested ".
To the upgrading launch phase that the upgraded version of described Web API is issued, in R1, status information is still designated as " issuing " state, the upgraded version of described Web API is formally issued, and therefore, the issued state information in R2 is updated to " issuing " by " line is tested ".
In the process that Web API is upgraded, if receive the call request to described Web API, can according to the environment of the recalls information (Web API Name and major version number) in call request and call request (such as, formal environments on test environment or line on line) search the definition information of corresponding described Web API in a database, and based on the definition information determination goal systems found, and described call request is forwarded to described goal systems, to make described goal systems, described request is processed.Can as shown in Figure 4, Fig. 4 is at the process flow diagram carrying out Web API processing described call request when receiving the call request to described Web API in escalation process, as shown in Figure 4,
In step S401, receive the call request to described Web API, search the definition information of corresponding described Web API based on described call request.
Search rule is: if described request is test environment on line, search the definition information that and issued state corresponding with the recalls information in described call request is the described Web API of test mode on line in the database, if search less than, then search the definition information that and issued state corresponding with the recalls information in described call request is the described Web API of issued state in the database; If described request is formal environments on line, search the definition information that and issued state corresponding with the recalls information in described call request is the described Web API of issued state in the database.
Test phase on the upgrading line of compatibility update, in described first definition information, the issued state of the initial version of Web API is " issuing ", in described second definition information, the issued state of the upgraded version of Web API is " line is tested ", when applications (calls the call parameters during initial version of Web API with constant call parameters, such as, call name and be called aaa.bbb.ccc, the Web API of major version number 1.0), initiate the request of calling described Web API, if described call request processes in test environment on line, then need to find the definition information that issued state is " line is tested ", namely search the second definition information being in test mode on line.And if the definition information of searching less than test mode on line, then search issued state for the definition information of " issuing ", namely search the first definition information of the Web API initial version that issued state is " issuing " state.
And if described request processes in formal environments on line, searches the definition information that issued state is the described Web API of issued state in the database.Owing to initiating in call request on line formal environments, just need the definition information of searching the described Web API that issued state is " issuing " state, owing to being now in test phase on upgrading line, the upgraded version of Web API is not also formally issued, therefore, the first definition information that issued state is issued state can be searched, i.e. the definition information of the initial version of Web API, so just achieve the isolation of formal environments on test environment and line on line.
And at the upgrading launch phase of compatibility update, issued state in second definition information of Web API is updated to " issuing ", the state of the first definition information is updated to " out of date ", when receiving the request of calling described Web API, if described request processes in formal environments on line, just need to search the definition information that issued state is " issuing ", because the upgraded version of Web API is issued, and the initial version of described Web API is out of date, therefore can find issued state is announced second definition information.Like this, the Web API that on line, formal environments adopts is just automatic after distribution switches to upgraded version from initial version, achieve the transparency of compatibility update to applications, applications does not need to do any change to call request, just can obtain the result of the Web API after compatibility update.Alternatively, major version number and sub-version number can also be included in the result returned, applications can be made to know, and each returning results is by the Web API process of which concrete version, when to when having returned results doubt, is convenient to investigate problem fast simultaneously.
From the above mentioned, in compatibility update, because the major version number of Web API before and after upgrading does not change, therefore, described in outside application call during Web API, do not need to change the result that method of calling just can obtain the Web API after upgrading, and when processing described call request, Web API version before (such as, gateway processes applications is to the call request of described Web API) can distinguish again upgrading and after upgrading, and different goal systems will be routed to separately.Meanwhile, effectively formal environments on test environment on line and line is isolated according to the issued state of Web API.
Test phase on the upgrading line of incompatibility upgrading, in described Web API first definition information, issued state is " issuing " state, and the issued state in the second definition information is " line is tested " state.If described call request processes in test environment on line, need to search the definition information that issued state is test mode on line, if searching less than issued state is the definition information of test mode on line, then search the definition information that issued state is issued state.When receiving the call request of applications to described Web API, if applications still initiates call request (such as in the mode of the initial version calling described Web API before, call name and be called abc.defg.hij, the Web API of major version number 1.0), then according to the recalls information (described recalls information at least comprises: title, the major version number of the Web API called) in request, lookup names is wanted to be the definition information of abc.defg.hij, major version number 1.0.And during the upgraded version of Web API after external request wants to call upgrading, because incompatibility is during upgrading, initial version before and after Web API upgrades is different with the major version number of upgraded version, therefore, during Web API upgraded version then after calling upgrading, need to change the major version number in call parameters, such as, major version number is originally 1.0, after upgrading, major version number is 2.0, if then applications want to call upgrading after Web API upgraded version, when calling, the major version number changed in call request is needed to be 2.0, and when receiving the call request of applications, according to the recalls information in request, lookup names is abc.defg.hij, the definition information of major version number 2.0.
And if described request processes in formal environments on line, search corresponding with the recalls information in described call request, that issued state is the described Web API of issued state definition information in the database.Such as, when receiving the call request of applications to described Web API, if when applications still initiates call request in the mode of the initial version calling described Web API before, such as, call name and be called abc.defg.hij, the Web API of major version number 1.0, then according to the recalls information (described recalls information at least comprises: title, the major version number of the Web API called) in request, lookup names is wanted to be the definition information of abc.defg.hij, major version number 1.0.If and the call request of applications want to call upgrading after the upgraded version of Web API, because incompatibility is during upgrading, initial version before and after Web API upgrades is different with the major version number of upgraded version, therefore need to change the major version number in call parameters, such as, major version number is originally 1.0, after upgrading, major version number is 2.0, then applications is when calling upgraded version, the major version number changed in call request is needed to be 2.0, and when receiving the call request of applications, according to the recalls information in request, lookup names is abc.defg.hij, major version number 2.0, be in the definition information of issued state, the issued state being the definition information of 2.0 due to major version number in now database is also test mode on line, therefore can search less than major version number is 2.0, be in the definition information of issued state, at this moment, the malloc failure malloc on line in formal environments will be caused, so just achieve the isolation of formal environments on test environment and line on line.
At the upgrading launch phase of incompatibility upgrading, when receiving the call request of applications to described Web API, because the initial version before and after Web API upgrading is different with the major version number of upgraded version, such as original version (initial version of described Web API) number is 1.0, version (upgraded version of described Web API) number after incompatibility upgrading is 2.0, if when applications still initiates call request in the mode of the initial version calling described Web API before, such as, call name and be called abc.defg.hij, the Web API of major version number 1.0, then will according to the recalls information in request, lookup names is abc.defg.hij, major version number 1.0, be in the definition information of issued state, if and external request want to call upgrading after the upgraded version of Web API, then applications needs to change the major version number in call parameters, such as, major version number is originally 1.0, after upgrading, major version number is 2.0, then applications is when calling upgraded version, the major version number changed in call request is needed to be 2.0, and when receiving the call request of applications, according to the recalls information in request, lookup names is abc.defg.hij, and major version number 2.0 is in the definition information of issued state.
From the above mentioned, during upgrading in incompatibility, because the major version number before and after Web API upgrading is different, therefore when calling described Web API, applications can the Web API initial version voluntarily before Selection and call upgrading still call upgrading after the upgraded version of described Web API, like this while the incompatibility upgrading carrying out Web API, do not affect again the operation of existing application.Meanwhile, effectively formal environments on test environment on line and line is isolated according to the issued state of Web API.
In step S402, based on the definition information determination goal systems found.
In step S403, described call request is forwarded to described goal systems, to make described goal systems, described request is processed.
In step s 404, receive from the result of goal systems to described request.
Such as, when gateway receives the call request of applications, processing described request, can, with reference to figure 5, be the schematic diagram to the treatment scheme that the call request of applications processes; As shown in Figure 5:
Applications 50 accesses gateway 10, is called N and the Web API of key plate basis=V initiation call request to name.
Step S1, after gateway 10 receives the call request of applications 50, if described call request is the call request of upper test environment of reaching the standard grade based on line, then from database, lookup names is N, major version number is V and issued state is the Web API definition information of " line is tested ", if there is no, then query State is announced Web API definition information again.If described call request is based on formal environments on line, then from database Query Name be N, key plate basis=V and issued state is announced Web API definition information.
Step S2, gateway 10 is according to the routing iinformation in the Web API definition information found, determine corresponding target front-end system 30, wherein, target front-end system is the front-end system of the similar goal systems of one group of business, and it provides a unified external call interface to gateway for this group goal systems.
Step S3, described call request forwards to target front-end system 20 by gateway.
Step S4, target front-end system 20 determines according to the title in Web API definition information, major version number, sub-version number the goal systems 30 processing this request, and wherein, goal systems is the operation system of final process request.
Step S5, target front-end system 20 by request forward to goal systems 30.
Step S6, goal systems 30 processes request.
Step S7, result is returned to target front-end system 20 by goal systems 30
Step S8, result is returned to gateway 10 by target front-end system 20.
Step S9, result is returned to applications 50 by gateway 10.
With reference to figure 6, the block diagram of the system of a kind of web application interface upgrade related to for the application, as shown in Figure 6, the system 600 of this web application interface upgrade comprises: information generating module 601 and information updating module 602.
Information generating module 601, may be used in the starting and upgrading stage of upgrading to described Web API, generate second definition information corresponding with the upgraded version obtaining described Web API after upgrading, wherein, described second definition information is stored in a database, also store with the initial version of described Web API to the first corresponding definition information in described database, and wherein, described first and second definition information at least comprise respectively: the title of Web API, major version number, sub-version number, issued state information and routing iinformation.
Information updating module 602, may be used for test phase on the upgrading line carrying out line is tested to the upgraded version of described Web API, the issued state information in described second definition information of upgrading is to mark the current issued state of described Web API upgraded version for test mode on line; And at the upgrading launch phase issued the upgraded version of described Web API, the issued state information in described second definition information of upgrading is to mark the current issued state of described Web API upgraded version for issued state.And wherein, if the upgrading type of described Web API is compatibility update, described information updating module 602 can also be used at described upgrading launch phase, and the issued state information upgraded in described first definition information is out of date to mark the initial version of described Web API.
Described information generating module 601 can also be used for: when the upgrading type of described Web API is compatibility update, major version number in described second definition information is generated as the major version number identical with described first definition information, the sub-version number in described second definition information is generated as the sub-version number that sub-version number in described first definition information is different.
When the upgrading type of described Web API is incompatibility upgrading, major version number in described second definition information is generated as the major version number that major version number in described first definition information is different, the sub-version number in described second definition information is generated as the sub-version number identical with described first definition information.
Described system can also comprise information searching module 603, this module may be used for when receiving the call request to described Web API, if described request is test environment on line, search the definition information that and issued state corresponding with the recalls information in described call request is the described Web API of test mode on line in the database, if search less than, then search the definition information that and issued state corresponding with the recalls information in described call request is the described Web API of issued state in the database; If described request is formal environments on line, search the definition information that and issued state corresponding with described call request is the described Web API of issued state in the database.
Wherein, described recalls information at least comprises: title, the major version number of the Web API called.
Described system can also comprise: determination module 604, forwarding module 605 and receiver module 606.
Determination module 604, may be used for the definition information determination goal systems based on finding.
Forwarding module 605, may be used for described call request to forward to described goal systems, processes to make described goal systems to described request.
Receiver module 606, may be used for receiving from the result of goal systems to described request.
The concrete enforcement of the method for the application is corresponding with the concrete enforcement of the modules included by system 600, can be cross-referenced, in order to not fuzzy the application, is described the detail of system 600 in this omission.
Although it should be noted that the some modules or the submodule that are referred to system in describing above, this division is not enforceable.In fact, according to the embodiment of the application, the Characteristic and function of two or more modules above-described can be specialized in a module.Otherwise, the Characteristic and function of an above-described module can Further Division for be specialized by multiple module.
In addition, although describe the operation of the application's method in the accompanying drawings with particular order, this is not that requirement or hint must perform these operations according to this particular order, or must perform the result that all shown operation could realize expectation.
The application can describe in the general context of computer executable instructions, such as program module or unit.Usually, program module or unit can comprise the routine, program, object, assembly, data structure etc. that perform particular task or realize particular abstract data type.In general, program module or unit can be realized by software, hardware or both combinations.Also can put into practice the application in a distributed computing environment, in these distributed computing environment, be executed the task by the remote processing devices be connected by communication network.In a distributed computing environment, program module or unit can be arranged in the local and remote computer-readable storage medium comprising memory device.
In one typically configuration, computing equipment comprises one or more processor (CPU), input/output interface, network interface and internal memory.
Internal memory may comprise the volatile memory in computer-readable medium, and the forms such as random access memory (RAM) and/or Nonvolatile memory, as ROM (read-only memory) (ROM) or flash memory (flash RAM).Internal memory is the example of computer-readable medium.
Computer-readable medium comprises permanent and impermanency, removable and non-removable media can be stored to realize information by any method or technology.Information can be computer-readable instruction, data structure, the module of program or other data.The example of the storage medium of computing machine comprises, but be not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic RAM (DRAM), the random access memory (RAM) of other types, ROM (read-only memory) (ROM), Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc ROM (read-only memory) (CD-ROM), digital versatile disc (DVD) or other optical memory, magnetic magnetic tape cassette, tape magnetic rigid disk stores or other magnetic storage apparatus or any other non-transmitting medium, can be used for storing the information can accessed by computing equipment.According to defining herein, computer-readable medium does not comprise non-temporary computer readable media (transitory media), as data-signal and the carrier wave of modulation.
Also it should be noted that, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, commodity or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, commodity or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, commodity or the equipment comprising described key element and also there is other identical element.
Those skilled in the art should understand, the embodiment of the application can be provided as method, system or computer program.Therefore, the application can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the application can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code.
Apply specific case herein to set forth the principle of the application and embodiment, the explanation of above embodiment is just for helping method and the main thought thereof of understanding the application; Meanwhile, for one of ordinary skill in the art, according to the thought of the application, all will change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the application.