-
Notifications
You must be signed in to change notification settings - Fork 44
Configuration file
Philip Helger edited this page Oct 4, 2019
·
5 revisions
A special XML configuration file must be used to configure the AS2 handling. It contains:
- a reference to the keystore to be used (in element
certificates
) - a reference to a partnership factory (storing the exchange combinations) (in element
partnerships
) - a list of modules that are executed when a message is received (in elements
module
)
Within a configuration file, the macro %home%
is replaced with the parent directory of the configuration file. This replacement happens only when a value starts with %home%
.
Complete example configuration file:
<?xml version="1.0" encoding="utf-8"?>
<openas2>
<!-- [required] The keystore to be used (since v4) -->
<certificates classname="com.helger.as2lib.cert.CertificateFactory"
type="pkcs12"
filename="%home%/server-certs.p12"
password="mypassword" />
<!-- [required] The keystore to be used (prior to v4) -->
<!--
<certificates classname="com.helger.as2lib.cert.PKCS12CertificateFactory"
filename="%home%/server-certs.p12"
password="mypassword" />
-->
<!-- [required] The pro-forma partnership factory -->
<partnerships classname="com.helger.as2servlet.util.AS2ServletPartnershipFactory"
filename="%home%/server-partnerships.xml"
disablebackup="true" />
<!-- [required] the processing queue -->
<processor classname="com.helger.as2lib.processor.DefaultMessageProcessor"
pendingMDN="%home%/pendingMDN"
pendingMDNinfo="%home%/pendinginfoMDN">
<!-- [optional] Store sent MDNs to a file
Note: "charset" attribute was added in v4.1.0
-->
<module classname="com.helger.as2lib.processor.storage.MDNFileModule"
filename="%home%/mdn/$date.uuuu$/$date.MM$/$mdn.msg.sender.as2_id$-$mdn.msg.receiver.as2_id$-$mdn.msg.headers.message-id$"
protocol="as2"
tempdir="%home%/temp"
charset="utf-8" />
<!-- [optional] Store received messages and headers to a file
Note: "charset" attribute was added in v4.1.0
-->
<module classname="com.helger.as2lib.processor.storage.MessageFileModule"
filename="%home%/inbox/$date.uuuu$/$date.MM$/$msg.sender.as2_id$-$msg.receiver.as2_id$-$msg.headers.message-id$"
header="%home%/inbox/msgheaders/$date.uuuu$/$date.MM$/$msg.sender.as2_id$-$msg.receiver.as2_id$-$msg.headers.message-id$"
protocol="as2"
tempdir="%home%/temp"
charset="utf-8" />
<!-- [required] The main receiver module that performs the message parsing.
This module also sends synchronous MDNs back.
Note: the port attribute is required but can be ignored in our case!
Note: the 'errordir' attribute allows parameters since v3.0.4 only!
Note: the 'errorstorebody' attribute was added with v3.0.4!
-->
<module classname="com.helger.as2servlet.util.AS2ServletReceiverModule"
port="10080"
errordir="%home%/inbox/error/$date.uuuu$/$date.MM$"
errorformat="$msg.sender.as2_id$, $msg.receiver.as2_id$, $msg.headers.message-id$"
errorstorebody="false"/>
<!-- To process the documents further than just storing them to disk, implement
class AbstractProcessorModule and register the module here.
See the phax/as2-peppol-servlet project on how to handle e.g. SBDH documents
-->
</processor>
</openas2>