WO2018126938A1 - 一种数据获取方法和装置 - Google Patents

一种数据获取方法和装置 Download PDF

Info

Publication number
WO2018126938A1
WO2018126938A1 PCT/CN2017/118452 CN2017118452W WO2018126938A1 WO 2018126938 A1 WO2018126938 A1 WO 2018126938A1 CN 2017118452 W CN2017118452 W CN 2017118452W WO 2018126938 A1 WO2018126938 A1 WO 2018126938A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
server
web page
page
request
Prior art date
Application number
PCT/CN2017/118452
Other languages
English (en)
French (fr)
Inventor
王甜
Original Assignee
阿里巴巴集团控股有限公司
王甜
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 阿里巴巴集团控股有限公司, 王甜 filed Critical 阿里巴巴集团控股有限公司
Priority to EP17890593.1A priority Critical patent/EP3550788A4/en
Priority to SG11201906183UA priority patent/SG11201906183UA/en
Priority to JP2019537168A priority patent/JP6898452B2/ja
Priority to KR1020197021508A priority patent/KR102281401B1/ko
Priority to MYPI2019003826A priority patent/MY190374A/en
Publication of WO2018126938A1 publication Critical patent/WO2018126938A1/zh
Priority to US16/459,294 priority patent/US20190327287A1/en
Priority to PH12019501584A priority patent/PH12019501584A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • H04L45/04Interdomain routing, e.g. hierarchical routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/541Client-server

Definitions

  • the present disclosure relates to network technologies, and in particular, to a data acquisition method and apparatus.
  • JSONP can be used, but JSONP only supports GET requests and does not support other types of HTTP requests such as POST.
  • the scope of application is small and there are security risks.
  • the method of modifying cross-domain files can also be used, but the method is only used. Very few browsers are supported and not flexible enough.
  • the present disclosure provides a data acquisition method and apparatus to provide a simple and widely applicable cross-domain data acquisition method.
  • a data acquisition method is provided, the method being applied to a mobile application, the mobile application comprising a web page and a page container for loading the web page, the page container being implemented by Native; the method comprising :
  • a data acquisition system comprising: a mobile application and a server installed on a mobile device, the mobile application comprising a web page and a page container for loading the web page, the page container passing Native implementation, and the server provides data required for the web page presentation across domains;
  • the mobile application is configured to: when detecting that the web page receives the data acquisition request, send, by the page container, a data request to a server that provides the data across domains;
  • the server is configured to feed back the data to a page container of the mobile application, and the data is transferred by the page container to the web page for loading.
  • a data acquisition apparatus is provided, the apparatus being applied to a mobile application, the mobile application comprising a webpage and a page container for loading the webpage, the page container being implemented by Native; the webpage
  • the data request module is included, and the page container includes a call processing module:
  • the data requesting module is configured to, when detecting that the web page receives the data obtaining request, send, by the invoking processing module of the page container, a data request to a server that provides the data across domains;
  • the invoking processing module is configured to transmit the data to the data requesting module when receiving the data fed back by the server.
  • the data acquisition method and apparatus of the present disclosure requests data from a server across domains by using a client interface provided by Native.
  • the method does not have a cross-domain concept because the RPC data request sent by the Native to the server is not subject to the related cross-domain method. Restrictions, wider applicability, and simple implementation.
  • FIG. 1 is a system architecture of a data acquisition method according to an embodiment of the present disclosure
  • FIG. 2 is a flowchart of a data acquisition method according to an embodiment of the present disclosure
  • FIG. 3 is a schematic structural diagram of a data acquiring apparatus according to an embodiment of the present disclosure.
  • the hybrid application refers to the combination of the Web and the Native
  • the hybrid application is the combination of the Native application and the Web application.
  • the hybrid application can implement a UI (User Interface) container with web browsing function using the native system programming language (Native). All users can use HTML (Hyper Text Mark-up Language, Web pages developed by web languages such as hypertext markup language, JavaScript (Java script), CSS (Cascading Style Sheet). Therefore, in the present disclosure, it can be said that the hybrid application includes two parts, one is a web page, and the other is a page container for loading the web page, and the page container is implemented by Native.
  • HTML Hyper Text Mark-up Language
  • Web pages developed by web languages such as hypertext markup language, JavaScript (Java script), CSS (Cascading Style Sheet). Therefore, in the present disclosure, it can be said that the hybrid application includes two parts, one is a web page, and the other is a page container for loading the web page, and the page container is implemented by Native.
  • Figure 1 illustrates the system environment in which the method is applied, and illustrates the process of cross-domain access in conjunction with the environment.
  • the system may include: a mobile device 11, a server 12, and a gateway 13.
  • the mobile device may be, for example, a smart phone, a PDA, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer , wearable devices, or a combination of any of these devices, and the like.
  • the mobile device can be the user's smartphone 11.
  • the mobile application 12 installed on the smart phone 11 may include a web page 121 and a page container 122.
  • the web page 121 may be a page developed by a webpage programming language
  • the page container 122 may be implemented by a native. For example, you can embed a WebView component or other browser kernel component, you can load the page in this component, which is equivalent to the embedded browser.
  • the system of FIG. 1 may further include a gateway 13 which will function as a message forwarding in the information transmission between the mobile application and the server 12 in the data acquisition method of the present example.
  • FIG. 2 illustrates a flow of the mobile application in FIG. 1 acquiring data from a server across domains. As shown in FIG. 2, the process may include the following steps:
  • step 201 the mobile application detects that the web page receives a data acquisition request.
  • the web page code portion of the mobile application can be set during development to include a function that can detect whether the page receives a data acquisition request. When it is detected that the user performs a data acquisition trigger operation on the web page, it indicates that the data needs to be acquired.
  • the data acquisition triggering operation may be when the user clicks on a button item in the page, or inputs a keyword, and clicks “search”, the mobile application needs to obtain data of the search result to be displayed on the page.
  • the web page of the mobile application can invoke a native encapsulated client interface that invokes the native RPC interface.
  • a page container in a mobile application may encapsulate a client interface that invokes an RPC (Remote Procedure Call Protocol) interface, as in step 201.
  • RPC Remote Procedure Call Protocol
  • the client interface may be invoked to trigger the execution of step 203.
  • the web page when it invokes the client interface, it can pass some parameters required to request data to Native.
  • the parameters may include interface address information and request parameter information.
  • the interface address information may be information that is predetermined in advance with the server, and is used to indicate an address of the server where the data is located, and a name of the calling interface of the data at the server.
  • the database storing the data takes the corresponding data, and the calling interface name may be before the cross-domain request data of the example, the server pre-declares the interface for externally calling the corresponding data.
  • the server can know which data of the specific request according to the parameter, and then send the data to the client as required. For example, if the data to be acquired is the first five data in the data set corresponding to the interface address information, the request parameter information may include “5” indicating that the first five data are to be acquired.
  • step 203 Native sends a data request to the gateway.
  • the Native When the web page invokes the client interface provided by the above Native, the Native will be triggered to send an RPC data request to the server 12 to request the data provided by the server 12 across the domain.
  • Native can send an RPC data request to the gateway 13, and through the RPC remote procedure call, the server service can be invoked like a local service.
  • the usual implementation can include XML-RPC, JSON-RPC, and the like.
  • the RPC data request is used to request cross-domain data provided by the server 12, which is data that the mobile application's web page needs to display.
  • the RPC data request may carry interface address information and request parameter information.
  • step 204 the gateway forwards the data request to the server.
  • the gateway 13 can pre-fetch the interface, configuration, and release declared by the server 12, so that the gateway 13 can record the forwarding path required when receiving an invocation of an interface.
  • the gateway may forward the request route to the server 12 according to the interface address information and the request parameter information in the request. For example, the gateway can record the forwarding path corresponding to the address of a certain server, and when receiving the server address for www.alipay.com, find the corresponding path forwarding.
  • step 205 the server returns cross-domain data to the gateway.
  • the server may obtain corresponding data according to the calling interface name in the request, complete the processing, and return the data to the gateway, so that the gateway can feed the data to the mobile application in the mobile device. .
  • step 206 the gateway returns the data to Native.
  • step 207 Native transmits the cross-domain data to a web page to load and display the data in the page.
  • the RPC data request sent by the Native to the server is not characterized by cross-domain, and the Native encapsulates a client interface to the Web page, and the interface invokes the Native RPC interface, when the Web When the page receives the data acquisition trigger, the interface is invoked, and the Native can be triggered to send an RPC data request to the server to obtain data of different domains.
  • the RPC request sent by the Native to the server does not have the concept of cross-domain, so the applicability is wider, and the development process of the strategy is simple and the compatibility is good;
  • the server After the server publishes the interface, it can be accessed by the mobile page of multiple domains, and each domain can request data across domains according to the process shown in FIG. 2.
  • the mobile device in which the mobile application for executing the data acquisition method is located may include one or more of the following components: processing component, memory, power component, multimedia component, audio component, input/output (I/ O) interfaces, sensor components, and communication components.
  • Processing components typically control the overall operation of the mobile device, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
  • the processing component can include one or more processors to execute instructions to perform all or part of the steps of the methods described above.
  • a processing component can include one or more modules to facilitate interaction between components and other components.
  • the processing component can include a multimedia module to facilitate interaction between the multimedia component and the processing component.
  • the memory is configured to store various types of data to support operation at the mobile device. Examples of such data include instructions for any application or method operating on the device, contact data, phone book data, messages, pictures, videos, and the like.
  • the data acquisition method in the present disclosure can be implemented when instructions in the memory are executed by the processor.
  • the memory can be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), and erasable programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Flash Memory, Disk or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Flash Memory Disk or Optical Disk.
  • the mobile device may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable A gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the above methods.
  • ASICs application specific integrated circuits
  • DSPs digital signal processors
  • DSPDs digital signal processing devices
  • PLDs programmable logic devices
  • FPGA field programmable A gate array
  • controller microcontroller, microprocessor or other electronic component implementation for performing the above methods.
  • non-transitory computer readable storage medium comprising instructions, such as a memory comprising instructions executable by a processor of a mobile device to perform the data acquisition method of the present disclosure.
  • the non-transitory computer readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.
  • an example of the present disclosure further provides a data acquisition device, the device being applied to a mobile application, the mobile application comprising a web page and a page container for loading the web page,
  • the page container is implemented by Native; the web page includes a data request module, and the page container includes a call processing module.
  • the data requesting module 31 is configured to, when detecting that the web page receives the data obtaining request, send, by using the calling processing module of the page container, a data request to a server that provides the data across domains. ;
  • the processing module 32 is configured to transmit the data to the data requesting module upon receiving the data fed back by the server.
  • the data request carries: interface address information and request parameter information, where the interface address information is used to indicate an address of a server where the data is located, and a call interface name of the data at the server.
  • the processing module 32 is specifically configured to encapsulate a client interface to the web page, and the client interface invokes an RPC interface of the page container;
  • the data requesting module 31 is specifically configured to invoke the client interface to trigger the call processing module to send an RPC data request to the server through the RPC interface.
  • the apparatus or module illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product having a certain function.
  • the above devices are described as being separately divided into various modules by function.
  • the functions of the various modules may be implemented in one or more software and/or hardware in the practice of the present disclosure.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Information Transfer Between Computers (AREA)
  • Telephonic Communication Services (AREA)
  • Measurement Of Velocity Or Position Using Acoustic Or Ultrasonic Waves (AREA)
  • Radar Systems Or Details Thereof (AREA)

Abstract

本公开提供一种数据获取方法和装置,其中应用于移动应用,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现;所述方法包括:当检测到所述Web页面接收到数据获取请求时,通过所述页面容器向跨域提供所述数据的服务器发送数据请求;通过所述页面容器接收所述服务器反馈的数据,并将所述数据传输至所述Web页面加载。本公开通过借助Native提供的客户端接口向服务器跨域请求数据,该方法由于Native向服务器发送的RPC数据请求没有跨域的概念,所以适用性更广,并且,该策略的开发过程简单,兼容性好。

Description

一种数据获取方法和装置 技术领域
本公开涉及网络技术,特别涉及一种数据获取方法和装置。
背景技术
移动设备和移动应用越来越普及,人们每天都使用移动设备上安装的移动应用浏览资料、查询数据,并且移动设备及移动应用的数量和功能也越来越多,其中一种类型的功能即通过移动应用浏览网页中的内容。在网页展示中,有时涉及到跨域请求数据,比如,A网站和B网站分属于不同的域(Domain),A网站的页面在显示时,页面显示所需的部分数据是存储在B网站的服务器,这就需要跨域访问B网站的服务器获取数据。相关技术中,跨域获取数据的方法也可以有多种,但是当前的方法都存在诸多缺点,致使跨域交互不太理想。例如可以使用JSONP,但是JSONP只支持GET请求而不支持POST等其他类型的HTTP请求,适用范围较小,同时又存在安全隐患;又例如还可以使用修改跨域文件的方式,但是该方法只在很少的浏览器中支持,而且不够灵活。
发明内容
有鉴于此,本公开提供一种数据获取方法和装置,以提供一种简单且适用性广的跨域数据获取方式。
具体地,本公开是通过如下技术方案实现的:
第一方面,提供一种数据获取方法,所述方法应用于移动应用,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现;所述方法包括:
当检测到所述Web页面接收到数据获取请求时,通过所述页面容器向跨域提供所述数据的服务器发送数据请求;
通过所述页面容器接收所述服务器反馈的数据,并将所述数据传输至所述Web页面加载。
第二方面,提供一种数据获取系统,所述系统包括:移动设备上安装的移动应用和服务器,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现,且所述服务器跨域提供所述Web页面展示所需要的数据;
所述移动应用,用于当检测到所述Web页面接收到数据获取请求时,通过所述页面容器向跨域提供所述数据的服务器发送数据请求;
所述服务器,用于将所述数据反馈至所述移动应用的页面容器,并由所述页面容器将所述数据传输至所述Web页面加载。
第三方面,提供一种数据获取装置,所述装置应用于移动应用,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现;所述Web页面包括数据请求模块,所述页面容器包括调用处理模块:
所述数据请求模块,用于当检测到所述Web页面接收到数据获取请求时,通过所述页面容器的所述调用处理模块向跨域提供所述数据的服务器发送数据请求;
所述调用处理模块,用于在接收到所述服务器反馈的数据时,将所述数据传输至所述数据请求模块。
本公开的数据获取方法和装置,通过借助Native提供的客户端接口向服务器跨域请求数据,该方法由于Native向服务器发送的RPC数据请求没有跨域的概念,所以不会受到相关跨域方法的限制,适用性更广,并且实施简单。
附图说明
图1是本公开实施例提供的一种数据获取方法的系统架构;
图2是本公开实施例提供的一种数据获取方法的流程图;
图3是本公开实施例提供的一种数据获取装置的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
随着移动设备的普及,移动应用在数量和功能的发展也越来越丰富。移动应用存在三种形态:原生应用(Native APP)、Web应用(Web APP)、混合应用(Hybrid App)。其中,混合应用是指Web与Native相结合的App,混合应用正是取Native应用和Web应用各自所长。
混合应用(Hybrid App)可以使用原生系统程序语言(即Native)实现一个具备网页浏览功能的UI(User Interface,用户界面)容器,所有用户可见的内容均为使用HTML(Hyper Text Mark-up Language,超文本标记语言)、JavaScript(Java脚本)、CSS(Cascading Style Sheet,层叠样式)等网页语言开发的Web页面。因此,本公开中,可以称为混合应用包括两个部分,一部分是Web页面,另一部分是用于加载所述Web页面的页面容器,所述页面容器通过Native实现。
用户在使用混合应用时,可能会遇到跨域数据请求的场景:例如,用户在自己移动设备上安装的移动应用中打开Web页面http://www.a.com/,该页面属于网站A。假设一种情况,用户在这个页面上触发了一个操作,比如输入关键词,点击“搜索”,那么该Web页面会监测上述触发操作,则需要获取对应关键词的搜索结果数据,并返回展示在页面上。在一个例子中,该数据可以是由另一个域的服务器跨域提供的,比如该服务器是http://www.b.com/的服务端,属于网站B,A网站和B网站分属于不同的域(Domain)。那么,移动应用就需要跨域获取页面展示需要的数据,即跨域数据请求。
本公开的数据获取方法,将描述移动应用如何获取服务器跨域提供的数据。 图1示例了该方法应用的系统环境,并结合该环境说明跨域访问的过程。如图1所示,该系统中可以包括:移动设备11、服务器12和网关13。
在一个示例性的实施方式中,移动设备例如可以是智能电话、PDA、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合等。在图1的例子中,移动设备可以是用户的智能手机11。
如图1所示,智能手机11上安装的移动应用12,可以包括Web页面121和页面容器122,其中,Web页面121可以是通过网页程序语言开发的页面,而页面容器122可以是通过Native实现,例如可以嵌入一个WebView组件或其他浏览器内核组件,可以在这个组件中载入页面,相当于内嵌的浏览器。
用户在移动应用中打开Web页面121,并在该页面中执行了数据获取触发操作时,例如点击了页面中的一个按钮项,可以触发该移动应用去获取服务器12跨域提供的数据,以供在页面中展示。图1的系统中还可以包括网关13,该网关13将在本例子的数据获取方法中,在移动应用和服务器12之间的信息传输中起到信息转发的作用。
在Javascript中,有一个很重要的安全性限制,即同源策略,Javascript只能访问与包含它的文档在同一域下的内容,简单来说就是A域的Javascript代码试图访问B域时,这种跨域访问通常是被禁止的。本例子为了实现跨域的数据访问,提供了一种数据获取方法,图2示例了图1中的移动应用向服务器跨域获取数据的流程,如图2所示,该流程可以包括如下步骤:
在步骤201中,移动应用检测到所述Web页面接收到数据获取请求。
例如,移动应用的Web页面代码部分,在开发时可以设定该页面包括一个功能,即可以检测页面是否接收到数据获取请求。当检测到用户在Web页面执行了数据获取触发操作时,表明需要获取数据。在一个例子中,该数据获取触发操作可以是用户点击了页面中的某个按钮项,或者是输入关键词,点击“搜索”,则移动应用需要获取搜索结果的数据,以在页面展示。
在步骤202中,移动应用的Web页面可以调用Native封装的客户端接口, 该客户端接口调用了Native的RPC接口。
本公开的例子中,移动应用中的页面容器(后续的描述中将称为Native)可以封装一个调用了RPC(Remote Procedure Call Protocol,远程过程调用协议)接口的客户端接口,当步骤201中的Web页面检测到数据获取请求时,可以调用该客户端接口,以触发步骤203的执行。
此外,Web页面在调用客户端接口时,可以将一些请求数据所需要的参数传递至Native。例如,所述参数可以包括接口地址信息和请求参数信息。其中,接口地址信息可以是与服务器端提前预定好的信息,用于表示所述数据所在的服务器的地址、以及所述数据在服务器的调用接口名称。例如,Web页面向Native传递的信息可以包括https://www.alipay.com/a.json?data=123,其中,https://www.alipay.com/a.json即接口地址信息,其中,www.alipay.com是服务器地址、a.json是数据调用接口名称,服务器根据该接口名称去存储数据的数据库取对应的数据,该调用接口名称可以是在本例子的跨域请求数据之前,服务器预先进行接口的声明,以用于外部调用对应的数据。“?data=123”即请求参数信息,用于表示具体取哪些数据。服务器可以根据该参数得知具体请求的哪些数据,从而按照要求下发数据到客户端。比如,假设要获取的数据是接口地址信息对应的数据集合中的前五个数据,则请求参数信息可以包括“5”,表明要获取前五个数据。
在步骤203中,Native向网关发送数据请求。
当Web页面调用了上述Native提供的客户端接口后,将触发Native向服务器12发送RPC数据请求,以请求服务器12跨域提供的数据。本步骤中,Native可以向网关13发送RPC数据请求,通过RPC远程过程调用,可以像调用本地服务一样调用服务器的服务,通常的实现可以包括XML-RPC,JSON-RPC等。该RPC数据请求用于请求服务器12提供的跨域数据,该跨域数据是移动应用的Web页面需要展示的数据。此外,该RPC数据请求中可以携带接口地址信息和请求参数信息。
在步骤204中,网关将所述数据请求转发至所述服务器。
本例子中,网关13可以预先拉取服务器12声明的接口、配置并发布,这样网关13可以记录在接收到某个接口的调用时所需的转发路径。网关在接收到Native的RPC数据请求后,可以根据请求中的接口地址信息和请求参数信息,将请求路由转发至服务器12。例如,网关可以记录某个服务器的地址对应的转发路径,在接收到对于www.alipay.com的服务器地址时,找到对应路径转发。
在步骤205中,服务器将跨域数据返回给网关。
例如,服务器在接收到网关转发的数据请求之后,可以根据请求中的调用接口名称获取对应的数据,处理完成并将数据返回给网关,以使得网关可以将该数据反馈至移动设备中的移动应用。
在步骤206中,网关将数据返回给Native。
在步骤207中,Native将所述跨域数据传输至Web页面,以在页面中加载展示该数据。
本例子的数据获取方法中,是利用了Native向服务器发送的RPC数据请求没有跨域的概念的特点,由Native向Web页面封装了一个客户端接口,该接口调用了Native的RPC接口,当Web页面接收到数据获取触发时调用该接口,就可以相应触发Native向服务器发送RPC数据请求,以获取不同域的数据。这种
通过借助Native提供的客户端接口向服务器跨域请求数据的方法,由于Native向服务器发送的RPC请求没有跨域的概念,所以适用性更广,并且,该策略的开发过程简单,兼容性好;对于服务器来说,在服务器发布接口之后,可以供多个域的移动端页面来访问,各个域都可以按照图2所示的流程跨域请求数据即可。
本公开的例子中,用于执行该数据获取方法的移动应用所在的移动设备,可以包括以下一个或多个组件:处理组件,存储器,电源组件,多媒体组件,音频组件,输入/输出(I/O)的接口,传感器组件,以及通信组件。处理组件通常控制移动设备的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件可以包括一个或多个处理器来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件可以包括一个或多个模块, 便于处理组件和其它组件之间的交互。例如,处理部件可以包括多媒体模块,以方便多媒体组件和处理组件之间的交互。
存储器被配置为存储各种类型的数据以支持在移动设备的操作。这些数据的示例包括用于在设备上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。当存储器中的指令被处理器执行时,可以实现本公开中的数据获取方法。存储器可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),快闪存储器,磁盘或光盘。
在示例性实施例中,移动设备可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其它电子元件实现,用于执行上述方法。
在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器,上述指令可由移动设备的处理器执行以完成本公开的数据获取方法。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。
为了实现上述的数据获取方法,本公开的例子中还提供了一种数据获取装置,所述装置应用于移动应用,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现;所述Web页面包括数据请求模块,所述页面容器包括调用处理模块。
如图3所示,数据请求模块31,用于当检测到所述Web页面接收到数据获取请求时,通过所述页面容器的所述调用处理模块向跨域提供所述数据的服务器发送数据请求;
调用处理模块32,用于在接收到所述服务器反馈的数据时,将所述数据传输至所述数据请求模块。
在一个例子中,所述数据请求中携带:接口地址信息和请求参数信息,所述接口地址信息用于表示所述数据所在的服务器的地址、以及所述数据在服务器的调用接口名称。
在一个例子中,调用处理模块32,具体用于将客户端接口封装给所述Web页面,所述客户端接口调用了所述页面容器的RPC接口;
所述数据请求模块31,具体用于调用所述客户端接口,以触发所述调用处理模块通过所述RPC接口向所述服务器发送RPC数据请求。
上述实施例阐明的装置或模块,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本公开时可以把各模块的功能在同一个或多个软件和/或硬件中实现。
以上所述仅为本公开的较佳实施例而已,并不用以限制本公开,凡在本公开的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开保护的范围之内。

Claims (10)

  1. 一种数据获取方法,其特征在于,所述方法应用于移动应用,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现;所述方法包括:
    当检测到所述Web页面接收到数据获取请求时,通过所述页面容器向跨域提供所述数据的服务器发送数据请求;
    通过所述页面容器接收所述服务器反馈的数据,并将所述数据传输至所述Web页面加载。
  2. 根据权利要求1所述的方法,其特征在于,所述数据请求中携带:接口地址信息和请求参数信息,所述接口地址信息用于表示所述数据所在的服务器的地址、以及所述数据在服务器的调用接口名称。
  3. 根据权利要求1所述的方法,其特征在于,所述检测到所述Web页面接收到数据获取请求,包括:
    检测到用户在所述Web页面执行了数据获取触发操作。
  4. 根据权利要求1所述的方法,其特征在于,所述通过所述页面容器向跨域提供所述数据的服务器发送数据请求,包括:
    调用所述页面容器封装给所述Web页面的客户端接口,所述客户端接口调用了所述页面容器的RPC接口;
    通过所述页面容器的RPC接口向所述服务器发送RPC数据请求。
  5. 一种数据获取系统,其特征在于,所述系统包括:移动设备上安装的移动应用和服务器,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现,且所述服务器跨域提供所述Web页面展示所需要的数据;
    所述移动应用,用于当检测到所述Web页面接收到数据获取请求时,通过所述页面容器向跨域提供所述数据的服务器发送数据请求;
    所述服务器,用于将所述数据反馈至所述移动应用的页面容器,并由所述 页面容器将所述数据传输至所述Web页面加载。
  6. 根据权利要求5所述的系统,其特征在于,所述系统还包括:网关;
    所述网关,用于接收所述移动应用通过页面容器的RPC接口发送的数据请求,并根据所述数据请求中携带的接口地址信息和请求参数信息,将所述数据请求转发至所述服务器;还用于将所述服务器反馈的数据转发至所述页面容器。
  7. 根据权利要求5所述的系统,其特征在于,
    所述移动应用,具体用于当检测到所述Web页面接收到数据获取请求时,由所述Web页面调用页面容器封装给所述Web页面的客户端接口,所述客户端接口调用了所述页面容器的RPC接口,以通过所述RPC接口,向所述服务器发送远程过程调用协议RPC数据请求。
  8. 一种数据获取装置,其特征在于,所述装置应用于移动应用,所述移动应用包括Web页面和用于加载所述Web页面的页面容器,所述页面容器通过Native实现;所述Web页面包括数据请求模块,所述页面容器包括调用处理模块;
    所述数据请求模块,用于当检测到所述Web页面接收到数据获取请求时,通过所述页面容器的所述调用处理模块向跨域提供所述数据的服务器发送数据请求;
    所述调用处理模块,用于在接收到所述服务器反馈的数据时,将所述数据传输至所述数据请求模块。
  9. 根据权利要求8所述的装置,其特征在于,所述数据请求中携带:接口地址信息和请求参数信息,所述接口地址信息用于表示所述数据所在的服务器的地址、以及所述数据在服务器的调用接口名称。
  10. 根据权利要求8所述的装置,其特征在于,
    所述调用处理模块,具体用于将客户端接口封装给所述Web页面,所述客户端接口调用了所述页面容器的RPC接口;
    所述数据请求模块,具体用于调用所述客户端接口,以触发所述调用处理模块通过所述RPC接口向所述服务器发送RPC数据请求。
PCT/CN2017/118452 2017-01-09 2017-12-26 一种数据获取方法和装置 WO2018126938A1 (zh)

Priority Applications (7)

Application Number Priority Date Filing Date Title
EP17890593.1A EP3550788A4 (en) 2017-01-09 2017-12-26 DATA COLLECTION PROCESS AND DEVICE
SG11201906183UA SG11201906183UA (en) 2017-01-09 2017-12-26 Data acquisition method and device
JP2019537168A JP6898452B2 (ja) 2017-01-09 2017-12-26 データ取得方法およびデバイス
KR1020197021508A KR102281401B1 (ko) 2017-01-09 2017-12-26 데이터 획득 방법 및 디바이스
MYPI2019003826A MY190374A (en) 2017-01-09 2017-12-26 Data acquisition method and device
US16/459,294 US20190327287A1 (en) 2017-01-09 2019-07-01 Data acquisition method and device
PH12019501584A PH12019501584A1 (en) 2017-01-09 2019-07-04 Data acquisition method and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710013608.1 2017-01-09
CN201710013608.1A CN107070870B (zh) 2017-01-09 2017-01-09 一种数据获取方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/459,294 Continuation US20190327287A1 (en) 2017-01-09 2019-07-01 Data acquisition method and device

Publications (1)

Publication Number Publication Date
WO2018126938A1 true WO2018126938A1 (zh) 2018-07-12

Family

ID=59623393

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/118452 WO2018126938A1 (zh) 2017-01-09 2017-12-26 一种数据获取方法和装置

Country Status (10)

Country Link
US (1) US20190327287A1 (zh)
EP (1) EP3550788A4 (zh)
JP (1) JP6898452B2 (zh)
KR (1) KR102281401B1 (zh)
CN (1) CN107070870B (zh)
MY (1) MY190374A (zh)
PH (1) PH12019501584A1 (zh)
SG (1) SG11201906183UA (zh)
TW (1) TWI787213B (zh)
WO (1) WO2018126938A1 (zh)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107070870B (zh) * 2017-01-09 2020-04-14 阿里巴巴集团控股有限公司 一种数据获取方法和装置
CN107885502B (zh) * 2017-11-10 2021-10-15 广州市千钧网络科技有限公司 接口处理方法、处理装置、接口管理方法和管理装置
CN108399223B (zh) * 2018-02-12 2022-06-03 北京奇艺世纪科技有限公司 一种数据获取方法、装置及电子设备
CN109800374A (zh) * 2018-12-13 2019-05-24 平安普惠企业管理有限公司 临时页面数据处理方法、装置、计算机设备及存储介质
CN110290104A (zh) * 2019-05-09 2019-09-27 北京善义善美科技有限公司 应用中内嵌网页的安全通信方法及所述应用
CN110245156A (zh) * 2019-05-29 2019-09-17 吉旗(成都)科技有限公司 缓存数据处理方法及装置
CN110336753B (zh) * 2019-06-19 2021-10-22 腾讯科技(深圳)有限公司 一种跨网络区域的服务调用方法、装置、设备及存储介质
CN111124410A (zh) * 2019-12-28 2020-05-08 北京浪潮数据技术有限公司 一种页面加载方法、装置、设备及可读存储介质
CN110943872A (zh) * 2019-12-31 2020-03-31 上海擎感智能科技有限公司 数据采集服务配置/性能分析方法/系统、介质及服务器
CN111367581B (zh) * 2020-02-28 2024-02-09 上海盛付通电子支付服务有限公司 一种用于提供寄宿程序的方法与设备
CN112153064B (zh) * 2020-09-28 2022-11-22 上海缓存命中科技有限公司 应用商店及其使用方法
CN113779350A (zh) * 2020-09-28 2021-12-10 北京沃东天骏信息技术有限公司 数据采集方法、装置、计算机系统和计算机可读存储介质
CN113132347B (zh) * 2021-03-08 2022-11-15 微梦创科网络科技(中国)有限公司 Rpc服务的配置方法、装置以及系统
CN113515767B (zh) * 2021-08-02 2024-01-23 杭州粉象家科技有限公司 一种基于混合模式移动应用的接口请求管理方法及装置
CN115550333B (zh) * 2022-12-02 2023-03-31 中国电子科技集团公司第十五研究所 基于Web的在多级多域环境中访问应用的系统及方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101615179A (zh) * 2008-06-25 2009-12-30 国际商业机器公司 用于Web应用的跨域交互的方法和系统
CN105045887A (zh) * 2015-07-24 2015-11-11 苏州工业园区迪锐信信息科技有限责任公司 混合模式跨域数据交互的系统及其方法
US20160070551A1 (en) * 2014-09-09 2016-03-10 Liveperson, Inc. Dynamic code management
CN107070870A (zh) * 2017-01-09 2017-08-18 阿里巴巴集团控股有限公司 一种数据获取方法和装置

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2518637A1 (en) * 2005-12-22 2012-10-31 Catalog.Com, Inc. System and method for cross-domain social networking
KR100759218B1 (ko) * 2006-04-27 2007-09-17 아시아나아이디티 주식회사 개선된 rfid 미들웨어 엔진 시스템 및 구현방법
CN101662460B (zh) * 2008-08-25 2015-07-15 阿里巴巴集团控股有限公司 一种跨域通讯的方法、系统和装置
US8930440B2 (en) * 2010-06-29 2015-01-06 International Business Machines Corporation Systems and methods for enabling mobile mashups
GB2494027B (en) * 2011-08-25 2014-05-21 Ibm A computer-implemented method enabling a web application to call at least one native function of a mobile device
US9450826B2 (en) * 2012-02-22 2016-09-20 Rooundarch Corporation Device connectivity framework
TW201348994A (zh) * 2012-05-25 2013-12-01 Acer Inc 資料蒐集方法及裝置
CN103118137B (zh) * 2013-03-01 2015-11-04 畅捷通信息技术股份有限公司 跨域访问页面装置和跨域访问页面方法
CN103297275B (zh) * 2013-06-08 2016-08-17 烽火通信科技股份有限公司 Web网管客户端模块动态发现与加载方法
US9407725B2 (en) * 2013-06-14 2016-08-02 Dell Products L.P. Generic transcoding service for client-server communication
CN104808971B (zh) * 2014-01-24 2020-02-21 北京三星通信技术研究有限公司 网络应用程序管理器、方法、装置和移动终端
CN104301443B (zh) * 2014-10-09 2018-06-12 百度在线网络技术(北京)有限公司 一种在web页面上调用端能力接口的方法和系统
CN105791295B (zh) * 2016-03-04 2019-01-11 宁波工程学院 一种基于Node.js的应用服务器
CN106254420B (zh) * 2016-07-18 2019-10-22 中国农业银行股份有限公司 一种跨域通讯方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101615179A (zh) * 2008-06-25 2009-12-30 国际商业机器公司 用于Web应用的跨域交互的方法和系统
US20160070551A1 (en) * 2014-09-09 2016-03-10 Liveperson, Inc. Dynamic code management
CN105045887A (zh) * 2015-07-24 2015-11-11 苏州工业园区迪锐信信息科技有限责任公司 混合模式跨域数据交互的系统及其方法
CN107070870A (zh) * 2017-01-09 2017-08-18 阿里巴巴集团控股有限公司 一种数据获取方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3550788A4 *

Also Published As

Publication number Publication date
EP3550788A4 (en) 2019-11-20
CN107070870A (zh) 2017-08-18
EP3550788A1 (en) 2019-10-09
KR102281401B1 (ko) 2021-07-26
TW201826153A (zh) 2018-07-16
SG11201906183UA (en) 2019-08-27
TWI787213B (zh) 2022-12-21
JP6898452B2 (ja) 2021-07-07
MY190374A (en) 2022-04-18
PH12019501584A1 (en) 2020-02-24
KR20190101405A (ko) 2019-08-30
JP2020505681A (ja) 2020-02-20
US20190327287A1 (en) 2019-10-24
CN107070870B (zh) 2020-04-14

Similar Documents

Publication Publication Date Title
WO2018126938A1 (zh) 一种数据获取方法和装置
US20240168616A1 (en) Information processing terminal and control method
US10990655B1 (en) Methods, systems, and computer program products for web browsing
US10255255B2 (en) Customization of mobile applications using web-based technology
US8650481B1 (en) Stable and secure use of content scripts in browser extensions
US8332878B2 (en) User scriptable server initiated user interface creation
US9552338B2 (en) Mechanisms to compose, execute, save, and retrieve hyperlink pipelines in web browsers
US8819819B1 (en) Method and system for automatically obtaining webpage content in the presence of javascript
KR101720071B1 (ko) 온보드 하드웨어 기능들을 가진 웹페이지들
US10339199B2 (en) Methods, systems, and computer readable media for capturing and storing a web page screenshot
CN105245518B (zh) 网址劫持的检测方法及装置
CN106528657A (zh) 浏览器跳转至应用程序的控制方法及装置
US20140136937A1 (en) Providing and procuring worksheet functions through an online marketplace
US20140245124A1 (en) System and method thereof for browser agnostic extension models
WO2019119974A1 (zh) 对象上传方法及装置
AU2019100103A4 (en) A system and method for delivering in-app content using mobile messaging
CN113626741A (zh) 一种移动客户端网页加载的方法及设备
US10599403B2 (en) Methods, systems, and computer program products for web browsing
Yen et al. AMDWAF: A context-aware web application framework

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17890593

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019537168

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2017890593

Country of ref document: EP

Effective date: 20190704

ENP Entry into the national phase

Ref document number: 20197021508

Country of ref document: KR

Kind code of ref document: A