use of com.helger.phase4.attachment.Phase4OutgoingAttachment in project phase4 by phax.
the class AbstractAS4UserMessageBuilderMIMEPayload method mainSendMessage.
@Override
protected final void mainSendMessage() throws Phase4Exception {
// Temporary file manager
try (final AS4ResourceHelper aResHelper = new AS4ResourceHelper()) {
// Start building AS4 User Message
final AS4ClientUserMessage aUserMsg = new AS4ClientUserMessage(aResHelper);
applyToUserMessage(aUserMsg);
// No payload - only one attachment
aUserMsg.setPayload(null);
// Add main attachment
aUserMsg.addAttachment(WSS4JAttachment.createOutgoingFileAttachment(m_aPayload, aResHelper));
// Add other attachments
for (final Phase4OutgoingAttachment aAttachment : m_aAttachments) aUserMsg.addAttachment(WSS4JAttachment.createOutgoingFileAttachment(aAttachment, aResHelper));
// Main sending
AS4BidirectionalClientHelper.sendAS4UserMessageAndReceiveAS4SignalMessage(m_aCryptoFactory, pmodeResolver(), incomingAttachmentFactory(), incomingProfileSelector(), aUserMsg, m_aLocale, m_sEndpointURL, m_aBuildMessageCallback, m_aOutgoingDumper, m_aIncomingDumper, m_aRetryCallback, m_aResponseConsumer, m_aSignalMsgConsumer);
} catch (final Phase4Exception ex) {
// Re-throw
throw ex;
} catch (final Exception ex) {
// wrap
throw new Phase4Exception("Wrapped Phase4Exception", ex);
}
}
Aggregations