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.3.0.tar.gz (21.4 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.3.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ebms_adapter_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c1f374a76d818c804c751abca65b5c241a1c68959e6de529b3797b724d246fd7
MD5 fe6541fb3ad5a069e773e05fbb18fa26
BLAKE2b-256 30008e301ff9c64559c4d917dd92a14aa42f55cdaf3bab1a3263912f3d471774

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebms_adapter_client-0.3.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ebms_adapter_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b916601ee8467349ec596d4fe7d3f1d7270cf50de4430b9f19c70f8f03b5f9f3
MD5 cceb285e1b15173cbe37439b1311b517
BLAKE2b-256 fc1dd55d602685dcedb2d0cb3171c044abc40aec525524e2c87ded32ad943c58

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebms_adapter_client-0.3.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