apparently you are mixing several things (and the WSO2 documentation is misleading in that point too):
I want to create a java client (on eclipse) to connect to WSO2 Identity Server 5.1.0 using the API to autenticate, create, save and manage users
The web page you refer provides 2 ways to call the admin services:
admin web services - you may create or generate a web service client and use the web service to connect to the WSO2 IS remotely. How to get the WSDL files is described in this post. That should work with all (even older) versions of the WSO2 IS. I would suggest to use this approach.
The code snippet you have provided should works (I haven't try it myself though). I use the default admin web services.
If you are unable to create a client or connect, you should provide more details where / with what you have the problem.
So my idea to configurate the identity server as ldap...
WS2 Identity Server is not an LDAP server. It may have an LDAP configured as a user store (it has an embedded OpenLDAP instance by default). But you can use the web services or the OAuth2 endpoint to authenticate users against configured user stores.