Package org.opensaml.soap.messaging
Class SOAPMessagingSupport
java.lang.Object
org.opensaml.soap.messaging.SOAPMessagingSupport
Support class for SOAP messaging.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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, eithersoap11:actor
, orsoap12: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.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.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 currentInboundSOAPContext
for the givenMessageContext
.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, boolean autoCreate) Get the currentSOAP11Context
for the givenMessageContext
.static Fault
getSOAP11Fault
(MessageContext messageContext) Get the registered SOAP 1.1 fault, if any.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.
-
Constructor Details
-
SOAPMessagingSupport
private SOAPMessagingSupport()Constructor.
-
-
Method Details
-
getInboundSOAPContext
@Nonnull public static InboundSOAPContext getInboundSOAPContext(@Nonnull MessageContext messageContext) Get the currentInboundSOAPContext
for the givenMessageContext
.- 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 currentSOAP11Context
for the givenMessageContext
.- Parameters:
messageContext
- the current message contextautoCreate
- 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 contextheader
- 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 contextheader
- the header that is to be checked for understanding- Returns:
- true if header was understood, false otherwise
-
isSOAPMessage
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
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
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 processedheaderBlock
- 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 processedheaderBlock
- the header block to checkmustUnderstand
- 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, eithersoap11:actor
, orsoap12:role
.- Parameters:
messageContext
- the message context being processedheaderBlock
- the header block to checktargetNode
- 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 processedheaderName
- 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 processedheaderName
- 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 processedheaderName
- the name of the header block to returntargetNodes
- the explicitly specified SOAP node actors (1.1) or roles (1.2) for which the header is desiredisFinalDestination
- 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 processheaderName
- the name of the header block to returntargetNodes
- the explicitly specified SOAP node actors for which the header is desiredisFinalDestination
- 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 evaluatenodeActors
- the explicitly specified node actors for which the header is desiredisFinalDestination
- 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 processedheaderBlock
- the header block to add
-
addSOAP11HeaderBlock
Add a header to the SOAP 1.1 Envelope.- Parameters:
envelope
- the SOAP 1.1 envelope to processheaderBlock
- 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 contextfaultCode
- the fault code QName (required)faultString
- the fault message string value (required)faultActor
- the fault actor value (may be null)detailChildren
- the detail child elementsdetailAttributes
- 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 contextfault
- the fault to register
-
getSOAP11Fault
Get the registered SOAP 1.1 fault, if any.- Parameters:
messageContext
- the current message context- Returns:
- the registered fault, or null
-
clearFault
Clear the currently registered SOAP fault, if any.- Parameters:
messageContext
- the current message context
-