Resources for IT Professionals >
Forums Home
>
Identity Management Forums
>
Identity Lifecycle Manager 2
>
Improvements and bug fixes in the FIM RC1 Web Service client.
Improvements and bug fixes in the FIM RC1 Web Service client.
- Hi all,
Working with the FIM RC1 public web service client , I have found some small bugs and some missing features (I already reported about a bug in a previous post on this forum ).
I think it would be great if we could share our experience in using the client, so I would like to propose to use this discussion thread to post bugs, fixes and improvements for the web service client .
If you are interested in getting a version of the client with the fixes I made, you can contact me on the "Identity Management at CERN" blog .
Paolo Tedesco - http://espace.cern.ch/idm- Edited byPaolo Tedesco Monday, October 19, 2009 2:47 PM
All Replies
- Enumeration responses do not include the total number of matching objects
When you run an Enumerate request, the response does not get the total count of objects that matched the query filter, which is an important piece of information if the total number of results is higher than the limit on the number of returned objects.
To add this missing feature, you must add an EnumerationDetail class as follows:
[XmlRoot]
public class EnumerationDetail {
[XmlElement()]
public int Count;
}
Then you need to modify the EnumerateResponse class to add that element (file EnumerationResponse.cs). Here I'm also adding a "convenience" property that will store the total number of results:
[XmlRoot(Namespace = Constants.WsEnumeration.Namespace)]
public class EnumerateResponse : PullResponse {
[XmlElement(Namespace = Constants.Rm.Namespace)]
public EnumerationDetail EnumerationDetail;
[XmlIgnore()]
public int? Count {
get {
if (null == EnumerationDetail) {
return null;
} else {
return EnumerationDetail.Count;
}
}
}
}
And finally you have to go to the WsEnumerationClient.cs file and add a message header to request for the count information (add the lines in bold to the Enumerate method inside the lock block):
public EnumerateResponse Enumerate(EnumerationRequest request) {
// code omitted for brevity ...
lock (request) {
enumerateRequest = Message.CreateMessage(MessageVersion.Default, Constants.WsEnumeration.EnumerateAction, request, new ClientSerializer(typeof(EnumerationRequest)));
MessageHeader includeCount = MessageHeader.CreateHeader("IncludeCount",Constants.Rm.Namespace,null);
enumerateRequest.Headers.Add(includeCount);
}
// code omitted for brevity ...
}
Paolo Tedesco - http://espace.cern.ch/idm - Comparing RmReference objects with a null reference as a left-side operator causes a NullReferenceException
If you compare an RmReference object against a null reference on the left side of the comparison operator, you get a NullReferenceException, e.g:
RmReference a = SomeOperation();
if (null != a) { // crashes
You can fix this by re-defining the == and != operators of the RmReference class as follows:
public static bool operator ==(RmReference attrib1, RmReference attrib2) {
if (attrib1 as object == null)
return (attrib2 as object == null);
if (attrib2 as object == null)
return false;
return attrib1.CompareTo(attrib2) == 0;
}
public static bool operator !=(RmReference attrib1, RmReference attrib2) {
if (attrib1 as object == null)
return (attrib2 as object != null);
if (attrib2 as object == null)
return true;
return attrib1.CompareTo(attrib2) != 0;
}
Paolo Tedesco - http://espace.cern.ch/idm Love it!
IsMultiValue property of RmAttributeValue class returns true whenever the attribute has a value
RmAttributeValue stores values internally as a list, and IsMultiValue property is defined as
public bool IsMultiValue { get { return this.isMultiValue || this.values.Count > 0; } }Thus it returns true when at least one value is stored. The property should be defined as
public bool IsMultiValue { get { return this.isMultiValue || this.values.Count > 1; } }
Paolo Tedesco - http://espace.cern.ch/idm- CopyTo method of RmList makes a copy the wrong way round
The CopyTo method in RmList is defined as follows:
public void CopyTo(T[] array, int arrayIndex) { int j = arrayIndex; for (int i = 0; i < array.Length; i++) { this.values[j] = this.ConvertTo(array[i]); j++; } }
This actually is copying the array into the list, while it should be the opposite. If you try to initialize a List with the contents of an RmList the code will crash.
I think that the correct implementation of the method should be like this:
public void CopyTo(T[] array, int arrayIndex) { for (int i = 0; i < this.values.Count; i++) { array[i + arrayIndex] = this.ConvertFrom(this.values[i]); } }
Paolo Tedesco - http://espace.cern.ch/idm

