Getting and updating objects in a particular locale

In the previous post I mentioned I would cover selecting attributes in an enumeration this post.  I misread my schedule and got a week ahead.  This post should be about how to get and put objects in specific locales.  To keep to the schedule, we will cover locales now and enumerations next.

Specifying locale is just another SOAP header element like rm:ResourceReferenceProperty.  The particular element we use is rm:Locale.  The body of rm:Locale is an ISO language code like en-US, en-ES, etc.

Here’s an example of a WS-Transfer Get request:

<s:Envelope xmlns:s = "http://www.w3.org/2003/05/soap-envelope" xmlns:a ="http://www.w3.org/2005/08/addressing" xmlns:rm ="http://schemas.microsoft.com/2006/11/ResourceManagement">

    <s:Header>

      <rm:Locale>

        en-us

      </rm:Locale>

        <a:Action s:mustUnderstand = "1">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>

        <rm:ResourceReferenceProperty> urn:uuid:058b26e1-2111-48fd-968e-f9605e0ffae6</rm:ResourceReferenceProperty>

        <rm:IncludePermissionHints/>

    </s:Header>

    <s:Body></s:Body>

</s:Envelope>

That’s all there is to it.  When you go update a resource, you add the same header to the Put request.

Locales in general work like this: You request the localized version of a whole object and not localized attributes.  This localized object still has the same number of attributes as when you don’t specify a locale, except some of the attribute values may be in a different language.  For example, if I get a group with locale English, I might get this object back:

<rm:Group>

   <rm:DisplayName>

     White House 

   </rm:DisplayName>

   <rm:Owner> urn:uuid:058b26e1-2111-48fd-968e-f9605e0ffae6</rm:Owner>

</rm:Group>

Now I get the same group with locale Spanish:

<rm:Group>

   <rm:DisplayName>

     Casa Blanca

   </rm:DisplayName>

   <rm:Owner> urn:uuid:058b26e1-2111-48fd-968e-f9605e0ffae6</rm:Owner>

</rm:Group>

Notice that you get back an object in both cases, only some of the attribute values are in different languages.  If the server doesn’t have a value in the requested language, the server fails back to a value it does have.

In the next post I will cover selecting attributes in an enumeration.