CDP4ServicesDal Overview - STARIONGROUP/COMET-SDK-Community-Edition GitHub Wiki

Introduction

The CDP4ServicesDal library is a C# library that provides an implementation of ECSS-E-TM-10-25A Annex C.2, the JSON REST API. The purpose of the CDP4ServicesDal is to communicate with the CDP4-COMET Web Services. The JSON REST API is based on HTTP and makes use of GET and POST requests.

The [COMET Data Model]] includes more classes than the [ECSS-E-TM-10-25A meta model. These extra concepts can be included in the communication with the CDP4-COMET Web Services, this is facilitated by the CDP4ServicesDal. The CDP4ServicesDal is only compatible with the CDP4-COMET Web Services and not with a standard implementation of ECSS-E-TM-10-25A and ECSS-E-TM-10-25A Annex C.2.

The CDP4ServicesDal library is a very light weight library, it exposes only one class:

CDP Version and HTTP Headers

HTTP Headers

The CDP4ServicesDal should only be used to communicate with an instance of the CDP4-COMET Web Services. The CDP4-COMET Web Services always include CDP4-COMET specific HTTP headers. If these headers are missing, then the DAL is used to communicate with a plain E-TM-10-25 data source. If that is the case, the CDP4ServicesDal should not be used. Use the CDP4WspDal instead. A HeaderException will be thrown if the expected HTTP Headers are missing from the response.

DalExport

The CdpServicesDal class is decorated with the DalExportAttribute. This allows it to be dynamicaly loaded using the Managed Extensibility Framework (MEF).

HttpClient

The CdpServicesDal is a wrapper around the the C# HttpClient. It takes care of all the nitty gritty details of the ECSS-E-TM-10-25A Annex C.2. It uses the Cdp4JsonSerializer to handle the deserialization of the [DTO]] objects that are returned from the CDP4-COMET Web Services and the serialization of [Classless DTO.

For each GET or POST request a Token is generated. This token is used to identify the request and responses that are being sent to the CDP4-COMET Web Services. The Token is used in NLog statements in order to be able to use these logs for debugging purposes.