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 privateSOAPMessagingSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddHeaderBlock(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 voidaddMustUnderstand(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 voidaddSOAP11HeaderBlock(Envelope envelope, org.opensaml.core.xml.XMLObject headerBlock)Add a header to the SOAP 1.1 Envelope.static voidaddTargetNode(org.opensaml.messaging.context.MessageContext messageContext, org.opensaml.core.xml.XMLObject headerBlock, String targetNode)Add the target node info to the header block, eithersoap11:actor, orsoap12:role.static booleancheckUnderstoodHeader(org.opensaml.messaging.context.MessageContext msgContext, org.opensaml.core.xml.XMLObject header)Check whether a header was understood.static voidclearFault(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 InboundSOAPContextgetInboundSOAPContext(org.opensaml.messaging.context.MessageContext messageContext)Get the currentInboundSOAPContextfor the givenMessageContext.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 SOAP11ContextgetSOAP11Context(org.opensaml.messaging.context.MessageContext messageContext, boolean autoCreate)Get the currentSOAP11Contextfor the givenMessageContext.static FaultgetSOAP11Fault(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 SOAPVersiongetSOAPVersion(org.opensaml.messaging.context.MessageContext messageContext)Determine the SOAP version of the message represented by the message context.static booleanisMustUnderstand(org.opensaml.messaging.context.MessageContext messageContext, org.opensaml.core.xml.XMLObject headerBlock)Check whether the specified header block is indicated as mustUnderstand == true.static booleanisSOAP11HeaderTargetedToNode(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 booleanisSOAP11Message(org.opensaml.messaging.context.MessageContext messageContext)Determine whether the message represented by the message context contains a SOAP 1.1.static booleanisSOAPMessage(org.opensaml.messaging.context.MessageContext messageContext)Determine whether the message represented by the message context contains a SOAP Envelope.static voidregisterSOAP11Fault(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 voidregisterSOAP11Fault(org.opensaml.messaging.context.MessageContext messageContext, Fault fault)Register a SOAP 1.1 fault.static voidregisterUnderstoodHeader(org.opensaml.messaging.context.MessageContext msgContext, org.opensaml.core.xml.XMLObject header)Register a header as understood.
-
-
-
Method Detail
-
getInboundSOAPContext
@Nonnull public static InboundSOAPContext getInboundSOAPContext(@Nonnull org.opensaml.messaging.context.MessageContext messageContext)
Get the currentInboundSOAPContextfor 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 org.opensaml.messaging.context.MessageContext messageContext, boolean autoCreate)
Get the currentSOAP11Contextfor 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 org.opensaml.messaging.context.MessageContext msgContext, @Nonnull org.opensaml.core.xml.XMLObject header)Register a header as understood.- Parameters:
msgContext- the current message contextheader- 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 contextheader- 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 processedheaderBlock- 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 processedheaderBlock- the header block to checkmustUnderstand- 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, 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<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 processedheaderName- 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 processedheaderName- 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 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<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 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 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 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 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 processedheaderBlock- 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 processheaderBlock- 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 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 org.opensaml.messaging.context.MessageContext messageContext, @Nullable Fault fault)Register a SOAP 1.1 fault.- Parameters:
messageContext- the current message contextfault- 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
-
-