Skip to main content
phase4 provides two complementary approaches for sending AS4 messages:

Profile-specific senders

Pre-configured builders for Peppol, CEF eDelivery, BDEW, ENTSOG, and EUDAMED. Sensible defaults for crypto algorithms, PMode IDs, HTTP client settings, and message properties are baked in so you don’t have to set them manually.

Generic AS4Sender

No profile defaults applied. You control every AS4 header field, encryption algorithm, and party ID. Use this when your trading network doesn’t match any of the built-in profiles.

The builder pattern

Every sender in phase4 exposes a fluent builder. The same call style applies regardless of which sender you use:
EAS4UserMessageSendResult eResult =
    Phase4PeppolSender.builder()          // or AS4Sender.builderUserMessage(), etc.
        .someField(value)
        .anotherField(value)
        .sendMessageAndCheckForReceipt(); // or .sendMessage()
Builders are not thread-safe. Create a new builder instance for each outgoing message.

Triggering the send

Each builder exposes two methods to trigger sending:
MethodReturnsWhen to use
sendMessage()ESuccessWhen you handle receipt checking yourself via signalMsgConsumer()
sendMessageAndCheckForReceipt()EAS4UserMessageSendResultPreferred — wraps the entire send + receipt check in one call

EAS4UserMessageSendResult values

sendMessageAndCheckForReceipt() returns one of these enum values:
ValueIDMeaningRetry?
SUCCESSsuccessReceipt received — message delivered
INVALID_PARAMETERSinvalid-parametersA mandatory builder field is missingNo
TRANSPORT_ERRORtransport-errorNetwork / HTTP(S) failureYes
TRANSPORT_ERROR_NO_RETRYtransport-error-no-retryNetwork failure where retry is unlikely to helpNo
NO_SIGNAL_MESSAGE_RECEIVEDno-signal-msg-receivedResponse was not a valid AS4 signal messageYes
AS4_ERROR_MESSAGE_RECEIVEDas4-error-msg-receivedThe receiver returned an AS4 errorNo
INVALID_SIGNAL_MESSAGE_RECEIVEDinvalid-signal-message-receivedSignal message contained neither receipt nor errorYes
Use isSuccess() and isRetryFeasible() on the result to branch your error-handling logic.
final EAS4UserMessageSendResult eResult = builder.sendMessageAndCheckForReceipt();
if (eResult.isSuccess()) {
    // message delivered
} else if (eResult.isRetryFeasible()) {
    // schedule a retry
} else {
    // permanent failure — investigate logs
}

When to use which sender

1

Check for a matching profile

If your network uses Peppol, CEF eDelivery / TOOP, BDEW, ENTSOG, or EUDAMED, use the corresponding profile-specific sender. It sets the correct profile ID, crypto parameters, HTTP timeouts, and mandatory message properties automatically.
2

Fall back to the generic sender

If no profile matches — for example a custom AS4 trading network — use AS4Sender.builderUserMessage() and configure all fields manually.

Sender pages

Generic AS4

AS4Sender.builderUserMessage() and builderPullRequest()

Peppol

Phase4PeppolSender.builder() and sbdhBuilder()

CEF eDelivery

Phase4CEFSender.builder()

BDEW

Phase4BDEWSender.builder()

ENTSOG

Phase4ENTSOGSender.builder()

EUDAMED

Phase4EudamedSender.builder()

Dynamic Discovery

IAS4EndpointDetailProvider and its implementations

Build docs developers (and LLMs) love