Specific embodiment
A kind of logical construction of the embodiment of the present application application scenarios is as shown in figure 1, when multiple service users need to call
During the service interface of multiple service providers, compared to the realization for changing each service user and each service provider, can
Gateway is respectively connected to multiple service providers with by one to multiple service user and one, the application is run on gateway
Embodiment, to service user and service provider between calling interface request and response pass on, by that will use
Unique associate field for representing service identification in square call request is carried in the call request initiated to service provider, from
And can from service provider return call response in obtain associate field, further to obtain the corresponding user of the response
Service identification, it is to avoid to service using the full table scan of party database, the decline of database manipulation speed is not resulted in, to solve
Problems of the prior art.
In embodiments herein, gateway can mutually be visited with each the service user for being accessed and each service provider
Ask.It should be noted that gateway, service user, service provider can be separately operable in independent physically or logically equipment
On;Gateway can also as One function module operate in one service user where equipment on, for carrying out to one
To calling for multiple service provider service interfaces;Gateway is also used as One function module and operates in a service provider
In the equipment at place, as the preposition functional module of its service interface, to be called to multiple service user for one.
Embodiments herein may operate in any equipment with calculating and storage capacity, for example, can be hand
The physical equipments such as machine, panel computer, PC (Personal Computer, PC), notebook, server, virtual machine are patrolled
The equipment of collecting;The physically or logically equipment of different responsibilities can also be shared by two or more, mutually cooperate with to realize this Shen
Various functions that please be in embodiment.
In embodiments herein, the flow of the implementation method of service interface asynchronous call is as shown in Fig. 2 the method application
One is being accessed to multiple service user and a gateway to multiple service providers.
Step 210, calls receiving from service user, the user including calling interface and user's service identification
After request, according at least one associate field generation relating value in user's call request, relating value and user's business are preserved
The corresponding relation of mark, provider's service identification is obtained according to calling interface.
It is raw when certain business procedure carried out in service user needs the service interface for calling certain service provider
Into user's call request and it is sent to gateway.
Include user's service identification and calling interface using call request.Wherein, user's service identification is service
User is the mark for calling the business procedure of the service interface to assign, and in service, user can uniquely represent the business mistake
Journey;If needing to carry out multiple service interface in the business procedure calls, user's service identification will be used for each time
In user's call request.Calling interface is to service the service interface that user is called, and what can be accessed in gateway is all
Uniquely a service interface is represented in service interface;Can implement to determine calling interface institute according to practical application scene
Comprising content, for example, to one application scenarios of service provider of gateway accessing, calling interface can be service interface mark
Know;To the application scenarios of gateway accessing multiple service provider, calling interface can be service provider mark and service interface
Mark.
In embodiments herein, one to multiple associate fields, all associated characters are carried in user's call request
The combination of section can uniquely represent the business procedure of service user on gateway, and in other words, all associate fields can
Uniquely represent user's service identification.It should be noted that user's service identification and/or tune can be included in associate field
Use interface.Similar, can implement to select which content as associate field, example according to practical application scene
Such as, to the application scenarios of the service user of gateway accessing one, can by user's service identification or user's service identification and
Calling interface is used as associate field;To the application scenarios of the multiple service users of gateway accessing, can be by service user's mark
With user's service identification as associate field, it is also possible to by service user mark, user's service identification and calling interface
As associate field.
Gateway extracts all after user's call request that service user sends is received from user's call request
Associate field, generates relating value, and preserve the corresponding relation of relating value and user's service identification according to all of associate field.
In application scenes, different calling interfaces can be combined using different associate fields or associate field.
Can on gateway preset calling interface with and user's correlation rule corresponding relation, gateway can be from user's call request
In calling interface obtain corresponding user's correlation rule, according still further to the associate field specified in user's correlation rule from
Extract all of associate field in user's call request, and according to the combination specified in user's correlation rule by institute
Relevant field combination is got up.
May be referred to all associate fields length, to factors such as the rate requests of gateway processes interface interchange come select by
The mode of relating value is generated according to all associate fields, embodiments herein is not limited.If for example, all associate fields
Pattern length is shorter, then directly can make associate field combination (associate field is during only one of which associate field in itself)
It is relating value;For another example, if the length of associate field combination is more long or require that gateway quickly Processing Interface can be called,
The combination of all associate fields can be input to predetermined digest algorithm, the digest value using digest algorithm output is used as association
Value.Digest algorithm can be CRC (Cyclic Redundancy Check, CRC), MD (Message-Digest
Algorithm, Message Digest 5), SHA (Secure Hash Algorithm, Secure Hash Algorithm) etc..Need explanation
It is that in above-mentioned two example, if only one of which associate field, associate field combination is the associate field in itself.
When only one of which service user in the application scenarios where the embodiment of the present application or the industry of each service user
When business mark will not be identical, gateway can directly preserve the corresponding relation of relating value and user's service identification.If each takes
The service identification of business user may be identical, then two database tables can be used on gateway:User's service identification is recorded
Table and incidence relation table preserve the corresponding relation of relating value and user's service identification.Specifically, gateway is the user
Call request generates unique index code (index code is unique in user's service identification record sheet), in user's business mark
It is the corresponding relation that major key preserves index code and user's service identification to know in record sheet with index code;After relating value is generated,
Gateway preserves the corresponding relation of relating value and the index code with relating value in incidence relation table as major key.So, by index
, can be mapped for the relating value of same user's call request and user's service identification by code.
According to the calling interface in user's call request, gateway obtains provider's service identification of the calling interface, uses
Come the business procedure being called during the service interface in service provider.According to the specific of service provider and its service interface
Realize, gateway can in different ways obtain provider's service identification, and embodiments herein is not limited.For example,
When thering is multiple to use the service interface of distinct interface mark rule (being used for generating the rule of provider's service identification), can be in net
Shut the corresponding relation for preserving calling interface and interface identifier rule, after user's call request is received, using with wherein adjust
With the corresponding interface identifier rule of interface, provider's service identification is generated.For another example, gateway can be in user's call request
Calling interface asks provider's service identification, the generation rule that the service provider as where calling interface is identified according to own service
New provider's service identification is then produced, and returns to gateway and used for it.
Step 220, based on user's call request, sends gateway and calls to the service provider with the calling interface
Request.
Based on user's call request, being called corresponding to the user using the generation of provider's service identification please for gateway
The gateway call request asked, and it is sent to the service provider in user's call request where calling interface.Gateway is called please
Seek all associate fields and provider's service identification carried in user's call request.
Gateway call request is used for, according to the specification of the service interface, entering the service interface using provider's service identification
Row is called.
Step 230, after the gateway that service provider including associate field is received from calling interface calls response, according to net
The associate field generation relating value in response is called in pass, obtains user's service identification corresponding with relating value.
Service provider receives gateway call request from calling interface, and performing has provider's business in gateway call request
The business procedure of mark, and by all associate fields in implementing result, gateway call request be encapsulated in gateway call response in, hair
Give gateway.
It is pre- on gateway in the application scenarios that different calling interfaces are combined using different associate fields or associate field
Put the corresponding relation of calling interface and provider's correlation rule, gateway can with transmission gateway call the calling interface of response according to
The corresponding relation side of the being provided correlation rule, calls according still further to the associate field specified in provider's correlation rule from gateway
Extract all of associate field in response, and according to the combination specified in provider's correlation rule by all associate fields
Combine.User's correlation rule and provider's correlation rule of same calling interface can be based on identical associate field
Content, the associate field combination of generation identical.
By the way of same with step 210, gateway calls the combination producing of associate field in response to close according to gateway
Connection value, using the relating value preserved in step 210 and the corresponding relation of user's service identification, obtains the gateway and calls response
Reply user's mark of object (servicing the business procedure of user).Gateway using user's service identification record sheet and
Incidence relation table is come in the application scenarios for preserving relating value and user's service identification corresponding relation, gateway is called according to gateway
In response after the combination producing relating value of associate field, index code corresponding with the relating value is first searched in incidence relation table,
Again to lookup user's service identification corresponding with the index code in user's service identification record sheet, you can obtain being associated with this
It is worth corresponding user's service identification.
Step 240, response is called based on gateway, and being sent to service user includes that the user of user's service identification adjusts
With response.
Based on gateway calls response by gateway, response is called corresponding to the gateway using the generation of user's service identification
User calls response, and is sent to the service user of the user's call request for initiating corresponding.User calls response
In carry implementing result and the user's service identification that service interface is called, for service user recognize that the user calls sound
It should be the response to which user's call request.
Gateway can recognize that corresponding gateway call request and gateway are called by carrying identical associate field
Response, recognizes that corresponding service user's call request kimonos is make sure use by carrying identical user service identification
Call response in side.
It can be seen that, in embodiments herein, gateway according to will be in user's call request unique represent user's business
The associate field generation relating value of mark, and associate field is carried in the gateway call request initiated to service provider,
Service provider is returned to the gateway with associate field and call response, closed by the way that relating value is corresponding with user's service identification
System, returns to the user with user's service identification and calls response such that it is able to user is respectively adopted to service user
Service identification and provider's service identification service the business procedure of user and service provider, it is to avoid service is made
With the full table scan of party database, the decline of database manipulation speed is not resulted in.
In an application example of the application, multiple service user and multiple service providers access same net
Close, each service user and each service provider have respective business serial number (service identification) create-rule, service
The service interface that provider is available for calling to outside open system.When service, user calls certain to take in certain business procedure
During the service interface of business provider, the interaction flow of service user, gateway and the service provider is as shown in Figure 3.
Service user generates user's business serial number according to point storehouse point table rule of its own system, by user's business
Serial number, service user mark, service provider mark and service interface identifier are encapsulated in user's call request, are sent
To gateway.Wherein, calling interface is that service provider is identified and service interface identifier.
Safeguard there is user's contingency table and provider's contingency table on gateway, be respectively intended to for preserving calling interface and using
The corresponding relation and calling interface of square correlation rule and the corresponding relation of provider's correlation rule.Gateway receives user's tune
After with request, service provider mark and service interface identifier are therefrom extracted, found in user's contingency table for the tune
With user's correlation rule of interface, i.e.,:Associated characters are designated with user's mark, user's business serial number and provider
Section, and combined by associate field of above-mentioned sequential combination.Gateway is according to user's correlation rule from user's call request
Extract user's mark, user's business serial number and provider to identify and generate associate field combination, associate field is combined
MD5 (Message Digest Algorithm 5, Message Digest 5 the 5th edition) value as relating value.
Gateway is that user's call request generates index code, with index code as major key, index code and the user is adjusted
It is stored in user's Business Stream water meter with the corresponding relation of the user's business serial number in request;With relating value as major key,
The corresponding relation of relating value and the index code is stored in incidence relation table.
Gateway generates provider's Business Stream according to provider's serial number create-rule (interface identifier rule) of calling interface
Water number.
Gateway is marked user's mark, user's business serial number, provider based on user's call request
Other business information in knowledge, provider's business serial number and user's call request are encapsulated in gateway call request, are sent out
Service provider where giving the calling interface.
Service provider performs the business mistake of the calling interface using provider's business serial number according to gateway call request
Journey, obtains implementing result.Service provider identifies implementing result, user, user's business serial number and provider are identified
Be encapsulated in gateway call response in, gateway is replied to by the calling interface.
Gateway searches provider's contingency table, the side's of being provided correlation rule to receive the calling interface that gateway calls response.
Provider's correlation rule matches with user's correlation rule of same calling interface, i.e.,:With user's mark, user's industry
Business serial number and provider are designated associate field, and are combined by associate field of above-mentioned sequential combination.Gateway is according to provider
Correlation rule, extracts user's mark, user's business serial number and provider and identifies, and generate pass in calling response from gateway
Connection field combination.Gateway calculates the MD5 values of associate field combination, as relating value.
Gateway searches incidence relation table with relating value, obtains index code;User's business is searched with the index code of gained again
Flowing water table, obtains user's business serial number.
Based on gateway calls response by the gateway, user's business serial number, implementing result are encapsulated in user and are adjusted
With the service user in response, being sent to the user's call request for initiating to carry user's business serial number.
Service user determines the business procedure of the application implementing result according to user's business serial number, and according to its industry
Business logic carries out follow-up business treatment.
Corresponding with the realization of above-mentioned flow, it is different that embodiments herein additionally provides a kind of service interface applied on gateway
Step realizes device.The device can be realized by software, it is also possible to the reality by way of hardware or software and hardware combining
It is existing.It is by CPU (the Central Process of place equipment as the device on logical meaning as a example by implemented in software
Unit, central processing unit) corresponding computer program instructions are read run in internal memory what is formed.From for hardware view,
In addition to the CPU shown in Fig. 4, internal memory and nonvolatile memory, service interface asynchronous call realize device where
Equipment generally also including for carrying out the chip etc. of wireless signal transmitting-receiving other hardware, and/or for realizing network communicating function
Other hardware such as board.
A kind of service interface asynchronous call that Fig. 5 show the embodiment of the present application offer realizes device, applies and is accessing
One services on user and a gateway to multiple service providers to multiple, and described device includes that user's request is processed
Unit, user's request pass on unit, gateway response processing unit and gateway response and pass on unit, wherein:
User's requesting processing is used to receive from service user, including calling interface and user's business mark
After user's call request of knowledge, according at least one associate field generation relating value in user's call request, association is preserved
Value and the corresponding relation of user's service identification, provider's service identification is obtained according to calling interface;All associate fields
User's service identification can uniquely be represented;
User's request passs on unit for based on user's call request, to the service offer with the calling interface
Side sends gateway call request, and the gateway call request includes provider's service identification and all associate fields;
Gateway response processing unit is used to be called in the gateway for receiving service provider including associate field from calling interface
After response, called the associate field in response to generate relating value according to gateway, obtain user's business mark corresponding with relating value
Know;
Gateway response passs on unit for calling response based on gateway, and being sent to service user includes user's business mark
The user of knowledge calls response.
Optionally, user's requesting processing preserves the corresponding relation of relating value and user's service identification, bag
Include:For user's call request generates unique index code and in user's service identification record sheet based on index code
Key preserves the corresponding relation of index code and user's service identification, and relating value is preserved by major key of relating value in incidence relation table
With the corresponding relation of index code;The gateway response processing unit obtains user's service identification corresponding with relating value, including:
Index code corresponding with relating value is searched in incidence relation table, is searched in user's service identification record sheet and the index
The corresponding user's service identification of code.
Optionally, the relating value is combined as input with all associate fields, is generated using predetermined digest algorithm.
Optionally, user's requesting processing obtains provider's service identification according to calling interface, including:According to
Interface identifier rule corresponding with calling interface, generates provider's service identification.
In one example, user's requesting processing is according at least one associate field in user's call request
Generation relating value, including:According to the association that user's correlation rule corresponding with calling interface in user's call request is specified
Field and the combination specified, are combined, and use associate field after extracting associate field from user's call request
Combination producing relating value;The gateway response processing unit calls the associate field in response to generate relating value, bag according to gateway
Include:According to receiving the associate field and specify that the gateway calls the corresponding provider's correlation rule of the calling interface of response to specify
Combination, be combined after extracting associate field in calling response from gateway, and using the association of associate field combination producing
Value.
In above-mentioned example, user's service identification includes:User's business serial number, provider's service identification
Including:Provider's business serial number;The associate field includes:User's mark, user's business serial number and provider's mark
Know.
The preferred embodiment of the application is the foregoing is only, is not used to limit the application, all essences in the application
Within god and principle, any modification, equivalent substitution and improvements done etc. should be included within the scope of the application protection.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net
Network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium
Example.
Computer-readable medium includes that permanent and non-permanent, removable and non-removable media can be by any method
Or technology realizes information Store.Information can be computer-readable instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus
Or any other non-transmission medium, can be used to store the information that can be accessed by a computing device.Defined according to herein, calculated
Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
Also, it should be noted that term " including ", "comprising" or its any other variant be intended to nonexcludability
Comprising so that process, method, commodity or equipment including a series of key elements not only include those key elements, but also wrapping
Include other key elements being not expressly set out, or also include for this process, method, commodity or equipment is intrinsic wants
Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described
Also there is other identical element in process, method, commodity or the equipment of element.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer program product.
Therefore, the application can be using the embodiment in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Form.And, the application can be used to be can use in one or more computers for wherein including computer usable program code and deposited
The shape of the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.