🌐 Deutsche Version hier verfügbar: README.md 👈
This document describes the usage of the X.Justiz Core .NET SDK for software developers.
The SDK is provided as a NuGet package. You can install it via the Package Manager Console or the .NET CLI:
# .NET CLI
dotnet add package xjustiz.core-dotnet
# Package Manager Console
Install-Package xjustiz.core-dotnet
The latest version can be found on nuget.org.
The central model for data exchange is the UebermittlungSchriftgutobjekteNachricht class. It represents the standardized “envelope” for files and documents.
using xjustiz.core_dotnet.Models;
var message = new UebermittlungSchriftgutobjekteNachricht
{
Kopf = new Nachrichtenkopf
{
Erstellungszeitpunkt = DateTime.UtcNow,
EigeneNachrichtenId = Guid.NewGuid().ToString()
},
Grunddaten = new Grunddaten
{
// Case data, participants etc.
},
Schriftgutobjekte = new Schriftgutobjekte
{
// Files and documents
}
};
X.Justiz Core uses a structured system of codes (e.g., for roles, courts, document classes).
listVersionID.The available codes can be found in the xjustiz.core_dotnet.Models.Codes namespace.
The SDK is optimized for use in ASP.NET Core controllers and supports both XML and JSON.
[ApiController]
[Route("api/xjustiz")]
public class MyController : ControllerBase
{
// JSON Support (Standard in ASP.NET Core)
[HttpPost("json")]
public IActionResult ReceiveJson(UebermittlungSchriftgutobjekteNachricht message)
{
// Processing...
return Ok();
}
// XML Support (requires .AddXmlSerializerFormatters() in Program.cs)
[HttpPost("xml")]
[Consumes("application/xml")]
public IActionResult ReceiveXml([FromBody] UebermittlungSchriftgutobjekteNachricht message)
{
// Processing...
return Ok();
}
}
A complete example can be found in the example-api project.
The SDK supports deserialization directly from files.
var jsonString = File.ReadAllText("akte.json");
var message = JsonSerializer.Deserialize<UebermittlungSchriftgutobjekteNachricht>(jsonString, new JsonSerializerOptions
{
PropertyNameCaseInsensitive = true
});
var serializer = new XmlSerializer(typeof(UebermittlungSchriftgutobjekteNachricht));
using var stream = File.OpenRead("akte.xml");
var message = (UebermittlungSchriftgutobjekteNachricht?)serializer.Deserialize(stream);
Checks which X.Justiz or X.Justiz Core versions an instance of the model is compatible with (based on used fields and attributes).
using xjustiz.core_dotnet.Util.Versioning;
var compatibility = CompatibilityChecker.Check(message);
Console.WriteLine($"Compatible with Core: {string.Join(", ", compatibility.CompatibleXJustizCoreVersions)}");
Converts messages between different versions of X.Justiz Core.
using xjustiz.core_dotnet.Util.Converter;
var converted = XJustizConverter.Convert(message, XJustizCoreVersion.V0_1_0).Result;
Validates XML files against the official X.Justiz XSD schemas. The SDK includes the schemas in the archive.
using xjustiz.core_dotnet.Util;
var errors = await XmlValidator.ValidateAsync("path/to/file.xml", XJustizVersion.V3_5_1);
if (errors.Any()) { /* Error handling */ }
Creates X.Justiz-compliant ZIP archives containing both the XML message and the physical document attachments.
using xjustiz.core_dotnet.Util;
var attachments = new List<string> { "document1.pdf", "attachment.jpg" };
await Zipper.ArchiveToZipFileAsync(message, "export.zip", attachments);
Further examples can be found in the /dotnet/example-api folder.