1407.0.55.002 - ABS.Stat - Beta: Web Services User Guide , 2013  
Previous 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

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: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("<DataSet>" + dataSetCode + "</DataSet> ");

    XmlDocument doc = new XmlDocument();


    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