MSH2 Basic Test

Introduction
To facilitate the use of MSH2 we defined this test to check the basic functionalities, in this way it is possible to quickly check setup, configuration, free communication channels, database access, etc.
If this test is successfully finished, it is possible to proceed with next tests to check, for example: ebMS envelope, cryptography e digital signature, specificazione dei processi di business, consegna sicura, ecc.

The MSH2 Basic Test consists in:
- a receipt phase [ Client > SimpleMail > MSH2 ]
- a sending phase [ MSH2 > SimpleMail > Client ]
of a XML file through a simple e-mail on SMTP protocol (SimpleMail).
In other words, a SimpleMail is an e-mail with an XML file in attachment.
In this test the supported ebMS envelope (that MSH2 uses to envelope the documents) will not be used during the exchange.

Receipt
In the first phase of test, the Receipt, the goal is to receive with MSH2 an XML file sent by a generic e-mail client.
Because a generic e-mail client does not support, usually, the ebMS standard, we enable in MSH2 the receipt of SimpleMail.

To perform this test it is necessary two e-mail account, for example:
- client@email.com as sender
(a generic e-mail client (f.e. a web mail or Eudora, Outlook, etc.);
- msh2@email.com as receiver
(MSH2 client configured).

Before test performing, we suggest to execute the following actions:
- to delete or download possible messages on mail server;
- to modify in the Options/SimpleMail tab the e-mail subject to [MODAML Document]
Try to receive, if MSH2 console shows the message “No new message” then proceed.

Send, through the generic client (with account client@email.com) an e-mail with XML in attachment and subject [MODAML Document] to recipient msh2@email.com.
In receiving, MSH2:
- identifies the message through the agreed e-mail subject;
- parses the message;
- extracts the XML document and checks if it is well-formed and valid against Schema;
- saves the document in a directory (specified in the Options/SimpleMail).

Sending
In the second test phase, the Sending, the goal is to send with MSH2 a XML file to generic e-mail client.
Enable in MSH2, if it is not done, the SimpleMail receiving, because a generic e-mail client does not support, usually, the ebMS standard.

To perform this test it is necessary to have two e-mail accounts, for example:
- client@email.com as receiver,
generic e-mail client (a web mail or Eudora, Outlook, etc.);
- msh2@email.com as sender
Configured in MSH2.

To perform the sending phase with MSH2, it is necessary to create a configuration file where to specify the recipient. To define the configuration file, that represent a collaboration agreement between two parties, the ebXML framework provides the CPA standard, in XML format. A CPA is a file shared between two systems that have accepted it as collaboration representation. In this test we assumed one party only with MSH2: the sender;

in the CPA we specify:
- two PartyID for the two systems (enterprises identifiers)
- two endpoints for the two systems (e-mail adresses).

The two PartyID have to respect a predefined syntax:
- two letters, in UPPERCASE, that declare the enterprise nationality;
- a dash, "-", “minus”, separator and
- 11/13 digits number that declare the european VAT number (or italian P.IVA).
For the moment we use the imaginary PartyID: IT-123451234501 for the sender msh2@email.com
IT-543215432101 for the receiver client@email.com

To create/edit a CPA file, representation of a ebXML collaboration agreement and compliant with MSH2, it is possible to use the free web application CPA-FastEditor
It is possible to display and/or to download the resulting CPA for this particulat test, that was created by: - insertion of the two PartyID,
- insertion of the two e-mail adresses
- specification of SimpleMail option instead of ebMS
(ebMS is used in MSH2 by default to envelope the messages with ebXML standard).

Save the CPA file in the specific MSH2 folder: MSH2/CPA/
Now MSH2 “knows” the collaboration described in this CPA, between sender and receiver for this test, and it can to retrieve the related information when it is necessary.

Before the sending phase for this test:
- check the sender PartyID in Options/General panel of MSH2,
(IT-123451234501 in our example);
- try to send, if the “No files in the Outbox folder” message compares in the MSH2 panel, we can proceed.

Take a XML file to send and rename it:
MSH2_IT-543215432101_0_1.xml
This particular syntax allows to MSH2:
- to recognize the recipient loading the related CPA containg all necessaty information;
- to integrate in a simple way the eventual internal enterprise system that, exporting data from its database in a XML file named with this particular syntax, can use automatically the transport module.

Copy the XML file in the MSH2/Outbox/ folder
MSH2 asks to send the file
(or, if set out in the Options/General, MSH2 sends immediately the document).

At this point, in the web mail (or generic e-mail client), check for new message with XML document in attachment.