CN103530401A - Method for obtaining data and drawing graph based on web service - Google Patents
Method for obtaining data and drawing graph based on web service Download PDFInfo
- Publication number
- CN103530401A CN103530401A CN201310502651.6A CN201310502651A CN103530401A CN 103530401 A CN103530401 A CN 103530401A CN 201310502651 A CN201310502651 A CN 201310502651A CN 103530401 A CN103530401 A CN 103530401A
- Authority
- CN
- China
- Prior art keywords
- interface
- data
- intelligent terminal
- database
- webservice
- 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.)
- Pending
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to a method for obtaining data and drawing a graph based on a web service and belongs to the technical field of computer drawing. Intelligent terminals obtain data information through remote procedure call of web service interfaces and the corresponding data are expressed in a curve mode. The method for obtaining the data and drawing the graph based on the web service is characterized in that the intelligent terminals call the data information through the web service interfaces, so that the intelligent terminals are prevented from having direct access to a database in a JDBC mode, and the safety of the data is guaranteed; the limits of authority of the different intelligent terminals are divided, layered management of the data is achieved, and the confidentiality and the reliability are effectively improved; access ip addresses and port numbers can be set and changed by the intelligent terminals, so that the data are called conveniently and rapidly; result sets are packaged to an Array list through the web service interfaces, resources of the database are prevented from being occupied for a long time, and the efficiency of data obtaining is improved; the data and the time interval of the data to be inquired can be set through the method and the inquiry result is accurate and effective.
Description
Technical field
The present invention relates to computer drawing technology field, specifically relate to a kind of data acquisition and drawing practice based on webservice.
Background technology
Webservice is a cross-platform service, it makes between different machines swap data mutually, and do not go to concern platform, language and the internal agreement that they use, and Webservice is used the data of xml transfer structure, and soap agreement realizes far call.Nowadays, this technology is widely used on PC and mobile phone terminal, but the part that still comes with some shortcomings at the aspects such as demonstration of authority setting, database resource utilization and data.For example, " the Various database access method based on WebService " (ISSN1009-3044 that the Wu Haibo He Wubao state teacher of Beijing Forestry University delivers on Computer Knowledge and Technology computer knowledge and technical journal, Vol.5, No.31, November2009, pp.8628-8631), this article provides a kind of WebService of take technology as basis, by the long-range Various database data access method of Java platform development.With Java language, write service, Axis2 framework issue WebService, JSON format analysis processing exchanges data, the application by gordian techniquies such as WebService, Java, JSON, Axis2, realizes cross-platform remote data access service.The authority setting of the method is mainly reflected on database manipulation (operation such as select, insert, update, delete), and concrete zones of different data are not associated with terminal, the method adopts JSON form to carry out deal with data exchange, although efficiently succinct, but quoted third party software, and JSON is more applied to browser, on mobile phone terminal, there is many restrictions.In addition, these class methods, in the demonstration of real time data, are described meticulously the aspects such as variation tendency with curve and are not described in detail.
Summary of the invention
The present invention is directed to above these shortcomings, a kind of data Real-time Obtaining based on webservice method that can curve plotting are provided, can authority be reasonably set according to demand, effectively utilize database resource, and the data obtained of more careful processing and displaying.
Technical scheme of the present invention is as follows:
A kind of data Real-time Obtaining based on webservice the method for curve plotting, mainly comprise intelligent terminal, database and interface three parts, interface and database are encapsulated in server end, interface by connection method, complete and database between communication, intelligent terminal is by network call webservice interface, and the method step is as follows:
1, webservice is encapsulated different sql according to demand, thereby form the interface of difference in functionality, between the interface of difference in functionality, by method name, carry out unique identification, these functional interfaces mainly comprise that landing(logs in interface, effect is to carry out authentication), real-timeData(real time data interface, effect is for obtaining the real time data of database), historyData(historical data interface, effect is from database, to obtain the data message of concrete time, for the function of curve plotting provides data source), alertData(Realtime Alerts interface, effect is that up-to-date warning message is passed to intelligent terminal), the historical remote alarm interface of historyAlert(, effect is that the historical data of warning is passed to intelligent terminal), after interface has been issued, the method name that intelligent terminal provides according to webservice, three parameters in NameSpace and url address realize to be called,
2, carry out the setting of authority, first when building database, the data message of different range is connected from different intelligent terminals, that is to say, each terminal has own corresponding data area, login name by intelligent terminal between them identifies, secondly, when writing Webservice interface, each interface will be introduced two variablees, userName and password(username and password), these two variablees need to obtain from terminal, when terminal calling interface obtains data, the value of these two variablees must be passed to interface, then interface removes accessing database according to the value of these two variablees, the setting of intelligent terminal part is after user logs in successfully, with SharedPerferences, preserve user name, when calling webservice interface, user name is all as a parameter transmission at every turn, to sum up, arranging of authority needs database, interface, intelligent terminal three parts jointly to complete,
3, realize intelligent terminal change ip address and port numbers, method is, at intelligent terminal, two global variables are set, i.e. " IP " and " PORT " two variablees, be used for ip address and the port numbers that record communication will be used, then by SharedPerferences method, store the concrete numerical value of these two variablees, thereby realize, at intelligent terminal, arrange in the page and can change ip address and port numbers;
4, Webservice interface is with Arraylist array form packing data, finally be packaged into List, implementation method is, Webservice interface is from database obtains result set, press row reading out data, the data content of every a line is as String type data, then be encapsulated in array Arraylist, after All Datarows Information encapsulation completes, whole List is passed to intelligent terminal as a variable, attention: the List variable that will transmit here, need to create XML file, by method name and return-type componentType method, to transmitting variable, describe definition,
5, intelligent terminal shows real time data, method is on intelligent terminal, to adopt Thread class to open up separately the variation that a thread monitors real time data, adopt the method for timer access database, by method name, NameSpace and three of url addresses parameter access real-timeData interface, obtain the real time data that will show, adopt afterwards the Handler of Android to process the communication between main thread and sub-thread, the data that obtain are presented on intelligent terminal in real time;
During 6, by webservice interface accessing database, using the date and time interval of input as variate-value, with String type data, pass to historyData interface (historical data interface), historyData interface is by sql statement accessing database, then return to XML file to intelligent terminal, intelligent terminal is resolved the XML file that interface returns, and the point that uses HashMap storage to draw adopts the icon library AChartEngine that increases income of Google to draw.
Described connection method is class methods in java connection data storehouse.
Described sql is a language of access and operating database.
The network address that described Shi Youip address, url address and port numbers form.
Described SharedPerferences method is the storage class of a lightweight providing of Android platform.
Described Arraylist is the dynamic array that is used for storing data in java.
Described List is the class being used in java in deal with data class libraries.
Described method name and return-type componentType method are respectively for define method name and return to the data type in List.
The advantage of the inventive method is as follows:
1, intelligent terminal only needs far call webservice interface, and does not need to know the inner structure of database, has avoided, by the direct accessing database of JDBC mode, having guaranteed the security of database data;
2, intelligent terminal has obvious delineation of power, with different username and passwords, label, terminal can only be accessed the data in own extent of competence, and can not check the part that exceeds own authority, make data management methodization, structurized while more, increased again confidentiality and the reliability of data;
3, intelligent terminal need to be changed ip address and the port numbers of access services device according to difference, that is to say, be the relation of one-to-many between intelligent terminal and server, and staff can check the data message of disparate databases, effectively heighten work efficiency, saved labour;
4, Webservice interface, with Arraylist array form packing data, is finally packaged into List, and intelligent terminal receives and reading out data with map form, rather than from database, obtains data message separately one by one, has improved the efficiency of obtaining data; Meanwhile, being connected to after sql inquires desired data between interface and database just disconnects immediately, avoided taking for a long time of database resource;
5, database, by some data such as warning message, initiatively sends the intelligent terminal of corresponding authority to, makes it make in time respective handling; Intelligent terminal is checked corresponding historical data according to the demand of oneself, and curve plotting, thereby shows intuitively the variation tendency of data;
6, intelligent terminal, when checking data, is set the date and time interval of the data query of wanting, thereby makes to check that result is more accurately effective, has avoided the redundancy of data, has saved again resource.
Embodiment
Below in conjunction with embodiment, the invention will be further described, but be not limited to this.
Embodiment:
A kind of data Real-time Obtaining based on webservice the method for curve plotting, mainly comprise intelligent terminal, database and interface three parts, interface and database are encapsulated in server end, interface by connection method, complete and database between communication, intelligent terminal is by network call webservice interface, and the method step is as follows:
1, webservice is encapsulated different sql according to demand, thereby form the interface of difference in functionality, between the interface of difference in functionality, by method name, carry out unique identification, these functional interfaces mainly comprise that landing(logs in interface, effect is to carry out authentication), real-timeData(real time data interface, effect is for obtaining the real time data of database), historyData(historical data interface, effect is from database, to obtain the data message of concrete time, for the function of curve plotting provides data source), alertData(Realtime Alerts interface, effect is that up-to-date warning message is passed to intelligent terminal) the historical remote alarm interface of historyAlert(, effect is that the historical data of warning is passed to intelligent terminal), after interface has been issued, the method name that intelligent terminal provides according to webservice, three parameters in NameSpace and url address realize to be called,
2, carry out the setting of authority, first when building database, the data message of different range is connected from different intelligent terminals, that is to say, each terminal has own corresponding data area, login name by intelligent terminal between them identifies, secondly, when writing Webservice interface, each interface will be introduced two variablees, userName and password(username and password), these two variablees need to obtain from terminal, when terminal calling interface obtains data, the value of these two variablees must be passed to interface, then interface removes accessing database according to the value of these two variablees, the setting of intelligent terminal part is after user logs in successfully, with SharedPerferences, preserve user name, when calling webservice interface, user name is all as a parameter transmission at every turn, to sum up, arranging of authority needs database, interface, intelligent terminal three parts jointly to complete,
3, realize intelligent terminal change ip address and port numbers, method is, at intelligent terminal, two global variables are set, i.e. " IP " and " PORT " two variablees, be used for ip address and the port numbers that record communication will be used, then by SharedPerferences method, store the concrete numerical value of these two variablees, thereby realize, at intelligent terminal, arrange in the page and can change ip address and port numbers;
4, Webservice interface is with Arraylist array form packing data, finally be packaged into List, implementation method is, Webservice interface is from database obtains result set, press row reading out data, the data content of every a line is as String type data, then be encapsulated in array Arraylist, after All Datarows Information encapsulation completes, whole List is passed to intelligent terminal as a variable, attention: the List variable that will transmit here, need to create XML file, by method name and return-type componentType method, to transmitting variable, describe definition,
5, intelligent terminal shows real time data, method is on intelligent terminal, to adopt Thread class to open up separately the variation that a thread monitors real time data, adopt the method for timer access database, by method name, NameSpace and three of url addresses parameter access real-timeData interface, obtain the real time data that will show, adopt afterwards the Handler of Android to process the communication between main thread and sub-thread, the data that obtain are presented on intelligent terminal in real time;
During 6, by webservice interface accessing database, using the date and time interval of input as variate-value, with String type data, pass to historyData interface (historical data interface), historyData interface is by sql statement accessing database, then return to XML file to intelligent terminal, intelligent terminal is resolved the XML file that interface returns, and the point that uses HashMap storage to draw adopts the icon library AChartEngine that increases income of Google to draw.
Claims (1)
1. a data Real-time Obtaining based on webservice the method for curve plotting, mainly comprise intelligent terminal, database and interface three parts, interface and database are encapsulated in server end, interface by connection method, complete and database between communication, intelligent terminal is by network call webservice interface, and the method step is as follows:
1) webservice is encapsulated different sql according to demand, thereby form the interface of difference in functionality, the interface of difference in functionality carries out unique identification by method name, these functional interfaces mainly comprise that landing logs in interface, real-timeData is that real time data interface, historyData are that historical data interface, alertData are that Realtime Alerts interface, historyAlert are historical remote alarm interface, after interface has been issued, the method name that intelligent terminal provides according to webservice, NameSpace and three of url addresses parameter realize to be called;
2) carry out the setting of authority, first when building database, the data message of different range is connected from different intelligent terminals, that is to say, each terminal has own corresponding data area, login name by intelligent terminal between them identifies, secondly, when writing Webservice interface, it is that user name and password are password that each interface will be introduced two variable: userName, these two variablees need to obtain from terminal, when terminal calling interface obtains data, the value of these two variablees must be passed to interface, then interface removes accessing database according to the value of these two variablees, the setting of intelligent terminal part is after user logs in successfully, with SharedPerferences, preserve user name, when calling webservice interface, user name is all as a parameter transmission at every turn, to sum up, arranging of authority needs database, interface, intelligent terminal three parts jointly to complete,
3) realize intelligent terminal change ip address and port numbers, method is, at intelligent terminal, two global variables are set, i.e. " IP " and " PORT " two variablees, be used for ip address and the port numbers that record communication will be used, then by SharedPerferences method, store the concrete numerical value of these two variablees, thereby realize, at intelligent terminal, arrange in the page and can change ip address and port numbers;
4) Webservice interface is with Arraylist array form packing data, finally be packaged into List, implementation method is, Webservice interface is from database obtains result set, press row reading out data, the data content of every a line is as String type data, then be encapsulated in array Arraylist, after All Datarows Information encapsulation completes, whole List is passed to intelligent terminal as a variable, attention: the List variable that will transmit here, need to create XML file, by method name and return-type componentType method, to transmitting variable, describe definition,
5) intelligent terminal shows real time data, method is on intelligent terminal, to adopt Thread class to open up separately the variation that a thread monitors real time data, adopt the method for timer access database, by method name, NameSpace and three of url addresses parameter access real-timeData interface, obtain the real time data that will show, adopt afterwards the Handler of Android to process the communication between main thread and sub-thread, the data that obtain are presented on intelligent terminal in real time;
6) during by webservice interface accessing database, using the date and time interval of input as variate-value, with String type data, pass to historyData interface, historyData interface is by sql statement accessing database, then return to XML file to intelligent terminal, intelligent terminal is resolved the XML file that interface returns, and the point that uses HashMap storage to draw adopts the icon library AChartEngine that increases income of Google to draw.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310502651.6A CN103530401A (en) | 2013-10-23 | 2013-10-23 | Method for obtaining data and drawing graph based on web service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310502651.6A CN103530401A (en) | 2013-10-23 | 2013-10-23 | Method for obtaining data and drawing graph based on web service |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103530401A true CN103530401A (en) | 2014-01-22 |
Family
ID=49932410
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310502651.6A Pending CN103530401A (en) | 2013-10-23 | 2013-10-23 | Method for obtaining data and drawing graph based on web service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103530401A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104317600A (en) * | 2014-10-31 | 2015-01-28 | 北京思特奇信息技术股份有限公司 | Configurable graph generation method and system |
CN105739990A (en) * | 2016-02-17 | 2016-07-06 | 浪潮通用软件有限公司 | Implementation method for remote call of button based on C # |
CN105824283A (en) * | 2015-01-22 | 2016-08-03 | 欧姆龙株式会社 | Programmable display |
CN106570118A (en) * | 2016-11-02 | 2017-04-19 | 国网山东省电力公司物资公司 | Report data processing system and method based on electric power material distribution mobile platform |
CN112040025A (en) * | 2020-09-03 | 2020-12-04 | 北京文香信息技术有限公司 | Server address switching method, system and terminal equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102255961A (en) * | 2011-06-30 | 2011-11-23 | 重庆新媒农信科技有限公司 | Java 2 micro edition (J2ME)-based Web Service interface calling method |
CN102255914A (en) * | 2011-07-19 | 2011-11-23 | 河南大学 | Android network application program information verification method |
CN102917021A (en) * | 2012-09-19 | 2013-02-06 | 深圳市融创天下科技股份有限公司 | Method, system and terminal equipment for returning data on basis of Web service |
US20130204935A1 (en) * | 2012-02-07 | 2013-08-08 | Soaric Ab | Dynamic sharing of a webservice |
-
2013
- 2013-10-23 CN CN201310502651.6A patent/CN103530401A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102255961A (en) * | 2011-06-30 | 2011-11-23 | 重庆新媒农信科技有限公司 | Java 2 micro edition (J2ME)-based Web Service interface calling method |
CN102255914A (en) * | 2011-07-19 | 2011-11-23 | 河南大学 | Android network application program information verification method |
US20130204935A1 (en) * | 2012-02-07 | 2013-08-08 | Soaric Ab | Dynamic sharing of a webservice |
CN102917021A (en) * | 2012-09-19 | 2013-02-06 | 深圳市融创天下科技股份有限公司 | Method, system and terminal equipment for returning data on basis of Web service |
Non-Patent Citations (5)
Title |
---|
BYXDAZ: "WebService", 《HTTP://BLOG.CSDN.NET/BYXDAZ/ARTICLE/DETAILS/9732737》, 3 August 2013 (2013-08-03) * |
SXWGF: "对WebService的一些封装技巧总结", 《HTTP://WWW.CNBLOGS.COM/SXWGF/ARCHIVE/2011/07/10/SOMETHING-ABOUT-WEBSERVICE.HTML》, 10 July 2011 (2011-07-10) * |
TMAJIER: "Android 与webservice进行实体对象的传递", 《HTTP://BLOG.CSDN.NET/WUWO333/ARTICLE/DETAILS/8059029》, 11 October 2012 (2012-10-11) * |
WXG22526451: "WebService数据库操作", 《HTTP://M.BLOG.CSDN.NET/ARTICLE/DETAILS》, 6 November 2007 (2007-11-06) * |
邬海波 等: "基于WebService的多源数据库访问方法", 《数据库与信息管理》, vol. 5, no. 31, 30 November 2009 (2009-11-30) * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104317600A (en) * | 2014-10-31 | 2015-01-28 | 北京思特奇信息技术股份有限公司 | Configurable graph generation method and system |
CN104317600B (en) * | 2014-10-31 | 2018-02-13 | 北京思特奇信息技术股份有限公司 | A kind of configurable curve drawing generating method and system |
CN105824283A (en) * | 2015-01-22 | 2016-08-03 | 欧姆龙株式会社 | Programmable display |
CN105739990A (en) * | 2016-02-17 | 2016-07-06 | 浪潮通用软件有限公司 | Implementation method for remote call of button based on C # |
CN105739990B (en) * | 2016-02-17 | 2018-11-02 | 浪潮通用软件有限公司 | Implementation method for remote call of button based on C # |
CN106570118A (en) * | 2016-11-02 | 2017-04-19 | 国网山东省电力公司物资公司 | Report data processing system and method based on electric power material distribution mobile platform |
CN106570118B (en) * | 2016-11-02 | 2020-08-07 | 国网山东省电力公司物资公司 | Report data processing system and method based on electric power material allocation mobile platform |
CN112040025A (en) * | 2020-09-03 | 2020-12-04 | 北京文香信息技术有限公司 | Server address switching method, system and terminal equipment |
CN112040025B (en) * | 2020-09-03 | 2023-03-24 | 安徽文香科技有限公司 | Server address switching method, system and terminal equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106980669B (en) | Data storage and acquisition method and device | |
CN103530401A (en) | Method for obtaining data and drawing graph based on web service | |
AU2016382909A1 (en) | Method and device for processing short link, and short link server | |
US20210116903A1 (en) | Use of a smart node in a universal, smart system for monitoring industrial processes | |
JP6641067B1 (en) | Detection system, method and related device | |
Gaitan et al. | A survey on the internet of things software architecture | |
CN101769767A (en) | Vegetable greenhouse monitoring system | |
Kim et al. | Developing an On‐Demand Cloud‐Based Sensing‐as‐a‐Service System for Internet of Things | |
CN112905600A (en) | Data query method and device, storage medium and electronic equipment | |
CN109067871A (en) | Electric power ubiquitous intelligent cloud architecture | |
US9201938B2 (en) | Parameter driven data format conversion in client/server architectures | |
CN104021216A (en) | Message proxy server and information publish subscription method and system | |
WO2018188607A1 (en) | Stream processing method and device | |
CN105245622A (en) | Configurable data processing method and system and mobile platform | |
Mangla et al. | A comprehensive review: Internet of things (IoT) | |
CN104461553A (en) | Storage management method in conformity with SMI-S (storage management initiative specification) standard | |
CN115002072B (en) | JMX-based data acquisition method, JMX-based data acquisition device and JMX-based data acquisition medium | |
CN116467274A (en) | Data sharing method and device for multi-source heterogeneous data, storage medium and terminal | |
CN113836212B (en) | Method for automatically generating Json data by database data, readable medium and electronic equipment | |
CN114296696A (en) | Business function operation method and device, storage medium and electronic equipment | |
CN112231377A (en) | Data mapping method, system, device, server and storage medium | |
Geronymo | Smart Lab: an application of Industry 4.0 design principles to calibration laboratories | |
Na | Internet of things based on the cloud computing architecture | |
CN103885780A (en) | Website development method and server | |
Facchinetti et al. | Design and implementation of a web-centric remote data acquisition system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20140122 |