Skip to main content

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

Project description

ebms-adapter-client

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.

This package only talks to ebms-core's HTTP/JSON REST API — it doesn't implement ebMS/SOAP itself. It's a building block intended to be consumed later by a NotifyNL service (e.g. a Celery task) as a new notification channel; it has no NotifyNL-specific code 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 -e .

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.1.0.tar.gz (17.6 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.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ebms_adapter_client-0.1.0.tar.gz
  • Upload date:
  • Size: 17.6 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.1.0.tar.gz
Algorithm Hash digest
SHA256 213fd66170af68b1ad527b2b67326e6e91bb8cac6dfa5580bf3f0e37099faa6e
MD5 f7611d91ec28f9c2d86abf1840497d38
BLAKE2b-256 8a4a399364c78db270585c35a20bea05325d2bef7eaafac0a0e514959ec6fb56

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for ebms_adapter_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0090c88e54b1636d5560df73d26803ce76bd6b4d1d9daf2e6e424dd0f2b3a76
MD5 296c4066bb96881555b623c8f581dfb8
BLAKE2b-256 f30eacd46ddb9aeb636f953077d219b20048636ecef099d706c4312ffdecf83a

See more details on using hashes here.

Provenance

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