Skip to content

CDP4ServicesDal Overview

sam.gerene edited this page Jan 4, 2018 · 8 revisions

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 Web Services. The JSON REST API is based on HTTP and makes use of GET and POST requests.

The CDP4 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 Web Services, this is facilitated by the CDP4ServicesDal. The CDP4ServicesDal is only compatible with the CDP4 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 CDP4 Web Services are able to include or exclude the CDP4 Data Model classes in the response of a GET or POST request. HTTTP headers are used to communicate to the CDP4 Web Services that the client supports CDP4 concepts and what version is supported. The Accept-CDP HTTP header is used to let the CDP4 Web Services know that CDP4 extensions are accepted by the client that is making the GET or POST requests.

A response from the CDP4 Web Services will always contain the following HTTP Headers:

  • CDP4-Server: The header that is used to communicate the version of the server that is being used
  • CDP4-Common: The header that specifies the version of the CDP4Common library that is being used
  • Content-Type: The header that specifies the ECCS-E-TM-10-25 protocol and it's version

The CDP4 HTTP headers must be present in the response, if they are not present this means the CDP4ServicesDal is used to communicate with a server that is not an instance of the CDP4 Web Services. 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 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 Web Services. The Token is used in NLog statements in order to be able to use these logs for debugging purposes.

Clone this wiki locally