Using the Query Service
The use of the Query Service involves the following steps:
-
Connect to Query Service servlet
Connect to the servlet and open a stream for sending the XML query through.
-
Send XML query
The XML should be sent using HTTP Post method and the parameter containing the XML must be named
query
.Please refer to XML Schema defining the query XML protocol,
{EAE QS web app}/WEB-INF/eae-qs-query.xsd
, when creating queries. Some examples are listed below.- Time distributed page views query during Aug 22nd with interval set to 60 minutes
-
<eae-qs> <query> <pageview> <time-distributed> <timeframe> <period from="2004-08-22 00:00" to="2004-08-23 00:00" /> </timeframe> <interval value="60" /> </time-distributed> </pageview> </query> </eae-qs>
-
Receive XML response
Receive the XML response stream from the servlet, and redirect it to a XML parser.
-
Parse XML response
Parse the XML response. When using Java it is recommended that a SAX parser is used. Please refer to XML Schema defining the response XML protocol,
{EAE QS web app}/WEB-INF/eae-qs-query.xsd
, when creating a parser. Some examples of responses are listed below.- Time distributed page views response from Aug 22nd and to 29th Aug with interval set to 1440 minutes
-
<eae-qs> <response> <pageview> <time-distributed> <meta> <response-time value="215" /> </meta> <timeslots> <timeslot from="2004-08-22 00:00" to="2004-08-23 00:00" pageviews="75467" /> <timeslot from="2004-08-23 00:00" to="2004-08-24 00:00" pageviews="71546" /> <timeslot from="2004-08-24 00:00" to="2004-08-25 00:00" pageviews="89063" /> <timeslot from="2004-08-25 00:00" to="2004-08-26 00:00" pageviews="67323" /> <timeslot from="2004-08-26 00:00" to="2004-08-27 00:00" pageviews="93443" /> <timeslot from="2004-08-27 00:00" to="2004-08-28 00:00" pageviews="56432" /> <timeslot from="2004-08-28 00:00" to="2004-08-29 00:00" pageviews="45663" /> </timeslots> </time-distributed> </pageview> </response> </eae-qs>