Dashboard > Project: People Picker > Home > WritingCustomClient

View Info

WritingCustomClient

If web-pp does not do exactly what you want, you can always create your own people picker client, in fact, it is quite easy to do (if you are working in Java).

We don't recommend writing a client in any other language since you will then have to deal with the wsdl directly, although you can do this if you like.

Java client

We have done all the hard work of creating a people picker client and we have bundled it up in a single class FedPPService. This section is really just a guide to using this class.

We will use the vt1-pp project as our example for creating clients. I recommend you download the latest version of that code to have handy as you work through this guide

svn co https://www.mams.org.au/svn/PeoplePicker/vt1-pp/trunk/

Step 1: Set up the libraries you need

We recommend having a lib directory in the root of your project into which you put all incomming libraries. For this project you will need:

  1. All the .jar files in the lib directory of the axis2 1.3 distribution
  2. A jar file we prepare that contains (almost) all the specific code required to access fed-pp – fed-pp-connector.jar (this will get you the trunk, modify the path to get a β if that is what you want)
  3. Another jar that contains axis2 code that can't be put into the above .jarxbeans-packaged.jar .

Step 2: Write the code.

To connect to a federated people picker service and to use it's services, you need FedPPService.java which is in fed-pp-connector.jar. The documentation for this class is available online at

https://www.mams.org.au/svn/PeoplePicker/fed-pp/trunk/docs/connector/index.html

The following code segments gives a quick example of how to get started with FedPPService

Setting up a FedPPService
String fed = "http://www.XXXX.com/axis2/services/FederatedPeoplePicker";
fedpp = new FedPPService(fed);  // set up the FedPPService object that will do all the hard work for you
Getting the list of available idps
idps = fedpp.getAllIdpIds();
Submitting a search
String searchId = fedpp.submitSearch(idps, "baggins", "SURNAME", null, 10000, 10);

vt1-pp

vt1-pp is a fully functional client that takes advantage of FedPPService. If you look through the vt1-pp code you will see examples for the use of all FedPPService functionality.

Step 3: Write your ant file

I guess you could use whatever build system you want, but we will describe the process using ant build scripts. We are not going into heaps of detail here, just noting a few things that might trip you up.

  1. If you have used vt1-pp as your base, you have created a program that only works on vt100 emulators.
  2. You need to compile your code with all the axis2 1.3 libraries and the connector and the xbeans package that you downloaded. Assuming you put them in lib/axis2, the following code will setup a refid and a property that you can use in compile and run targets.
    <path id="required.jars">
    	<fileset dir="/lib/axis2">
    		<include name="*.jar"/>
    	</fileset>
    	<fileset file="lib/xbeans-packaged.jar"/>
    	<fileset file="lib/fed-pp-connector.jar"/>
    </path>
    <property name="required.jars" refid="required.jars"/>
  3. Link the required libraries in at compile time (include the above refid in your compile target), for example
    <target name="compile.src">
        <javac  destdir="build/classes"> 	
    	<src path="src"/>
    	<classpath refid="required.jars"/>
        </javac>
    </target>
  4. Link the required libraries in at run time (include the above refid in your run targets), for example
    <target name="run" depends="jar">
    	<java classname="Main">
    		<classpath location="${lib-out}/${name}.jar"/>
    		<classpath refid="required.jars"/>
    		<arg line="--interactive-state false" />
    	</java>
    </target>

Other languages

You will need to download fedpp.wsdl . The wsdl is largely self-documenting. Any web-service client you create from the wsdl will be able to communicate with any FederatedPeoplePicker service. From there, you are on your own I am afraid.



Browse Space
- Pages
- Labels
- Attachments
- Mail
- News
- Advanced

Explore Confluence
- Popular Labels
- Notation Guide

Your Account
Log In

 

Other Features

View a printable version of the current page.

Add Content


Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.4.3 Build:#705 Mar 21, 2007)
Bug/feature request - Contact Administrators