Because not so many people blog about BDC somehow I feel responsible to post a bit about this MOSS feature. Today I will describe how to implement the web service which should be enabled for MOSS search crawler.
Interesting in this scenario is not how to create Lob system based on the web service. More over, the question is how to do this by using of service which retrieve millions of records.
Such service has to provide in general at least two BDC methods: IdEnumerator and FindSpecific. If you do not know what this mean I would recommend to read more about BDC.
Here is the code snippet which shows how to implement the operation GetCustomerPaged (of type IdEnumerator). This operation receives the ID of the last retrieved record and the size of the page which MOSS crawler will supply. After collecting of the data (implementation not described in this post) the operation returns the page of data which contains the list of identifiers in the page and corresponding timestamp. The timestamp information is required because of incremental crawling and not because of paging.
Here is the code:
GetCustomerIdsPagedResult
GetCustomerIdsPaged(GetCustomerIdsPagedRequest request);
[MessageContract]
public class GetCustomerIdsPagedRequest
{
[MessageBodyMember]
public int PageSize;
[MessageBodyMember]
public string Id;
}
[MessageContract]
public class GetCustomerIdsPagedResult
{
[MessageBodyMember]
public CustomerId[] Ids;
}
[DataContract]
public class CustomerId
{
public CustomerId(string id, DateTime lastModified)
{
Id = id;
LastModified = lastModified;
}
[DataMember]
public string Id;
[DataMember]
public DateTime LastModified;
}
Creating method
In the BDC editor we need to create the method of type IdEnumerator.
After the method is created it should look like shown at the next picture:
Create Identifier
Now we need to create the identifier. This is one of properties which service returns in the list of elements of type CustomerId . In this case this is property Id.
Creating Filter
Now we have to create the filter type descriptor of type LastIdFilter and with the name LastIdSeen.
Creating Parameters
Next picture shows all automatically created parameters. We have to bind now the parameter Id to the filter LastIdSeen. All other parameters remain as they are.
Returning parameter
The returning parameter Id has to be mapped to the property Id. This is because the crawler has to know which returning property is identifier.
Testing the method
This is all you have to do. Now you can test the method without of deploying the XML described LobSystem. Select method instance GetPaged and press „Collection“ button.
To do that first set Testing Arguments and then execute the method.
Goto execute and press next.
Execute
Posted
Jan 08 2008, 12:27 AM
by
Damir Dobric