How to enable OData access in Data Abstract

Data Abstract for .NET provides support for OData publishing in both the provided Relativity server, and in custom Data Abstract servers. This page provides all the information you need to get going with OData support.

It is quite easy to add an OData dispatcher to a newly created Data Abstract for .NET server, because the New Project Wizard exposes the corresponding project option. If you already have an existing Data Abstract server then you can easily add OData capabilities to it, as long as that server uses one of the server channels that are able to serve OData requests.

Compatible Server Channels

OData is an HTTP-based data access protocol, so obviously not all server channels can serve OData requests. Only the HTTP and Super HTTP channels are supported, it is not possible to add an OData dispatcher to either the TCP, Super TCP or Named Pipe server channels.

Required Data Service Changes

First, you need to ensure that your service implements the ISimpleDataAbstractService interface or is inherited from the SimpleDataAbstractService class.

If your data service class is inherited from the DataAbstractService class, you can just change the parent class name to SimpleDataAbstractService. No other code changes are required in this case.

You also need to adjust the ancestor service in the data service definition in the server RODL.

Adding OData Publishing to a Custom Data Abstract Server

Adding OData support to an existing Data Abstract Server is a rather simple process. The first step is to open your server's main form or component, where the HTTP server channel component is located; for instance in a custom Data Abstract server created by the New Project Wizard. Then add an ODataSchemaDispatcher class there by dragging it from the Toolbox.

You then need to set a few of the properties before the OData service works:

Property Is Required Description
Server + Should contain a link to the server channel instance of compatible type.
ServiceName + Name of the data service, this can be any regular Data Abstract service implementing the ISimpleDataAbstractService interface.
Path URI suffix that is assotiated with the OData provider.
The default value is /odata.
RootUrl This property should contain the full URL to the OData service; the path part of the URL should match the Path property. If this property is not set, the OData dispatcher uses the service's URL contained in the incoming HTTP request to compose the server URL in the answer.
Namespace Simple string that uniquely identifies this service.
HttpAuthLoginServiceName If the data service requires authentication, this property contains a link to the SimpleLoginService descendant that will handle user logins.
HttpAuthRealm The realm passed to the client when authentication is requested.

Once the ODataSchemaDispatcher is set up, the Data Abstract service will be able to act as an OData service.

Enabling OData Support in Relativity

Enabling OData support in Relativity Server is even easier using the Relativity Admin Tool. In the global Network Settings, OData support for the entire Relativity server can be enabled with the "Enable OData support" check box.

Once enabled, OData support will be added to all domains and schemas on the server. Because Relativity can host multiple domains, the OData access URL must specify the domain and schema, too. To access OData for the Simple schema in the DASamples domain you would use the following URL http://localhost:7099/odata/DASamples/Simple. Accessing the data will require authentication with the login credentials specified by the Login Provider.