Share via


LocationServiceSoap.SetDefaultCulture Method

Sets the default culture for the current user.

Public Sub SetDefaultCulture (culture As System.String)

[C#]
public SetDefaultCulture (System.String culture);

Parameters

  • culture
    The culture name in the format "languagecode2-regioncode2", where languagecode2 is a lowercase two-letter code derived from International Organization for Standardization (ISO) 639-1 and regioncode2 is an uppercase two-letter code derived from ISO 3166. For example, "en-US" denotes English (United States). When no culture value is passed (null value), an exception is thrown.

    For more information about the term culture, see the Glossary.

Remarks

The cultureName parameter should be a valid culture name in string format; for example, "en-US".

When this method is passed an invalid domain and alias (one that does not exist in the enterprise), a UserNotProvisionedException is thrown.

When this method is passed an invalid specific culture (such as "en-XY") an InvalidCultureNameException is thrown.

When passed a neutral culture (such as "en" instead of "en-US") a NeutralCultureNameException is thrown.

For more information, see Valid Culture Namesc.

This method accepts the following SOAP headers:

UserInfoLocationHeader—Used to establish the current user's (the user that is invoking the location service) specific information, such as culture and so on. When this SOAP header is not provided, the current user's default culture is applied. For more information, see UserInfoLocationHeader Class.

ClientIdHeader—Not used with MapPoint Location Server 1.0.

Because this is a Web service, all exceptions appear as SOAP exceptions. For more information, see the SoapException.Detail property.

Example

 
[Visual Basic]
    'Create a LocationServiceSoap proxy instance.
    Dim MyLocationService As New LocationServiceSoap
    'Create and add the credentials required to access the Web service.
    Dim MyCredentials As New NetworkCredential("user", "password", "DOMAIN")
    MyLocationService.Credentials = MyCredentials

    Try
        'Set the default culture of the current user
        MyLocationService.SetDefaultCulture("en-US")

    Catch MyException As SoapException
        'Your exception processing goes here.
        If ((Not MyException.Detail Is Nothing) And (Not MyException.Detail("Type") Is Nothing)) Then
            MessageBox.Show(MyException.Detail("Type").InnerText)
        End If

    Finally
        'Your cleanup goes here
        MyLocationService = Nothing
    End Try


 
[C#]
  //Create a LocationServiceSoap proxy instance.
  LocationServiceSoap MyLocationService = new LocationServiceSoap();
  //Create and add the credentials required to access the Web service.
  NetworkCredential MyCredentials = new NetworkCredential("user", "password", "DOMAIN");
  MyLocationService.Credentials = MyCredentials;

  try
  {
   //Set the default culture for the current user
   MyLocationService.SetDefaultCulture("de-DE");
  }
  catch(SoapException MyException)
  {
   //Your exception processing goes here.
   if (MyException.Detail != null && MyException.Detail["Type"] != null)
    MessageBox.Show(MyException.Detail["Type"].InnerText);
  }
  finally
  {
   //Your cleanup goes here
   MyLocationService = null;
  }   
 
  
 

See Also

Location Service Class  |  UserInfoLocationHeader Class  |  Culture Definition  |  Using Soap Headers