Australian Bureau of Statistics

Rate the ABS website
ABS Home > Statistics > By Catalogue Number
ABS @ Facebook ABS @ Twitter ABS RSS ABS Email notification service
1407.0.55.002 - ABS.Stat - Beta: Web Services User Guide , 2013  
Latest ISSUE Released at 11:30 AM (CANBERRA TIME) 01/03/2013  First Issue
   Page tools: Print Print Page Print all pages in this productPrint All RSS Feed RSS Bookmark and Share Search this Product

Information for building a custom .Net application to call SDMX Web Service

Below is general information on how to build a simple C# .NET application that calls the SDMX web services.

Set up
Set up C#.NET developer environment i.e. Visual Studio 2010
Create C# project (application form or web application)
Create a 'web references' to the SDMX web service
http://stat.abs.gov.au/sdmxws/sdmx.asmx

Build an SDMX Query
Create a function / method to build a SDMX query message specific to the SDMX web service call. The SDMX web service provides several methods where users can retrieve data from ABS.Stat.
The available methods are:

  • GetGenericData
  • GetCompactData
  • GetDataStructureDefinition
  • GetDatasetMetadata
  • GetDimensionMemberMetadata
  • GetDimensionMetadata
  • GetMetadata
  • GetMetadataStructure
  • GetReferenceMetadata

    Refer to each of the 'SDMX Query Message Example' provided above for the structure of the query message to construct and pass onto the SDMX web service.
    Below is an example of C# code that builds the query messages which is then passed to the SDMX web service.

    Query message builder for GetGenericData function:

    public static XmlElement GetGenericDataQuery(string dataSetCode, string senderCode)
    {
    StringBuilder query = new StringBuilder();
    query.Append(@"<message:QueryMessage xmlns=""http://www.SDMX.org/resources/SDMXML/schemas/v2_0/query"" xmlns:message=""http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message"" xsi:schemaLocation=""http://www.SDMX.org/resources/SDMXML/schemas/v2_0/query http://www.sdmx.org/docs/2_0/SDMXQuery.xsd http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message http://www.sdmx.org/docs/2_0/SDMXMessage.xsd"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">");
    query.Append("<message:Header>");
    query.Append("<message:ID>none</message:ID> ");
    query.Append("<message:Test>false</message:Test> ");
    query.Append("<message:Prepared>2007-02-22T00:00:00-01:00</message:Prepared> ");
    query.Append(@"<message:Sender id=""ABS"" /> ");
    query.Append(@"<message:Receiver id=""" + senderCode + @""" /> ");
    query.Append("</message:Header>");
    query.Append("<message:Query>");
    query.Append("<DataWhere>");
    query.Append("<And>");
    query.Append("<DataSet>" + dataSetCode + "</DataSet> ");
    query.Append("<Time>");
    query.Append("<StartTime>1900</StartTime>");
    query.Append("<EndTime>2049</EndTime>");
    query.Append("</Time>");
    query.Append("</And>");
    query.Append("</DataWhere>");
    query.Append("</message:Query>");
    query.Append("</message:QueryMessage>");

    XmlDocument doc = new XmlDocument();

    doc.LoadXml(query.ToString());

    return doc.DocumentElement;
    }

    Establish a web service connection to the server object
    i.e. OECDStatSDMXwebservice svc = new OECDStatSDMXwebservice();

    Call the SDMX web service
    Pass the query message in XmlDocument format and store the output / result from the web service call as an xml element
    XmlElement xe = svc.GetCompactData(GetCompactDataQuery());

    Pipe the element to where necessary
    i.e. Save to xml file use xe.WriteTo(XmlWriterPtr);
    where XmlWriterPtr is of type XmlWriter


  • Bookmark and Share. Opens in a new window

    Commonwealth of Australia 2014

    Unless otherwise noted, content on this website is licensed under a Creative Commons Attribution 2.5 Australia Licence together with any terms, conditions and exclusions as set out in the website Copyright notice. For permission to do anything beyond the scope of this licence and copyright terms contact us.