CN105183672B - A kind of adaptive interface call method and system - Google Patents

A kind of adaptive interface call method and system Download PDF

Info

Publication number
CN105183672B
CN105183672B CN201510484840.4A CN201510484840A CN105183672B CN 105183672 B CN105183672 B CN 105183672B CN 201510484840 A CN201510484840 A CN 201510484840A CN 105183672 B CN105183672 B CN 105183672B
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.)
Active
Application number
CN201510484840.4A
Other languages
Chinese (zh)
Other versions
CN105183672A (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 kind of adaptive interface call methods and system, including:Type of service and critical field are obtained according to the interface call request that peripheral system is sent, the interface call request is used for request call business interface;According to type of service query configuration file, the foundation forms of message is obtained from the configuration file, and service message template is generated according to foundation forms;Judge in service message template whether to include critical field according to configuration file, it is whether complete according to configuration file check key section when including critical field in service message template;When critical field is complete, secondary field is obtained using service message template;Service message is generated according to complete critical field after verification and the secondary field of acquisition;The business interface of request call in the interface call request is called according to service message.The present invention has subtracted few exploitation and has tested workload of reaching the standard grade, and reduces development difficulty, and business interface deployment is more prone to.

Description

A kind of adaptive interface call method and system
Technical field
The present invention relates to interface calling technology field, more particularly to a kind of adaptive interface call method and system.
Background technology
Sichuan CRM/BOSS systems have carried out the update of big version, in upgrading exploitation and debugging process, since periphery connects Mouth calling platform is more, and business is more.And new system uses the message of xml formats, causes peripheral interface manufacturer in message tissue mistake Problem is continuous in journey, development difficulty multiplication.
Since there is the case where multi-to-multi in interface, and there are business difference, interface similar in argument structure.Periphery is caused to connect There are many case where exploitation of mouth producer and test interface are obscured, mistuning, misadjustment.
Invention content
Technical problem to be solved by the invention is to provide a kind of adaptive interface calling for capableing of automatic calling interface Method and system.
The technical solution that the present invention solves above-mentioned technical problem is as follows:A kind of adaptive interface call method, including:
Type of service and critical field, the interface call request are obtained according to the interface call request that peripheral system is sent For request call business interface;
According to type of service query configuration file, the foundation forms of message is obtained from the configuration file, and according to base Plinth template generation service message template;
Judge in service message template whether to include critical field according to configuration file, pass is included in service message template It is whether complete according to configuration file check key section when key field;
When critical field is complete, secondary field is obtained using service message template;
Service message is generated according to complete critical field after verification and the secondary field of acquisition;
The business interface of request call in the interface call request is called according to service message.
The beneficial effects of the invention are as follows:The present invention has subtracted few exploitation and has tested workload of reaching the standard grade, and reduces development difficulty, business Interface deployment is more prone to.
Based on the above technical solution, the present invention can also be improved as follows.
Further, described to include using service message template acquisition secondary field:It is set in the service message template of acquisition Fixed default value obtains secondary field, obtains secondary field by database access using service message template, utilizes industry Business message template by interface acquisition secondary field and passes through calculating by file acquisition secondary field, using service message template Obtain secondary field.
Further, the type of the secondary field includes numeric type, character string type and xml types.
Further, the mode that the business interface of request call in the interface call request is called according to service message Including:Business interface is called using network address, business interface is called using the network port and calls business using service name Interface.
Further, the method further includes:If critical field is imperfect, mistake is directly returned.
Further, a kind of adaptive interface calling system, including:
First acquisition module, the interface call request for being sent according to peripheral system obtain type of service and keyword Section, the interface call request are used for request call business interface;
Query generation module, for according to type of service query configuration file, message to be obtained from the configuration file Foundation forms, and service message template is generated according to foundation forms;
Judgment module, for judging in service message template whether to include critical field according to configuration file, in business report It is whether complete according to configuration file check key section when in literary template including critical field;
Second acquisition module, for when critical field is complete, secondary field to be obtained using service message template;
Generation module, for generating service message according to complete critical field after verification and the secondary field of acquisition;
Calling module, for the business interface according to request call in service message interface call request to be called.
Further, second acquisition module includes:When critical field is complete, set in the service message template of acquisition Fixed default value obtains secondary field, obtains secondary field by database access using service message template, utilizes business report Literary template is obtained by file acquisition secondary field, using service message template by interface acquisition secondary field and by calculating Secondary field.
Further, the type of the secondary field includes numeric type, character string type and xml types.
Further, the calling module includes:Business interface is called using network address, calls business using the network port Interface and utilization service name call business interface.
Further, the system also includes:
Module is returned to, for when critical field is imperfect, directly returning to mistake.
Description of the drawings
Fig. 1 is the method for the present invention flow chart of steps;
Fig. 2 is present system structure chart.
In attached drawing, parts list represented by the reference numerals are as follows:
1, the first acquisition module, 2, query generation module, 3, judgment module, the 4, second acquisition module, 5, generation module, 6, Calling module, 7, return module.
Specific implementation mode
The principle and features of the present invention will be described below with reference to the accompanying drawings, and the given examples are served only to explain the present invention, and It is non-to be used to limit the scope of the present invention.
Embodiment 1
As shown in Figure 1, a kind of adaptive interface call method, including:
Type of service and critical field, the interface call request are obtained according to the interface call request that peripheral system is sent For request call business interface;
According to type of service query configuration file, the foundation forms of message is obtained from the configuration file, and according to base Plinth template generation service message template;
Judge in service message template whether to include critical field according to configuration file, pass is included in service message template It is whether complete according to configuration file check key section when key field;
When critical field is complete, secondary field is obtained using service message template;
Service message is generated according to complete critical field after verification and the secondary field of acquisition;
The business interface of request call in the interface call request is called according to service message.
It is described to include using service message template acquisition secondary field:The acquiescence set in the service message template of acquisition Value obtains secondary field, obtains secondary field by database access using service message template, utilizes service message mould Plate obtains secondary by file acquisition secondary field, using service message template by interface acquisition secondary field and by calculating Field.
The type of the secondary field includes numeric type, character string type and xml types.
It is described to call the mode of the business interface of request call in the interface call request to include according to service message:Profit Business interface is called, business interface is called using the network port and is called business interface using service name with network address.
The method further includes:If critical field is imperfect, mistake is directly returned.
As shown in Fig. 2, a kind of adaptive interface calling system, including:
First acquisition module 1, the interface call request for being sent according to peripheral system obtain type of service and keyword Section, the interface call request are used for request call business interface;
Query generation module 2, for according to type of service query configuration file, message to be obtained from the configuration file Foundation forms, and service message template is generated according to foundation forms;It is described in the configuration file each in service message template A field whether be critical field and critical field verification rule.Secondary field is described in the service message template Acquisition modes, including be not limited in setting default value, it is obtained by database access, by file acquisition, is obtained by interface It takes, by calculating the modes such as acquisition.The method of calling of specific final service interface is described in the service message template, including But it is not limited only to network address, the network port, the relevant informations such as service name.
Judgment module 3, for judging in service message template whether to include critical field according to configuration file, in business report It is whether complete according to configuration file check key section when in literary template including critical field;
Second acquisition module 4, for when critical field is complete, secondary field to be obtained using service message template;
Generation module 5, for generating service message according to complete critical field after verification and the secondary field of acquisition;Institute It is that split is completed after completing the critical field of verification and obtaining minor parameter by service message template to state service message.
Calling module 6, for the business interface according to request call in service message interface call request to be called.
Second acquisition module 4 includes:When critical field is complete, what is set in the service message template of acquisition is silent Recognize value to obtain secondary field, obtain secondary field by database access using service message template, utilize service message template By file acquisition secondary field, secondary field is obtained by interface using service message template and obtains secondary word by calculating Section.
The type of the secondary field includes numeric type, character string type and xml types.
The calling module 6 includes:Using network address call business interface, using the network port call business interface and Business interface is called using service name.
The system also includes:
Module 7 is returned to, for when critical field is imperfect, directly returning to mistake.
The application is mainly that the acquisition of secondary field is completed by configuring, and realizes obtaining for the relevant parameter of final service interface It takes.Its main advantage is that parameter required when external call is reduced to and only needs a small amount of key parameter.
The change of final interface does not all influence external interface only if it were not for the change of critical field simultaneously.
In specifically in real time, following manner may be used and realize the present invention.
1, determine that the important parameter and minor parameter of each calling service, important parameter are that peripheral system is necessary according to business It provides, if missing will be unable to correct calling interface transacting business.Minor parameter is that adaptive interface can be by its other party What formula obtained (such as inquiry database, the modes such as caller acquisition), peripheral system can fill out the parameter that can not be filled out.
2, peripheral system calls adaptive interface, provides type of service and important parameter.
3, adaptive interface obtains the foundation forms of message according to type of service query configuration.
4, whether message, the important parameter that filling peripheral interface provides, and check key section are generated according to foundation forms Completely.
If 5, lacking important parameter, mistake is directly returned.
If 6, important parameter is complete, the acquisition modes configured by minor parameter in template obtain the tool of the minor parameter Body value inserts message.
7, after the completion of split, according to the address of the interface for finally needing to call provided in template, title, which is called, finally to be needed The interface finishing service to be called is handled.
8, further interface finishing service is called to call.
The present invention is the configuration important parameter (parameter that peripheral interface must provide) and secondary by way of configuration file Whether the service parameter template of parameter (adaptive interface can be obtained by important parameter inquiry), mark clear parameters For important parameter, if it is the clear acquisition modes of minor parameter.Peripheral system calls this intermediary interface, passes through inside intermediary interface The specific business of template generation enters to join message.Then specific business interface finishing service flow is called.
The configuration mode of the present invention:
1, the important parameter and minor parameter that interface is determined with peripheral producer give unique business number.
2, peripheral producer inserts business number in the work_type of ginseng.
3, business interface configuration file is created, the unique business number that the entitled front of file is given.
4, the relevant parameter and message template of specific business interface are configured in business interface configuration file.
5, in the configuration file catalogue for the server for uploading configuration file.
6, configuration is completed.
The maintenance mode of the present invention:
1, the offline configuration file directly deleted on server of interface.
2, the configuration file on server is directly changed in interface adjustment.
3, interface increase directly uploads onto the server new configuration file.
The points for attention of the present invention:
1, document No. must be consistent with program coding.
2, configuration file is text mode, and format is matched with server system holding.
The configuration file of the present invention uses key-value pair mode, secures the parameter name of interface calling.And it will enter to join message Xmlization defines acquisition modes in minor parameter, and important parameter and minor parameter can be distinguished, and intermediary interface passes through important parameter Important parameter is filled in configuration verification, and intermediary interface is configured by minor parameter obtains occurrence, and configuration file is according to server Situation is set as unix formats, is encoded to GBK.
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention.

Claims (8)

1. a kind of adaptive interface call method, which is characterized in that including:
The interface call request sent according to peripheral system obtains type of service and critical field, the interface call request are used for Request call business interface;
According to type of service query configuration file, the foundation forms of message is obtained from the configuration file, and according to basic mould Plate generates service message template, wherein the method for calling of specific final service interface is described in the service message template;
Judge in service message template whether to include critical field according to configuration file, includes keyword in service message template Whether Duan Shi is complete according to configuration file check key section;
When critical field is complete, secondary field is obtained using service message template, wherein described to be obtained using service message template The secondary field is taken to include:The default value set in the service message template of acquisition obtains secondary field, utilizes service message mould Plate obtains secondary field by database access, obtains secondary field by database access using service message template, utilizes Service message template obtains secondary field by interface and obtains secondary field by calculating;
Service message is generated according to complete critical field after verification and the secondary field of acquisition;
The business interface of request call in the interface call request is called according to service message.
2. a kind of adaptive interface call method according to claim 1, which is characterized in that the class of the secondary field Type includes numeric type, character string type, wherein the character string type includes xml types.
3. a kind of adaptive interface call method according to claim 1, which is characterized in that described according to service message The mode of the business interface of request call in the interface call request is called to include:Using network address call business interface, Business interface is called using the network port and calls business interface using service name.
4. a kind of adaptive interface call method according to claim 1, which is characterized in that the method further includes: If critical field is imperfect, mistake is directly returned.
5. a kind of adaptive interface calling system, which is characterized in that including:
First acquisition module, the interface call request for being sent according to peripheral system obtain type of service and critical field, institute Interface call request is stated for request call business interface;
Query generation module, for according to type of service query configuration file, the basis of message to be obtained from the configuration file Template, and service message template is generated according to foundation forms, wherein describe specific final service in the service message template The method of calling of interface;
Judgment module, for judging in service message template whether to include critical field according to configuration file, in service message mould It is whether complete according to configuration file check key section when in plate including critical field;
Second acquisition module, for when critical field is complete, obtaining secondary field using service message template, wherein described Second acquisition module includes:When critical field is complete, the default value acquisition set in the service message template of acquisition is secondary Field is obtained secondary field by database access using service message template, is visited by database using service message template It asks and obtains secondary field, secondary field is obtained by interface using service message template and secondary field is obtained by calculating;
Generation module, for generating service message according to complete critical field after verification and the secondary field of acquisition;
Calling module, for the business interface according to request call in service message interface call request to be called.
6. a kind of adaptive interface calling system according to claim 5, which is characterized in that the class of the secondary field Type includes numeric type, character string type, wherein the character string type includes xml types.
7. a kind of adaptive interface calling system according to claim 5, which is characterized in that the calling module packet It includes:Business interface is called using network address, business interface is called using the network port and calls business to connect using service name Mouthful.
8. a kind of adaptive interface calling system according to claim 5, which is characterized in that the system also includes:
Module is returned to, for when critical field is imperfect, directly returning to 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 CN105183672A (en) 2015-12-23
CN105183672B true 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)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106484421B (en) * 2016-10-11 2019-08-02 武汉斗鱼网络科技有限公司 A kind of method and system quickly generating api interface
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
CN109783249B (en) * 2018-12-13 2024-04-30 中国平安财产保险股份有限公司 Platform access method and device, terminal and computer readable storage medium
CN109586979B (en) * 2018-12-29 2022-01-21 中国银行股份有限公司 Message transmission method and device
CN110730107B (en) * 2019-09-02 2022-07-12 深圳壹账通智能科技有限公司 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 (2)

* 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
CN104717179A (en) * 2013-12-13 2015-06-17 中国移动通信集团河南有限公司 Communication service processing method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101751241A (en) * 2009-12-09 2010-06-23 南京联创科技集团股份有限公司 Implementation method of DATACOM (data communication) data command platform

Patent Citations (2)

* 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
CN104717179A (en) * 2013-12-13 2015-06-17 中国移动通信集团河南有限公司 Communication service processing method and device

Also Published As

Publication number Publication date
CN105183672A (en) 2015-12-23

Similar Documents

Publication Publication Date Title
CN105183672B (en) A kind of adaptive interface call method and system
US10318412B1 (en) Systems, methods, and apparatus for dynamic software generation and testing
US8356056B2 (en) Functional extensions for business objects
CN107678736A (en) A kind of business Page Template shows method, system and computer installation
TWI751139B (en) Business processing system, business processing method and business update method
CN109474578A (en) Message method of calibration, device, computer equipment and storage medium
CN102446303B (en) Distribution method and device of process route assembly
US20140359362A1 (en) Information interaction test device and method based on automatic generation of associated test cases
CN115599870B (en) Data synchronization method based on fusion of stock data and incremental data of message queue
CN110659018B (en) Method and device for realizing flow engine
CN110941630A (en) Database operation and maintenance method, device and system
CN103488562A (en) Automated testing method and device
CN112364049A (en) Data synchronization script generation method, system, terminal and storage medium
CN108075911B (en) Service testing method and device
CN104320415B (en) A kind of substation equipment kinematic insert formula specification analytic method
CN104363112B (en) A kind of parameter management method and device
CN110765749A (en) Method for intelligently generating certificate
US7296254B2 (en) System and method for using MPW integration service on demand
US6929962B1 (en) System and method for wafer acceptance test configuration
CN112084278B (en) Verification method and device for map data conversion customized product
CN102546334A (en) Data resource uniqueness combining method based on enterprise service bus
CN106559493A (en) Service issuing method and service delivery system
US9338297B2 (en) Setup application for generating custom code
CN108984355A (en) A kind of automated testing method of interface testing
CN116089517B (en) Automatic construction method and system for API (application program interface) for cloud platform

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