CN111352748B - Interface calling method and device, electronic equipment and storage medium - Google Patents

Interface calling method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111352748B
CN111352748B CN202010121314.2A CN202010121314A CN111352748B CN 111352748 B CN111352748 B CN 111352748B CN 202010121314 A CN202010121314 A CN 202010121314A CN 111352748 B CN111352748 B CN 111352748B
Authority
CN
China
Prior art keywords
target
information
calling
acquiring
class name
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
CN202010121314.2A
Other languages
Chinese (zh)
Other versions
CN111352748A (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 CN202010121314.2A priority Critical patent/CN111352748B/en
Publication of CN111352748A publication Critical patent/CN111352748A/en
Application granted granted Critical
Publication of CN111352748B publication Critical patent/CN111352748B/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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides an interface calling method, an interface calling device, a storage medium and electronic equipment. The method is used in a server and comprises the following steps: acquiring target message information which is sent by electronic equipment and used for calling target service, wherein the target message information carries packet path information, class name information and method identification information of the target service; acquiring a unified target URL address according to the packet path information and the class name information; accessing a corresponding area of the server according to the target URL address; and addressing the target method in the corresponding area by a java reflection-based mechanism, and calling the target method.

Description

Interface calling method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer networks, and in particular, to an interface calling method, an interface calling device, an electronic device, and a storage medium.
Background
Because of the large number of PaaS components involved in services, a unified management and control, operation and maintenance platform needs to be developed to manage multiple components. However, the workload of the interface development is large, so that the workload of the overall development is large, and the time is wasted.
In view of the above problems, no effective technical solution is currently available.
Disclosure of Invention
The embodiment of the application aims to provide an interface calling method, an interface calling device, electronic equipment and a storage medium, which can reduce development workload and realize quick sharing of the method.
In a first aspect, an embodiment of the present application provides an interface calling method, which is used in a server, and the method includes the following steps:
acquiring target message information which is sent by electronic equipment and used for calling target service, wherein the target message information carries packet path information, class name information and method identification information of the target service;
acquiring a unified target URL address according to the packet path information and the class name information;
accessing a corresponding area of the server according to the target URL address;
and addressing the target method in the corresponding area by a java reflection-based mechanism, and calling the target method.
Optionally, in the interface calling method provided by the embodiment of the present application, the step of obtaining target message information sent by the electronic device and used for calling the target service includes:
acquiring a request sent by electronic equipment for calling a target service;
and analyzing the request to extract target message information in the request.
Optionally, in the interface calling method provided by the embodiment of the present application, the step of obtaining a uniform URL address according to the packet path information and the class name information includes:
acquiring an address information base according to the packet path information, wherein a plurality of URL addresses are stored in the address information base;
and acquiring a corresponding target URL address from a plurality of URL addresses in the address information base according to the class name information.
Optionally, in the interface calling method provided by the embodiment of the present application, before the step of obtaining the target message information for calling the target service sent by the electronic device, the method further includes the following steps:
acquiring method packages uploaded by users, wherein each method package carries a service method and class name information of a corresponding service;
and storing the method package to a corresponding area of the server based on the class name information of the service.
Optionally, in the interface calling method provided by the embodiment of the present application, the step of addressing the java reflection-based mechanism to the target method in the corresponding area and calling the target method includes:
addressing the target method in the corresponding area based on a java reflection mechanism;
and packaging the target method, and sending the packaged target method to the electronic equipment for calling.
In a second aspect, an embodiment of the present application provides an interface calling device, which is used in a server, and the device includes:
the first acquisition module is used for acquiring target message information which is sent by the electronic equipment and used for calling target service, wherein the target message information carries packet path information, class name information and method identification information of the target service;
the second acquisition module is used for acquiring a unified target URL address according to the packet path information and the class name information;
the access module is used for accessing the corresponding area of the server according to the target URL address;
and the calling module is used for addressing the target method in the corresponding area based on the java reflection mechanism and calling the target method.
Optionally, in the interface calling device according to the embodiment of the present application, the first obtaining module includes:
the first acquisition unit is used for acquiring a request for calling a target service, which is sent by the electronic equipment;
and the extraction unit is used for analyzing the request to extract the target message information in the request.
Optionally, in the interface calling device according to the embodiment of the present application, the second obtaining module includes:
a second obtaining unit, configured to obtain an address information base according to the packet path information, where the address information base stores a plurality of URL addresses;
and a third obtaining unit, configured to obtain a corresponding target URL address from a plurality of URL addresses in the address information base according to the class name information.
In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory storing computer readable instructions which, when executed by the processor, perform the steps of the method as provided in the first aspect above.
In a fourth aspect, embodiments of the present application provide a storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method as provided in the first aspect above.
As can be seen from the above, in the embodiment of the present application, by acquiring the target message information for calling the target service, which is sent by the electronic device, the target message information carries the packet path information, the class name information and the method identification information of the target service; acquiring a unified target URL address according to the packet path information and the class name information; accessing a corresponding area of the server according to the target URL address; addressing the target method in the corresponding area based on a java reflection mechanism, and calling the target method; therefore, the method can be called, the methods can be shared, and the development workload can be reduced.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of an interface calling method according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a first structure of an interface calling device according to an embodiment of the present application.
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by a person skilled in the art without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a flowchart of an interface calling method according to some embodiments of the present application, where the interface calling method is used in a server, and the method includes the following steps:
s101, acquiring target message information which is sent by electronic equipment and used for calling target service, wherein the target message information carries packet path information, class name information and method identification information of the target service;
s102, acquiring a unified target URL address according to the packet path information and the class name information;
s103, accessing a corresponding area of the server according to the target URL address;
s104, addressing the target method in the corresponding area by a java reflection-based mechanism, and calling the target method.
In step S101, the electronic sending request is parsed to obtain the target message information therein. The packet path information is used for indicating a packet storage area corresponding to the method. The class name information is used for describing the class and the purpose corresponding to the target method. The method identification information is used for indicating the name corresponding to the method so as to accurately find the target method.
Specifically, in some embodiments, this step S101 includes the sub-steps of: s1011, acquiring a request for calling a target service, which is sent by electronic equipment; s1012, analyzing the request to extract target message information in the request.
In step S102, the URL is a uniform resource locator, and a concise representation of the location and access method of the resource available on the internet is the address of the standard resource on the internet. Each file on the internet has a unique URL that contains information indicating the location of the file and how the browser should handle it. The name or IP address of the server where the file is located, followed by the name of the path to the file and the file itself. This step S102 comprises the following sub-steps: s1021, acquiring an address information base according to the packet path information, wherein a plurality of URL addresses are stored in the address information base; s1022, obtaining the corresponding target URL address from the URL addresses in the address information base according to the class name information.
In step S103, each target URL address is mapped to one area of the storage area of the server, so that the corresponding area of the server is accessible based on the target URL address.
In this step S104, a java reflection based mechanism addresses the target method in the corresponding area; and packaging the target method, and sending the packaged target method to the electronic equipment for calling.
It will be appreciated that, in some embodiments, before the step of obtaining the target message information for invoking the target service sent by the electronic device, the method further includes the following steps:
s105, obtaining method packages uploaded by users, wherein each method package carries a service method and corresponding service class name information; and storing the method package to a corresponding area of the server based on the class name information of the service.
As can be seen from the above, in the embodiment of the present application, by acquiring the target message information for calling the target service, which is sent by the electronic device, the target message information carries the packet path information, the class name information and the method identification information of the target service; acquiring a unified target URL address according to the packet path information and the class name information; accessing a corresponding area of the server according to the target URL address; addressing the target method in the corresponding area based on a java reflection mechanism, and calling the target method; therefore, the method can be called, the methods can be shared, and the development workload can be reduced.
Referring to fig. 2, fig. 2 is a schematic structural diagram of an interface calling device according to some embodiments of the application. The interface calling device is used in a server, and the device comprises: a first acquisition module 201, a second acquisition module 202, an access module 203, and a call module 204.
The first obtaining module 201 is configured to obtain target message information sent by an electronic device and used for calling a target service, where the target message information carries packet path information, class name information and method identification information of the target service; the first acquisition module includes: the first acquisition unit is used for acquiring a request for calling a target service, which is sent by the electronic equipment; and the extraction unit is used for analyzing the request to extract the target message information in the request. And analyzing the electronic sent request to acquire target message information in the electronic sent request. The packet path information is used for indicating a packet storage area corresponding to the method. The class name information is used for describing the class and the purpose corresponding to the target method. The method identification information is used for indicating the name corresponding to the method so as to accurately find the target method.
The second obtaining module 202 is configured to obtain a uniform target URL address according to the packet path information and the class name information; the second acquisition module includes: a second obtaining unit, configured to obtain an address information base according to the packet path information, where the address information base stores a plurality of URL addresses; and a third obtaining unit, configured to obtain a corresponding target URL address from a plurality of URL addresses in the address information base according to the class name information. The URL is a uniform resource locator, a compact representation of the location and access method of resources available on the internet, is the address of a standard resource on the internet. Each file on the internet has a unique URL that contains information indicating the location of the file and how the browser should handle it. The name or IP address of the server where the file is located, followed by the name of the path to the file and the file itself.
The access module 203 accesses a corresponding area of the server according to the target URL address; each target URL address is in a mapping relation with one area of the storage area of the server, so that the corresponding area of the server can be accessed based on the target URL address.
The calling module 204 is configured to address the target method in the corresponding area based on a java reflection mechanism, and call the target method. Addressing the target method in the corresponding area based on a java reflection mechanism; and packaging the target method, and sending the packaged target method to the electronic equipment for calling.
As can be seen from the above, in the embodiment of the present application, by acquiring the target message information for calling the target service, which is sent by the electronic device, the target message information carries the packet path information, the class name information and the method identification information of the target service; acquiring a unified target URL address according to the packet path information and the class name information; accessing a corresponding area of the server according to the target URL address; addressing the target method in the corresponding area based on a java reflection mechanism, and calling the target method; therefore, the method can be called, the methods can be shared, and the development workload can be reduced.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application, and the present application provides an electronic device 3, including: processor 301 and memory 302, the processor 301 and memory 302 being interconnected and in communication with each other by a communication bus 303 and/or other form of connection mechanism (not shown), the memory 302 storing a computer program executable by the processor 301, which when run by a computing device, the processor 301 executes to perform the method in any of the alternative implementations of the embodiments described above.
The embodiment of the application provides a storage medium, when the computer program is executed by a processor, the method in any optional implementation manner of the above embodiment is executed, so as to realize the following functions as known from the above, and the embodiment of the application obtains target message information for calling a target service sent by electronic equipment, where the target message information carries packet path information, class name information and method identification information of the target service; acquiring a unified target URL address according to the packet path information and the class name information; accessing a corresponding area of the server according to the target URL address; addressing the target method in the corresponding area based on a java reflection mechanism, and calling the target method; therefore, the method can be called, the methods can be shared, and the development workload can be reduced. The storage medium may be implemented by any type of volatile or nonvolatile Memory device or combination thereof, such as static random access Memory (Static Random Access Memory, SRAM), electrically erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable Programmable Read-Only Memory (Erasable Programmable Read Only Memory, EPROM), programmable Read-Only Memory (PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
Further, the units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Furthermore, functional modules in various embodiments of the present application may be integrated together to form a single portion, or each module may exist alone, or two or more modules may be integrated to form a single portion.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and variations will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (6)

1. An interface calling method for a server, the method comprising the steps of:
acquiring target message information which is sent by electronic equipment and used for calling target service, wherein the target message information carries packet path information, class name information and method identification information of the target service;
acquiring a unified target URL address according to the packet path information and the class name information;
accessing a corresponding area of the server according to the target URL address;
addressing a target method in the corresponding area based on a java reflection mechanism, and calling the target method;
the step of obtaining target message information for calling target service, which is sent by the electronic equipment, comprises the following steps:
acquiring a request sent by electronic equipment for calling a target service;
analyzing the request to extract target message information in the request;
the step of obtaining a uniform URL address according to the packet path information and the class name information includes:
acquiring an address information base according to the packet path information, wherein a plurality of URL addresses are stored in the address information base;
and acquiring a corresponding target URL address from a plurality of URL addresses in the address information base according to the class name information.
2. The interface calling method according to claim 1, wherein before the step of obtaining the target message information for calling the target service sent by the electronic device, the method further comprises the steps of:
acquiring method packages uploaded by users, wherein each method package carries a service method and class name information of a corresponding service;
and storing the method package to a corresponding area of the server based on the class name information of the service.
3. The interface calling method of claim 1, wherein the java reflection based mechanism addresses the target method in the corresponding region and the step of calling the target method comprises:
addressing the target method in the corresponding area based on a java reflection mechanism;
and packaging the target method, and sending the packaged target method to the electronic equipment for calling.
4. An interface calling device for use in a server, the device comprising:
the first acquisition module is used for acquiring target message information which is sent by the electronic equipment and used for calling target service, wherein the target message information carries packet path information, class name information and method identification information of the target service;
the second acquisition module is used for acquiring a unified target URL address according to the packet path information and the class name information;
the access module is used for accessing the corresponding area of the server according to the target URL address;
the calling module is used for addressing a target method in the corresponding area based on a java reflection mechanism and calling the target method;
the first acquisition module includes:
the first acquisition unit is used for acquiring a request for calling a target service, which is sent by the electronic equipment;
the extraction unit is used for analyzing the request to extract target message information in the request;
the second acquisition module includes:
a second obtaining unit, configured to obtain an address information base according to the packet path information, where the address information base stores a plurality of URL addresses;
and a third obtaining unit, configured to obtain a corresponding target URL address from a plurality of URL addresses in the address information base according to the class name information.
5. An electronic device comprising a processor and a memory storing computer readable instructions which, when executed by the processor, perform the steps of the method of any of claims 1-3.
6. A storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method according to any of claims 1-3.
CN202010121314.2A 2020-02-26 2020-02-26 Interface calling method and device, electronic equipment and storage medium Active CN111352748B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010121314.2A CN111352748B (en) 2020-02-26 2020-02-26 Interface calling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010121314.2A CN111352748B (en) 2020-02-26 2020-02-26 Interface calling method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111352748A CN111352748A (en) 2020-06-30
CN111352748B true CN111352748B (en) 2023-12-05

Family

ID=71192505

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010121314.2A Active CN111352748B (en) 2020-02-26 2020-02-26 Interface calling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111352748B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101132374A (en) * 2006-10-09 2008-02-27 杭州华三通信技术有限公司 Method and device for transmitting message
CN102096631A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Interface testing method and device
CN103067511A (en) * 2012-12-28 2013-04-24 上海寰创通信科技股份有限公司 Control method of hyper text transport protocol (HTTP) demand processing
WO2015054882A1 (en) * 2013-10-18 2015-04-23 华为技术有限公司 Network device communication method and network device
WO2018112759A1 (en) * 2016-12-20 2018-06-28 华为技术有限公司 Resource access method, apparatus and system
CN109040316A (en) * 2018-09-19 2018-12-18 天津字节跳动科技有限公司 HTTP service treating method and apparatus
CN110222286A (en) * 2019-05-21 2019-09-10 平安普惠企业管理有限公司 Information acquisition method, device, terminal and computer readable storage medium
WO2019223167A1 (en) * 2018-05-21 2019-11-28 平安科技(深圳)有限公司 Method, apparatus and device for obtaining sip server address and storage medium
CN110601984A (en) * 2019-09-20 2019-12-20 清华大学 Method and device for acquiring local service and generating link local address

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101132374A (en) * 2006-10-09 2008-02-27 杭州华三通信技术有限公司 Method and device for transmitting message
CN102096631A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Interface testing method and device
CN103067511A (en) * 2012-12-28 2013-04-24 上海寰创通信科技股份有限公司 Control method of hyper text transport protocol (HTTP) demand processing
WO2015054882A1 (en) * 2013-10-18 2015-04-23 华为技术有限公司 Network device communication method and network device
WO2018112759A1 (en) * 2016-12-20 2018-06-28 华为技术有限公司 Resource access method, apparatus and system
WO2019223167A1 (en) * 2018-05-21 2019-11-28 平安科技(深圳)有限公司 Method, apparatus and device for obtaining sip server address and storage medium
CN109040316A (en) * 2018-09-19 2018-12-18 天津字节跳动科技有限公司 HTTP service treating method and apparatus
CN110222286A (en) * 2019-05-21 2019-09-10 平安普惠企业管理有限公司 Information acquisition method, device, terminal and computer readable storage medium
CN110601984A (en) * 2019-09-20 2019-12-20 清华大学 Method and device for acquiring local service and generating link local address

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Java EE中Filter技术的研究与应用;姚添译等;《电脑知识与技术》;20180625;第4卷(第18期);47-50 *

Also Published As

Publication number Publication date
CN111352748A (en) 2020-06-30

Similar Documents

Publication Publication Date Title
CN107948135B (en) Data processing method and device supporting multiple API protocols
US8375379B2 (en) Importing language extension resources to support application execution
US6427151B1 (en) Method, computer program product, system and data structure for formatting transaction results data
CN111182089B (en) Container cluster system, method and device for accessing big data assembly and server
CN103942225A (en) Method and system for invoking resources of Hybrid App client and client
CN111641676B (en) Method and device for constructing third-party cloud monitoring service
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
CN112836152A (en) Page rendering method, system, computer device and computer readable storage medium
CN105516333A (en) Interactive method and system based on webpage
KR20210043865A (en) NGSI-LD API Wrapping Method
CN113452780A (en) Access request processing method, device, equipment and medium for client
CN109814863A (en) A kind of processing method, device, computer equipment and computer storage medium for requesting returned data
CN113220481A (en) Request processing and feedback method and device, computer equipment and readable storage medium
CN109032693B (en) Method and device for loading display information, electronic equipment and readable storage medium
WO2022090847A1 (en) Handling deferrable network requests
CN111367685B (en) Interface calling method and device, computer equipment and storage medium
CN111352748B (en) Interface calling method and device, electronic equipment and storage medium
CN114885024B (en) Routing method, device, equipment and medium of application instance
CN114090083B (en) Visual component configuration method, device, equipment and storage medium
CN107453950A (en) A kind of information processing method and monitoring system
CN109618016B (en) DNS request sending and processing method, related method and related device
WO2015192497A1 (en) Communication link sending method and apparatus, and terminal
CN111782428B (en) Data calling system and method
CN116233123A (en) Information processing method and device, processor and electronic equipment
CN114238743A (en) Cost query method and related device for Content Delivery Network (CDN)

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