Skip to content

DLL Client

If you wish to use this DLL, you must request it from an SDH administrator.

Authentication based on certificates accessible by the third-party application

SDHAuthorization auth = new ()
{
    // Certificate instance
    // Used to retrieve the certificate whose Thumbprint
    // has been provided to SDH administrators
    //
    // new Certificate(x509Certificate2)
    // new Certificate(serialNumberOrHash)
    // new Certificate(fromFileName, passwordFromFileName)
};


var client = new ControlDocumentsClient();
client.Set(companyId: "00000000-0000-0000-0000-000000000000",
           url: "https://decatest.solmicrosdh.com",
           sdhAuth: auth);

var response = client.Create(new CreateControlDocumentRequest
{
    ContractualCharger = new ContractualCharger { BusinessName = "...", TaxIdentificationNumber = "...", Address = "..." },
    ActualCarrier = new ActualCarrier { BusinessName = "...", TaxIdentificationNumber = "..." },
    Shipments = new List<Shipment> { new Shipment { Origin = "...", Destination = "...", GoodsNature = "...", WeightKg = 1000 } },
    Vehicle = new Vehicle { LicensePlate = "1234ABC" },
    TransportDate = DateTime.Today
});

client.Update(response.Id, new UpdateControlDocumentRequest { /* ... */ });
client.ResendNotification(response.Id, new ResendNotificationRequest { Channel = NotificationChannel.Email, Address = "recipient@domain.com" });
client.Delete(response.Id);

Authentication based on Azure

SDHAuthorization authAzureOption1 = new ()
{
    clientId = "",      // Azure client identifier
    clientSecret = ""   // Azure client secret
};

SDHAuthorization authAzureOption2 = new ()
{
    clientId = "", // Azure client identifier
    certificate =
    // Certificate instance
    //
    // new Certificate(x509Certificate2)
    // new Certificate(serialNumberOrHash)
    // new Certificate(fromFileName, passwordFromFileName)
};

var client = new ControlDocumentsClient();
client.Set(companyId: "00000000-0000-0000-0000-000000000000",
           url: "https://decatest.solmicrosdh.com",
           sdhAuth: authAzureOptionX);

var response = client.Create(new CreateControlDocumentRequest
{
    ContractualCharger = new ContractualCharger { BusinessName = "...", TaxIdentificationNumber = "...", Address = "..." },
    ActualCarrier = new ActualCarrier { BusinessName = "...", TaxIdentificationNumber = "..." },
    Shipments = new List<Shipment> { new Shipment { Origin = "...", Destination = "...", GoodsNature = "...", WeightKg = 1000 } },
    Vehicle = new Vehicle { LicensePlate = "1234ABC" },
    TransportDate = DateTime.Today
});

client.Update(response.Id, new UpdateControlDocumentRequest { /* ... */ });
client.ResendNotification(response.Id, new ResendNotificationRequest { Channel = NotificationChannel.Email, Address = "recipient@domain.com" });
client.Delete(response.Id);

Certificate class

The Certificate class is used to obtain the certificate. It supports constructors with:

  • X509Certificate2: An object of the X509Certificate2 class.
  • serialNumberOrHash: A string with the SerialNumber or the Thumbprint to locate the certificate installed in the user's personal store on the machine that consumes the integration. It must be installed as exportable.
  • fromFileName and passwordFromFileName: Path to a file whose content is a certificate, and the password of that certificate.

```