GDSN DS Configuration OpenAS2

Configure OpenAS2

There are two main configuration files which are relevant to each installation and have to be configured individually for every customer:

config.xml

This file contains common configurations. It configures the modules that will be activated by OpenAS2 server when it starts up. You can use the default template provided by OpenAS2 or have a look at the example below which has the properties and the modules pre-configured. Replace the {customer_as2_url} placeholder with your customer's URL and try it out.

config.xml example
<?xml version="1.0" encoding="UTF-8"?>
<openas2>
<properties storageBaseDir="%home%/../data"
log_date_format="yyyy-MM-dd HH:mm:ss.SSS"
sql_timestamp_format="yyyy-MM-dd HH:mm:ss.SSS"
as2_message_id_format="OPENAS2-$date.ddMMyyyyHHmmssZ$-$rand.UUID$@$msg.sender.as2_id$_$msg.receiver.as2_id$"
as2_async_mdn_url="http://194.165.163.148:5080/as2"
as2_receive_message_filename_fallback="$rand.shortUUID$"
console.logger.enabled="true"
file.logger.enabled="true"
socket.logger.enabled="false"
console.command.processor.enabled="true"
socket.command.processor.enabled="false"
restapi.command.processor.enabled="false"
module.AS2SenderModule.enabled="true"
module.MDNSenderModule.enabled="true"
module.DbTrackingModule.enabled="true"
module.MDNFileModule.enabled="true"
module.MessageFileModule.enabled="true"
module.DirectoryResenderModule.enabled="true"
module.AS2ReceiverModule.http.enabled="true"
module.AS2MDNReceiverModule.http.enabled="true"
module.AS2ReceiverModule.https.enabled="false"
module.AS2MDNReceiverModule.https.enabled="false"
module.HealthCheckModule.enabled="false"
customer_name="Informatica"
as2_mdn_response_max_wait_seconds="60"/>
<certificates classname="org.openas2.cert.PKCS12CertificateFactory"
filename="%home%/infa_gdsn_test.p12"
password="testas2"
interval="300"/>
<partnerships classname="org.openas2.partner.XMLPartnershipFactory"
filename="%home%/partnerships.xml"
interval="120"/>
<loggers>
<logger classname="org.openas2.logging.ConsoleLogger"/>
<!-- Remove this comment to enable emailing of exceptions
<logger classname="org.openas2.logging.EmailLogger"
only_active_msg_transfer_errors="false"
log_exception_trace="false"
javax.mail.properties.file="%home%/java.mail.properties"
from="openas2"
to="your email address"
smtpserver="your smtp server"
smtpport="your smtp server port"
smtpauth="true"
smtpuser="mySmtpUserId"
smtppwd="mySmtpPwd"
subject="$exception.name$: $exception.message$"
bodytemplate="%home%/emailtemplate.txt"/>
-->
<logger classname="org.openas2.logging.FileLogger"
filename="%home%/../logs/log-$date.yyyyMMdd$.txt"/>
<!-- Remove this comment to enable socket logging
<logger classname="org.openas2.logging.SocketLogger"
ipaddr="127.0.0.1"
portid="19999"/>
-->
</loggers>
<commands classname="org.openas2.cmd.XMLCommandRegistry"
filename="%home%/commands.xml"/>
<commandProcessors>
<commandProcessor classname="org.openas2.cmd.processor.StreamCommandProcessor"/>
<commandProcessor classname="org.openas2.cmd.processor.SocketCommandProcessor"
enabled="$properties.socket.command.processor.enabled$"
portId="14321"
userid="userID"
password="pWd"
response_format="xml"/>
</commandProcessors>
<processor classname="org.openas2.processor.DefaultProcessor"
pendingMDN="$properties.storageBaseDir$/pendingMDN3"
pendingMDNinfo="$properties.storageBaseDir$/pendinginfoMDN3"
resend_max_retries="10">
<module classname="org.openas2.processor.sender.AS2SenderModule"
retries="3"/>
<module classname="org.openas2.processor.sender.MDNSenderModule"
retries="3"/>
<module classname="org.openas2.processor.receiver.AS2DirectoryPollingModule"
outboxdir="$properties.storageBaseDir$/toAtrify"
errordir="$properties.storageBaseDir$/toAtrify/error"
stored_error_filename="OPENAS2-$rand.UUID$@$msg.attributes.filename$_failed_toAtrify"
sentdir="$properties.storageBaseDir$/toAtrify/sent"
stored_sent_filename="OPENAS2-$rand.UUID$@$msg.attributes.filename$_succeeded_toAtrify"
interval="5"
defaults="sender.as2_id=INFA_DEMO05_DS_EU, receiver.as2_id=4049111170017"
sendfilename="true"
mimetype="application/XML"/>
<module classname="org.openas2.processor.receiver.AS2DirectoryPollingModule"
outboxdir="$properties.storageBaseDir$/fromAtrify"
errordir="$properties.storageBaseDir$/fromAtrify/error"
interval="5"
defaults="sender.as2_id=4049111170017, receiver.as2_id=INFA_DEMO05_DS_EU"
sendfilename="true"
mimetype="application/XML"/>
<module classname="org.openas2.processor.receiver.AS2ReceiverModule"
port="5080"
errordir="$properties.storageBaseDir$/fromAtrify/inbox/error"
errorformat="sender.as2_id, receiver.as2_id, headers.message-id"/>
<module classname="org.openas2.processor.receiver.AS2MDNReceiverModule"
port="5081"
errordir="$properties.storageBaseDir$/fromAtrify/inbox/error"
errorformat="sender.as2_id, receiver.as2_id, headers.message-id"/>
<module classname="org.openas2.processor.msgtracking.DbTrackingModule"
use_embedded_db="true"
force_load_jdbc_driver="false"
db_user="sa"
db_pwd="OpenAS2"
db_name="openas2"
table_name="msg_metadata"
db_directory="%home%/DB"
jdbc_driver="org.h2.Driver"
jdbc_connect_string="jdbc:h2:$component.db_directory$/$component.db_name$"
sql_escape_character="'"
tcp_server_start="true"
tcp_server_port="9092"
tcp_server_password="openas2"/>
<module classname="org.openas2.processor.storage.MDNFileModule"
filename="$properties.storageBaseDir$/fromAtrify/mdn/$date.yyyy-MM-dd$/$mdn.msg.content-disposition.filename$-$mdn.msg.headers.message-id$"
protocol="as2"
tempdir="$properties.storageBaseDir$/temp"/>
<module classname="org.openas2.processor.storage.MessageFileModule"
filename="$properties.storageBaseDir$/fromAtrify/inbox/$msg.content-disposition.filename$-$msg.headers.message-id$_fromAtrify"
header="$properties.storageBaseDir$/fromAtrify/msgheaders/$date.yyyy-MM-dd$/$msg.content-disposition.filename$-$msg.headers.message-id$"
protocol="as2"
tempdir="$properties.storageBaseDir$/temp"/>
<!-- Example HTTPS configuration
<module classname="org.openas2.processor.receiver.AS2ReceiverModule"
port="10443"
protocol="https"
ssl_protocol="TLS"
ssl_keystore="%home%/ssl_certs.jks"
ssl_keystore_password="testas2"
errordir="$properties.storageBaseDir$/inbox/error"
errorformat="sender.as2_id, receiver.as2_id, headers.message-id"/>
-->
<module classname="org.openas2.processor.resender.DirectoryResenderModule"
resenddir="$properties.storageBaseDir$/resend"
errordir="$properties.storageBaseDir$/toAtrify/error"
resenddelay="10"/>
<!--
<module classname="org.openas2.processor.receiver.HealthCheckModule"
port="10099"/>
-->
</processor>
</openas2>
 

The following chapter is only important if you change the OpenAS2 file structure. If you go with the defaults provided by Informatica nothing has to be adjusted or considered.

Sending Files

OpenAS2 has a directory polling module that scans configured directories for files and will send the file to a partner (e.g. 1WorldSync). Some of the key attributes for the polling module defined in the config.xml are:

  • outboxdir: specifies the directory to scan for files to send

    outboxdir="$properties.storageBaseDir$/toAtrify"
  • errordir: specifies the directory where the file will be put to whenever OpenAS2 is not able to send it due to any configuration or connection issue

    errordir="$properties.storageBaseDir$/toAtrify/error"
  • stored_error_filename: defines the name used to store the file in the errordir

    stored_error_filename="OPENAS2-$rand.UUID$@$msg.attributes.filename$_failed_toAtrify"
  • sentdir: specifies the directory where the files that are successfully sent will be stored

    sentdir="$properties.storageBaseDir$/toAtrify/sent"
  • stored_sent_filename: defines the name used to store the file in the sentdir that are successfully sent

    stored_sent_filename="OPENAS2-$rand.UUID$@$msg.attributes.filename$_succeeded_toAtrify"

Receiving Files

There is not much to configure for receiving files. Messages will be received and the files stored in the configured directory. The default modules for receiving and string files is shown below.

<module classname="org.openas2.processor.storage.MessageFileModule"
filename="$properties.storageBaseDir$/fromAtrify/inbox/$msg.content-disposition.filename$-$msg.headers.message-id$_fromAtrify"
header="$properties.storageBaseDir$/fromAtrify/msgheaders/$date.yyyy-MM-dd$/$msg.content-disposition.filename$-$msg.headers.message-id$"
protocol="as2"
tempdir="$properties.storageBaseDir$/temp"/>
<module classname="org.openas2.processor.receiver.AS2ReceiverModule"
port="5080"
errordir="$properties.storageBaseDir$/fromAtrify/inbox/error"
errorformat="sender.as2_id, receiver.as2_id, headers.message-id"/>

partnerships.xml

The partnerships.xml contains information about the connection details between the trade partners such as AS2 ids, certificates and URLs. You can use the default template provided by OpenAS2 or you have a look at the example below which is pre-configured for a connection to the PreProd atrify data pool. Replace the {customer} placeholders with your customer´s name, email etc... and try it out.

partnerships.xml
<partnerships>
<partner name="Informatica"
as2_id="INFA_DEMO05_DS_EU"
x509_alias="infa_dev_to_atrify"
email="mmustermann@informatica.com"/>
 
<partner name="Atrify"
as2_id="4049111170017"
x509_alias="atrify"
email="Info@Atrify.com"/>
 
<partnership name="Informatica-to-Atrify">
<sender name="Informatica"/>
<receiver name="Atrify"/>
<attribute name="protocol" value="as2"/>
<attribute name="content_transfer_encoding" value="binary"/>
<attribute name="subject" value="Sent from $sender.name$ to $receiver.name$"/>
<attribute name="as2_url" value="http://as2-datasync-test.atrify.com:80/as2"/>
<attribute name="as2_mdn_to" value="http://as2-datasync-test.atrify.com:80/as2"/>
<attribute name="as2_mdn_options" value="signed-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, $attribute.sign$"/>
<attribute name="encrypt" value="3DES"/>
<attribute name="sign" value="SHA256"/>
<attribute name="resend_max_retries" value="0"/>
<attribute name="prevent_canonicalization_for_mic" value="false"/>
<attribute name="rename_digest_to_old_name" value="false"/>
 
</partnership>
<partnership name="Atrify-to-Informatica">
<sender name="Atrify"/>
<receiver name="Informatica"/>
<attribute name="protocol" value="as2"/>
<attribute name="content_transfer_encoding" value="binary"/>
<attribute name="subject" value="File sent from Atrify to us"/>
<attribute name="as2_url" value="http://194.165.163.148:5080/as2"/>
<attribute name="as2_mdn_to" value="http://194.165.163.148:5080/as2"/>
<attribute name="as2_mdn_options" value="signed-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, $attribute.sign$"/>
<attribute name="encrypt" value="3DES"/>
<attribute name="sign" value="SHA256"/>
<attribute name="resend_max_retries" value="0"/>
<attribute name="prevent_canonicalization_for_mic" value="false"/>
<attribute name="remove_cms_algorithm_protection_attrib" value="false"/>
<attribute name="no_set_transfer_encoding_for_signing" value="false"/>
<attribute name="no_set_transfer_encoding_for_encryption" value="false"/>
<attribute name="rename_digest_to_old_name" value="false"/>
<attribute name="remove_cms_algorithm_protection_attrib" value="false"/>
</partnership>
 
</partnerships>

Overview:

If the default configurations are used your file structure should look like in the screenshot below:

images/download/thumbnails/485049517/image2020-6-4_16-56-46.png

Certificates

Finally you have to import and/or create certificates to communicate secure with 1WorldSync. This is described in Appendix B: Certificates.