AS1Receiver Class

Properties   Methods   Events   Configuration Settings   Errors  

The AS1Receiver class is used to process AS1 messages and generate receipts.




The AS1Receiver class allows you to receive AS1 messages as specified in RFC 3335. The class can act as an email client, decrypt and verify incoming messages, generate receipts including Message Disposition Notifications (MDNs), and send them over SMTP/S.

Basic Operation

You should first log in to your mail server by setting MailServer, User, and Password, and invoking Connect. You may then navigate your mail inbox by setting MailMessageNumber, and inspecting properties such as MailMessageFrom, etc. When you find the desired file you may download it by invoking ReadRequest. Alternatively, you may acquire the AS1 data by other means and directly set Request and RequestHeaders.

ReadRequest (or ParseHeaders) will determine information such as From and SendTo, which will allow you to set the appropriate certificates. You may specify your certificate with the Certificate property, and your trading partner's (signing) certificate with the SignerCert property.

Then, invoke ProcessRequest to process the request and generate the MDN receipt as specified in RFC 3335. If the request was processed successfully, EDIData will contain the transmitted EDI data. If a problem occurred, EDIData will not be populated and an exception will be thrown. In either case MDNReceipt will contain the RFC-compliant receipt, which should be returned to the client.

The MDNReceipt may be returned over SMTP/S by invoking SendResponse. In case the server address for incoming mail is different than that for outgoing mail you should use Config to configure this.

To create log files, set LogDirectory prior to invoking ProcessRequest. This will log all incoming and outgoing data, and will also write the received EDI files to disk.


AS1Receiver1.User = "myusername"
AS1Receiver1.Password = "mypassword"
AS1Receiver1.MailServer = ""
// You may need to search the server for received files at this point
AS1Receiver1.MessageNumber = 1;
// You may check properties such as MailMessageFrom, etc.
AS1Receiver1.Certificate = new Certificate(CertStoreTypes.cstPFXFile, "\\my_server_directory\\my_pfx_file.pfx", "my password", "CN=Me");
AS1Receiver1.SignerCert = (base 64 encoded certificate);
AS1Receiver1.LogDirectory = "c:\\my_server_directory\\my_log_directory";
Additional functionality allows the user to examine details of the client's request, to permit certain types of errors, or to customize the outgoing MDN. See the property and method list for details.

Property List

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

AttachmentsCollection of files attached to the current message.
CertificateThe decryption and receipt signing certificate.
CompressionFormatThe compression format used on the incoming message.
ConnectedShows whether the class is connected.
EDIDataThe EDI data sent in Request .
FirewallA set of properties related to firewall access.
FromThe sender of the original message.
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.
MailMessageCcThe value of the Cc header of the mail message.
MailMessageCountThe number of messages waiting in the mailbox.
MailMessageDateThe message date for the currently selected message.
MailMessageFromThe sender of the mail message.
MailMessageHeadersThe message headers for the currently selected message.
MailMessageNumberThe message number on the incoming mail server.
MailMessageReplyToThe value of the ReplyTo header of the mail message.
MailMessageSizeThe size of the mail message.
MailMessageSubjectThe subject of the mail message.
MailMessageTextThe text of the mail message.
MailMessageToThe recipient of the mail message.
MailMessageUIDThe unique id of the mail message.
MailServerThe address of your mail server.
MDNReceiptThe MDN-based receipt generated by the class.
MDNToThe recipient for the Message Disposition Notification (MDN).
MessageIdThe message ID of the incoming message.
PasswordThe password for your incoming mail server.
RequestThe AS1 request to be processed.
RequestHeadersThe headers in the AS1 request.
RequestHeadersStringThe headers in the AS1 request.
ScanResultThe result of invoking ParseRequest .
SendToThe recipient of the original message.
SignerCertYour trading partner's certificate.
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.
SSLStartModeDetermines how the class starts the SSL negotiation. By default, SSL will not be used.
UserThe username for your incoming mail server.

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.
ConnectConnects to the incoming mail server.
CreateMDNReceiptCreates MDNReceipt .
DeleteMessageDeletes the message specified by MailMessageNumber .
DisconnectDisconnects from the incoming mail server.
ParseRequestParses the EDI message and determines the EDIData .
ProcessQueueSend the messages queued for sending.
ProcessRequestProcesses the EDI data, and generates the receipt.
QueuePrepares and queues the message to the specified directory.
ReadRequestReads the AS1 request from the mail server.
ResetResets the state of the control.
SendResponseSends the 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.

ConnectionStatusFired to indicate changes in connection state.
EndTransferFired when the message text completes transferring.
ErrorInformation about errors during data delivery.
HeaderFired for every message header being retrieved.
LogFired with log information while processing a message.
PITrailTraces the commands sent to the mail server, and the respective replies.
SignerCertInfoFired during verification of the signed message.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.
StartTransferFired when the message text starts transferring (on either a send or receive).
TransferFired while the message text gets transferred to or from MailServer .

Configuration Settings

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

filenameThe filename of the EDI Data.
LogFilenameThe base name of the log file.
POPPortThe POP mail port to be used, if different than MailServer.
POPServerThe POP server to be used, if different than MailServer.
SMTPAuthMechanismThe authentication mechanism used to connect to the SMTP server.
SMTPPasswordThe password used for authentication.
SMTPPortThe SMTP mail port to be used, if different than MailServer.
SMTPServerThe SMTP server to be used, if different than MailServer.
SMTPSSLStartModeDetermines how SSL negotiation starts with the SMTP server.
SMTPUserThe user name used for authentication.
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.
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]