use of com.helger.phase4.ebms3header.Ebms3Error in project phase4 by phax.
the class StoringServletMessageProcessorSPI method processAS4UserMessage.
@Nonnull
public AS4MessageProcessorResult processAS4UserMessage(@Nonnull final IAS4IncomingMessageMetadata aMessageMetadata, @Nonnull final HttpHeaderMap aHttpHeaders, @Nonnull final Ebms3UserMessage aUserMessage, @Nonnull final IPMode aPMode, @Nullable final Node aPayload, @Nullable final ICommonsList<WSS4JAttachment> aIncomingAttachments, @Nonnull final IAS4MessageState aState, @Nonnull final ICommonsList<Ebms3Error> aProcessingErrorMessages) {
LOGGER.info("Received AS4 user message");
_dumpSoap(aMessageMetadata, aState);
// Dump all incoming attachments (but only if they are repeatable)
if (aIncomingAttachments != null) {
int nAttachmentIndex = 0;
for (final WSS4JAttachment aIncomingAttachment : aIncomingAttachments) {
if (aIncomingAttachment.isRepeatable())
_dumpIncomingAttachment(aMessageMetadata, aIncomingAttachment, nAttachmentIndex);
nAttachmentIndex++;
}
}
return AS4MessageProcessorResult.createSuccess();
}
use of com.helger.phase4.ebms3header.Ebms3Error in project phase4 by phax.
the class ExampleReceiveMessageProcessorSPI method processAS4UserMessage.
@Nonnull
public AS4MessageProcessorResult processAS4UserMessage(@Nonnull final IAS4IncomingMessageMetadata aMessageMetadata, @Nonnull final HttpHeaderMap aHttpHeaders, @Nonnull final Ebms3UserMessage aUserMessage, @Nonnull final IPMode aPMode, @Nullable final Node aPayload, @Nullable final ICommonsList<WSS4JAttachment> aIncomingAttachments, @Nonnull final IAS4MessageState aState, @Nonnull final ICommonsList<Ebms3Error> aProcessingErrorMessages) {
LOGGER.info("Received AS4 user message");
_dumpSoap(aMessageMetadata, aState);
if (aIncomingAttachments != null) {
int nIndex = 1;
for (final WSS4JAttachment aIncomingAttachment : aIncomingAttachments) {
final File aFile = StorageHelper.getStorageFile(aMessageMetadata, "-" + nIndex + ".payload");
if (StreamHelper.copyInputStreamToOutputStream(aIncomingAttachment.getSourceStream(), FileHelper.getOutputStream(aFile)).isFailure())
LOGGER.error("Failed to write incoming attachment [" + nIndex + "] to '" + aFile.getAbsolutePath() + "'");
else
LOGGER.info("Wrote incoming attachment [" + nIndex + "] to '" + aFile.getAbsolutePath() + "'");
++nIndex;
}
}
return AS4MessageProcessorResult.createSuccess();
}
use of com.helger.phase4.ebms3header.Ebms3Error in project phase4 by phax.
the class MockClientMessages method createErrorMessageSigned.
@Nonnull
public static Document createErrorMessageSigned(@Nonnull final ESoapVersion eSoapVersion, @Nullable final ICommonsList<WSS4JAttachment> aAttachments, @Nonnull @WillNotClose final AS4ResourceHelper aResHelper) throws WSSecurityException {
final ICommonsList<Ebms3Error> aEbms3ErrorList = new CommonsArrayList<>(EEbmsError.EBMS_INVALID_HEADER.getAsEbms3Error(Locale.US, null));
final AS4ErrorMessage aErrorMsg = AS4ErrorMessage.create(eSoapVersion, "srcmsgid", aEbms3ErrorList).setMustUnderstand(true);
final Document aSignedDoc = AS4Signer.createSignedMessage(AS4CryptoFactoryProperties.getDefaultInstance(), aErrorMsg.getAsSoapDocument(), eSoapVersion, aErrorMsg.getMessagingID(), aAttachments, aResHelper, false, AS4SigningParams.createDefault());
return aSignedDoc;
}
use of com.helger.phase4.ebms3header.Ebms3Error in project phase4 by phax.
the class AS4ErrorMessage method create.
@Nonnull
public static AS4ErrorMessage create(@Nonnull final ESoapVersion eSoapVersion, @Nonnull final Ebms3MessageInfo aEbms3MessageInfo, @Nonnull final ICommonsList<Ebms3Error> aErrorMessages) {
final Ebms3SignalMessage aSignalMessage = new Ebms3SignalMessage();
// Message Info
aSignalMessage.setMessageInfo(aEbms3MessageInfo);
// Error Message
aSignalMessage.setError(aErrorMessages);
return new AS4ErrorMessage(eSoapVersion, aSignalMessage);
}
use of com.helger.phase4.ebms3header.Ebms3Error in project phase4 by phax.
the class IEbmsError method getAsEbms3Error.
@Nonnull
default Ebms3Error getAsEbms3Error(@Nonnull final Locale aContentLocale, @Nullable final String sRefToMessageInError, @Nullable final String sOrigin, @Nullable final Ebms3Description aEbmsDescription) {
final Ebms3Error aEbms3Error = new Ebms3Error();
// Default to shortDescription if none provided
aEbms3Error.setDescription(aEbmsDescription != null ? aEbmsDescription : MessageHelperMethods.createEbms3Description(aContentLocale, getShortDescription()));
aEbms3Error.setErrorDetail(getErrorDetail().getDisplayText(aContentLocale));
aEbms3Error.setErrorCode(getErrorCode());
aEbms3Error.setSeverity(getSeverity().getSeverity());
aEbms3Error.setShortDescription(getShortDescription());
aEbms3Error.setCategory(getCategory().getDisplayName());
aEbms3Error.setRefToMessageInError(sRefToMessageInError);
aEbms3Error.setOrigin(sOrigin);
return aEbms3Error;
}
Aggregations