Metadata Service
Important
This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
The metadata service returns information about AOT objects in Microsoft Dynamics AX such as tables, services, extended data types (EDTs), enums, and so on. The metadata service is:
automatically installed
by default, hosted by the Application Object Server (AOS)
always available
a Windows Communication Foundation (WCF) service that adheres to WCF protocols and standards
How the Metadata Service Works
The metadata service has two types of service operations:
Service operations that return names or keys – these service operations return the names or keys for all queries, tables, menus, and so on. The names are returned in a string array. The name of the metadata service operation specifies the names that are returned. For example, the GetQueryNames method returns a string array of names for all the queries in the installation.
Service operations that return metadata – these service operations take a string array of names, an integer array of IDs, or an array of key objects (such as MenuItemKeys[ ]) and return the metadata for those objects. Each of these service operations returns an array of metadata objects.
For example, the signature of the service operation to retrieve query metadata is: QueryMetadata[] GetQueryMetadataByName(string[] queryNames). The QueryMetadata objects that are returned in the QueryMetadata[] array derive from the QueryMetadata class.
To use the metadata service, you call the service operation to retrieve the object names. Then, you call the metadata service operation and pass in the name or names to retrieve the metadata for those objects as shown in the following code:
static void Main(string[] args)
{
AxMetadataServiceClient client = new AxMetadataServiceClient();
try
{
// Gets the names of all services in a string array.
string[] services = client.GetServiceNames();
// Loops through all the service names and prints them to the console.
foreach (string serviceName in services)
{
Console.WriteLine("Service named: {0}", serviceName);
}
// Gets the name of the first service.
string[] serviceNames = new string[1];
serviceNames[0] = services[0];
// Gets the metadata for the first service.
ServiceMetadata[] serviceMetadata = client.GetServiceMetadataByName(serviceNames);
client.Close();
}
catch
{
client.Abort();
throw;
}
}
For more information about calling the metadata service, see Walkthrough: Calling the Metadata Service.
The following table lists the metadata service operations that return object names or keys.
Service operation |
Description |
---|---|
string[] GetQueryNames() |
Returns the names for all queries defined in the AOT. |
string[] GetTableNames() |
Returns the names for all tables defined in the AOT. |
string[] GetMenuNames() |
Returns the names for all menus defined in the AOT. |
MenuItemKey[] GetMenuItemKeys() |
Returns the keys for all menu items. |
string[] GetServiceNames() |
Returns the fully-qualified, unique XML names for all published services in Microsoft Dynamics AX. For example, https://schemas.microsoft.com/dynamics/2008/01/services/SalesOrderService. |
string[] GetService GroupNames() |
Returns all the names for service groups found in the Service Groups node in the AOT. |
string[] GetExtendedDataTypeNames() |
Returns the names for all EDTs defined in the AOT. |
string[] GetEnumNames() |
Returns the names for all enums defined in the AOT. |
string[] GetLabelNames() |
Returns the names for all labels defined in the label file. The labels are returned in the @SYSnnnn format. |
string[] GetInfoPartNames() |
Returns the names for all info parts. |
string[] GetWebMenuNames() |
Returns the names for all web menus. |
WebMenuItemKeys[] GetWebMenuItemKeys() |
Returns the keys for all web menu items. |
string[] GetListPageNames() |
Returns the names for all list pages. |
string[] GetCueNames() |
Returns the names for all cues. |
string[] GetCueGroupNames() |
Returns the names for all cue groups. |
string[] GetFormPartNames() |
Returns the names for all form parts. |
string[] GetWebControlNames() |
Returns the names for all web controls. |
string[] GetWebPageDefinitioNodeNames() |
Returns the names for all web page definition nodes. |
The following table lists the metadata service operations that return object metadata.
Service operation |
Description |
---|---|
QueryMetadata[] GetQueryMetadataByName(string[] queryNames) |
Takes a string array of query names and returns the metadata for the queries with the specified names. |
TableMetadata[] GetTableMetadataByName(string[] tableNames) |
Takes a string array of table names and returns the metadata for tables with the specified names. |
TableMetadata[] GetTableMetadataByID(int[] tableIds) |
Takes an integer array of table IDs and returns the metadata for all tables with the specified IDs. |
TableMetadata[] GetTableMetadataByTypeDiscriminatorValue(long[] typeDiscriminatorValues) |
Takes an array of type discriminator values and returns metadata for all tables that have that discriminator value. |
MenuMetadata[] GetMenuMetadataByName(string[] menuNames) |
Takes a string array of menu names and returns the metadata for all menus with the specified names. |
MenuItemMetadata[] GetMenuItemMetadata(MenuItemKey[] menuItemKey) |
Takes an array of menu item keys and returns the metadata for the specified menu items. Menu item keys are retrieved by calling the GetMenuItemKeys service operation. |
ServiceMetadata[] GetServiceMetadataByName(string[] serviceNames) |
Takes a string array of service names and returns the metadata for all services that have the specified names. |
ServiceGroupMetadata[] GetServiceGroupMetadataByName(string[] serviceGroupNames) |
Takes a string array of service group names and returns the metadata for all service groups that have the specified names. |
ExtendedDataTypeMetadata[] GetExtendedDataTypeMetadataByID(int[] edtIds) |
Takes an integer array of extended data type IDs and returns the metadata for all extended data types with the specified IDs. |
ExtendedDataTypeMetadata[] GetExtendedDataTypeMetadataByName(string[] edtNames) () |
Takes a string array of extended data type names and returns the metadata for all EDTs with the specified names. |
EnumMetadata[] GetEnumMetadataByID(int[] enumIDs) |
Takes a string array of enum IDs and returns the metadata for all the enums with the specified names. |
EnumMetadata[] GetEnumMetadataByName(string[] enumNames) |
Takes a string array of enum names and returns the metadata for all enums with the specified names. |
LabelMetadata[] GetLabelMetadataById(string[] labelIds) |
Takes a string array of label IDs and returns the metadata for the specified labels. The label IDs are in the format @SYSnnnn and the metadata is returned in the installation default language. |
LabelMetadata[] GetLabelMetadataForLanguageById(string languageId, string[] labelIDs) |
Takes a string variable that contains the language ID and a string array of label IDs and returns the metadata for the specified labels in the specified language. The label IDs are in the format @SYSnnnn. The language ID is retrieved by calling the GetLanguages service operation. |
WebMenuMetadata[] GetWebMenuMetadataByName(string[] menuNames) |
Takes a string array of web menu names and returns the metadata for all web menus with the specified names. |
WebMenuItemMetadata[] GetWebMenuItemMetadata(WebMenuItemKey[] webMenuKey) |
Takes an array of web menu item keys and returns the metadata for all web menu items with the specified keys. The web menu item keys are retrieved by calling the GetWebMenuItemKeys service operation. |
InfoPartMetadata[] GetInfoPartMetadataByName(string[] infoPartNames) |
Takes a string array of info part names and returns the metadata for all info part names with the specified names. |
DimensionMetadata[] GetDimensionMetadataByID(int[] dimensionIDs) |
Takes a string array of dimension IDs and returns the metadata for all the dimensions with the specified names. |
DimensionMetadata[] GetDimensionMetadataByName(string[] dimensionNames) |
Takes a string array of dimension names and returns the metadata for dimensions with the specified names. |
ListPageMetadata[] GetListPageMetadataByName(string[] listPageNames) |
Takes a string array of list page names and returns the metadata for list pages with the specified names. |
CueMetadata[] GetCueMetadataByName(string[] cueNames) |
Takes a string array of cue names and returns the metadata for cues with the specified names. |
CueGroupMetadata[] GetCueGroupMetadataByName(string[] cueGroupNames) |
Takes a string array of cue group names and returns the metadata for cue groups with the specified names. |
FormPartMetadata[] GetFormPartMetadataByName(string[] formPartNames) |
Takes a string array of form part names and returns the metadata for form parts with the specified names. |
WebControlMetadata[] GetWebControlMetadataByName(string[] webControlNames) |
Takes a string array of web control names and returns the metadata for web controls with the specified names. |
WebPageDefinitionMetadata[] GetWebPageDefinitionMetadataByName(string[] webPageDefinitionNodeNames) |
Takes a string array of web page definition node names and returns the metadata for web page definition nodes with the specified names. |
These service operations return an array of metadata objects. The metadata object contains the actual metadata. The type of metadata object returned depends on the service operation. For example, the GetQueryMetadataByName service operation returns an array of QueryMetadata objects. The QueryMetadata object contains the metadata for a single query and this metadata is exposed through the object methods and properties. For example, the QueryMetadata object has properties such as Name, QueryType, DataSources, and AllowCrossCompany.
The metadata classes reside in the Microsoft.Dynamics.AX.Framework.Services.Metadata.Contracts namespace. Some commonly used top-level metadata classes include the following:
Metadata Service Architecture
The metadata service is a WCF service that is contained in the Microsoft.Dynamics.AX.Services.Metadata.Service.dll assembly. This assembly is located in the server Bin directory. Depending on your configuration, the assembly is located in a directory such as C:\Program Files\Microsoft Dynamics AX\<version>\Server\MicrosoftDynamicsAX\Bin.
The metadata service has the following configuration default values:
It is hosted by the AOS on port 8201 and the URL is net.tcp://servername:8201/DynamicsAx/Services/MetadataService.
The service WSDL URL is http://servername:8101/DynamicsAx/Services/MetadataService
It uses the netTcpBinding binding.
These settings will vary depending on what port number the service port and the WSDL port have been configured to use.
The configuration settings for the metadata service are found in the Ax32Serv.config file which is also located in the server Bin directory.
Metadata Service Security
Only authenticated Microsoft Dynamics AX users can access the metadata service. In order to retrieve data by using the metadata service, you must have a valid username in Microsoft Dynamics AX. The metadata service uses Windows integrated security. Therefore, when a caller invokes the metadata service, the system verifies the credentials under which the calling client is running and verifies that the username is a valid Microsoft Dynamics AX user.
The metadata service is available to all authenticated users. Therefore, all security roles have the same access level to metadata information.
See also
Metadata Service Class Diagrams
Walkthrough: Calling the Metadata Service
Walkthrough: Using the Metadata Service to Get Table Field Labels