Package org.opensaml.soap.messaging

# Class SOAPMessagingSupport

java.lang.Object
org.opensaml.soap.messaging.SOAPMessagingSupport

public final class SOAPMessagingSupport extends Object
Support class for SOAP messaging.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`SOAPMessagingSupport()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static void`
`addHeaderBlock(MessageContext messageContext, XMLObject headerBlock)`
Add a header block to the SOAP envelope contained within the specified message context's SOAP subcontext.
`static void`
`addMustUnderstand(MessageContext messageContext, XMLObject headerBlock, boolean mustUnderstand)`
Add whether the specified header block is indicated as mustUnderstand.
`static void`
`addSOAP11HeaderBlock(Envelope envelope, XMLObject headerBlock)`
Add a header to the SOAP 1.1 Envelope.
`static void`
`addTargetNode(MessageContext messageContext, XMLObject headerBlock, String targetNode)`
Add the target node info to the header block, either `soap11:actor`, or `soap12:role`.
`static boolean`
`checkUnderstoodHeader(MessageContext msgContext, XMLObject header)`
Check whether a header was understood.
`static void`
`clearFault(MessageContext messageContext)`
Clear the currently registered SOAP fault, if any.
`static SOAP11Context`
`ensureSOAP11Context(MessageContext messageContext)`
Get the current `SOAP11Context` for the given `MessageContext`, or create one if necessary.
`static List<XMLObject>`
`getHeaderBlock(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<XMLObject>`
`getInboundHeaderBlock(MessageContext messageContext, QName headerName)`
Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
`static InboundSOAPContext`
`getInboundSOAPContext(MessageContext messageContext)`
Get the current `InboundSOAPContext` for the given `MessageContext`.
`static List<XMLObject>`
`getOutboundHeaderBlock(MessageContext messageContext, QName headerName)`
Get a header block from the SOAP envelope contained within the specified message context's SOAP subcontext.
`static SOAP11Context`
`getSOAP11Context(MessageContext messageContext)`
Get the current `SOAP11Context` for the given `MessageContext`.
`static SOAP11Context`
`getSOAP11Context(MessageContext messageContext, boolean autoCreate)`
Deprecated, for removal: This API element is subject to removal in a future version.
`static Fault`
`getSOAP11Fault(MessageContext messageContext)`
Get the registered SOAP 1.1 fault, if any.
`static List<XMLObject>`
`getSOAP11HeaderBlock(Envelope envelope, QName headerName, Set<String> targetNodes, boolean isFinalDestination)`
Get a header block from the SOAP 1.1 envelope.
`static SOAPVersion`
`getSOAPVersion(MessageContext messageContext)`
Determine the SOAP version of the message represented by the message context.
`static boolean`
`isMustUnderstand(MessageContext messageContext, XMLObject headerBlock)`
Check whether the specified header block is indicated as mustUnderstand == true.
`static boolean`
`isSOAP11HeaderTargetedToNode(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(MessageContext messageContext)`
Determine whether the message represented by the message context contains a SOAP 1.1.
`static boolean`
`isSOAPMessage(MessageContext messageContext)`
Determine whether the message represented by the message context contains a SOAP Envelope.
`static void`
`registerSOAP11Fault(MessageContext messageContext, QName faultCode, String faultString, String faultActor, List<XMLObject> detailChildren, Map<QName,String> detailAttributes)`
Register a SOAP 1.1.
`static void`
`registerSOAP11Fault(MessageContext messageContext, Fault fault)`
Register a SOAP 1.1 fault.
`static void`
`registerUnderstoodHeader(MessageContext msgContext, XMLObject header)`
Register a header as understood.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SOAPMessagingSupport

private SOAPMessagingSupport()
Constructor.

## Method Details

### 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

@Deprecated(since="5.0.0", forRemoval=true) @Nullable public static SOAP11Context getSOAP11Context(@Nonnull MessageContext messageContext, boolean autoCreate)
Deprecated, for removal: This API element is subject to removal in a future version.
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

### getSOAP11Context

@Nullable public static SOAP11Context getSOAP11Context(@Nonnull MessageContext messageContext)
Get the current `SOAP11Context` for the given `MessageContext`.

Parameters:
  `messageContext` - the current message context
Returns:
  the current SOAP 1.1 context or null

### ensureSOAP11Context

@Nonnull public static SOAP11Context ensureSOAP11Context(@Nonnull MessageContext messageContext)
Get the current `SOAP11Context` for the given `MessageContext`, or create one if necessary.

Parameters:
  `messageContext` - the current message context
Returns:
  the current SOAP 1.1 context.
Since:
  5.0.0

### 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