IBM Support

webMethods Knowlegebase : CDS API, cannot set user locale (1742142)

Troubleshooting


Problem

Is there any way to programmatically change the user locale?

Background:

==========

Customer is trying to do change the user locale by using below code:

----------------------

final IDirectorySystem system = DirectorySystemFactory

.getDirectorySystem();

IDirectorySession session = system.createSession();

try {

IDirectoryUser directoryUser = (IDirectoryUser) session.lookupPrincipalByName(userId, IDirectoryPrincipal.TYPE_USER);

if (directoryUser == null) {

log.error(mName, "Can not find user with id: " + userId); throw new SAGSFrameworkException("Can not find user with id: " + userId + " in DirectorySystem");

}

Map<String, Object> userAttributes = directoryUser.getAllAttributes();

userAttributes.put("locale", locale);

session.modifyPrincipal(directoryUser.getID(), userAttributes);

system.destroySession(session);

session = null;

} finally {

if (session != null) { system.destroySession(session); }

}

--------------------

But this produces the following error:

--------------

com.webmethods.portal.PortalException: [POP.001.0001] Methode "setAttribute" wurde nicht implementiert.

at com.webmethods.portal.PortalException.notImplemented(PortalException.java:618)

at com.webmethods.portal.portlet.wm_xt_ldapdirsvc.service.LdapDirService.setAttribute(LdapDirService.java:260)

at com.webmethods.portal.mech.dir.impl.PrincipalAttributeMechanics.modifyPrincipal(PrincipalAttributeMechanics.java:276)

at com.webmethods.portal.bizPolicy.command.dir.ModifyPrincipal._modifyPrincipal(ModifyPrincipal.java:153)

at com.webmethods.portal.bizPolicy.command.dir.ModifyPrincipal.modifyPrincipal(ModifyPrincipal.java:124)

at com.webmethods.portal.bizPolicy.biz.dir.impl.PrincipaAttributeBizPolicy.modifyPrincipal(PrincipaAttributeBizPolicy.java:105)

at com.webmethods.sc.directory.impl.DirectorySession.modifyPrincipal(DirectorySession.java:594)

at com.tsystems.icto.tom.user.util.WmDirectoryLookup.setUserLocale(WmDirectoryLookup.java:89)

-------------

Looking at the source of LdapDirService.java I can see that the method setAttribute has intentionally not been implemented:

----------

public void setAttribute(IURI principalURI, String attrName, Object attrValue) throws PortalException {

throw PortalException.notImplemented("setAttribute");

}

---------

Customer is calling method modifyPrincipal(String principalID, Map attributes) of IDirectorySession, documented here: http://documentation.softwareag.com/webmethods/wmsuites/wmsuite8-2_sp2/My_webMethods/8-2-SP1_CAF_and_MWS_Java_API_Reference/com/webmethods/sc/directory/IDirectorySession.html

They use an LDAP connection to retrieve the userid and password. The locale is stored in MWS.

==========

Document Location

Worldwide

[{"Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSVYEV","label":"IBM webMethods Integration"},"ARM Category":[{"code":"a8mKe00000000AQIAY","label":"My webMethods Server (MWS)"}],"ARM Case Number":"","Platform":[{"code":"PF027","label":"Solaris"}],"Version":"8.2.1"},{"Line of Business":{"code":"LOB76","label":"Data Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSAWP1J","label":"IBM webMethods BPM"},"ARM Category":[{"code":"a8mKe00000000AQIAY","label":"My webMethods Server (MWS)"}],"ARM Case Number":"","Platform":[{"code":"PF027","label":"Solaris"}],"Version":"8.2.1"},{"Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSFIWYE","label":"IBM webMethods B2B"},"ARM Category":[{"code":"a8mKe00000000AQIAY","label":"My webMethods Server (MWS)"}],"ARM Case Number":"","Platform":[{"code":"PF027","label":"Solaris"}],"Version":"8.2.1"},{"Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSQG2X","label":"IBM webMethods Managed File Transfer"},"ARM Category":[{"code":"a8mKe00000000AQIAY","label":"My webMethods Server (MWS)"}],"ARM Case Number":"","Platform":[{"code":"PF027","label":"Solaris"}],"Version":"8.2.1"}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
20 March 2025

UID

ibm17213074