AS2Sender Class

Properties   Methods   Events   Configuration Settings   Errors  

The AS2Sender class implements an AS2 / EDI-INT client.




The AS2Sender component may be used to send EDI or other messages over HTTP/S, using the AS2 protocol. It may also be used to verify synchronous or asynchronous server responses.

A typical AS2 transaction is as follows:

(1) The sender sends an EDI document to the receiver using HTTP or HTTPS. Typically the document will be signed and encrypted (particularly if SSL is not used). A signed receipt will also be requested.

(2) The receiver decrypts the message and verifies the signature.

(3) The receiver sends a signed receipt back to the client. The signature is over the hash of an MDN, which contains a hash of the received message.

When sending an EDI message, the client should specify, at a minimum, AS2From and AS2To, URL, and EDIData. The Post method should then be invoked.

To secure the EDI transmission, the message may be signed and/or encrypted by setting the appropriate certificates. By default, the class will apply message security if the appropriate certificates are specified. To sign the data, set SigningCert. To encrypt, set RecipientCerts. If the recipient uses different certificates for signing and encryption it will also be necessary to set ReceiptSignerCert.

SSL will also be used if the scheme in URL is "https". If your trading partner is using a self-signed certificate, it will be necessary to set SSLAcceptServerCert or trap the SSLServerAuthentication event to accept the certificate.

The message may also be compressed by setting CompressionFormat.

To request a receipt, or Message Disposition Notification (MDN), simply set the MDNTo property. The MDNOptions property may be used to customize the request. By default, the class will request a signed MDN over an SHA1 hash.

The class supports both synchronous and asynchronous MDN receipt delivery. By default, the class requests synchronous MDN receipt delivery, and the MDN will be returned in the HTTP reply. To request asynchronous MDN delivery, set the MDNDeliveryOption to the URL where MDN's are to be delivered.

The HTTP reply will automatically be processed by the class. If an MDN was requested, Post will validate the MDN and (if signed) establish non-repudiation of receipt. Any errors or warnings will cause the class to throw an exception.

In either case, after the EDI transaction is processed successfully, the MDNReceipt will be populated with the appropriate values.

Validating Asynchronous MDNs

The class may also be used to process and verify asynchronous MDNs. To do this, you should invoke ReadAsyncReceipt. This will read the receipt from the current HTTP context (or from MDNReceipt, if set manually), and allow you to determine your trading partner's identity and the message ID. You should then set ReceiptSignerCert and OriginalContentMIC, and finally invoke VerifyReceipt.

Property List

The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

AS2FromThe AS2 Identifier of the sending system.
AS2ToThe AS2 Identifier of the receiving system.
AS2VersionThe version of AS2 being used.
AsyncMDNInfoDirPath to a directory to store data used in verifying AsyncMDNs.
AttachmentsCollection of files attached to the current message.
CEMDetailsA collection of Certificate Exchange Messaging (CEM) details.
CompressionFormatThe compression format (if any) to use.
CookiesCollection of cookies.
EDIDataThe EDI or other data to be sent.
EncryptionAlgorithmThe algorithm used to encrypt the EDI data.
EtagThe Etag of the file being sent.
FirewallA set of properties related to firewall access.
FromThe email address of the HTTP agent (optional).
LocalHostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
LogDirectoryThe path to a directory for logging.
LogFileThe log file written.
MDNDeliveryOptionA URL indicating how the receipt is to be delivered.
MDNOptionsUsed to indicate the options requested for the MDN receipt.
MDNReceiptThe MDN receipt returned from the server.
MDNToUsed to indicate that a message disposition notification is requested.
MessageIdThe Id of the message.
OriginalContentMICThe Message Integrity Check(s) (one-way hash) of the outgoing message.
ProxyA set of properties related to proxy access.
ReceiptSignerCertThe public key certificate for the MDN receipt signature.
RecipientCertsThe public key certificates of the recipients for this message.
RestartDirectoryThe directory to log cached files when using AS2 restart functionality.
RolloverSigningCertContains the certificate to use when signing messages.
SignatureAlgorithmSignature algorithm to be used in outgoing messages.
SigningCertContains the certificate to use when signing messages.
SSLAcceptServerCertInstructs the class to unconditionally accept the server certificate that matches the supplied certificate.
SSLCertThe certificate to be used during SSL negotiation.
SSLServerCertThe server certificate for the last established connection.
SubjectThe subject of the message.
TimeoutA timeout for the class.
URLThe URL to which the request is made.
UseOAEPWhether to use Optimal Asymmetric Encryption Padding (OAEP).
UsePSSWhether to use RSA-PSS during signing and verification.
UserAgentInformation about the user agent.

Method List

The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting.
DoEventsProcesses events from the internal message queue.
InterruptInterrupt the current method.
PostPost data to the AS2 server, and check the receipt.
ReadAsyncReceiptReads an asynchronous MDN receipt from the current HTTP session.
ResetResets the state of the control.
RestartRestart sending of the file specified by the Etag property.
SendCEMRequestSends a Certificate Exchange Messaging (CEM) request.
SendCEMResponseSends a Certificate Exchange Messaging (CEM) response.
SetRequestHeaderAllows the user to set or add arbitrary HTTP request headers.
SetTPInfoA convenient way to set AS2 communication parameters using XML strings.
VerifyReceiptVerifies an asynchronous MDN receipt.

Event List

The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ConnectedFired immediately after a connection completes (or fails).
DisconnectedFired when a connection is closed.
EndTransferFired when a document finishes transferring.
ErrorInformation about errors during data delivery.
HeaderFired every time a header line comes in.
LogFired with log information while processing a message.
SetCookieFired for every cookie set by the server.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.
StartTransferFired when a document starts transferring (after the headers).
TransferFired while a document transfers (delivers document).

Configuration Settings

The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

AllowMDNWarningsWhether to fail on MDN warnings.
AuthorizationThe Authorization string to be sent to the server.
AuthSchemeThe authorization scheme to be used when server authorization is to be performed.
CompressFirstWhether compression occurs before signing a message.
EncodeToTempDirWhether to use temporary files when creating messages.
IncludeHeadersWhether headers are included when posting to a file.
LogDebugWhether to log debug data.
LogFilenameThe base name of the log file.
LogOptionsThe information to be written to log files.
MDNDispositionReturns the Disposition header of the MDN.
MessageHeadersReturns the headers of the message.
NormalizeMICWhether to normalize line endings before calculating the MIC.
OAEPMGF1HashAlgorithmThe MGF1 hash algorithm used when encrypting a key.
OAEPParamsThe hex encoded OAEP parameters to be used when encrypting a key.
OAEPRSAHashAlgorithmThe RSA hash algorithm used when encrypting a key.
PasswordA password if authentication is to be used.
PostToFileCreates the message on disk.
RequiredSignatureAlgorithmsSpecifies a list of acceptable signature algorithms.
UserA user name if authentication is to be used.
AcceptEncodingUsed to tell the server which types of content encodings the client supports.
AllowHTTPCompressionThis property enables HTTP compression for receiving data.
AllowHTTPFallbackWhether HTTP/2 connections are permitted to fallback to HTTP/1.1.
AllowNTLMFallbackWhether to allow fallback from Negotiate to NTLM when authenticating.
AppendWhether to append data to LocalFile.
AuthorizationThe Authorization string to be sent to the server.
BytesTransferredContains the number of bytes transferred in the response data.
ChunkSizeSpecifies the chunk size in bytes when using chunked encoding.
CompressHTTPRequestSet to true to compress the body of a PUT or POST request.
EncodeURLIf set to true the URL will be encoded by the class.
FollowRedirectsDetermines what happens when the server issues a redirect.
GetOn302RedirectIf set to true the class will perform a GET on the new location.
HTTP2HeadersWithoutIndexingHTTP2 headers that should not update the dynamic header table with incremental indexing.
HTTPVersionThe version of HTTP used by the class.
IfModifiedSinceA date determining the maximum age of the desired document.
KeepAliveDetermines whether the HTTP connection is closed after completion of the request.
KerberosSPNThe Service Principal Name for the Kerberos Domain Controller.
LogLevelThe level of detail that is logged.
MaxHeadersInstructs class to save the amount of headers specified that are returned by the server after a Header event has been fired.
MaxHTTPCookiesInstructs class to save the amount of cookies specified that are returned by the server when a SetCookie event is fired.
MaxRedirectAttemptsLimits the number of redirects that are followed in a request.
NegotiatedHTTPVersionThe negotiated HTTP version.
OtherHeadersOther headers as determined by the user (optional).
ProxyAuthorizationThe authorization string to be sent to the proxy server.
ProxyAuthSchemeThe authorization scheme to be used for the proxy.
ProxyPasswordA password if authentication is to be used for the proxy.
ProxyPortPort for the proxy server (default 80).
ProxyServerName or IP address of a proxy server (optional).
ProxyUserA user name if authentication is to be used for the proxy.
SentHeadersThe full set of headers as sent by the client.
StatusLineThe first line of the last response from the server.
TransferredDataThe contents of the last response from the server.
TransferredDataLimitThe maximum number of incoming bytes to be stored by the class.
TransferredHeadersThe full set of headers as received from the server.
TransferredRequestThe full request as sent by the client.
UseChunkedEncodingEnables or Disables HTTP chunked encoding for transfers.
UseIDNsWhether to encode hostnames to internationalized domain names.
UsePlatformDeflateWhether to use the platform implementation to decompress compressed responses.
UsePlatformHTTPClientWhether or not to use the platform HTTP client.
UserAgentInformation about the user agent (browser).
CloseStreamAfterTransferIf true, the class will close the upload or download stream after the transfer.
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallListenerIf true, the class binds to a SOCKS firewall as a server (IPPort only).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the class binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
UseNTLMv2Whether to use NTLM V2.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCheckCRLWhether to check the Certificate Revocation List for the server certificate.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLContextProtocolThe protocol used when getting an SSLContext instance.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLNegotiatedCipherReturns the negotiated ciphersuite.
SSLNegotiatedCipherStrengthReturns the negotiated ciphersuite strength.
SSLNegotiatedCipherSuiteReturns the negotiated ciphersuite.
SSLNegotiatedKeyExchangeReturns the negotiated key exchange algorithm.
SSLNegotiatedKeyExchangeStrengthReturns the negotiated key exchange algorithm strength.
SSLNegotiatedProtocolReturns the negotiated protocol version.
SSLProviderThe name of the security provider to use.
SSLServerCACertsA newline separated list of CA certificate to use during SSL server certificate validation.
SSLTrustManagerFactoryAlgorithmThe algorithm to be used to create a TrustManager through TrustManagerFactory.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SupportedGroupsThe supported groups for ECC.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
GUIAvailableTells the class whether or not a message loop is available for processing events.
LicenseInfoInformation about the current license.
UseDaemonThreadsWhether threads created by the class are daemon threads.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 Java Edition - Version 20.0 [Build 8162]