This topic has not yet been rated - Rate this topic

How to: Retrieve the FIM Service Schema Using WS-MetadataExchange

Visual Studio 2010

Updated: April 7, 2010

FIM lets you retrieve the schemas for FIM resource types, as well as schema metadata, from the FIM Service database.

How to Retrieve a Schema Using the Get Method

You can retrieve a schema using the WS-Transfer Get method defined in the Web Services Metadata Exchange specification, section 5.1. The schema is retrieved through an endpoint with the address http://Localhost:5725/ResourceManagementService/MEX.

The following is an example of a Get request message to request a schema:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope 
  xmlns:a="http://www.w3.org/2005/08/addressing" 
  xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  
  <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
    <a:MessageID>urn:uuid:6eb17746-64d0-42fb-8206-af9c2470819b</a:MessageID>
    <a:ReplyTo>
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">http://localhost:5725/ResourceManagementService/MEX</a:To>
  </s:Header>
  <s:Body/>
</s:Envelope>

The following is an example response to a Get request message:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
        <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse</a:Action>
        <a:RelatesTo>urn:uuid:6eb17746-64d0-42fb-8206-af9c2470819b</a:RelatesTo>
    </s:Header>
    <s:Body>
        <Metadata xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsx:MetadataSection Dialect="http://www.w3.org/2001/XMLSchema" Identifier=":" xmlns="">
                <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2006/11/ResourceManagement" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rm="http://schemas.microsoft.com/2006/11/ResourceManagement">
                    <xs:simpleType name="ReferenceType">
                        <xs:restriction base="xs:string">
                            <xs:pattern value="([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}" />
                        </xs:restriction>
                    </xs:simpleType>
                    <xs:complexType name="BinaryCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="xs:base64Binary" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="DateTimeCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="xs:dateTime" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="IntegerCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="xs:integer" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="ReferenceCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="rm:ReferenceType" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="StringCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item">
                                <xs:simpleType>
                                    <xs:annotation>
                                        <xs:appinfo>
                                            <rm:DataType>String</rm:DataType>
                                        </xs:appinfo>
                                    </xs:annotation>
                                    <xs:restriction base="xs:string">
                                        <xs:pattern value=".{0,448}" />
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
<xs:element minOccurs="1" name="CreatedTime" type="xs:dateTime">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <rm:DisplayName>Created Time</rm:DisplayName>
                                        <rm:Description>The time when the resource is created in the FIM service database. This attribute is assigned its value by the FIM service. It cannot be modified by any user.</rm:Description>
                                        <rm:Key>4</rm:Key>
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
<xs:element name="mv-dataInstance" type="rm:mv-data" />
                </xs:schema>
            </wsx:MetadataSection>
        </Metadata>
    </s:Body>
</s:Envelope><?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
        <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse</a:Action>
        <a:RelatesTo>urn:uuid:6eb17746-64d0-42fb-8206-af9c2470819b</a:RelatesTo>
    </s:Header>
    <s:Body>
        <Metadata xmlns="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsx:MetadataSection Dialect="http://www.w3.org/2001/XMLSchema" Identifier=":" xmlns="">
                <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2006/11/ResourceManagement" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:rm="http://schemas.microsoft.com/2006/11/ResourceManagement">
                    <xs:simpleType name="ReferenceType">
                        <xs:restriction base="xs:string">
                            <xs:pattern value="([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}" />
                        </xs:restriction>
                    </xs:simpleType>
                    <xs:complexType name="BinaryCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="xs:base64Binary" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="DateTimeCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="xs:dateTime" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="IntegerCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="xs:integer" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="ReferenceCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item" type="rm:ReferenceType" />
                        </xs:sequence>
                    </xs:complexType>
                    <xs:complexType name="StringCollectionType">
                        <xs:sequence>
                            <xs:element minOccurs="1" maxOccurs="unbounded" name="Item">
                                <xs:simpleType>
                                    <xs:annotation>
                                        <xs:appinfo>
                                            <rm:DataType>String</rm:DataType>
                                        </xs:appinfo>
                                    </xs:annotation>
                                    <xs:restriction base="xs:string">
                                        <xs:pattern value=".{0,448}" />
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
<xs:element minOccurs="1" name="CreatedTime" type="xs:dateTime">
                                <xs:annotation>
                                    <xs:appinfo>
                                        <rm:DisplayName>Created Time</rm:DisplayName>
                                        <rm:Description>The time when the resource is created in the FIM service database. This attribute is assigned its value by the FIM service. It cannot be modified by any user.</rm:Description>
                                        <rm:Key>4</rm:Key>
                                    </xs:appinfo>
                                </xs:annotation>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
<xs:element name="mv-dataInstance" type="rm:mv-data" />
                </xs:schema>
            </wsx:MetadataSection>
        </Metadata>
    </s:Body>
</s:Envelope>

See Also

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Query FIM MEX with PowerShell

The FIM MEX endpoint can be queried pretty easily with PowerShell, returning some XML which can easily be diced and sliced in PowerShell.

### The FIM MEX URL
$fimMexUrl = "http://Localhost:5725/ResourceManagementService/MEX"
### Copied from FIM MSDN Site (http://msdn.microsoft.com/en-us/library/ee652305.aspx)
$soapMessage = @"
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:s="http://www.w3.org/2003/05/soap-envelope">

<s:Header>
<a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
<a:MessageID>urn:uuid:6eb17746-64d0-42fb-8206-af9c2470819b</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">http://localhost:5725/ResourceManagementService/MEX</a:To>
</s:Header>
<s:Body/>
</s:Envelope>
"@
### Connect to the FIM MEX endpoint to submit the request
$webclient = New-Object System.Net.WebClient
$webclient.headers.Add("SOAPAction",$fimMexUrl)
$webclient.headers.Add("Content-Type", "application/soap+xml; charset=utf-8")
$result = ([XML]$webclient.UploadString($Url, $saopMessage))
### Dump the response
$result.InnerXml