Class SOAPMessagingSupport


  • public final class SOAPMessagingSupport
    extends Object
    Support class for SOAP messaging.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private SOAPMessagingSupport()
      Constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addHeaderBlock​(org.opensaml.messaging.context.MessageContext messageContext, org.opensaml.core.xml.XMLObject headerBlock)
      Add a header block to the SOAP envelope contained within the specified message context's SOAP subcontext.
      static void addMustUnderstand​(org.opensaml.messaging.context.MessageContext messageContext, org.opensaml.core.xml.XMLObject headerBlock, boolean mustUnderstand)
      Add whether the specified header block is indicated as mustUnderstand.
      static void addSOAP11HeaderBlock​(Envelope envelope, org.opensaml.core.xml.XMLObject headerBlock)
      Add a header to the SOAP 1.1 Envelope.
      static void addTargetNode​(org.opensaml.messaging.context.MessageContext messageContext, org.opensaml.core.xml.XMLObject headerBlock, String targetNode)
      Add the target node info to the header block, either soap11:actor, or soap12:role.
      static boolean checkUnderstoodHeader​(org.opensaml.messaging.context.MessageContext msgContext, org.opensaml.core.xml.XMLObject header)
      Check whether a header was understood.
      static void clearFault​(org.opensaml.messaging.context.MessageContext messageContext)
      Clear the currently registered SOAP fault, if any.
      static List<org.opensaml.core.xml.XMLObject> getHeaderBlock​(org.opensaml.messaging.context.MessageContext messageContext, QName headerName, Set<String> targetNodes, boolean isFinalDestination)
      Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
      static List<org.opensaml.core.xml.XMLObject> getInboundHeaderBlock​(org.opensaml.messaging.context.MessageContext messageContext, QName headerName)
      Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
      static InboundSOAPContext getInboundSOAPContext​(org.opensaml.messaging.context.MessageContext messageContext)
      Get the current InboundSOAPContext for the given MessageContext.
      static List<org.opensaml.core.xml.XMLObject> getOutboundHeaderBlock​(org.opensaml.messaging.context.MessageContext messageContext, QName headerName)
      Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
      static SOAP11Context getSOAP11Context​(org.opensaml.messaging.context.MessageContext messageContext, boolean autoCreate)
      Get the current SOAP11Context for the given MessageContext.
      static Fault getSOAP11Fault​(org.opensaml.messaging.context.MessageContext messageContext)
      Get the registered SOAP 1.1 fault, if any.
      static List<org.opensaml.core.xml.XMLObject> getSOAP11HeaderBlock​(Envelope envelope, QName headerName, Set<String> targetNodes, boolean isFinalDestination)
      Get a header block from the SOAP 1.1 envelope.
      static SOAPVersion getSOAPVersion​(org.opensaml.messaging.context.MessageContext messageContext)
      Determine the SOAP version of the message represented by the message context.
      static boolean isMustUnderstand​(org.opensaml.messaging.context.MessageContext messageContext, org.opensaml.core.xml.XMLObject headerBlock)
      Check whether the specified header block is indicated as mustUnderstand == true.
      static boolean isSOAP11HeaderTargetedToNode​(org.opensaml.core.xml.XMLObject header, Set<String> nodeActors, boolean isFinalDestination)
      Evaluate whether the specified header block is targeted to a SOAP 1.1 node given the specified parameters.
      static boolean isSOAP11Message​(org.opensaml.messaging.context.MessageContext messageContext)
      Determine whether the message represented by the message context contains a SOAP 1.1.
      static boolean isSOAPMessage​(org.opensaml.messaging.context.MessageContext messageContext)
      Determine whether the message represented by the message context contains a SOAP Envelope.
      static void registerSOAP11Fault​(org.opensaml.messaging.context.MessageContext messageContext, QName faultCode, String faultString, String faultActor, List<org.opensaml.core.xml.XMLObject> detailChildren, Map<QName,​String> detailAttributes)
      Register a SOAP 1.1.
      static void registerSOAP11Fault​(org.opensaml.messaging.context.MessageContext messageContext, Fault fault)
      Register a SOAP 1.1 fault.
      static void registerUnderstoodHeader​(org.opensaml.messaging.context.MessageContext msgContext, org.opensaml.core.xml.XMLObject header)
      Register a header as understood.
    • Constructor Detail

      • SOAPMessagingSupport

        private SOAPMessagingSupport()
        Constructor.
    • Method Detail

      • getInboundSOAPContext

        @Nonnull
        public static InboundSOAPContext getInboundSOAPContext​(@Nonnull
                                                               org.opensaml.messaging.context.MessageContext messageContext)
        Get the current InboundSOAPContext for the given MessageContext.
        Parameters:
        messageContext - the current message context
        Returns:
        the current inbound SOAP context. May be null if autoCreate=false, otherwise will be non-null
      • getSOAP11Context

        @Nullable
        public static SOAP11Context getSOAP11Context​(@Nonnull
                                                     org.opensaml.messaging.context.MessageContext messageContext,
                                                     boolean autoCreate)
        Get the current SOAP11Context for the given MessageContext.
        Parameters:
        messageContext - the current message context
        autoCreate - whether to auto-create the context if it does not exist
        Returns:
        the current SOAP 1.1 context. May be null if autoCreate=false, otherwise will be non-null
      • registerUnderstoodHeader

        public static void registerUnderstoodHeader​(@Nonnull
                                                    org.opensaml.messaging.context.MessageContext msgContext,
                                                    @Nonnull
                                                    org.opensaml.core.xml.XMLObject header)
        Register a header as understood.
        Parameters:
        msgContext - the current message context
        header - the header that was understood
      • checkUnderstoodHeader

        public static boolean checkUnderstoodHeader​(@Nonnull
                                                    org.opensaml.messaging.context.MessageContext msgContext,
                                                    @Nonnull
                                                    org.opensaml.core.xml.XMLObject header)
        Check whether a header was understood.
        Parameters:
        msgContext - the current message context
        header - the header that is to be checked for understanding
        Returns:
        true if header was understood, false otherwise
      • isSOAPMessage

        public static boolean isSOAPMessage​(@Nonnull
                                            org.opensaml.messaging.context.MessageContext messageContext)
        Determine whether the message represented by the message context contains a SOAP Envelope.
        Parameters:
        messageContext - the current message context
        Returns:
        true iff the message context contains a SOAP Envelope
      • isSOAP11Message

        public static boolean isSOAP11Message​(@Nonnull
                                              org.opensaml.messaging.context.MessageContext messageContext)
        Determine whether the message represented by the message context contains a SOAP 1.1. Envelope.
        Parameters:
        messageContext - the current message context
        Returns:
        true iff the message context contains a SOAP 1.1 Envelope
      • getSOAPVersion

        @Nullable
        public static SOAPVersion getSOAPVersion​(@Nonnull
                                                 org.opensaml.messaging.context.MessageContext messageContext)
        Determine the SOAP version of the message represented by the message context.
        Parameters:
        messageContext - the current message context
        Returns:
        the SOAP version. May be null if the version could not be determined.
      • isMustUnderstand

        public static boolean isMustUnderstand​(@Nonnull
                                               org.opensaml.messaging.context.MessageContext messageContext,
                                               @Nonnull
                                               org.opensaml.core.xml.XMLObject headerBlock)
        Check whether the specified header block is indicated as mustUnderstand == true.
        Parameters:
        messageContext - the message context being processed
        headerBlock - the header block to check
        Returns:
        true if header is indicated as mustUnderstand==true, false if not
      • addMustUnderstand

        public static void addMustUnderstand​(@Nonnull
                                             org.opensaml.messaging.context.MessageContext messageContext,
                                             @Nonnull
                                             org.opensaml.core.xml.XMLObject headerBlock,
                                             boolean mustUnderstand)
        Add whether the specified header block is indicated as mustUnderstand.
        Parameters:
        messageContext - the message context being processed
        headerBlock - the header block to check
        mustUnderstand - true if header must be understood, false if not
      • addTargetNode

        public static void addTargetNode​(@Nonnull
                                         org.opensaml.messaging.context.MessageContext messageContext,
                                         @Nonnull
                                         org.opensaml.core.xml.XMLObject headerBlock,
                                         @Nullable
                                         String targetNode)
        Add the target node info to the header block, either soap11:actor, or soap12:role.
        Parameters:
        messageContext - the message context being processed
        headerBlock - the header block to check
        targetNode - the node to add
      • getInboundHeaderBlock

        @Nonnull
        public static List<org.opensaml.core.xml.XMLObject> getInboundHeaderBlock​(@Nonnull
                                                                                  org.opensaml.messaging.context.MessageContext messageContext,
                                                                                  @Nonnull
                                                                                  QName headerName)
        Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
        Parameters:
        messageContext - the message context being processed
        headerName - the name of the header block to return
        Returns:
        the list of matching header blocks
      • getOutboundHeaderBlock

        @Nonnull
        public static List<org.opensaml.core.xml.XMLObject> getOutboundHeaderBlock​(@Nonnull
                                                                                   org.opensaml.messaging.context.MessageContext messageContext,
                                                                                   @Nonnull
                                                                                   QName headerName)
        Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
        Parameters:
        messageContext - the message context being processed
        headerName - the name of the header block to return
        Returns:
        the list of matching header blocks
      • getHeaderBlock

        @Nonnull
        public static List<org.opensaml.core.xml.XMLObject> getHeaderBlock​(@Nonnull
                                                                           org.opensaml.messaging.context.MessageContext messageContext,
                                                                           @Nonnull
                                                                           QName headerName,
                                                                           @Nullable
                                                                           Set<String> targetNodes,
                                                                           boolean isFinalDestination)
        Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
        Parameters:
        messageContext - the message context being processed
        headerName - the name of the header block to return
        targetNodes - the explicitly specified SOAP node actors (1.1) or roles (1.2) for which the header is desired
        isFinalDestination - true specifies that headers targeted for message final destination should be returned, false means they should not be returned
        Returns:
        the list of matching header blocks
      • getSOAP11HeaderBlock

        @Nonnull
        public static List<org.opensaml.core.xml.XMLObject> getSOAP11HeaderBlock​(@Nonnull
                                                                                 Envelope envelope,
                                                                                 @Nonnull
                                                                                 QName headerName,
                                                                                 @Nullable
                                                                                 Set<String> targetNodes,
                                                                                 boolean isFinalDestination)
        Get a header block from the SOAP 1.1 envelope.
        Parameters:
        envelope - the SOAP 1.1 envelope to process
        headerName - the name of the header block to return
        targetNodes - the explicitly specified SOAP node actors for which the header is desired
        isFinalDestination - true specifies that headers targeted for message final destination should be returned, false specifies they should not be returned
        Returns:
        the list of matching header blocks
      • isSOAP11HeaderTargetedToNode

        public static boolean isSOAP11HeaderTargetedToNode​(@Nonnull
                                                           org.opensaml.core.xml.XMLObject header,
                                                           @Nullable
                                                           Set<String> nodeActors,
                                                           boolean isFinalDestination)
        Evaluate whether the specified header block is targeted to a SOAP 1.1 node given the specified parameters.
        Parameters:
        header - the header to evaluate
        nodeActors - the explicitly specified node actors for which the header is desired
        isFinalDestination - true specifies that headers targeted for message final destination should be returned, false specifies they should not be returned
        Returns:
        the list of matching header blocks
      • addHeaderBlock

        public static void addHeaderBlock​(@Nonnull
                                          org.opensaml.messaging.context.MessageContext messageContext,
                                          @Nonnull
                                          org.opensaml.core.xml.XMLObject headerBlock)
        Add a header block to the SOAP envelope contained within the specified message context's SOAP subcontext.
        Parameters:
        messageContext - the message context being processed
        headerBlock - the header block to add
      • addSOAP11HeaderBlock

        public static void addSOAP11HeaderBlock​(@Nonnull
                                                Envelope envelope,
                                                @Nonnull
                                                org.opensaml.core.xml.XMLObject headerBlock)
        Add a header to the SOAP 1.1 Envelope.
        Parameters:
        envelope - the SOAP 1.1 envelope to process
        headerBlock - the header to add
      • registerSOAP11Fault

        public static void registerSOAP11Fault​(@Nonnull
                                               org.opensaml.messaging.context.MessageContext messageContext,
                                               @Nonnull
                                               QName faultCode,
                                               @Nonnull
                                               String faultString,
                                               @Nullable
                                               String faultActor,
                                               @Nullable
                                               List<org.opensaml.core.xml.XMLObject> detailChildren,
                                               @Nullable
                                               Map<QName,​String> detailAttributes)
        Register a SOAP 1.1. fault based on its constituent information items.
        Parameters:
        messageContext - the current message context
        faultCode - the fault code QName (required)
        faultString - the fault message string value (required)
        faultActor - the fault actor value (may be null)
        detailChildren - the detail child elements
        detailAttributes - the detail element attributes
      • registerSOAP11Fault

        public static void registerSOAP11Fault​(@Nonnull
                                               org.opensaml.messaging.context.MessageContext messageContext,
                                               @Nullable
                                               Fault fault)
        Register a SOAP 1.1 fault.
        Parameters:
        messageContext - the current message context
        fault - the fault to register
      • getSOAP11Fault

        public static Fault getSOAP11Fault​(@Nonnull
                                           org.opensaml.messaging.context.MessageContext messageContext)
        Get the registered SOAP 1.1 fault, if any.
        Parameters:
        messageContext - the current message context
        Returns:
        the registered fault, or null
      • clearFault

        public static void clearFault​(@Nonnull
                                      org.opensaml.messaging.context.MessageContext messageContext)
        Clear the currently registered SOAP fault, if any.
        Parameters:
        messageContext - the current message context