public class AS2EnvelopQuerySender extends EnvelopQuerySender

The AS2EnvelopQuerySender is a client service sender using HTTP protocol for query the message envelop (i.e EDI Header + payload) from the Hermes 2 Messaging Gateway. To use it you have to provide the configuration instance called AS2AdminData. it defines the URL end-point and credential for connecting to your Hermes 2 Restricted area. An Example for adding partnership :

// Create an admin data for configuration.
AS2AdminData adminData = new AS2AdminData();
adminData.setManagePartnershipEndpoint("Your H2O location");
adminData.setUsername("Your username for logging H2O");
adminData.setPassword("Your password for logging H2O");

AS2EnvelopQuerySender sender = new AS2EnvelopQuerySender(someLogger, adminData, pData);
sender.setMessageCriteriaToDownload("The message id you want to query", "INBOX or OUTBOX");;
InputStream ins = sender.getEnvelopStream();
// The envelop content ... process it.

Note for setting the manage partnership end-point You should add /admin/as2/partnership to your H2O host. For example, ‘http://localhost:8080/admin/as2/partnership‘. Note that the client service does not guarantee transactional behavior meaning you are always able to down-load the envelop when invoking the client. (Different from the receiver Web service).

Author:Twinsen Tsang

See also:



protected static final String DL_RECEIPT_FORM_PARAM



public AS2EnvelopQuerySender(FileLogger logger, AS2AdminData ad)

Explicit Constructor. Create an instance of AS2EnvelopQuerySender.

  • logger – The logger for log the sending process.
  • ad – The AS2AdminData for locating the HTTP end-point the request send to.
  • NullPointerException – When p is null. When the manage partnership end-point from ad is null or empty.



protected Map getMessageBoxMapping()


public static void main(String[] args)

The main method is for CLI mode.


protected HttpMethod onCreateRequest()