Class ValidatingAS4SignalMsgConsumer

java.lang.Object
com.helger.phase4.sender.ValidatingAS4SignalMsgConsumer
All Implemented Interfaces:
IAS4SignalMessageConsumer

public final class ValidatingAS4SignalMsgConsumer extends Object implements IAS4SignalMessageConsumer
Specific wrapped IAS4SignalMessageConsumer that verifies the DSig References between the sent message and received Receipt is identical.
Since:
3.0.0
Author:
Philip Helger
  • Constructor Details

    • ValidatingAS4SignalMsgConsumer

      public ValidatingAS4SignalMsgConsumer(@NonNull AS4ClientSentMessage<?> aClientSetMsg, @Nullable IAS4SignalMessageConsumer aOriginalConsumer, @Nullable IAS4SignalMessageValidationResultHandler aResultHandler)
      Constructor
      Parameters:
      aClientSetMsg - The original message sent, that contains the DSig references in the built message. Non-null.
      aOriginalConsumer - The original signal message consumer to be invoked after the reference check. May be null.
      aResultHandler - The result handler to be invoked. May be null in which case some default messages will be logged.
  • Method Details

    • areSemanticallyEquivalent

      public static boolean areSemanticallyEquivalent(@NonNull com.helger.xsds.xmldsig.ReferenceType aRef1, @NonNull com.helger.xsds.xmldsig.ReferenceType aRef2)
      This method compares XMLDSig references based on the following parameters:
      • Reference URI
      • Transform Algorithms (count and algorithms)
      • DigestMethod Algorithm
      • DigestValue

      This is based on a real world problem, where the outbound message used
        <ds:Reference URI="#my-msg-6311136f-ff8e-4d84-9ca4-6ba68939680e">
         <ds:Transforms>
          <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
           <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="S12"/>
          </ds:Transform>
         </ds:Transforms>
         <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
         <ds:DigestValue>LceN50/wXDPAvAvitk+EtQHANOxac2zVrWTCHm3P2UA=</ds:DigestValue>
        </ds:Reference>
       
      but the returned reference looked like this:
        <ns4:Reference URI="#my-msg-6311136f-ff8e-4d84-9ca4-6ba68939680e">
          <ns4:Transforms>
              <ns4:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
          </ns4:Transforms>
          <ns4:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
          <ns4:DigestValue>LceN50/wXDPAvAvitk+EtQHANOxac2zVrWTCHm3P2UA=</ns4:DigestValue>
        </ns4:Reference>
       
      Parameters:
      aRef1 - First reference. May not be null.
      aRef2 - Second reference. May not be null.
      Returns:
      true if they are equivalent, false if not.
      Since:
      3.0.7
    • handleSignalMessage

      public void handleSignalMessage(@NonNull Ebms3SignalMessage aEbmsSignalMsg, @NonNull IAS4IncomingMessageMetadata aIncomingMessageMetadata, @NonNull IAS4IncomingMessageState aIncomingState) throws Phase4Exception
      Description copied from interface: IAS4SignalMessageConsumer
      Handling an EBMS 3 Signal Message. Make sure to copy all attachments you are interested in, because by default they are only available based on temporary files during the processing of the inbound request.
      Specified by:
      handleSignalMessage in interface IAS4SignalMessageConsumer
      Parameters:
      aEbmsSignalMsg - The Signal Message domain object. Never null.
      aIncomingMessageMetadata - The message metadata of the synchronously received message. Never null. Added in v2.5.0.
      aIncomingState - The internal processing state of the signal message. Never null. Added in v2.5.0.
      Throws:
      Phase4Exception - in case of error