Skip to main content

Python client for the ebms-core (eluinstra/ebms-core) REST API.

Project description

ebms-adapter-client

PyPI Python versions CI License: MIT uv Ruff mijn | overheid

A minimal Python client for the REST API exposed by eluinstra/ebms-core (branch ebms-core-2.20.x), an ebMS (Electronic Business Messaging Service) adapter/core used to send and receive ebMS messages between trading partners.

[!NOTE] This package only talks to ebms-core's HTTP/JSON REST API — it doesn't implement ebMS/SOAP itself.

Endpoint coverage

ebms-core mounts its REST API at {base_url}/service/rest/v19/... (see EmbeddedWebConfig.java/Start.java in the sibling ebms-admin repo, which is what actually deploys ebms-core). Four JSON resource groups are covered:

  • /cpas — Collaboration Protocol Agreement (CPA) management
  • /urlMappings — URL mapping management
  • /certificateMappings — certificate mapping management
  • /ebms — message submission, retrieval, status, and event polling

The MTOM/multipart variants (POST /ebms/messages/mtom, GET /ebms/messages/mtom/{messageId}) are intentionally not implemented — the JSON DataSource model (Base64-encoded content) covers attachments for the plain JSON endpoints.

Installation

pip install ebms-adapter-client

Usage

from ebms_adapter_client import (
    DataSource,
    EbmsAdapterClient,
    EbmsAdapterClientConfig,
    MessageRequest,
    MessageRequestProperties,
)

config = EbmsAdapterClientConfig(
    base_url="http://localhost:8080",
    username="user", # omit if the server runs without --authentication
    password="pass",
)

with EbmsAdapterClient(config) as client:
    message_id = client.send_message(
        MessageRequest(
            properties=MessageRequestProperties(
                cpa_id="cpa-1",
                from_party_id="party-a",
                service="my-service",
                action="my-action",
            ),
            data_sources=[
                DataSource(content_type="application/pdf", content=b"...", name="letter.pdf"),
            ],
        )
    )

    status = client.get_message_status(message_id)

Configuration

EbmsAdapterClientConfig builds the full API base URL as {base_url}{service_path}{api_path}, defaulting to /service + /rest/v19 to match ebms-admin's default wiring. Override service_path/api_path if a reverse proxy changes that layout.

Auth

  • No credentials (username=None) → no Authorization header is sent, matching a server started without --authentication.
  • username/password set → HTTP Basic Auth, matching a server started with --authentication (without --clientAuthentication).
  • Mutual TLS (--authentication --ssl --clientAuthentication) is not wired up yet; pass a preconfigured httpx.Client (with cert=) via the http_client constructor argument if needed.

Error handling

All non-2xx responses raise a subclass of EbmsAdapterError (ebms_adapter_client.exceptions):

  • EbmsNotFoundError — HTTP 404
  • EbmsBadRequestError — HTTP 400 (message text carries the server's error)
  • EbmsServerError — HTTP 5xx
  • EbmsConnectionError — the server could not be reached at all

Development

uv sync --all-groups
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mypy src

See CONTRIBUTING.md for more.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ebms_adapter_client-0.2.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ebms_adapter_client-0.2.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file ebms_adapter_client-0.2.0.tar.gz.

File metadata

  • Download URL: ebms_adapter_client-0.2.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ebms_adapter_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b97a041b6efb03c155a068cd49bce4bae1ef1bc16989b6387ca817c27100a2fb
MD5 2fceb6eadd9db39c926f4450e2ea235e
BLAKE2b-256 072f761401ed02a2b0ec9e10c270a17a474f488a7733993732da5b0d77dd9165

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebms_adapter_client-0.2.0.tar.gz:

Publisher: publish.yml on Worth-NL/ebms-adapter-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ebms_adapter_client-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ebms_adapter_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 861e1f3c3c2a4a62064fbedad12aca1d953149d906527d498a8186171eb5403f
MD5 56ffee97a0a3068dde018ae1b2057f73
BLAKE2b-256 f9ce2173466d279f3f9b436558ed3b03ab3742f2dd4f6307f40b3bcad558b14e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebms_adapter_client-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Worth-NL/ebms-adapter-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page