CN105183672A - Self-adaptive interface calling method and system - Google Patents

Self-adaptive interface calling method and system Download PDF

Info

Publication number
CN105183672A
CN105183672A CN201510484840.4A CN201510484840A CN105183672A CN 105183672 A CN105183672 A CN 105183672A CN 201510484840 A CN201510484840 A CN 201510484840A CN 105183672 A CN105183672 A CN 105183672A
Authority
CN
China
Prior art keywords
interface
service message
service
message template
field
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.)
Granted
Application number
CN201510484840.4A
Other languages
Chinese (zh)
Other versions
CN105183672B (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 Si Tech Information Technology Co Ltd
Original Assignee
Beijing Si Tech Information Technology 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 Si Tech Information Technology Co Ltd filed Critical Beijing Si Tech Information Technology Co Ltd
Priority to CN201510484840.4A priority Critical patent/CN105183672B/en
Publication of CN105183672A publication Critical patent/CN105183672A/en
Application granted granted Critical
Publication of CN105183672B publication Critical patent/CN105183672B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The present invention relates to a self-adaptive interface calling method and system. The method comprises: acquiring a service type and a key field according to an interface calling request sent by a peripheral system, wherein the interface calling request is used for making a request for calling a service interface; querying a configuration file according to the service type, acquiring a base template of a message from the configuration file, and generating a service message template according to the base template; according to the configuration file, determining whether the service message template contains the key field, and verifying whether the key field is complete according to the configuration file when the service message template contains the key field; when the key field is complete, acquiring a secondary field by use of the service message template; generating a service message according to the verified compete key field and the acquired secondary field; and calling the service interface requested to be called in the interface calling request according to the service message. According to the adaptive interface method and system provided by the present invention, a development testing online workload is reduced, development difficulty is reduced and service interface deployment is better facilitated.

Description

A kind of adaptive interface interchange method and system
Technical field
The present invention relates to interface interchange technical field, particularly the adaptive interface interchange method and system of one.
Background technology
Sichuan CRM/BOSS system has carried out the renewal of large paper edition, and in upgrading exploitation and debug process, because peripheral interface calling platform is many, business is many.And new system have employed the message of xml form, cause peripheral interface manufacturer problem in message organizational process continuous, development difficulty doubles.
Because the situation of multi-to-multi appears in interface, and there is business difference, the interface that argument structure is close.Cause peripheral interface producer development& testing interface to be obscured, mistuning, the situation of misadjustment is a lot.
Summary of the invention
Technical matters to be solved by this invention be to provide a kind of can the adaptive interface interchange method and system of Automatically invoked interface.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of adaptive interface interchange method, comprising:
The interface interchange acquisition request type of service sent according to peripheral system and critical field, described interface interchange request is used for request call business interface;
According to type of service query configuration file, from described configuration file, obtain the foundation forms of message, and generate service message template according to foundation forms;
Judge whether comprise critical field in service message template according to configuration file, when comprising critical field in service message template, whether complete according to configuration file check key section;
When critical field is complete, service message template is utilized to obtain secondary field;
Secondary field according to complete critical field and acquisition after verification generates service message;
The business interface of request call in described interface interchange request is called according to service message.
The invention has the beneficial effects as follows: the present invention has subtracted few development and testing and to have reached the standard grade workload, reduces development difficulty, and business interface is disposed and is more prone to.
On the basis of technique scheme, the present invention can also do following improvement.
Further, the described service message template acquisition secondary field that utilizes comprises: the default value set in the service message template obtained obtaining secondary field, utilizing service message template to obtain secondary field by database access, utilize service message template by file acquisition secondary field, utilizing service message template to obtain secondary field by interface acquisition secondary field with by calculating.
Further, the type of described secondary field comprises numeric type, character string type and xml type.
Further, the described mode calling the business interface of request call in described interface interchange request according to service message comprises: utilize the network address to call business interface, utilize the network port to call business interface and utilize service name to call business interface.
Further, described method also comprises: if when critical field is imperfect, directly return mistake.
Further, a kind of adaptive interface interchange system, comprising:
First acquisition module, for the interface interchange acquisition request type of service that sends according to peripheral system and critical field, described interface interchange request is used for request call business interface;
Query generation module, for according to type of service query configuration file, obtains the foundation forms of message from described configuration file, and generates service message template according to foundation forms;
Whether judge module is for judging whether comprise critical field in service message template according to configuration file, when comprising critical field in service message template, complete according to configuration file check key section;
Second acquisition module, for when critical field is complete, utilizes service message template to obtain secondary field;
Generation module, generates service message for the secondary field according to complete critical field and acquisition after verification;
Calling module, for the business interface according to request call in service message interface interchange request to be called.
Further, described second acquisition module comprises: when critical field is complete, and the default value set in the service message template obtained obtaining secondary field, utilizing service message template to obtain secondary field by database access, utilize service message template by file acquisition secondary field, utilizing service message template to obtain secondary field by interface acquisition secondary field with by calculating.
Further, the type of described secondary field comprises numeric type, character string type and xml type.
Further, described calling module comprises: utilize the network address to call business interface, utilize the network port to call business interface and utilize service name to call business interface.
Further, described system also comprises:
Return module, for when critical field is imperfect, directly return mistake.
Accompanying drawing explanation
Fig. 1 is the inventive method flow chart of steps;
Fig. 2 is present system structural drawing.
In accompanying drawing, the list of parts representated by each label is as follows:
1, the first acquisition module, 2, query generation module, 3, judge module, the 4, second acquisition module, 5, generation module, 6, calling module, 7, return module.
Embodiment
Be described principle of the present invention and feature below in conjunction with accompanying drawing, example, only for explaining the present invention, is not intended to limit scope of the present invention.
Embodiment 1
As shown in Figure 1, a kind of adaptive interface interchange method, comprising:
The interface interchange acquisition request type of service sent according to peripheral system and critical field, described interface interchange request is used for request call business interface;
According to type of service query configuration file, from described configuration file, obtain the foundation forms of message, and generate service message template according to foundation forms;
Judge whether comprise critical field in service message template according to configuration file, when comprising critical field in service message template, whether complete according to configuration file check key section;
When critical field is complete, service message template is utilized to obtain secondary field;
Secondary field according to complete critical field and acquisition after verification generates service message;
The business interface of request call in described interface interchange request is called according to service message.
The described service message template acquisition secondary field that utilizes comprises: the default value set in the service message template obtained obtaining secondary field, utilizing service message template to obtain secondary field by database access, utilize service message template by file acquisition secondary field, utilizing service message template to obtain secondary field by interface acquisition secondary field with by calculating.
The type of described secondary field comprises numeric type, character string type and xml type.
The described mode calling the business interface of request call in described interface interchange request according to service message comprises: utilize the network address to call business interface, utilize the network port to call business interface and utilize service name to call business interface.
Described method also comprises: if when critical field is imperfect, directly return mistake.
As shown in Figure 2, a kind of adaptive interface interchange system, comprising:
First acquisition module 1, for the interface interchange acquisition request type of service that sends according to peripheral system and critical field, described interface interchange request is used for request call business interface;
Query generation module 2, for according to type of service query configuration file, obtains the foundation forms of message from described configuration file, and generates service message template according to foundation forms; Describe in described configuration file whether each field in service message template is critical field, and the verification rule of critical field.Describe the obtain manner of secondary field in described service message template, comprise and be not limited in setting default value, obtained by database access, by file acquisition, obtained by interface, by calculating the modes such as acquisition.Describe the method for calling of concrete final service interface in described service message template, include but are not limited to the network address, the network port, the relevant informations such as service name.
Whether judge module 3 is for judging whether comprise critical field in service message template according to configuration file, when comprising critical field in service message template, complete according to configuration file check key section;
Second acquisition module 4, for when critical field is complete, utilizes service message template to obtain secondary field;
Generation module 5, generates service message for the secondary field according to complete critical field and acquisition after verification; Described service message be complete verification critical field and after obtaining minor parameter by service message template split complete.
Calling module 6, for the business interface according to request call in service message interface interchange request to be called.
Described second acquisition module 4 comprises: when critical field is complete, and the default value set in the service message template obtained obtaining secondary field, utilizing service message template to obtain secondary field by database access, utilize service message template by file acquisition secondary field, utilizing service message template to obtain secondary field by interface acquisition secondary field with by calculating.
The type of described secondary field comprises numeric type, character string type and xml type.
Described calling module 6 comprises: utilize the network address to call business interface, utilize the network port to call business interface and utilize service name to call business interface.
Described system also comprises:
Return module 7, for when critical field is imperfect, directly return mistake.
The application mainly by having configured the acquisition of secondary field, realizes the acquisition of the correlation parameter of final service interface.When its main advantage is external call, required parameter reduces to and only needs a small amount of key parameter.
The change of final interface is so long as not the change of critical field simultaneously, does not all affect external interface.
Concrete in real time in, the present invention can be realized in the following ways.
1, determine important parameter and the minor parameter of each calling service according to business, important parameter is that peripheral system must provide, if disappearance cannot correct calling interface transacting business.Minor parameter is that adaptive interface can (as Query Database, modes such as calling program acquisitions) obtain by other means, and peripheral system can fill out the parameter that can not fill out.
2, peripheral system calls adaptive interface, provides type of service and important parameter.
3, adaptive interface is according to type of service query configuration, obtains the foundation forms of message.
4, generate message according to foundation forms, insert the important parameter that peripheral interface provides, and whether check key section is complete.
If 5 disappearance important parameters, directly return mistake.
If 6 important parameters are complete, the occurrence being obtained this minor parameter by the obtain manner of minor parameter configuration in template inserts message.
7, after split completes, according to the address of the interface that the final needs provided in template call, title is called finally needs the interface finishing service called to handle.
8, call further interface finishing service to call.
The present invention is the mode by configuration file, the service parameter template of configuration important parameter (parameter that peripheral interface must provide) and minor parameter (adaptive interface can be obtained by important parameter inquiry), whether be important parameter, if the clear and definite obtain manner of minor parameter if marking clear and definite parameters.Peripheral system calls this intermediary interface, and intermediary interface is inner to enter to join message by the concrete business of template generation.Then concrete business interface finishing service flow process is called.
Configuration mode of the present invention:
1, determine important parameter and the minor parameter of interface with peripheral producer, give unique business numbering.
2, business numbering is inserted in the work_type of ginseng by peripheral producer.
3, create business interface configuration file, file is called the unique business numbering given above.
4, correlation parameter and the message template of concrete business interface is configured in business interface configuration file.
In the configuration file catalogue of the server 5, configuration file uploaded.
6, configuration is completed.
Maintenance mode of the present invention:
1, interface rolls off the production line the configuration file directly deleted on server.
2, the configuration file on server is directly revised in interface adjustment.
3, new configuration file is directly uploaded onto the server by interface increase.
Points for attention of the present invention:
1, document No. must be consistent with program coding.
2, configuration file is text mode, and form and server system keep mating.
Configuration file of the present invention adopts key-value pair mode, secures the parameter name of interface interchange.And will enter to join message xmlization, obtain manner is defined in minor parameter, important parameter and minor parameter can be distinguished, intermediary interface is by important parameter configuration verification, fill in important parameter, intermediary interface obtains occurrence by minor parameter configuration, and configuration file, for be set to unix form according to server conditions, is encoded to GBK.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. an adaptive interface interchange method, is characterized in that, comprising:
The interface interchange acquisition request type of service sent according to peripheral system and critical field, described interface interchange request is used for request call business interface;
According to type of service query configuration file, from described configuration file, obtain the foundation forms of message, and generate service message template according to foundation forms;
Judge whether comprise critical field in service message template according to configuration file, when comprising critical field in service message template, whether complete according to configuration file check key section;
When critical field is complete, service message template is utilized to obtain secondary field;
Secondary field according to complete critical field and acquisition after verification generates service message;
The business interface of request call in described interface interchange request is called according to service message.
2. adaptive interface call method according to claim 1, it is characterized in that, the described service message template acquisition secondary field that utilizes comprises: the default value set in the service message template obtained obtaining secondary field, utilizing service message template to obtain secondary field by database access, utilize service message template by file acquisition secondary field, utilizing service message template to obtain secondary field by interface acquisition secondary field with by calculating.
3. adaptive interface call method according to claim 1, is characterized in that, the type of described secondary field comprises numeric type, character string type and xml type.
4. adaptive interface call method according to claim 1, it is characterized in that, the described mode calling the business interface of request call in described interface interchange request according to service message comprises: utilize the network address to call business interface, utilize the network port to call business interface and utilize service name to call business interface.
5. adaptive interface call method according to claim 1, is characterized in that, described method also comprises: if when critical field is imperfect, directly return mistake.
6. an adaptive interface interchange system, is characterized in that, comprising:
First acquisition module, for the interface interchange acquisition request type of service that sends according to peripheral system and critical field, described interface interchange request is used for request call business interface;
Query generation module, for according to type of service query configuration file, obtains the foundation forms of message from described configuration file, and generates service message template according to foundation forms;
Whether judge module is for judging whether comprise critical field in service message template according to configuration file, when comprising critical field in service message template, complete according to configuration file check key section;
Second acquisition module, for when critical field is complete, utilizes service message template to obtain secondary field;
Generation module, generates service message for the secondary field according to complete critical field and acquisition after verification;
Calling module, for the business interface according to request call in service message interface interchange request to be called.
7. adaptive interface calling system according to claim 6, it is characterized in that, described second acquisition module comprises: when critical field is complete, and the default value set in the service message template obtained obtaining secondary field, utilizing service message template to obtain secondary field by database access, utilize service message template by file acquisition secondary field, utilizing service message template to obtain secondary field by interface acquisition secondary field with by calculating.
8. adaptive interface calling system according to claim 6, is characterized in that, the type of described secondary field comprises numeric type, character string type and xml type.
9. adaptive interface calling system according to claim 6, is characterized in that, described calling module comprises: utilize the network address to call business interface, utilize the network port to call business interface and utilize service name to call business interface.
10. adaptive interface calling system according to claim 6, is characterized in that, described system also comprises:
Return module, for when critical field is imperfect, directly return mistake.
CN201510484840.4A 2015-08-07 2015-08-07 A kind of adaptive interface call method and system Active CN105183672B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510484840.4A CN105183672B (en) 2015-08-07 2015-08-07 A kind of adaptive interface call method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510484840.4A CN105183672B (en) 2015-08-07 2015-08-07 A kind of adaptive interface call method and system

Publications (2)

Publication Number Publication Date
CN105183672A true CN105183672A (en) 2015-12-23
CN105183672B CN105183672B (en) 2018-09-11

Family

ID=54905762

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510484840.4A Active CN105183672B (en) 2015-08-07 2015-08-07 A kind of adaptive interface call method and system

Country Status (1)

Country Link
CN (1) CN105183672B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106484421A (en) * 2016-10-11 2017-03-08 武汉斗鱼网络科技有限公司 A kind of method and system quickly generating api interface
CN106960348A (en) * 2017-03-24 2017-07-18 泰华智慧产业集团股份有限公司 Pay docking calculation and pay docking system
CN107528839A (en) * 2017-08-18 2017-12-29 深圳乐信软件技术有限公司 The collocation method and device of a kind of interface packets
CN109586979A (en) * 2018-12-29 2019-04-05 中国银行股份有限公司 A kind of message transmitting method and device
CN109783249A (en) * 2018-12-13 2019-05-21 中国平安财产保险股份有限公司 Platform cut-in method and device, terminal and computer readable storage medium
CN110730107A (en) * 2019-09-02 2020-01-24 深圳壹账通智能科技有限公司 Test data generation method and device, computer equipment and storage medium
CN112416457A (en) * 2020-11-19 2021-02-26 中国建设银行股份有限公司 Interface configuration file generation method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102082812A (en) * 2009-12-01 2011-06-01 华为技术有限公司 Method, device and system for supporting file transfer between domain systems
US20110137958A1 (en) * 2009-12-09 2011-06-09 Linkage Technology Group Co., Ltd. Implementation Method of DATACOM Data Command Platform
CN104717179A (en) * 2013-12-13 2015-06-17 中国移动通信集团河南有限公司 Communication service processing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102082812A (en) * 2009-12-01 2011-06-01 华为技术有限公司 Method, device and system for supporting file transfer between domain systems
US20110137958A1 (en) * 2009-12-09 2011-06-09 Linkage Technology Group Co., Ltd. Implementation Method of DATACOM Data Command Platform
CN104717179A (en) * 2013-12-13 2015-06-17 中国移动通信集团河南有限公司 Communication service processing method and device

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106484421A (en) * 2016-10-11 2017-03-08 武汉斗鱼网络科技有限公司 A kind of method and system quickly generating api interface
CN106960348A (en) * 2017-03-24 2017-07-18 泰华智慧产业集团股份有限公司 Pay docking calculation and pay docking system
CN106960348B (en) * 2017-03-24 2020-07-03 泰华智慧产业集团股份有限公司 Payment docking method and payment docking system
CN107528839A (en) * 2017-08-18 2017-12-29 深圳乐信软件技术有限公司 The collocation method and device of a kind of interface packets
CN109783249A (en) * 2018-12-13 2019-05-21 中国平安财产保险股份有限公司 Platform cut-in method and device, terminal and computer readable storage medium
CN109783249B (en) * 2018-12-13 2024-04-30 中国平安财产保险股份有限公司 Platform access method and device, terminal and computer readable storage medium
CN109586979A (en) * 2018-12-29 2019-04-05 中国银行股份有限公司 A kind of message transmitting method and device
CN109586979B (en) * 2018-12-29 2022-01-21 中国银行股份有限公司 Message transmission method and device
CN110730107A (en) * 2019-09-02 2020-01-24 深圳壹账通智能科技有限公司 Test data generation method and device, computer equipment and storage medium
CN112416457A (en) * 2020-11-19 2021-02-26 中国建设银行股份有限公司 Interface configuration file generation method and device
CN112416457B (en) * 2020-11-19 2024-08-20 中国建设银行股份有限公司 Interface configuration file generation method and device

Also Published As

Publication number Publication date
CN105183672B (en) 2018-09-11

Similar Documents

Publication Publication Date Title
CN105183672A (en) Self-adaptive interface calling method and system
CN115599870B (en) Data synchronization method based on fusion of stock data and incremental data of message queue
CN102446303B (en) Distribution method and device of process route assembly
CN110968653B (en) Tree-shaped data dictionary maintenance system and method
CN108509599B (en) Data model creating method and device
CN105868196A (en) Method for generating industrial data report in server
CN112308727A (en) Insurance claim settlement service processing method and device
CN103488562A (en) Automated testing method and device
CN108075911B (en) Service testing method and device
CN103078952A (en) Automatic deployment method for cloud resources at cloud resource tenant end
CN105868170A (en) Method for generating industrial data report in server
CN105550431A (en) Three-dimensional layout design data integration method and system for nuclear power plant
CN117632904A (en) Model-driven data synchronization method and system
CN107578192A (en) The operation indicator monitoring method of aviation settlement system
CN111381864A (en) Configuration method and device of software system
CN109522595A (en) A kind of functional diagram importing automatic diagnosis method based on nuclear power plant's verification platform
CN102546334B (en) Data resource uniqueness combining method based on enterprise service bus
CN110910008B (en) One-key cost accounting management system and management method for visual accounting flow
CN112256978B (en) Data processing method, device and medium based on data model
CN112084278B (en) Verification method and device for map data conversion customized product
CN101426220A (en) Method, apparatus and system for base station cutover
CN103577746A (en) XML configuration-based detection method for authorization difference between information systems
CN111090710B (en) Distribution network multi-time scale graph-model abnormal automatic maintenance method
CN105354144A (en) Method and system for automatically testing consistency of business support system information models
CN105183967A (en) Report generation system and method for fire-fighting engineering computer aided design

Legal Events

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