Skip to content

Using SDMX 2.1 Web Service

The Data Service can be used either as ASP.NET Web Service or as WCF Service. They are distinguished by the URL.

To add reference to ASP.NET Web Service, use the following URL: http://dataservices.imf.org/sdmx21/SDMX_Web_Service21.asmx.

To add reference to WCF Service into your project, use the following URL: http://dataservices.imf.org/sdmx21/SDMX_WCF_Service21.svc.

These URLs are given as examples and may be different on the concrete server.

The SDMX Web Service exposes the following methods:

  • GetDataflow
  • GetDataStructure
  • GetStructureSpecificTimeSeriesData
  • GetMetadataStructure
  • GetGenericMetadata
  • GetCodeList
  • GetMaxSeriesInResult

1.1 GetDataflow Method

GetDataflow method returns the list of the datasets, registered for the Data Service.

C# SYNTAX

public StructureType GetDataflow(DataflowQueryType DataflowQuery);

PARAMETERS

 
DataflowQuery
Type: DataflowQueryType
SDMX-ML structure message.  

RETURN VALUE

Type: StructureType
SDMX-ML structure message.

REMARKS

SDMX-ML structure message is returned if no databases registered for the SDMX Web Service and no exceptions are thrown.

EXAMPLES

The following code example shows the use of GetDataflow method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var result = client.GetDataflow(new ASMX21.DataflowQueryType());

WCF Service example:
WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var result = client.GetDataflow(new WCF21.DataflowQueryType());

1.2 GetDataStructure Method

GetDataStructure method returns the structure of the dataset in the SDMX-ML structure message for the given SDMX-ML query message.

C# SYNTAX

StructureType GetDataStructure(DataStructureQueryType DataStructureQuery);

PARAMETERS

DataStructureQuery

       Type: DataStructureQueryType

 SDMX-ML query message

RETURN VALUE

Type: StructureType

SDMX-ML structure message.

EXAMPLES

 The following code example creates simple SDMX data structure query and shows the use of GetDataStructure method.

 ASP.NET Web Service example:   

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.DataStructureQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <DataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <ID>FAS</ID> </DataStructureWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetDataStructure(query);

  WCF Service example:  
WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var query = new WCF21.DataStructureQueryType();
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"
<Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"">
    <DataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"">
        <ID>FAS</ID>
    </DataStructureWhere>
</Query>");
query.Any = new XmlElement[1]
     {
             doc.DocumentElement
     };
var result = client.GetDataStructure(query);

1.3 GetStructureSpecificTimeSeriesData Method


GetStructureSpecificTimeSeriesData method returns the SDMX-ML compact data message for the given SDMX-ML query message.

C# SYNTAX


StructureSpecificTimeSeriesDataType GetStructureSpecificTimeSeriesData(StructureSpecificTimeSeriesDataQueryType StructureSpecificTimeSeriesDataQuery)

PARAMETERS

StructureSpecificTimeSeriesDataQuery
 Type: StructureSpecificTimeSeriesDataQueryType
SDMX-ML query message

RETURN VALUE

Type: StructureSpecificTimeSeriesDataType
SDMX-ML compact data message.

EXAMPLES

The following code example creates simple SDMX data query and shows the use of GetStructureSpecificTimeSeriesData method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.StructureSpecificTimeSeriesDataQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <mes:Query xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"" xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"" xsi:type=""qry:GenericTimeSeriesDataQueryType"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> <qry:DataWhere> <qry:Or> <qry:And> <qry:DataSetID>FAS</qry:DataSetID> <qry:Or> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>FR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>HR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>AL</qry:Value> </qry:DimensionValue> </qry:Or> <qry:Or> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODC_XDC</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCBODD_NUM</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODCHG_GDP_PT</qry:Value> </qry:DimensionValue> </qry:Or> <qry:TimeDimensionValue> <qry:ID>TIME_PERIOD</qry:ID> <qry:TimeValue operator=""greaterThanOrEqual"">2000</qry:TimeValue> <qry:TimeValue operator=""lessThanOrEqual"">2012</qry:TimeValue> </qry:TimeDimensionValue> </qry:And> </qry:Or> </qry:DataWhere> </mes:Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetStructureSpecificTimeSeriesData(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient(); var query = new WCF21.StructureSpecificTimeSeriesDataQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <mes:Query xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"" xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"" xsi:type=""qry:GenericTimeSeriesDataQueryType"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""> <qry:DataWhere> <qry:Or> <qry:And> <qry:DataSetID>FAS</qry:DataSetID> <qry:Or> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>FR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>HR</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>REF_AREA</qry:ID> <qry:Value>AL</qry:Value> </qry:DimensionValue> </qry:Or> <qry:Or> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODC_XDC</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCBODD_NUM</qry:Value> </qry:DimensionValue> <qry:DimensionValue> <qry:ID>INDICATOR</qry:ID> <qry:Value>FCLODCHG_GDP_PT</qry:Value> </qry:DimensionValue> </qry:Or> <qry:TimeDimensionValue> <qry:ID>TIME_PERIOD</qry:ID> <qry:TimeValue operator=""greaterThanOrEqual"">2000</qry:TimeValue> <qry:TimeValue operator=""lessThanOrEqual"">2012</qry:TimeValue> </qry:TimeDimensionValue> </qry:And> </qry:Or> </qry:DataWhere> </mes:Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetStructureSpecificTimeSeriesData(query);

1.4 GetMetadataStructure Method

GetMetadataStructure method returns the metadata structure of the dataset in the SDMX-ML structure message for the given SDMX-ML query message.

C# SYNTAX

StructureType GetMetadataStructure(MetadataStructureQueryType MetadataStructureQuery)

PARAMETERS

MetadataStructureQuery
        Type:StructureType
        SDMX-ML query message

RETURN VALUE

Type: StructureType
SDMX-ML metadata structure message.

EXAMPLES

The following code example creates simple SDMX metadata structure query and shows the use of GetMetadataStructure method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); ASMX21.MetadataStructureQueryType query = new ASMX21.MetadataStructureQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <MetadataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <ID>FAS</ID> </MetadataStructureWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetMetadataStructure(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient(); WCF21.MetadataStructureQueryType query = new WCF21.MetadataStructureQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <MetadataStructureWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <ID>FAS</ID> </MetadataStructureWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetMetadataStructure(query);

1.5 GetGenericMetadata Method

GetGenericMetadata method returns the SDMX-ML generic data message for the given SDMX-ML query message.

C# SYNTAX

GenericMetadataType GetGenericMetadata(MetadataQueryType GenericMetadataQuery)

PARAMETERS

GenericMetadataQuery
       Type: MetadataQueryType
       SDMX-ML query message

RETURN VALUE

Type: GenericMetadataType
SDMX-ML generic data message.

EXAMPLES

The following code example creates simple SDMX data query and shows the use of GetGenericMetadata method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.MetadataQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <mes:Query xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query"" xmlns=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message"" xmlns:com=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common""> <qry:MetadataParameters> <qry:MetadataTargetValue> <qry:TargetObjectValue> <qry:DataSet> <com:ID>FAS</com:ID> </qry:DataSet> </qry:TargetObjectValue> </qry:MetadataTargetValue> <qry:Or> <qry:ReportStructureValue> <qry:MetadataAttributeValue> <qry:ID>INDICATOR</qry:ID> <qry:TextValue>All Indicators</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>REF_AREA</qry:ID> <qry:TextValue>AR</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>INDICATOR</qry:ID> <qry:TextValue>FCLODCSG_GDP_PT</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>REF_AREA</qry:ID> <qry:TextValue>BE</qry:TextValue> </qry:MetadataAttributeValue> <qry:MetadataAttributeValue> <qry:ID>REF_AREA</qry:ID> <qry:TextValue>CN</qry:TextValue> </qry:MetadataAttributeValue> </qry:ReportStructureValue> </qry:Or> </qry:MetadataParameters> </mes:Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetGenericMetadata(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var query = new WCF21.MetadataQueryType();
XmlDocument doc = new XmlDocument();
doc.LoadXml(@"
<mes:Query
xmlns:qry=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""
xmlns=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:mes=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""
xmlns:com=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/common"">
<qry:MetadataParameters>
<qry:MetadataTargetValue>
<qry:TargetObjectValue>
<qry:DataSet>
<com:ID>FAS</com:ID>
</qry:DataSet>
</qry:TargetObjectValue>
</qry:MetadataTargetValue>
<qry:Or>
<qry:ReportStructureValue>
<qry:MetadataAttributeValue>
<qry:ID>INDICATOR</qry:ID>
<qry:TextValue>All Indicators</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>REF_AREA</qry:ID>
<qry:TextValue>AR</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>INDICATOR</qry:ID>
<qry:TextValue>FCLODCSG_GDP_PT</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>REF_AREA</qry:ID>
<qry:TextValue>BE</qry:TextValue>
</qry:MetadataAttributeValue>
<qry:MetadataAttributeValue>
<qry:ID>REF_AREA</qry:ID>
<qry:TextValue>CN</qry:TextValue>
</qry:MetadataAttributeValue>
</qry:ReportStructureValue>
</qry:Or>
</qry:MetadataParameters>
</mes:Query>");
query.Any = new XmlElement[1]
{
doc.DocumentElement
};

var result = client.GetGenericMetadata(query);

1.6 GetCodeList Method

GetCodeList method returns the description of CodeLists

C# SYNTAX

StructureType GetCodelist(CodelistQueryType CodelistQuery)

PARAMETERS

CodelistQuery
Type: CodelistQueryType
SDMX-ML query message

RETURN VALUE

Type: StructureType
SDMX-ML codelist message.

EXAMPLES

The following code example creates simple SDMX data query and shows the use of GetCodeList method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient(); var query = new ASMX21.CodelistQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <CodelistWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <CodeWhere> <ID>CL_INDICATOR_FAS</ID> </CodeWhere> </CodelistWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetCodelist(query);

WCF Service example:

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient(); var query = new WCF21.CodelistQueryType(); XmlDocument doc = new XmlDocument(); doc.LoadXml(@" <Query xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/message""> <CodelistWhere xmlns=""http://www.sdmx.org/resources/sdmxml/schemas/v2_1/query""> <CodeWhere> <ID>CL_INDICATOR_FAS</ID> </CodeWhere> </CodelistWhere> </Query>"); query.Any = new XmlElement[1] { doc.DocumentElement }; var result = client.GetCodelist(query);

1.7 GetMaxSeriesInResult Method

GetMaxSeriesInResult method returns the maximum number of time series that can be returned by GetCompactData method.

C# SYNTAX

public int GetMaxSeriesInResult();

RETURN VALUE

Type: System.Int32

A non-negative integer value that represents the maximum number of time series that can be returned by GetCompactData method.

A special value of 0 means GetCompactData method can return unlimited number of time series.

EXAMPLES

The following code example shows the use of GetMaxSeriesInResult method.

ASP.NET Web Service example:

ASMX21.SdmxServiceClient client = new ASMX21.SdmxServiceClient();
var result =
client.GetMaxSeriesInResult();

 WCF Service example: 

WCF21.SdmxServiceClient client = new WCF21.SdmxServiceClient();
var result = client.GetMaxSeriesInResult();

Feedback and Knowledge Base