Class SOAPMessagingSupport


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

      • SOAPMessagingSupport

        private SOAPMessagingSupport()
        Constructor.
    • Method Detail

      • getInboundSOAPContext

        @Nonnull
        public static InboundSOAPContext getInboundSOAPContext​(@Nonnull
                                                               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
                                                     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
                                                    MessageContext msgContext,
                                                    @Nonnull
                                                    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
                                                    MessageContext msgContext,
                                                    @Nonnull
                                                    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
                                            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
                                              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
                                                 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
                                               MessageContext messageContext,
                                               @Nonnull
                                               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
                                             MessageContext messageContext,
                                             @Nonnull
                                             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
                                         MessageContext messageContext,
                                         @Nonnull
                                         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<XMLObject> getInboundHeaderBlock​(@Nonnull
                                                            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<XMLObject> getOutboundHeaderBlock​(@Nonnull
                                                             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<XMLObject> getHeaderBlock​(@Nonnull
                                                     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<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
                                                           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
                                          MessageContext messageContext,
                                          @Nonnull
                                          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
                                                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
                                               MessageContext messageContext,
                                               @Nonnull
                                               QName faultCode,
                                               @Nonnull
                                               String faultString,
                                               @Nullable
                                               String faultActor,
                                               @Nullable
                                               List<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
                                               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
                                           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
                                      MessageContext messageContext)
        Clear the currently registered SOAP fault, if any.
        Parameters:
        messageContext - the current message context