Json2Ldap

Quick Start

Download

Download the ZIP package and save it in a suitable folder in your computer.

Install

Extract the content of the ZIP file. The web service software is packaged in a WAR file called

json2ldap.war

You need to deploy the WAR package into your Java web server.

If you're using Apache Tomcat, simply copy the WAR file to the webapps/ directory of your Tomcat installation and restart the server. The server will then extract automatically the content of the WAR package in a directory called webapps/json2ldap/.

Configure

Json2Ldap will run without having to touch the original default configuration. However, do look at the various configuration parameters, particularly if you intend to put the software to serious use.

The Json2Ldap configuration is stored as a set of context parameters found in the standard web app descriptor file

WEB-INF/web.xml

Remember to restart your web server after updating the Json2Ldap configuration!

Test

Point your web browser to the URL where the Json2Ldap service was just installed, e.g. to

http://localhost:8080/json2ldap/

assuming the web server is hosted on localhost and it is listening on port 8080.

If the Json2Ldap service is up and correctly configured you should see the following text message in your browser:

Json2Ldap: Use HTTP POST to send your JSON-RPC 2.0 request

This message basically says that the service expects JSON-RPC 2.0 requests received via HTTP POST.

Use

The remote procedure call (RPC) requests served by Json2Ldap are described in the API reference.

You can quickly issue a few directory requests to Json2Ldap by using the generic JSON-RPC 2.0 console client included in the download package. You can start it like this:

 java -jar jsonrpc2client.jar http://localhost:8080/json2ldap/

This will open a small command line shell where you can send JSON-RPC 2.0 requests to the specified HTTP URL at which Json2Ldap is listening.

*** Simple interactive JSON-RPC 2.0 console client ***
*** Copyright (c) Vladimir Dzhuvinov, 2009 - 2010  ***

Hints: 
        1. Example request with positional parameters and an ID of zero:
                addNumbers [10,20] 0
        2. Example request with named parameters and an ID of one:
                divideNumbers {"dividend":27,"divisor":3} 1
        3. Example notification with no parameters: 
                notifyIdleState
        4. To avoid typing request ID's repeatedly invoke the program with
           the -a/--auto-id option and specify a default ID value
        5. Press [Ctrl] + [C] to exit

JSON-RPC 2.0 >

Here is an example session, where we enter a few requests to connect to an LDAP server, bind and obtain a directory record's attributes (the input commands are in bold, the new lines were added extra for clarity):

JSON-RPC 2.0 > ldap.connect {"host":"localhost", "port":1389} 1
-479e57e71977152b8790a89cdf5e85eb
JSON-RPC 2.0 > ldap.simpleBind {"CID":"-479e57e71977152b8790a89cdf5e85eb", 
                                "DN":"uid=user.359,ou=People,dc=example,dc=com", 
                                "password":"secret"} 1
null
JSON-RPC 2.0 > ldap.getEntry {"CID":"-479e57e71977152b8790a89cdf5e85eb", 
                              "DN":"uid=user.359,ou=People,dc=example,dc=com", 
                              "attributes":"cn mail telephoneNumber"} 1
{
 "mail":["user.359@maildomain.net"],
 "cn":["Anatoli Arvin"],
 "telephoneNumber":["+1 498 048 9836"]
}

Check the JSON-RPC console client manual if you need help with its use.