AS2 Component

Available as of Camel version 2.22

The AS2 component provides transport of EDI messages using the HTTP transfer protocol as specified in RFC4130.

This component is currently a work in progress. Expect URI options and path and query parameters to change in future versions of this component.

Maven users will need to add the following dependency to their pom.xml for this component:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-as2</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

as2://apiName/methodName

apiName can be one of:

  • client

  • server

AS2 Options

The AS2 component supports 2 options, which are listed below.

Name Description Default Type

configuration (common)

To use the shared configuration

AS2Configuration

resolveProperty Placeholders (advanced)

Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.

true

boolean

The AS2 endpoint is configured using URI syntax:

as2:apiName

with the following path and query parameters:

Path Parameters (1 parameters):

Name Description Default Type

apiName

Required What kind of operation to perform

AS2ApiName

Query Parameters (31 parameters):

Name Description Default Type

as2From (common)

The value of the AS2From header of AS2 message.

String

as2MessageStructure (common)

The structure of AS2 Message. One of: PLAIN - No encryption, no signature, SIGNED - No encryption, signature, ENCRYPTED - Encryption, no signature, ENCRYPTED_SIGNED - Encryption, signature

AS2MessageStructure

as2To (common)

The value of the AS2To header of AS2 message.

String

as2Version (common)

The version of the AS2 protocol.

1.1

String

clientFqdn (common)

The Client Fully Qualified Domain Name (FQDN). Used in message ids sent by endpoint.

camel.apache.org

String

compressionAlgorithm (common)

The algorithm used to compress EDI message.

AS2Compression Algorithm

decryptingPrivateKey (common)

The key used to encrypt the EDI message.

PrivateKey

dispositionNotificationTo (common)

The value of the Disposition-Notification-To header. Assigning a value to this parameter requests a message disposition notification (MDN) for the AS2 message.

String

ediMessageTransferEncoding (common)

The transfer encoding of EDI message.

String

ediMessageType (common)

The content type of EDI message. One of application/edifact, application/edi-x12, application/edi-consent

ContentType

encryptingAlgorithm (common)

The algorithm used to encrypt EDI message.

AS2EncryptionAlgorithm

encryptingCertificateChain (common)

The chain of certificates used to encrypt EDI message.

Certificate[]

from (common)

The value of the From header of AS2 message.

String

inBody (common)

Sets the name of a parameter to be passed in the exchange In Body

String

methodName (common)

Required What sub operation to use for the selected operation

String

requestUri (common)

The request URI of EDI message.

/

String

server (common)

The value included in the Server message header identifying the AS2 Server.

Camel AS2 Server Endpoint

String

serverFqdn (common)

The Server Fully Qualified Domain Name (FQDN). Used in message ids sent by endpoint.

camel.apache.org

String

serverPortNumber (common)

The port number of server.

Integer

signedReceiptMicAlgorithms (common)

The list of algorithms, in order of preference, requested to generate a message integrity check (MIC) returned in message dispostion notification (MDN)

String[]

signingAlgorithm (common)

The algorithm used to sign EDI message.

AS2SignatureAlgorithm

signingCertificateChain (common)

The chain of certificates used to sign EDI message.

Certificate[]

signingPrivateKey (common)

The key used to sign the EDI message.

PrivateKey

subject (common)

The value of Subject header of AS2 message.

String

targetHostname (common)

The host name (IP or DNS name) of target host.

String

targetPortNumber (common)

The port number of target host. -1 indicates the scheme default port.

Integer

userAgent (common)

The value included in the User-Agent message header identifying the AS2 user agent.

Camel AS2 Client Endpoint

String

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

boolean

exceptionHandler (consumer)

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored.

ExceptionHandler

exchangePattern (consumer)

Sets the exchange pattern when the consumer creates an exchange.

ExchangePattern

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

Spring Boot Auto-Configuration

When using Spring Boot make sure to use the following Maven dependency to have support for auto configuration:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-as2-starter</artifactId>
  <version>x.x.x</version>
  <!-- use the same version as your Camel core version -->
</dependency>

The component supports 29 options, which are listed below.

Name Description Default Type

camel.component.as2.configuration.api-name

What kind of operation to perform

AS2ApiName

camel.component.as2.configuration.as2-from

The value of the AS2From header of AS2 message.

String

camel.component.as2.configuration.as2-message-structure

The structure of AS2 Message. One of: PLAIN - No encryption, no signature, SIGNED - No encryption, signature, ENCRYPTED - Encryption, no signature, ENCRYPTED_SIGNED - Encryption, signature

AS2MessageStructure

camel.component.as2.configuration.as2-to

The value of the AS2To header of AS2 message.

String

camel.component.as2.configuration.as2-version

The version of the AS2 protocol.

1.1

String

camel.component.as2.configuration.client-fqdn

The Client Fully Qualified Domain Name (FQDN). Used in message ids sent by endpoint.

camel.apache.org

String

camel.component.as2.configuration.compression-algorithm

The algorithm used to compress EDI message.

AS2Compression Algorithm

camel.component.as2.configuration.decrypting-private-key

The key used to encrypt the EDI message.

PrivateKey

camel.component.as2.configuration.disposition-notification-to

The value of the Disposition-Notification-To header. Assigning a value to this parameter requests a message disposition notification (MDN) for the AS2 message.

String

camel.component.as2.configuration.edi-message-transfer-encoding

The transfer encoding of EDI message.

String

camel.component.as2.configuration.edi-message-type

The content type of EDI message. One of application/edifact, application/edi-x12, application/edi-consent

ContentType

camel.component.as2.configuration.encrypting-algorithm

The algorithm used to encrypt EDI message.

AS2EncryptionAlgorithm

camel.component.as2.configuration.encrypting-certificate-chain

The chain of certificates used to encrypt EDI message.

Certificate[]

camel.component.as2.configuration.from

The value of the From header of AS2 message.

String

camel.component.as2.configuration.method-name

What sub operation to use for the selected operation

String

camel.component.as2.configuration.request-uri

The request URI of EDI message.

/

String

camel.component.as2.configuration.server

The value included in the Server message header identifying the AS2 Server.

Camel AS2 Server Endpoint

String

camel.component.as2.configuration.server-fqdn

The Server Fully Qualified Domain Name (FQDN). Used in message ids sent by endpoint.

camel.apache.org

String

camel.component.as2.configuration.server-port-number

The port number of server.

Integer

camel.component.as2.configuration.signed-receipt-mic-algorithms

The list of algorithms, in order of preference, requested to generate a message integrity check (MIC) returned in message dispostion notification (MDN)

String[]

camel.component.as2.configuration.signing-algorithm

The algorithm used to sign EDI message.

AS2SignatureAlgorithm

camel.component.as2.configuration.signing-certificate-chain

The chain of certificates used to sign EDI message.

Certificate[]

camel.component.as2.configuration.signing-private-key

The key used to sign the EDI message.

PrivateKey

camel.component.as2.configuration.subject

The value of Subject header of AS2 message.

String

camel.component.as2.configuration.target-hostname

The host name (IP or DNS name) of target host.

String

camel.component.as2.configuration.target-port-number

The port number of target host. -1 indicates the scheme default port.

Integer

camel.component.as2.configuration.user-agent

The value included in the User-Agent message header identifying the AS2 user agent.

Camel AS2 Client Endpoint

String

camel.component.as2.enabled

Whether to enable auto configuration of the as2 component. This is enabled by default.

Boolean

camel.component.as2.resolve-property-placeholders

Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders.

true

Boolean

Client Endpoints:

Client endpoints use the endpoint prefix client followed by the name of a method and associated options described next. The endpoint URI MUST contain the prefix client.

as2://client/method?[options]

Endpoint options that are not mandatory are denoted by []. When there are no mandatory options for an endpoint, one of the set of [] options MUST be provided. Producer endpoints can also use a special option inBody that in turn should contain the name of the endpoint option whose value will be contained in the Camel Exchange In message.

Any of the endpoint options can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelAS2.<option>. Note that the inBody option overrides message header, i.e. the endpoint option inBody=option would override a CamelAS2.option header.

If a value is not provided for the option defaultRequest either in the endpoint URI or in a message header, it will be assumed to be null. Note that the null value will only be used if other options do not satisfy matching endpoints.

In case of AS2 API errors the endpoint will throw a RuntimeCamelException with a org.apache.http.HttpException derived exception cause.

Method Options Result Body Type

send

ediMessage, requestUri, subject, from, as2From, as2To, as2MessageStructure, ediMessageContentType, ediMessageTransferEncoding, dispositionNotificationTo, signedReceiptMicAlgorithms

org.apache.http.protocol.HttpCoreContext

URI Options for client

Name Type

ediMessage

String

requestUri

String

subject

String

from

String

as2From

String

as2To

String

as2MessageStructure

org.apache.camel.component.as2.api.AS2MessageStructure

ediMessageContentType

String

ediMessageTransferEncoding

String

dispositionNotificationTo

String

signedReceiptMicAlgorithms

String[]

Server Endpoints:

Server endpoints use the endpoint prefix server followed by the name of a method and associated options described next. The endpoint URI MUST contain the prefix server.

as2://server/method?[options]

Endpoint options that are not mandatory are denoted by []. When there are no mandatory options for an endpoint, one of the set of [] options MUST be provided. Producer endpoints can also use a special option inBody that in turn should contain the name of the endpoint option whose value will be contained in the Camel Exchange In message.

Any of the endpoint options can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelAS2.<option>. Note that the inBody option overrides message header, i.e. the endpoint option inBody=option would override a CamelAS2.option header.

If a value is not provided for the option defaultRequest either in the endpoint URI or in a message header, it will be assumed to be null. Note that the null value will only be used if other options do not satisfy matching endpoints.

In case of AS2 API errors the endpoint will throw a RuntimeCamelException with a org.apache.http.HttpException derived exception cause.

Method Options Result Body Type

listen

requestUriPattern

org.apache.http.protocol.HttpCoreContext

URI Options for server

Name Type

requestUriPattern

String