CN113076153B - Interface calling method and device - Google Patents

Interface calling method and device Download PDF

Info

Publication number
CN113076153B
CN113076153B CN202110336790.0A CN202110336790A CN113076153B CN 113076153 B CN113076153 B CN 113076153B CN 202110336790 A CN202110336790 A CN 202110336790A CN 113076153 B CN113076153 B CN 113076153B
Authority
CN
China
Prior art keywords
platform
field identifier
field
interface
identifier
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
CN202110336790.0A
Other languages
Chinese (zh)
Other versions
CN113076153A (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 Jingdong Zhenshi Information Technology Co Ltd
Original Assignee
Beijing Jingdong Zhenshi 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 Jingdong Zhenshi Information Technology Co Ltd filed Critical Beijing Jingdong Zhenshi Information Technology Co Ltd
Priority to CN202110336790.0A priority Critical patent/CN113076153B/en
Publication of CN113076153A publication Critical patent/CN113076153A/en
Application granted granted Critical
Publication of CN113076153B publication Critical patent/CN113076153B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses an interface calling method and device, and relates to the technical field of computers. One embodiment of the method comprises the following steps: receiving service data sent by a first platform; wherein, the business data comprises: a plurality of field identifications and attribute values thereof; determining whether a target template corresponding to the first platform exists in a plurality of pre-configured templates, and if so, acquiring an attribute value of a first field identifier from the service data according to the first field identifier in the target template; generating an interface entry of a second platform according to a corresponding relation between a pre-configured field identifier of the first platform and a field identifier of the second platform and an attribute value of the first field identifier; and calling the interface of the second platform according to the interface call-in. According to the implementation mode, the requirements of different first platforms can be met, different codes do not need to be developed, the development cost can be reduced, and the interface calling efficiency is improved.

Description

Interface calling method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an interface calling method and apparatus.
Background
Platforms typically store data in a fixed format, with different platforms typically storing data in different formats. For example, for the "days of shelf life" field, the name in the first platform is "validPeriod" and the name in the second platform is "safe days".
In the prior art, a technician needs to develop a corresponding code for a first platform, call an interface of a second platform by executing the code, and then access the data of the first platform to the second platform or update the data of the second platform.
However, when the data of different first platforms need to be accessed to the second platform, the method needs to develop different codes, the process is complicated, and the cost is high.
Disclosure of Invention
In view of this, the embodiments of the present invention provide an interface calling method and apparatus, which can meet the requirements of different first platforms, and does not need to develop different codes, so as to reduce the development cost and improve the interface calling efficiency.
In a first aspect, an embodiment of the present invention provides an interface calling method, including:
receiving service data sent by a first platform; wherein, the business data comprises: a plurality of field identifications and attribute values thereof;
determining whether a target template corresponding to the first platform exists in a plurality of pre-configured templates, and if so, acquiring an attribute value of a first field identifier from the service data according to the first field identifier in the target template;
generating an interface entry of a second platform according to a corresponding relation between a pre-configured field identifier of the first platform and a field identifier of the second platform and an attribute value of the first field identifier;
and calling the interface of the second platform according to the interface call-in.
Alternatively, the process may be carried out in a single-stage,
further comprises:
acquiring a field identifier of the second platform; wherein the field identification comprises: a field name and its hierarchical structure;
generating a packet path corresponding to the hierarchical structure of the second platform;
the generating the interface parameter of the second platform according to the corresponding relation between the field identifier of the first platform and the field identifier of the second platform and the attribute value of the first field identifier, includes:
determining a second field identifier of a second platform corresponding to a first field identifier according to a corresponding relation between a pre-configured field identifier of the first platform and the field identifier of the second platform;
determining a packet path corresponding to the second field identifier according to the packet path corresponding to the hierarchical structure of the second platform;
and generating the interface entry according to the packet path and the attribute value of the first field identifier.
Alternatively, the process may be carried out in a single-stage,
the generating the interface entry according to the packet path and the attribute value of the first field identifier includes:
creating an object according to the packet path;
a method of acquiring the object;
and assigning a value to the object according to the method of the object and the attribute value of the first field identifier to obtain the interface entry.
Alternatively, the process may be carried out in a single-stage,
the method for acquiring the object comprises the following steps:
a method of acquiring the object using reflectoasm.
Alternatively, the process may be carried out in a single-stage,
the obtaining the field identifier of the second platform includes:
loading a Jar packet based on a class loader;
scanning services under a specified path in the Jar packet;
and loading the field identification of the second platform into a dictionary pool according to the service.
Alternatively, the process may be carried out in a single-stage,
further comprises:
determining a verification rule corresponding to the target template in a preset verification rule corresponding to the template;
and verifying the attribute value of the first field identifier according to a verification rule corresponding to the target template, and if the verification is passed, executing the corresponding relation between the field identifier of the first platform and the field identifier of the second platform according to the preset configuration and the attribute value of the first field identifier to generate the interface entry of the second platform.
Alternatively, the process may be carried out in a single-stage,
further comprises:
determining a check rule corresponding to the first field identifier in a pre-configured check rule corresponding to the field identifier;
and verifying the attribute value of the first field identifier according to a verification rule corresponding to the first field identifier, and if the verification is passed, executing the corresponding relation between the field identifier of the first platform and the field identifier of the second platform according to the preset configuration and the attribute value of the first field identifier to generate the interface parameter of the second platform.
In a second aspect, an embodiment of the present invention provides an interface calling device, including:
the receiving module is configured to receive service data sent by the first platform; wherein, the business data comprises: a plurality of field identifications and attribute values thereof;
the determining module is configured to determine whether a target template corresponding to the first platform exists in a plurality of pre-configured templates, and if so, the determining module obtains an attribute value of a first field identifier from the service data according to the first field identifier in the target template;
the generation module is configured to generate an interface entry of the second platform according to a corresponding relation between a field identifier of the first platform and a field identifier of the second platform which are pre-configured and an attribute value of the first field identifier;
and the calling module is configured to call the interface of the second platform according to the interface call-in parameters.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the embodiments above.
In a fourth aspect, embodiments of the present invention provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method as in any of the embodiments described above.
One embodiment of the above invention has the following advantages or benefits: and calling the interface of the second platform through the configured template and the corresponding relation between the field identification of the first platform and the field identification of the second platform, and if the data of different first platforms are required to be accessed to the second platform, only the corresponding relation between the different templates and the field identification of the first platform and the field identification of the second platform is required to be configured, and the code corresponding to different first platforms is not required to be developed, so that the development cost can be saved, and the interface calling efficiency is improved.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a flow chart of an interface calling method provided by an embodiment of the invention;
FIG. 2 is a flow chart of an interface calling method provided by another embodiment of the present invention;
FIG. 3 is a schematic diagram of an interface call device according to an embodiment of the present invention;
FIG. 4 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
fig. 5 is a schematic diagram of a computer system suitable for use in implementing an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The first platform may be a merchant system, a store system, etc., and the second platform may be a logistics commodity system, a logistics order system, etc. The following embodiments will take a first platform as a merchant system and a second platform as a commodity circulation commodity system as an example, and describe the interface calling method in detail. The merchant system is used for storing commodity information of merchants, and the logistics commodity system is used for storing commodity information of the second platform.
Table 1 correspondence between field information of merchant system a and field information of physical distribution commodity system
Table 2 correspondence between field information of merchant system B and field information of physical distribution commodity system
As shown in table 1, the correspondence between the field information of the merchant system a and the field information of the commodity circulation system is shown. As shown in table 2, the correspondence between the field information of the merchant system B and the field information of the commodity circulation system is shown. Taking the "days of shelf life" field as an example, in merchant system A it is named qadays, in merchant system B it is named "validPeriod", and in the commodity circulation commodity system it is named "safe days". It is known that the same field format in different merchant systems is different from that of the logistics commodity system. Therefore, if the field information in the merchant system is accessed into the commodity circulation system, the field information in the merchant system cannot be directly used as an interface of the second platform to enter the commodity circulation system due to the difference of the formats of the field information in the merchant system and the commodity circulation system, and the format conversion of the field information in the merchant system is required. The following examples will be described with reference to merchant system a.
As shown in fig. 1, an embodiment of the present invention provides an interface calling method, including:
step 101: receiving service data sent by a first platform; wherein, the business data comprises: several fields identify and attribute values thereof.
The merchant system transmits the business data in the form of messages. The field identifier may be a field name or a combination of a field name and a hierarchy. In an actual application scene, in order to classify and manage the fields, the fields can be classified into a hierarchy, and the fields can be positioned more quickly through a hierarchy structure and field names.
For example, the field hierarchy includes a primary hierarchy and a secondary hierarchy. The first-level is goodsFull, meaning commodity full information; the secondary hierarchy includes: commodity basic information goods and commodity extension information goodsextennd. The service data format is as follows: { "goodsFull": { "goods": { "id":1, "name": "merchandise" }, "goodsExtend": id ":1," goodsId ":1} }.
Step 102: determining whether a target template corresponding to the first platform exists in a plurality of templates which are configured in advance, if so, executing step 103, otherwise, executing step 106.
The embodiment of the invention pre-configures the corresponding relation between the first platform identification and the templates, and when a plurality of templates exist, the method can also receive the first platform identification. Since different first platforms correspond to different merchant systems, the first platform identification may be a merchant number. When there are multiple first platforms, the method may determine which first platform the traffic data originates from by the first platform identification. Meanwhile, different first platforms can correspond to the same template, and also can correspond to different templates. For example, merchant system A and merchant system B correspond to template 1 and template 2, respectively, or merchant system A and merchant system B each correspond to template 1. The template includes field identifications that need to be obtained from the platform.
Step 103: and acquiring the attribute value of the first field identifier from the service data according to the first field identifier in the target template.
Step 104: and generating an interface entry of the second platform according to the corresponding relation between the field identification of the first platform and the field identification of the second platform and the attribute value of the first field identification, which are preconfigured.
For example, merchant field "goodsid" corresponds to the logistics field "isvGoodsNo", and merchant field "goodsid" corresponds to the logistics field "isvGoodsNo".
Step 105: and calling the interface of the second platform according to the interface call-in.
The data in the second platform can be queried and updated through the interface and the data can be added into the second platform.
Step 106: the current flow is terminated.
And calling the interface of the second platform through the configured template and the corresponding relation between the field identification of the first platform and the field identification of the second platform, and if the data of different first platforms are required to be accessed to the second platform, only the corresponding relation between the different templates and the field identification of the first platform and the field identification of the second platform is required to be configured, and the code corresponding to different first platforms is not required to be developed, so that the development cost can be saved, and the interface calling efficiency is improved.
In one embodiment of the invention, the method further comprises:
acquiring a field identifier of a second platform; wherein the field identification comprises: a field name and its hierarchical structure;
generating a packet path corresponding to the hierarchical structure of the second platform;
generating an interface parameter of the second platform according to the corresponding relation between the field identification of the first platform and the field identification of the second platform and the attribute value of the first field identification, wherein the interface parameter comprises the following steps:
determining a second field identifier of a second platform corresponding to the first field identifier according to a corresponding relation between a pre-configured field identifier of the first platform and a field identifier of the second platform;
determining a packet path corresponding to the second field identifier according to the packet path corresponding to the hierarchical structure of the second platform;
and generating an interface entry according to the packet path and the attribute value of the first field identifier.
In an embodiment of the invention, the packet path is generated according to a hierarchical structure of the second platform. For example, the packet path corresponding to goodsFull is "com.jd.eclp.goods.domain.goodsfull", and the packet path corresponding to goods is "com.jd.eclp.goods.domain.goods".
The embodiment of the invention acquires the packet path based on the hierarchical structure of the fields, and further generates the interface entry. Because the fields have a hierarchical structure, the packet path can be determined more quickly, the efficiency of generating the interface entry is improved, and the interface calling efficiency is further improved.
In one embodiment of the present invention, generating an interface entry according to a packet path and an attribute value of a first field identifier includes:
creating an object according to the packet path;
a method of acquiring an object;
and assigning a value to the object according to the method of the object and the attribute value of the first field identifier to obtain the interface entry.
The embodiment of the invention establishes the object faster through the packet path, and improves the efficiency of generating the interface entry.
In one embodiment of the invention, a method of acquiring an object includes:
a method of acquiring an object using reflectoasm.
The reflectoasm is a Java class library, provides high-performance reflection processing through code generation, automatically provides access classes for get/set fields, and uses byte code operation instead of Java reflection technology, so that the access classes are very fast. Therefore, the method for acquiring the object can be faster, and the efficiency of generating the interface entry is further improved. In the practical application scene, other Reflection tools such as Reflection and the like can be adopted.
In the embodiment of the invention, the obtaining the field identifier of the second platform includes:
loading a Jar packet based on a class loader;
scanning services under a specified path in the Jar packet;
and loading the field identification of the second platform into the dictionary pool according to the service.
And loading jar packets of the eclp-goods-api by a class loader, scanning services under an appointed path of the eclp-goods-api, such as com.jd.eclp.goods, selecting an addgoodsInfo method of a goodsService service, and loading field identifiers of the second platform into a dictionary pool.
According to the embodiment of the invention, based on the class loader, the field identification of the second platform is loaded into the dictionary pool, so that the acquisition efficiency of the field identification is improved. In the practical application scene, the configuration can also be carried out by a configuration personnel in a manual mode.
In one embodiment of the invention, the method further comprises: determining a verification rule corresponding to the target template in the preset verification rules corresponding to the templates;
and verifying the attribute value of the first field identifier according to a verification rule corresponding to the target template, and if the verification is passed, executing the corresponding relation between the field identifier of the first platform and the field identifier of the second platform and the attribute value of the first field identifier according to the preset configuration, and generating the interface parameter of the second platform.
Since the verification rule corresponds to the template, the template corresponds to the first platform, and thus the verification rule corresponds to the first platform. The verification rule can verify the length, the data type, the size and the like of the attribute value so as to ensure the quality of the data accessed to the second platform and reduce the probability of invalid call.
In one embodiment of the invention, the method further comprises: determining a check rule corresponding to the first field identifier in the pre-configured check rules corresponding to the field identifiers;
and verifying the attribute value of the first field identifier according to a verification rule corresponding to the first field identifier, and if the verification is passed, executing the corresponding relation between the field identifier of the first platform and the field identifier of the second platform and the attribute value of the first field identifier according to the preset configuration to generate the interface parameter of the second platform.
In an embodiment of the present invention, the check rule corresponds to the first field identification. For the same field identifier in different templates, the corresponding check rules can be the same, and the check rules can be determined according to the combination of the templates and the field identifiers. If the corresponding relation between the template and the check rule and the corresponding relation between the first field identifier and the check rule are configured at the same time, the priority of the check rule corresponding to the template and the priority of the check rule corresponding to the first field identifier can be set, and the attribute value is checked by using the check rule with higher determined priority.
As shown in fig. 2, an embodiment of the present invention provides an interface calling method, including:
step 201: the Jar package is loaded based on the class loader.
The jar package of eclp-good-api is loaded by the class loader.
Step 202: the services under the specified path in the Jar packet are scanned.
Services under the specified path of eclp-good-api, such as com.jd.eclp.good, are scanned.
Step 203: according to the service, loading the field identification of the second platform into a dictionary pool; wherein the field identification comprises: field names and their hierarchical structure.
And selecting an addGoodsInfo method of the GoodsService service, and loading field identifiers of the second platform into the dictionary pool.
Table 3 field identification of the second platform
The field information loaded into the dictionary pool is shown in table 3. In an actual application scenario, a multi-level may be further set, such as a three-level, a four-level, and the like. It should be noted that only a part of the secondary hierarchy, field names, field types, and field meanings are shown in table 3.
Step 204: a packet path corresponding to the hierarchy of the second platform is generated.
According to the hierarchical structure of the second platform in table 3, packet paths "com.jd.eclp.goods.domain.goodsfull" and "com.jd.eclp.goods.domain.goods" are generated.
Step 205: receiving service data sent by a first platform; wherein, the business data comprises: several fields identify and attribute values thereof.
For example, the service data includes: { "goodsFull": { "goods": { "id":1, "name": "merchandise" }, "goodsExtend": id ":1," goodsId ":1} }.
Step 206: it is determined whether there is a target template corresponding to the first platform among the pre-configured templates, if so, step 207 is performed, otherwise, step 215 is performed.
Step 207: and acquiring the attribute value of the first field identifier from the service data according to the first field identifier in the target template.
Step 208: and determining the verification rule corresponding to the target template from the pre-configured verification rules corresponding to the templates.
Step 209: and checking the attribute value of the first field identifier according to the checking rule corresponding to the target template, if the checking is passed, executing step 210, otherwise, executing step 215.
Step 210: and determining a second field identifier of the second platform corresponding to the first field identifier according to the corresponding relation between the preconfigured field identifier of the first platform and the field identifier of the second platform.
Step 211: and determining the packet path corresponding to the second field identifier according to the packet path corresponding to the hierarchical structure of the second platform.
Step 212: and creating an object according to the packet path, and acquiring the object by using the reflectoasm.
Step 213: and assigning a value to the object according to the method of the object and the attribute value of the first field identifier to obtain the interface entry.
Step 214: and calling the interface of the second platform according to the interface call-in.
Step 215: the current flow is terminated.
According to the embodiment of the invention, only the corresponding relation between the field identifications of the different templates and the first platform and the field identifications of the second platform is required to be configured, and the code corresponding to the different first platforms is not required to be developed, so that the development cost can be saved. Meanwhile, assignment is carried out on the object based on the reflection toolkit reflectASM, so that the generation speed of the interface input parameters is improved, and the interface calling efficiency is improved.
As shown in fig. 3, an embodiment of the present invention provides an interface calling device, including:
a receiving module 301, configured to receive service data sent by the first platform; wherein, the business data comprises: a plurality of field identifications and attribute values thereof;
a determining module 302, configured to determine whether a target template corresponding to the first platform exists in a plurality of pre-configured templates, and if so, acquire an attribute value of a first field identifier from service data according to the first field identifier in the target template;
the generating module 303 is configured to generate an interface entry of the second platform according to a preset corresponding relation between the field identifier of the first platform and the field identifier of the second platform and an attribute value of the first field identifier;
and a calling module 304 configured to call the interface of the second platform according to the interface call-in.
In one embodiment of the present invention, the determining module 302 is configured to obtain a field identifier of the second platform; wherein the field identification comprises: a field name and its hierarchical structure; generating a packet path corresponding to the hierarchical structure of the second platform;
the generating module 303 is configured to determine a second field identifier of the second platform corresponding to the first field identifier according to a corresponding relationship between a preconfigured field identifier of the first platform and a field identifier of the second platform; determining a packet path corresponding to the second field identifier according to the packet path corresponding to the hierarchical structure of the second platform; and generating an interface entry according to the packet path and the attribute value of the first field identifier.
In one embodiment of the invention, the generation module 303 is configured to create an object from the packet path; a method of acquiring an object; and assigning a value to the object according to the method of the object and the attribute value of the first field identifier to obtain the interface entry.
In one embodiment of the present invention, the generating module 303 is configured to obtain the method of the object by using the reflectoasm.
In one embodiment of the invention, the determination module 302 is configured to load the Jar package based on the class loader; scanning services under a specified path in the Jar packet; and loading the field identification of the second platform into the dictionary pool according to the service.
In one embodiment of the present invention, the determining module 302 is configured to determine, among the pre-configured verification rules corresponding to the templates, a verification rule corresponding to the target template; and verifying the attribute value of the first field identifier according to the verification rule corresponding to the target template, and triggering the generation module 303 if the verification is passed.
In one embodiment of the present invention, the determining module 302 is configured to determine, among the pre-configured verification rules corresponding to the field identifiers, a verification rule corresponding to the first field identifier; and verifying the attribute value of the first field identifier according to the verification rule corresponding to the first field identifier, and triggering the generation module 303 if the verification is passed.
The embodiment of the invention provides electronic equipment, which comprises:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of the embodiments described above.
The present invention provides a computer readable medium having stored thereon a computer program which when executed by a processor implements a method as in any of the embodiments described above.
Fig. 4 illustrates an exemplary system architecture 400 to which an interface call method or interface call apparatus of an embodiment of the present invention may be applied.
As shown in fig. 4, the system architecture 400 may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 is used as a medium to provide communication links between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 405 via the network 404 using the terminal devices 401, 402, 403 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 401, 402, 403.
The terminal devices 401, 402, 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 405 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using the terminal devices 401, 402, 403. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, in the embodiment of the present invention, the interface calling method is generally executed by the server 405, and accordingly, the interface calling device is generally disposed in the server 405.
It should be understood that the number of terminal devices, networks and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 5 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, as: a processor includes a sending module, an obtaining module, a determining module, and a first processing module. The names of these modules do not in some cases limit the module itself, and for example, the transmitting module may also be described as "a module that transmits a picture acquisition request to a connected server".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
receiving service data sent by a first platform; wherein, the business data comprises: a plurality of field identifications and attribute values thereof;
determining whether a target template corresponding to the first platform exists in a plurality of pre-configured templates, and if so, acquiring an attribute value of a first field identifier from the service data according to the first field identifier in the target template;
generating an interface entry of a second platform according to a corresponding relation between a pre-configured field identifier of the first platform and a field identifier of the second platform and an attribute value of the first field identifier;
and calling the interface of the second platform according to the interface call-in.
According to the technical scheme of the embodiment of the invention, the interface of the second platform is called through the configured template and the corresponding relation between the field identification of the first platform and the field identification of the second platform, if the data of different first platforms are required to be accessed into the second platform, only the corresponding relation between the different templates and the field identifications of the first platform and the field identifications of the second platform are required to be configured, and the code corresponding to different first platforms is not required to be developed, so that the development cost can be saved, and the interface calling efficiency is improved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (8)

1. An interface calling method, comprising:
acquiring a field identifier of a second platform; wherein the field identification comprises: a field name and its hierarchical structure; generating a packet path corresponding to the hierarchical structure of the second platform;
receiving service data sent by a first platform; wherein, the business data comprises: a plurality of field identifications and attribute values thereof;
determining whether a target template corresponding to the first platform exists in a plurality of pre-configured templates, and if so, acquiring an attribute value of a first field identifier from the service data according to the first field identifier in the target template;
generating an interface entry of a second platform according to a corresponding relation between a pre-configured field identifier of the first platform and a field identifier of the second platform and an attribute value of the first field identifier; the method comprises the following steps: determining a second field identifier of a second platform corresponding to a first field identifier according to a corresponding relation between a pre-configured field identifier of the first platform and the field identifier of the second platform; determining a packet path corresponding to the second field identifier according to the packet path corresponding to the hierarchical structure of the second platform; creating an object according to the packet path; a method of acquiring the object; assigning a value to the object according to the method of the object and the attribute value of the first field identifier, and generating the interface entry;
and calling the interface of the second platform according to the interface call-in.
2. The method of claim 1, wherein,
the method for acquiring the object comprises the following steps:
a method of acquiring the object using reflectoasm.
3. The method of claim 1, wherein,
the obtaining the field identifier of the second platform includes:
loading a Jar packet based on a class loader;
scanning services under a specified path in the Jar packet;
and loading the field identification of the second platform into a dictionary pool according to the service.
4. A method as recited in any of claims 1-3, further comprising:
determining a verification rule corresponding to the target template in a preset verification rule corresponding to the template;
and verifying the attribute value of the first field identifier according to a verification rule corresponding to the target template, and if the verification is passed, executing the corresponding relation between the field identifier of the first platform and the field identifier of the second platform according to the preset configuration and the attribute value of the first field identifier to generate the interface entry of the second platform.
5. A method as recited in any of claims 1-3, further comprising:
determining a check rule corresponding to the first field identifier in a pre-configured check rule corresponding to the field identifier;
and verifying the attribute value of the first field identifier according to a verification rule corresponding to the first field identifier, and if the verification is passed, executing the corresponding relation between the field identifier of the first platform and the field identifier of the second platform according to the preset configuration and the attribute value of the first field identifier to generate the interface parameter of the second platform.
6. An interface calling device, comprising:
the receiving module is configured to acquire a field identifier of the second platform; wherein the field identification comprises: a field name and its hierarchical structure; generating a packet path corresponding to the hierarchical structure of the second platform; receiving service data sent by a first platform; wherein, the business data comprises: a plurality of field identifications and attribute values thereof;
the determining module is configured to determine whether a target template corresponding to the first platform exists in a plurality of pre-configured templates, and if so, the determining module obtains an attribute value of a first field identifier from the service data according to the first field identifier in the target template;
the generation module is configured to generate an interface entry of the second platform according to a corresponding relation between a field identifier of the first platform and a field identifier of the second platform which are pre-configured and an attribute value of the first field identifier; the method comprises the following steps: determining a second field identifier of a second platform corresponding to a first field identifier according to a corresponding relation between a pre-configured field identifier of the first platform and the field identifier of the second platform; determining a packet path corresponding to the second field identifier according to the packet path corresponding to the hierarchical structure of the second platform; creating an object according to the packet path; a method of acquiring the object; assigning a value to the object according to the method of the object and the attribute value of the first field identifier, and generating the interface entry;
and the calling module is configured to call the interface of the second platform according to the interface call-in parameters.
7. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-5.
8. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-5.
CN202110336790.0A 2021-03-29 2021-03-29 Interface calling method and device Active CN113076153B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110336790.0A CN113076153B (en) 2021-03-29 2021-03-29 Interface calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110336790.0A CN113076153B (en) 2021-03-29 2021-03-29 Interface calling method and device

Publications (2)

Publication Number Publication Date
CN113076153A CN113076153A (en) 2021-07-06
CN113076153B true CN113076153B (en) 2023-09-01

Family

ID=76611295

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110336790.0A Active CN113076153B (en) 2021-03-29 2021-03-29 Interface calling method and device

Country Status (1)

Country Link
CN (1) CN113076153B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113626223A (en) * 2021-08-12 2021-11-09 北京京东振世信息技术有限公司 Interface calling method and device
CN113742008B (en) * 2021-09-13 2024-04-02 挂号网(杭州)科技有限公司 Interface calling method and device, electronic equipment and storage medium
CN114528044B (en) * 2022-02-17 2024-02-23 深圳乐信软件技术有限公司 Interface calling method, device, equipment and medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105589968A (en) * 2015-12-25 2016-05-18 中国银联股份有限公司 Data summarization system and method
CN106878367A (en) * 2016-07-19 2017-06-20 阿里巴巴集团控股有限公司 The implementation method and device of service interface asynchronous call
CN110806945A (en) * 2019-11-05 2020-02-18 浪潮云信息技术有限公司 Interface docking method, device and computer readable medium
CN110912814A (en) * 2019-10-22 2020-03-24 苏宁云计算有限公司 Interface data distribution method and device
CN111563098A (en) * 2020-04-30 2020-08-21 深圳壹账通智能科技有限公司 Structured and unstructured data query method, device, storage medium and device
CN111752947A (en) * 2020-06-24 2020-10-09 中国银行股份有限公司 System integration method and device, storage medium and electronic equipment
CN112287216A (en) * 2020-10-23 2021-01-29 微医云(杭州)控股有限公司 Information pushing method and device, server and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9971569B2 (en) * 2016-02-11 2018-05-15 International Business Machines Corporation Generating object model validation rules
US10057344B2 (en) * 2016-04-11 2018-08-21 Cisco Technology, Inc. Efficient transport of data encoded using multiple templates

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105589968A (en) * 2015-12-25 2016-05-18 中国银联股份有限公司 Data summarization system and method
CN106878367A (en) * 2016-07-19 2017-06-20 阿里巴巴集团控股有限公司 The implementation method and device of service interface asynchronous call
CN110912814A (en) * 2019-10-22 2020-03-24 苏宁云计算有限公司 Interface data distribution method and device
CN110806945A (en) * 2019-11-05 2020-02-18 浪潮云信息技术有限公司 Interface docking method, device and computer readable medium
CN111563098A (en) * 2020-04-30 2020-08-21 深圳壹账通智能科技有限公司 Structured and unstructured data query method, device, storage medium and device
CN111752947A (en) * 2020-06-24 2020-10-09 中国银行股份有限公司 System integration method and device, storage medium and electronic equipment
CN112287216A (en) * 2020-10-23 2021-01-29 微医云(杭州)控股有限公司 Information pushing method and device, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
应用服务提供商平台统一用户管理模型的研究与实现;袁晓舟;范菲雅;马登哲;;计算机集成制造系统(12);全文 *

Also Published As

Publication number Publication date
CN113076153A (en) 2021-07-06

Similar Documents

Publication Publication Date Title
CN113076153B (en) Interface calling method and device
CN109062563B (en) Method and device for generating page
CN107302597B (en) Message file pushing method and device
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN111447257B (en) Message conversion method and device
CN110473036B (en) Method and device for generating order number
CN110764770A (en) Method and device for conversion and assignment between objects
CN114513552A (en) Data processing method, device, equipment and storage medium
CN113761565B (en) Data desensitization method and device
CN110851343A (en) Test method and device based on decision tree
CN111382953A (en) Dynamic process generation method and device
CN113448652A (en) Request processing method and device
CN112306791B (en) Performance monitoring method and device
CN110909269B (en) Log reporting method and device
CN112099841A (en) Method and system for generating configuration file
CN113326060A (en) Service request processing method, device and system and service configuration method and device
CN113760487A (en) Service processing method and device
CN111984616A (en) Method, device and system for updating shared file
CN113704222A (en) Method and device for processing service request
CN114189365B (en) Universal multi-tenant service authorization method and device based on field mapping
CN113360939B (en) Security access control method and device
CN113765868B (en) Service processing method and device
CN110135774B (en) Method and device for generating information
CN113065920B (en) Data processing method and system
CN115422067A (en) Interface testing method and device

Legal Events

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