Hello all,

Although not an Adapter so to speak…

I am working on a project where I receive data from PeopleSoft to create, change, and delete users in Active Directory using the standard LDAP services provided in WmPublic.

The one issue I have not been able to figure out is how to move a user from one OU to another location in the Forest. Has anyone done this?

I am sure I am missing something really simple, but I can not seem to catch on.

Thanks for any help.


I do not believe the pub.ldap services allow you to rename a DN. Based on the docs, it only seems to allow add/update/remove the attributes of an entry.

– Tim

That, unfortunately, is what I thought. It would certainly be a “Nice to have” feature. I have heard from several people who say they are working on a project similar to mine and would love to see something like this.

My particular situation is if someone changes jobs, a contractor becomes an employee, etc. We (webMethods) needs to be able to move them to a different group without changing their information.

My plan (for the short term) is to just pull all the attributes, delete them from AD and the add them back. This will require manual intervention as Some of their setting (password) will chnage at that point.


After some serious googling and some failed attempts here and there, I have been able to create a java service that does exactly what I want. Of course all the standard lawyer speak applies, plus I want to ba able to pass the connection Key instead of logging in (Kind of like what is done in WmPublic, but that is the next step that I am working on, and I need to figure that out.

I am NOT a Java coder so it ain’t pretty. The following is from the “source” directory under my package called ActiveDirectory

package ActiveDirectory;

// -----( IS Java Code Template v1.2
// -----( CREATED: 2005-05-11 14:20:35 CDT
// -----( ON-HOST: xxxx.xxx.com

import com.wm.data.*;
import com.wm.util.Values;
import com.wm.app.b2b.server.Service;
import com.wm.app.b2b.server.ServiceException;
// --- <> ---
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;
// --- <> ---

public final class javaServices

	// ---( internal utility methods )---

	final static javaServices _instance = new javaServices();

	static javaServices _newInstance() { return new javaServices(); }

	static javaServices _cast(Object o) { return (javaServices)o; }

	// ---( server methods )---

	public static final void renameDN (IData pipeline)
        throws ServiceException
		// --- <> ---
		// @subtype unknown
		// @sigtype java 3.5
		// [i] field:0:required fromDN
		// [i] field:0:required targetDN
		// [i] field:0:required ldapURL
		// [i] field:0:required ldapUser
		// [i] field:0:required ldapPass
		// [o] field:0:required targetDN
		// [o] field:0:required Error
			IDataCursor idcPipeline = pipeline.getCursor();
			String strFromDN = "";
			String strTargetDN = "";
			String strLdapURL = "";
			String strLdapUser = "";
			String strLdapPass = "";
			String strError = "";
			if (idcPipeline.first("fromDN"))
				strFromDN = (String)idcPipeline.getValue();  // full path  - CN=name,OU=Somewhere,DC=YourCompany,DC=com
			if (idcPipeline.first("targetDN"))
				strTargetDN = (String)idcPipeline.getValue(); // full path  - CN=name,OU=Somewhere,DC=YourCompany,DC=com
			if (idcPipeline.first("ldapURL"))
				strLdapURL = (String)idcPipeline.getValue(); // ldap://servername:389
			if (idcPipeline.first("ldapUser"))
				strLdapUser = (String)idcPipeline.getValue(); // Admin user
			if (idcPipeline.first("ldapPass"))
				strLdapPass = (String)idcPipeline.getValue(); // password
			// Set up environment for creating initial context
			Hashtable env = new Hashtable();
			env.put(Context.PROVIDER_URL, strLdapURL);
			env.put(Context.SECURITY_PRINCIPAL, strLdapUser);           
			env.put(Context.SECURITY_CREDENTIALS, strLdapPass);         
			try {
			    // Create initial context
			    DirContext ctx = new InitialDirContext(env);
			    // Perform rename rename
			    ctx.rename(strFromDN, strTargetDN);
			    // This does not yet work so well
			    // Close the context
				// Surely there will not be errors, but I'll catch them anyway
			catch(Exception ex)
				strError = ex.toString();
		// pipeline
		IDataHashCursor pipelineCursor_1 = pipeline.getHashCursor();
		pipelineCursor_1.insertAfter( "targetDN", strTargetDN );
		pipelineCursor_1.insertAfter( "Error", strError);
		// --- <> ---