OK, now for the fun – Hello World with the web services and sample client! In this post we get a specific person. By specific, I mean we already know the person’s ObjectID. In many scenarios you do not know the ObjectID ahead of time, and we will cover how to handle these cases in later topics.
Below is the Topic11 method from the sample code. Please visit the Identity Management Extensibility samples site and download the code to follow along at home.
Recall that the Get operation is part of WS-Transfer protocol we described in Topic 5. Let’s walk through the lines of code:
- We instantiate a new instance of a WSTransferClient object. This object is provided by the sample client.
- We set the network credentials of the client. ILM “2” uses .NET’s Windows Identity to determine client identities. Failing to set this value will revert to the default credentials, which is usually the current user logged in. In my case I run the client code on a separate box and on a separate domain than the ILM “2” installation so the default credentials will result in PermissionDenied faults.
- We specify the already-known ObjectID. In this case we use the Administrator’s guid from the ILM “2” RC demo VPC from IT Forum. This guid is not the Administrator guid for all ILM “2” installations.. In Topic 13 we will show how to search for objects using XPath.
- We invoke the get operation and pass in the ObjectID of the person we want. The operation returns a weakly-typed ResourceManagementObject that has a property bag of attributes.
- We assert that the returned object has the object id we requested. The sample client will throw a PermissionDenied fault if the server could not find the person.
That was it! The person object returned has all of the attributes you have permission to read. To get at the attributes, specify the attribute name in the person object’s indexer. Below we get the DisplayName of the person.
You now can get any object in ILM “2” provided you know its guid. In the next post we’ll show how to use the Transfer Extensions for Identity Management Operations when getting the same person.