Class HTTPSOAP11Encoder
- All Implemented Interfaces:
Component
,DestructableComponent
,InitializableComponent
,UnmodifiableComponent
,MessageEncoder
,HttpServletResponseMessageEncoder
- Direct Known Subclasses:
HTTPSOAP11Encoder
,HTTPSOAP11Encoder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SOAPObjectBuilder<Body>
SOAP Body builder.private SOAPObjectBuilder<Envelope>
SOAP Envelope builder.private final org.slf4j.Logger
Class logger. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
buildAndStoreSOAPMessage
(XMLObject payload) Builds the SOAP message to be encoded.protected void
doEncode()
Performs the encoding logic.protected int
Get the HTTP response status code to return.protected XMLObject
Get the XMLObject which will be logged as the protocol message.protected String
Determine the value of the SOAPAction HTTP header to send.protected Envelope
Retrieve the previously stored SOAP envelope from the message context.void
This method should prepare the message context by creating and populating any binding-specific data structures required in the MessageContext, prior to actually encoding.protected void
This implementation performs the following actions on the context'sHttpServletResponse
:protected void
storeSOAPEnvelope
(Envelope envelope) Store the constructed SOAP envelope in the message context for later encoding.Methods inherited from class org.opensaml.messaging.encoder.servlet.BaseHttpServletResponseXMLMessageEncoder
encode, logEncodedMessage, marshallMessage
Methods inherited from class org.opensaml.messaging.encoder.servlet.AbstractHttpServletResponseMessageEncoder
doDestroy, doInitialize, getHttpServletResponse, setHttpServletResponse
Methods inherited from class org.opensaml.messaging.encoder.AbstractMessageEncoder
getMessageContext, setMessageContext
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
Methods inherited from interface org.opensaml.messaging.encoder.MessageEncoder
setMessageContext
-
Field Details
-
log
private final org.slf4j.Logger logClass logger. -
envBuilder
SOAP Envelope builder. -
bodyBuilder
SOAP Body builder.
-
-
Constructor Details
-
HTTPSOAP11Encoder
public HTTPSOAP11Encoder()Constructor.
-
-
Method Details
-
prepareContext
This method should prepare the message context by creating and populating any binding-specific data structures required in the MessageContext, prior to actually encoding.This method should be called after the MessageContext has been set, and before any binding-specific Handler or HandlerChains are invoked.
Example: For a SOAP encoder, this method would create and store the basic SOAP Envelope structure in the message context, so that Handlers that are invoked have a place to which to add headers.
This method may be a no-op if not required by the binding, or if the message type of the context implies that the binding-specific structures have already been created elsewhere (e.g. message-oriented code where the calling code already knows its SOAP, and is operating on the raw SOAP envelope anyway).
. Default implementation is a no-op.- Specified by:
prepareContext
in interfaceMessageEncoder
- Overrides:
prepareContext
in classAbstractMessageEncoder
- Throws:
MessageEncodingException
- if there is a problem preparing the message context for encoding
-
doEncode
Performs the encoding logic. By the time this is called, this encoder has already been initialized and checked to ensure that it has not been destroyed.- Specified by:
doEncode
in classAbstractMessageEncoder
- Throws:
MessageEncodingException
- thrown if there is a problem encoding the message
-
storeSOAPEnvelope
Store the constructed SOAP envelope in the message context for later encoding.- Parameters:
envelope
- the SOAP envelope
-
getSOAPEnvelope
Retrieve the previously stored SOAP envelope from the message context.- Returns:
- the previously stored SOAP envelope
-
buildAndStoreSOAPMessage
Builds the SOAP message to be encoded.- Parameters:
payload
- body of the SOAP message
-
prepareHttpServletResponse
This implementation performs the following actions on the context's
HttpServletResponse
:- Adds the HTTP header: "Cache-control: no-cache, no-store"
- Adds the HTTP header: "Pragma: no-cache"
- Sets the character encoding to: "UTF-8"
- Sets the content type to: "text/xml"
- Sets the SOAPAction HTTP header the value returned by
getSOAPAction()
, if that returns non-null.
Subclasses should NOT set the SOAPAction HTTP header in this method. Instead, they should override the method
getSOAPAction()
.- Throws:
MessageEncodingException
- thrown if there is a problem preprocessing the transport
-
getSOAPAction
Determine the value of the SOAPAction HTTP header to send.The default behavior is to return the value of the SOAP Envelope's WS-Addressing Action header, if present.
- Returns:
- a SOAPAction HTTP header URI value
-
getHTTPResponseStatusCode
protected int getHTTPResponseStatusCode()Get the HTTP response status code to return.- Returns:
- the HTTP response status code
-
getMessageToLog
Get the XMLObject which will be logged as the protocol message.- Overrides:
getMessageToLog
in classBaseHttpServletResponseXMLMessageEncoder
- Returns:
- the XMLObject message considered to be the protocol message for logging purposes
-