100 likes | 217 Views
Tutorial: Live E! Data Retrieval <<SOAP/XML Web Service>>. Live E! Technical WG Created: 2008-03-04. Live E! Data Retriever Interfaces. SOAP/XML Web Services Portal Web Sites Graph Widgets. This document. See, data-retrieval-portal.pdf. See, data-retrieval-graph.pdf.
E N D
Tutorial: Live E! Data Retrieval<<SOAP/XML Web Service>> Live E! Technical WG Created: 2008-03-04
Live E! Data Retriever Interfaces • SOAP/XML Web Services • Portal Web Sites • Graph Widgets This document See, data-retrieval-portal.pdf See, data-retrieval-graph.pdf
SOAP/XML Web Services • GlobalDataProvider200703 WSDL: http://live-e2.hongo.wide.ad.jp/axis/services/GlobalDataProvider200703?wsdl • Data retrieval sample program by • Perl • Ruby • Python • PHP • Java • For more details about the services that a Live E! server provides, see <<TODO>>
Example by Perl • This code requires “SOAP::Lite” package. #!/usr/bin/perl use strict; use warnings; use SOAP::Lite; my $clinet = SOAP::Lite -> service('http://live-e2.hongo.wide.ad.jp/axis/services/GlobalDataProvider200703?wsdl‘); my $xml = $client-> getLatestDataAll(‘UTC',‘English'); print $xml;
Example by Ruby #!/usr/local/bin/ruby require 'soap/wsdlDriver’ wsdl = 'http://live-e2.hongo.wide.ad.jp/axis/services/GlobalDataProvider200703?wsdl' client = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver result = client.getLatestDataAll("UTC","English") print result • This code requires “soap4r” package. • Please also refer to • http://raa.ruby-lang.org/list.rhtml?name=soap4r • http://dev.ctor.org/soap4r
Example by Python import SOAPpy server = SOAPpy.WSDL.Proxy('http://live-e2.hongo.wide.ad.jp/axis/services/GlobalDataProvider200703?wsdl') x = server.getLatestDataAll("UTC", "English") • This code requires “SOAPpy”. • In debian, apt-get install python-soappy Example by PHP $server = new SoapClient("http://live-e2.hongo.wide.ad.jp/axis/services/GlobalDataProvider200703?wsdl"); $latest_xml=$server->getLatestDataAll("UTC","English");
Example by Java, using Axis1.4 • Stub code generation • Source code $ java org.apache.axis.wsdl.WSDL2Java -p org.livee.data.soap.client http://live-e2.hongo.wide.ad.jp/axis/services/GlobalDataProvider200703?wsdl import org.livee.data.soap.client.*; .............. // Request to GetLatestDataAll String globalDataProviderUrl="http://live-e2.hongo.wide.ad.jp/axis/services/GlobalDataProvider200703"; GlobalDataProvider200703Service dp=new GlobalDataProvider200703ServiceLocator(); GlobalDataProvider200703_PortType srv=dp.getGlobalDataProvider200703(new java.net.URL(globalDataProviderUrl)); String latestData=srv.getLatestDataAll("UTC","English");
Web ServiceGlobalDataProvider200703 getProfileSchema(); provides the global profile schema. getLatestDataAll(String tz,String locale); provides the latest data of all the sensors in Live E! network. getLatestData(String id,String tz,String locale); provides the latest data of the sensor specified by id. getLatestDataByAreaRect(double north,double south, double east, double west, String tz, String locale); provides the latest data of the sensor specified by geographical area ([west,east]*[south,north]). getArchiveCombinedData(String id,String start,String end,String tz,String locale); provides the archived data of the sensor specified by id. The timespan can be set by [start,end]. getDataHourlyAggregated(String id, String start,String end, String tz,String locale); provides the hourly aggregated data of the sensor specified by id. The timespan can by set by [start,end]. getDataDailyAggregated(String id, String start,String end, String tz,String locale); provides the daily aggregated data of the sensor specified by id. The timespan can by set by [start,end]. getDataMonthlyAggregated(String id, String start,String end, String tz,String locale); provides the monthly aggregated data of the sensor specified by id. The timespan can by set by [start,end]. getProfileAll(String tz,String locale); provides the profile of all the sensors. getProfile(String id,String tz,String locale); provides the profile of the sensor specifed by id. getProfileByAreaRect(double north, double south, double east, double west, String tz, String locale); provides the profile of the sensor specified by geographical area ([west,east]*[south,north]). getArchiveProfile(String id,String start, String end, String tz, String locale); provides the archived profile of the sensor specified by id. The timespan can be set by [start,end]. search(String query); provides the list of servers which matches the query.
Example $server->getLatestDataAll(“UTC”,”English”) $server->getLatestData(“hongo.wide.ad.jp/WXT510/test/”,“UTC”,”English”) $server->getLatestDataByAreaRect(40,30,140,135,”JST”,”Japanese”) $server->getDataHourlyAggregated(“hongo.wide.ad.jp/WXT510/test/”, ”2008-01-01T00:00:00.0000000+09:00”, ”2008-01-02T00:00:00.0000000+09:00”,”JST”,”Japanese”) $server->getProfileSchema() $server->getProfileAll(“UTC”,”English”) $server->getProfile(“hongo.wide.ad.jp/WXT510/test/”,“UTC”,”English”) $server->getProfileByAreaRect(40,30,140,135,”JST”,”Japanese”) $server->getArchiveProfile(“hongo.wide.ad.jp/WXT510/test/”, ”2008-01-01T00:00:00.0000000+09:00”, ”2008-03-01T00:00:00.0000000+09:00”,”JST”,”Japanese”) $query=“<query admin=\“domain\” name=\“*\” xmlns=\“http://live-e.org/Query/2007/03/\”/>” $server->search(query);
Example queries of the search method • To lookup all the servers in Live E! • <query domain="admin" name="*" xmlns="http://live-e.org/Query/2007/03/" /> • To lookup the server that has id = “weather.twnic.net.tw/WXT510/175/” • <query domain="admin" name="*" xmlns="http://live-e.org/Query/2007/03/"> • <filter targetClass="combined" attrName="id" eq="weather.twnic.net.tw/WXT510/175/"/> • </query> • To lookup the servers that have sensors in the geographical area of • latitude = [30,40]×longitude=[130,140] • <query domain="admin" name="*" xmlns="http://live-e.org/Query/2007/03/"> • <filter targetClass="combined" attrName="latitude" gteq="30" lteq="40"/> • <filter targetClass="combined" attrName="longitude" gteq="130" lteq="140"/> • </query> • To lookup the servers of “jp” family. • <query domain="admin" name="*.jp" xmlns="http://live-e.org/Query/2007/03/" /> • The search method responses the server list with entry points which service type is “Admin200703”. • To get data from the server resolved, at first, call the queryService method of • the resolved Admin200703 service as follows. • String url=Admin200703.queryService(“DataProvider200703”); • The obtained url tells the location of the data retrieval interface (DataProvider200703) of the server.