![]() | ![]() |
|
Proactive disclosure Print version ![]() ![]() | ![]() | ![]() Canadian Geochronology Knowledgebase Web Services
Geochronology data contained in the Canadian Geochronology Knowledgebase
is accessible through XML Web services. This page describes what
is available, states where
it can be located, and hints at how
you can retrieve the data programmatically.
The database includes these tables:
These tables are combined into a flat file view; the services query this view for information. You can get data from one table at a time or you can get all the data in the view at once. The data may be filtered to obtain only that which corresponds to a particular
Note that you must supply parameters to some of the service methods,
as described on the next page. Finally, you can obtain the results in either
XML or comma-delimited format.
The Web services are listed below. Those services returning data as XML have a different address from those returning comma-delimited text. In each table you can obtain the name of the desired service method by finding the intersection of the data table name and the particular filter. Services returning data in XML format Methods are located at http://gdr.ess.nrcan.gc.ca/ geochron/web_services/TableAsXML.asmx
Services returning data in comma-delimited text format Methods are located at http://gdr.ess.nrcan.gc.ca/ geochron/web_services/TableAsCSV.asmx
The parameters required to be supplied to some methods are given below. Failure to provide the correct parameter (for example, a valid province code for "...ByProv" methods) results in an error message being returned.
Obtaining data using these services is described briefly on the next page.
Basic description Web services are like other functions or methods available to a programming environment. The developer needs to know :
Typically, a Web service will describe all of this information via a Web Services Decription Language (WSDL) document. The WSDL is an XML document sometimes referred to as the "contract": the service will process and return a result given a SOAP (Simple Object Access Protocol) message containing the correct parameters. For these geochronology Web services, most of this information is given on the previous page. For all methods listed, the result is a "string" as defined by Microsoft's .NET environment. This data type is easily understood by most programming and scripting languages, or may be easily converted. NOTE that the result may be very large and may thus require special handling or increased memory, depending on the programming environment. A simple example - ASP.NET application An example Web application developed in ASP.NET and coded in VB.NET can be seen via the geochron Web service example page. The application takes input from the user, uses that input to determine which method to call, passes the correct parameter values to the method and displays the results on a new page. Here is a portion of the VB.NET code behind the application (formatted to fit this page): Private Sub Page_Load (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim result As String Dim value As String A-> Dim gcXService As Geochronology.TableASXML = New Geochronology.TableASXML() . . . Select Case Request.Form.Item("tablesel").ToString() Case "rockfile" Select Case Request.Form.Item("formattype").ToString() Case "xml" Select Case Request.Form.Item("limit").ToString() Case "prov" value = Request.Form.Item("prov").ToString() B-> result = gcXService.rockfileAsXMLByProv(value) . . . At point A->, an instance of a proxy class is created that substitutes for the Web service class. The programme then goes through the values chosen by the user on the Web page and selects the appropriate service method. For example, if the user has chosen to get data from the rockfile table, in XML format, filtering for a particular province, then the value of the province chosen is given as the parameter to the "rockfileAsXMLByProv" method, at point B->. The result of that method is received and later printed to the screen. Other programming interfaces There are a wide variety of programming interfaces for using Web services as a client or server. One of the attractions of Web services for a client is that one only needs to know the service definition in order to use the service; no knowledge of how the service is programmed is needed. Here is a partial list of existing packages employing SOAP, a popular protocol for accessing Web services.
|