Using MWS Services from external client

Hello,

I would like to access the MWS user registry from a standalone Java application. I’d like to be able to e.g. retrieve a role from the registry like this

IDirectorySession ds = DirectorySystemFactory.getDirectorySystem().createSession();
	IDirectoryRole role = (IDirectoryRole) ds.lookupPrincipalByDN("uid=My webMethods Users" , IDirectoryPrincipal.TYPE_ROLE);
List<IDirectoryPrincipal> members = ds.getMembers(roleID)

How do I call this from an external standalone client. Which libraries do I need and how do I configure the target server.

We are using MWS 8.0.1

Thanks for your suggestions.