Repository navigation
AS4 Errors
This page gives an overview of the ebMS / AS4 error codes known to phase4, when phase4 raises each of them for an incoming message, and which profiles add their own handling.
All information on this page is derived from the phase4 source code. For the handling of plain SOAP Faults received by a sender, see SOAP Handling.
| Type | Package | Purpose |
|---|---|---|
IEbmsError |
com.helger.phase4.model.error |
Generic interface of an ebMS error: error code, severity, short description, description and category |
EEbmsError |
com.helger.phase4.model.error |
Enum with all predefined ebMS errors (see the table below) |
EEbmsErrorSeverity |
com.helger.phase4.model.error |
FAILURE (failure, error level ERROR) and WARNING (warning, error level WARN) |
EEbmsErrorCategory |
com.helger.phase4.model.error |
Content, Communication, Unpackaging and Processing
|
Ebms3ErrorBuilder |
com.helger.phase4.model.error |
Builder for a single eb:Error element. Created via IEbmsError.errorBuilder (Locale) and filled with e.g. refToMessageInError (String), description (String, Locale) and errorDetail (String) / errorDetail (String, Throwable)
|
AS4Error |
com.helger.phase4.model.error |
Wraps an Ebms3Error together with an optional HTTP response status code (AS4Error.builder ().ebmsError (...).httpStatusCode (int)) |
Use EEbmsError.getFromErrorCodeOrNull (String) to map a received error code (e.g. EBMS:0004) back to the enum constant.
- Errors detected while processing an incoming message are returned to the sender as an ebMS Signal Message containing one
eb:Errorelement per error. - The Error message is signed, if a PMode leg is available. If signing fails, the unsigned Error message is returned.
- The HTTP response status code of an Error message is 200 by default.
If at least one
AS4Errorcarries an explicit HTTP status code, the first one is used instead (see the Peppol section below for where this happens). - Problems detected before the ebMS layer is reached are not answered with an
eb:Error, but with a plain HTTP error response:
| Situation | HTTP status code |
|---|---|
Content-Type header missing or not parsable, multipart without boundary parameter |
400 |
| A MIME part cannot be parsed | 400 |
| The SOAP document cannot be parsed | 400 |
The SOAP document has no Header element |
500 |
A SOAP header element with mustUnderstand cannot be handled by any registered processor |
500 |
| No PMode or no PMode leg could be determined for an incoming UserMessage | 400 |
Any other Phase4Exception
|
the HTTP status code of the exception, otherwise 400 |
| Any other exception | 500 |
The column "Raised by phase4" states whether phase4 itself creates this error for an incoming message. Errors that are not raised by phase4 can still be received from a remote peer and can be created by custom SPI implementations.
| Code | Enum constant | Short description | Severity | Category | Raised by phase4 |
|---|---|---|---|---|---|
EBMS:0001 |
EBMS_VALUE_NOT_RECOGNIZED |
ValueNotRecognized | failure | Content | yes |
EBMS:0002 |
EBMS_FEATURE_NOT_SUPPORTED |
FeatureNotSupported | warning | Content | no |
EBMS:0003 |
EBMS_VALUE_INCONSISTENT |
ValueInConsistent | failure | Content | yes |
EBMS:0004 |
EBMS_OTHER |
Other | failure | Content | yes |
EBMS:0005 |
EBMS_CONNECTION_FAILURE |
ConnectionFailure | warning | Communication | no |
EBMS:0006 |
EBMS_EMPTY_MESSAGE_PARTITION_CHANNEL |
EmptyMessagePartitionChannel | failure | Communication | yes |
EBMS:0007 |
EBMS_MIME_INCONSISTENCY |
MimeInconsistency | failure | Unpackaging | no |
EBMS:0008 |
EBMS_FEATURE_NOT_SUPPORTED_INCONSISTENCY |
FeatureNotSupportedInconsistency | failure | Unpackaging | no |
EBMS:0009 |
EBMS_INVALID_HEADER |
InvalidHeader | failure | Unpackaging | yes |
EBMS:0010 |
EBMS_PROCESSING_MODE_MISMATCH |
ProcessingModeMismatch | failure | Processing | yes |
EBMS:0011 |
EBMS_EXTERNAL_PAYLOAD_ERROR |
ExternalPayloadError | failure | Processing | yes |
EBMS:0101 |
EBMS_FAILED_AUTHENTICATION |
FailedAuthentication | failure | Processing | yes |
EBMS:0102 |
EBMS_FAILED_DECRYPTION |
FailedDecryption | failure | Processing | yes |
EBMS:0103 |
EBMS_POLICY_NONCOMPLIANCE |
PolicyNoncompliance | failure | Processing | yes |
EBMS:0201 |
EBMS_DYSFUNCTIONAL_RELIABILITY |
DysfunctionalReliability | failure | Processing | no |
EBMS:0202 |
EBMS_DELIVERY_FAILURE |
DeliveryFailure | failure | Communication | no |
EBMS:0301 |
EBMS_MISSING_RECEIPT |
MissingReceipt | failure | Communication | no |
EBMS:0302 |
EBMS_INVALID_RECEIPT |
InvalidReceipt | failure | Communication | yes |
EBMS:0303 |
EBMS_DECOMPRESSION_FAILURE |
DecompressionFailure | failure | Communication | yes |
EBMS:4001 |
EBMS_PHASE4_DUPLICATE |
DuplicateDetected | failure | Content | yes |
Sources of the codes:
-
EBMS:0001toEBMS:0202- OASIS ebMS 3.0 Core (processing, security and reliable messaging errors) -
EBMS:0301toEBMS:0303- AS4 Profile of ebMS 3.0 Version 1.0 (additional feature errors) -
EBMS:4001- phase4 specific, added according to ebMS 3.0 Core section 6.4.1 "Adding new ebMS Errors" (since v4.5.0) -
EBMS:0020toEBMS:0023- ebMS 3.0 Part 2, only with thephase4-multihopmodule (since v5.0.0, see below)
This section lists the generic situations in phase4-lib that apply to all profiles.
- The
eb:Messagingelement contains neither a UserMessage, a PullRequest, a Receipt nor an Error - The MPC of a PullRequest cannot be resolved
- No PMode can be resolved for the MPC of a PullRequest
- The
eb:Messagingelement contains more than one UserMessage or more than one SignalMessage, or neither of them -
PartyInfo/FromorPartyInfo/Tocontains more than onePartyId - The effective MPC of a UserMessage is unknown
- A SOAP body payload is present, but there is no
PayloadInfo/PartInfo - A
PartInforeferences the SOAP body, but the SOAP body is empty - An attachment uses an unsupported
CompressionTypeor an unsupported character set property, or a compressed attachment misses theMimeTypepart property - Attachments are present, but the UserMessage contains no
PayloadInfo, or fewerPartInfoelements than attachments - The
Content-IDof an attachment is empty, does not start with<attachment=or does not end with> - A
PartInfo/@hrefdoes not reference the respective attachment ID - A received Error signal does not contain a
RefToMessageInError - An
IAS4IncomingMessageProcessorSPIreturns an asynchronous response URL or a response UserMessage while a previous SPI already did so
- An exception occurs in a SOAP header element processor
- An
IOExceptionoccurs while processing the WS-Security header - An
IAS4IncomingMessageProcessorSPIthrows an exception or returns a failure without providing an error itself ("An undefined generic error occurred in phase4") - phase4 runs in production mode, but no
IAS4IncomingMessageProcessorSPIis installed - the message is rejected because it cannot be processed
- An
IAS4IncomingMessageProcessorSPIreturns no UserMessage for a PullRequest
- The
eb:Messagingheader element cannot be parsed (not well-formed or not schema valid) - A pushed UserMessage on leg 1 has an
eb:MessageIdthat is not a valid RFC 2822msg-id. This is only an error ifphase4.incoming.strict.messageidsistrue(the default); otherwise and for all other messages only a warning is logged. See Configuration.
- The PMode MPC of a UserMessage is invalid
- No PMode can be resolved for a UserMessage
- The resolved PMode does not contain leg 2, or not the effective leg
- The validation of the incoming message against the AS4 profile fails - see Profile validation
- Attachments are present, but there is no
PayloadInfo/PartInfo - The number of
PartInfoelements referencing attachments does not match the number of actual attachments
- The signature algorithm or the signature digest algorithm of the security header is not supported
- The WS-Security header cannot be processed - this covers both decryption and signature verification errors, because WSS4J does not differentiate between them. The WSS4J error code is appended to the error detail.
- A decrypted attachment cannot be written to a temporary file
- The message is signed, but the signature does not cover all message parts required by the profile (the
eb:Messagingheader, the SOAP body or the attachments). This is only an error ifphase4.incoming.signature.requirefullcoverageistrue(the default). Which parts are required is profile specific - see Profile validation. - The incoming UserMessage is not signed and/or not encrypted, although the AS4 profile requires it, or it is signed and/or encrypted, although the AS4 profile forbids it (see
IAS4Profile.getIncomingSignatureRequirement()andgetIncomingEncryptionRequirement()). This check is always performed (since v5.0.0). - The incoming UserMessage is not signed and/or not encrypted, although the effective PMode leg requires it.
This check is only performed if
phase4.incoming.security.enforcepmodeistrue(the default since v5.0.0).
- A received Receipt does not contain a
RefToMessageId
- A compressed payload cannot be decompressed while it is consumed by an
IAS4IncomingMessageProcessorSPI
- A UserMessage with an already known
eb:MessageIdis received. This error is only returned ifphase4.incoming.duplicate.handlingiserror(the default); withdismiss, the duplicate is silently dismissed, no SPI is invoked and the usual Receipt is returned; withprocess, the duplicate is processed again like a new message. The duplicate check is skipped if the resolved PMode disables duplicate detection. See Configuration.
Every profile can provide an IAS4ProfileValidator.
If a validator is present and the validation is not disabled via the IAS4IncomingProfileSelector, the incoming message is validated against the profile.
Every error found by the validator is returned as EBMS:0010 (ProcessingModeMismatch), with the validation message as error detail.
Validation warnings are only logged.
| Profile | Validator | Validated parts |
|---|---|---|
| BDEW | BDEWCompatibilityValidator |
PMode, SOAP message, UserMessage, SignalMessage, initiator identity |
| CEF | CEFCompatibilityValidator |
PMode, UserMessage, SignalMessage |
| DBNAlliance | DBNAllianceCompatibilityValidator |
PMode, UserMessage, SignalMessage |
| eDelivery2 | EDelivery2CompatibilityValidator |
PMode, UserMessage, SignalMessage |
| ENTSOG |
ENTSOGCompatibilityValidator, ENTSOG4CompatibilityValidator
|
PMode, UserMessage, SignalMessage |
| EUCTP | EuCtpCompatibilityValidator |
PMode, UserMessage, SignalMessage |
| HR eDelivery | HREDeliveryCompatibilityValidator |
PMode, UserMessage, SignalMessage |
| Nemhandel |
NemhandelCompatibilityValidator (extends the Peppol one) |
PMode, SOAP message, UserMessage, SignalMessage |
| Peppol | PeppolCompatibilityValidator |
PMode, SOAP message, UserMessage, SignalMessage |
Examples: in Peppol a non-empty SOAP body is rejected with EBMS:0010 (see Profile Peppol).
The parts that the signature must cover (EBMS:0103) are also defined by the validator (getRequiredSignedParts):
- Default: the
eb:Messagingheader plus the attachments if the message has attachments, otherwise theeb:Messagingheader plus the SOAP body - BDEW: always the
eb:Messagingheader and the attachments - the SOAP body is never required to be signed
The class Phase4PeppolServletMessageProcessorSPI performs the following checks for every incoming Peppol message.
Since Nemhandel uses phase4-peppol-servlet for receiving, this applies to Nemhandel as well (see Profile Nemhandel).
| Check | Error code | Notes |
|---|---|---|
| The message is not encrypted | EBMS:0103 |
Since v5.0.0 checked in AS4IncomingHandler based on the requirements of the AS4 profile and independent of phase4.incoming.security.enforcepmode; before it was EBMS:0102
|
| The message is not signed | EBMS:0103 |
Since v5.0.0 checked in AS4IncomingHandler based on the requirements of the AS4 profile and independent of phase4.incoming.security.enforcepmode; before it was EBMS:0101
|
The signing certificate is not provided as a BinarySecurityToken (direct reference) |
EBMS:0103 |
Since v4.2.6 |
The decrypting certificate is not provided as a BinarySecurityToken (direct reference) |
EBMS:0103 |
Since v4.2.6; only if "reject on non-compliance" is enabled |
| The signing AP certificate is invalid (e.g. expired or revoked) | EBMS:0101 |
The validity and the trust chain are always checked, the revocation unless the revocation check mode is NONE (since v5.0.0). With revocation soft-fail enabled, an unknown revocation status only logs a warning |
| More than one attachment | EBMS:0004 |
Only if "reject on non-compliance" is enabled |
| No attachment | EBMS:0004 |
|
| The payload cannot be decompressed | EBMS:0303 |
|
| The first attachment is not an SBDH | EBMS:0004 |
One eb:Error per SBDH parsing error, prefixed with "Peppol SBDH Issue" |
| The SBDH does not follow the Peppol rules | EBMS:0004 |
|
The originalSender / finalRecipient message property is missing, has no type or differs from the SBDH sender / receiver |
EBMS:0004 |
Only if "reject on non-compliance" is enabled |
PartyInfo/From or PartyInfo/To does not contain exactly one PartyId, or the PartyId/@type is wrong |
EBMS:0004 |
Only if "reject on non-compliance" is enabled |
The PartyId value does not match the Peppol seat ID pattern |
EBMS:0004 |
Only if "reject on non-compliance" is enabled and phase4.peppol.inbound.check-seat-id is true (default) |
CollaborationInfo/Service (incl. @type) or CollaborationInfo/Action differs from the SBDH process resp. document type identifier |
EBMS:0004 |
Only if "reject on non-compliance" is enabled (since v5.0.0; before only a warning was logged) |
CollaborationInfo/Service or CollaborationInfo/Action differs from the SBDH process / document type |
- | Only a warning is logged |
| Receiver check: no SMP endpoint is registered for the receiver, document type, process and transport profile | EBMS:0004 |
Error detail is PEPPOL:NOT_SERVICED as required by the Peppol AS4 profile; the description contains the human readable reason |
| Receiver check: the SMP address cannot be resolved via DNS | EBMS:0004 |
Error detail is PEPPOL:NOT_SERVICED
|
| Receiver check: the endpoint URL or the AP certificate from the SMP does not match the own one | EBMS:0004 |
HTTP status code 500 |
No IPhase4PeppolIncomingSBDHandlerSPI is installed in production mode |
EBMS:0004 |
|
An IPhase4PeppolIncomingSBDHandlerSPI throws an exception |
EBMS:0004 |
If it is a Phase4IncomingException with an HTTP status code, that status code is used for the response |
Notes:
- "Reject on non-compliance" is controlled by the configuration property
phase4.peppol.inbound.reject-on-non-compliance(defaulttrue). If it is set tofalse, the respective checks only log an error. - The receiver checks are only performed if they are enabled in the receiver check data.
- Peppol is the only profile in which phase4 sets an HTTP status code other than 200 on an
eb:Errorresponse. AnIPhase4PeppolIncomingSBDHandlerSPIcan add own errors to the providedAS4ErrorList, including an explicit HTTP status code viaAS4Error.builder ().
The class Phase4DBNAllianceServletMessageProcessorSPI works like the Peppol one, but uses an XHE envelope instead of an SBDH and has fewer checks:
| Check | Error code | Notes |
|---|---|---|
| The message is not encrypted | EBMS:0103 |
Since v5.0.0 checked in AS4IncomingHandler based on the requirements of the AS4 profile and independent of phase4.incoming.security.enforcepmode; before it was EBMS:0102
|
| The message is not signed | EBMS:0103 |
Since v5.0.0 checked in AS4IncomingHandler based on the requirements of the AS4 profile and independent of phase4.incoming.security.enforcepmode; before it was EBMS:0101
|
| The signing AP certificate is invalid | EBMS:0101 |
Revocation soft-fail as in Peppol |
| Not exactly one attachment | EBMS:0004 |
Always rejected |
| The payload cannot be decompressed | EBMS:0303 |
|
| The attachment is not an XHE document, or the XHE does not follow the DBNAlliance rules | EBMS:0004 |
One eb:Error per XHE parsing error, prefixed with "DBNAlliance XHE Issue" |
| Receiver check: no SMP endpoint is registered | EBMS:0004 |
Error detail is DBNALLIANCE:NOT_SERVICED
|
| Receiver check: the endpoint URL or the AP certificate does not match | EBMS:0004 |
HTTP status code 200 |
| No handler SPI is installed in production mode, or a handler SPI throws an exception | EBMS:0004 |
HTTP status code 200 |
There is no check of the certificate reference type and there is no "reject on non-compliance" switch.
The class Phase4HREDeliveryServletMessageProcessorSPI works like the Peppol one, with these differences:
| Check | Error code | Notes |
|---|---|---|
| The message is encrypted | EBMS:0103 |
HR eDelivery messages must not be encrypted - this is the inverse of the Peppol and DBNAlliance check. Since v5.0.0 checked in AS4IncomingHandler based on the requirements of the AS4 profile and independent of phase4.incoming.security.enforcepmode; before it was EBMS:0102
|
| The message is not signed | EBMS:0103 |
Since v5.0.0 checked in AS4IncomingHandler based on the requirements of the AS4 profile and independent of phase4.incoming.security.enforcepmode; before it was EBMS:0101
|
| The signing AP certificate is invalid | EBMS:0101 |
Revocation soft-fail as in Peppol |
| Not exactly one attachment | EBMS:0004 |
Always rejected |
| The payload cannot be decompressed | EBMS:0303 |
|
| The first attachment is not an SBDH, or the SBDH does not follow the HR eDelivery rules | EBMS:0004 |
One eb:Error per SBDH parsing error, prefixed with "HR eDelivery SBDH Issue" |
| Receiver check: no SMP endpoint is registered | EBMS:0004 |
Error detail is ERACUN:NOT_SERVICED
|
| Receiver check: the endpoint URL or the AP certificate does not match | EBMS:0004 |
HTTP status code 200 |
| No handler SPI is installed in production mode, or a handler SPI throws an exception | EBMS:0004 |
HTTP status code 200 |
There is no check of the certificate reference type and there is no "reject on non-compliance" switch.
BDEW, CEF, eDelivery2, ENTSOG and EUCTP have no own servlet module.
For them only the generic errors of phase4-lib and the profile validation (EBMS:0010) apply.
| Profile | Error code | Error detail | Description |
|---|---|---|---|
| Peppol (and Nemhandel) | EBMS:0004 |
PEPPOL:NOT_SERVICED |
Human readable reason |
| DBNAlliance | EBMS:0004 |
DBNALLIANCE:NOT_SERVICED |
Human readable reason |
| HR eDelivery | EBMS:0004 |
ERACUN:NOT_SERVICED |
Human readable reason |
Since v5.0.0, only with the phase4-multihop module
The enum EEbmsMultiHopError (package com.helger.phase4.multihop.error) adds the errors of ebMS 3.0 Part 2, section 2.5.6 and appendix H.
phase4 implements only the Multi-Hop endpoint side, so these errors are recognised when received, but never raised by phase4 itself.
| Code | Enum constant | Short description | Severity | Category |
|---|---|---|---|---|
EBMS:0020 |
EBMS_ROUTING_FAILURE |
RoutingFailure | failure | Communication |
EBMS:0021 |
EBMS_MPC_CAPACITY_EXCEEDED |
MPCCapacityExceeded | failure | Communication |
EBMS:0022 |
EBMS_MESSAGE_PERSISTENCE_TIMEOUT |
MessagePersistenceTimeout | failure | Communication |
EBMS:0023 |
EBMS_MESSAGE_EXPIRED |
MessageExpired | warning | Communication |
An ebint:RoutingInput header element that cannot be parsed is rejected with EBMS:0009 (InvalidHeader).
See Multi-Hop for details.
- If the synchronous response to an outgoing UserMessage is an ebMS Error message,
sendMessageAndCheckForReceipt()returnsEAS4UserMessageSendResult.AS4_ERROR_MESSAGE_RECEIVED(IDas4-error-msg-received). - The sending reports of Peppol (
Phase4PeppolSendingReport), DBNAlliance (Phase4DBNAllianceSendingReport) and HR eDelivery (Phase4HREdeliverySendingReport) contain the received errors including their error code, both in the JSON and in the XML serialisation. - A plain SOAP Fault is not an ebMS error and is handled separately - see SOAP Handling.
My personal Coding Styleguide | It is appreciated if you star the GitHub project if you like it.
