Package org.opensaml.soap.client.soap11.decoder.http.impl

# Class HttpClientResponseSOAP11Decoder

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
org.opensaml.messaging.decoder.AbstractMessageDecoder
org.opensaml.messaging.decoder.httpclient.AbstractHttpClientResponseMessageDecoder
org.opensaml.messaging.decoder.httpclient.BaseHttpClientResponseXMLMessageDecoder
org.opensaml.soap.client.soap11.decoder.http.impl.HttpClientResponseSOAP11Decoder

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `InitializableComponent`, `UnmodifiableComponent`, `HttpClientResponseMessageDecoder`, `MessageDecoder`

Direct Known Subclasses:
  `HttpClientResponseSOAP11Decoder`, `HttpClientResponseSOAP11Decoder`

public class HttpClientResponseSOAP11Decoder extends BaseHttpClientResponseXMLMessageDecoder
Basic SOAP 1.1 decoder for HTTP transport via an HttpClient's `ClassicHttpResponse`.

This decoder takes a mandatory `MessageHandler` instance which is used to populate the message that is returned as the `MessageContext.getMessage()`.

A SOAP message oriented message exchange style might just populate the Envelope as the message. An application-specific payload-oriented message exchange would handle a specific type of payload structure.

## Field Summary

Fields
Modifier and Type
Field
Description
`private MessageHandler`
`bodyHandler`
Message handler to use in processing the message body.
`private final org.slf4j.Logger`
`log`
Logger.

### Fields inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder

`BASE_PROTOCOL_MESSAGE_LOGGER_CATEGORY`

## Constructor Summary

Constructors
Constructor
Description
`HttpClientResponseSOAP11Decoder()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected MessageDecodingException`
`buildFaultException(org.apache.hc.core5.http.ClassicHttpResponse response)`
Build an exception by processing a fault response, i.e.
`protected void`
`doDecode()`
Performs the decoding logic.
`protected void`
`doInitialize()`
`MessageHandler`
`getBodyHandler()`
Get the configured body handler MessageHandler.
`protected Fault`
`getFault(Envelope soapMessage)`
Return the Fault element from the SOAP message, if any.
`protected XMLObject`
`getMessageToLog()`
Get the XMLObject which will be logged as the protocol message.
`protected void`
`processSuccessResponse(org.apache.hc.core5.http.ClassicHttpResponse httpResponse, SOAP11Context soapContext)`
Process a successful response, i.e.
`void`
`setBodyHandler(MessageHandler newBodyHandler)`
Set the configured body handler MessageHandler.
`protected InputStream`
`wrapInputStreamForSizeLimitEnforcement(InputStream responseIn)`
Check whether message size limit enforcement is enabled and wrap the passed input stream appropriately.

### Methods inherited from class org.opensaml.messaging.decoder.httpclient.BaseHttpClientResponseXMLMessageDecoder

`decode, getParserPool, serializeMessageForLogging, setParserPool, unmarshallMessage`

### Methods inherited from class org.opensaml.messaging.decoder.httpclient.AbstractHttpClientResponseMessageDecoder

`getHttpResponse, setHttpResponse`

### Methods inherited from class org.opensaml.messaging.decoder.AbstractMessageDecoder

`getMessageContext, getProtocolMessageLogger, getProtocolMessageLoggerSubCategory, logDecodedMessage, setMessageContext, setProtocolMessageLoggerSubCategory`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, 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.shared.component.DestructableComponent

`destroy, isDestroyed`

### Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

`initialize, isInitialized`

### Methods inherited from interface org.opensaml.messaging.decoder.MessageDecoder

`getMessageContext`

## Field Details

### log

@Nonnull private final org.slf4j.Logger log
Logger.

### bodyHandler

@NonnullAfterInit private MessageHandler bodyHandler
Message handler to use in processing the message body.

## Constructor Details

### HttpClientResponseSOAP11Decoder

public HttpClientResponseSOAP11Decoder()
Constructor.

## Method Details

### getBodyHandler

@NonnullAfterInit public MessageHandler getBodyHandler()
Get the configured body handler MessageHandler.

Returns:
  Returns the bodyHandler.

### setBodyHandler

public void setBodyHandler(@Nonnull MessageHandler newBodyHandler)
Set the configured body handler MessageHandler.

Parameters:
  `newBodyHandler` - The bodyHandler to set.

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `BaseHttpClientResponseXMLMessageDecoder`
Throws:
  `ComponentInitializationException`

### doDecode

protected void doDecode() throws MessageDecodingException
Performs the decoding logic. By the time this is called, this decoder has already been initialized and checked to ensure that it has not been destroyed.

Specified by:
  `doDecode` in class `AbstractMessageDecoder`
Throws:
  `MessageDecodingException` - thrown if there is a problem decoding the message

### processSuccessResponse

protected void processSuccessResponse(@Nonnull org.apache.hc.core5.http.ClassicHttpResponse httpResponse, @Nonnull SOAP11Context soapContext) throws MessageDecodingException, IOException
Process a successful response, i.e. one where the HTTP response code was 200.

Parameters:
  `httpResponse` - the HTTP client response
  `soapContext` - the SOAP11Context instance
Throws:
  `MessageDecodingException` - if message can not be unmarshalled
  `IOException` - if there is a problem with the response entity input stream

### buildFaultException

@Nonnull protected MessageDecodingException buildFaultException(@Nonnull org.apache.hc.core5.http.ClassicHttpResponse response) throws MessageDecodingException, IOException
Build an exception by processing a fault response, i.e. one where the HTTP response code was 500.

Parameters:
  `response` - the HTTP client response
Returns:
  the message decoding exception representing the SOAP fault
Throws:
  `MessageDecodingException` - if message can not be unmarshalled
  `IOException` - if there is a problem with the response entity input stream

### wrapInputStreamForSizeLimitEnforcement

@Nonnull protected InputStream wrapInputStreamForSizeLimitEnforcement(@Nonnull InputStream responseIn) throws MessageDecodingException
Check whether message size limit enforcement is enabled and wrap the passed input stream appropriately.

Parameters:
  `responseIn` - the response input stream being process
Returns:
  the effective input stream to use in message processing
Throws:
  `MessageDecodingException` - if size limit enforcement is enabled, but the size limit is not available

### getFault

@Nullable protected Fault getFault(@Nonnull Envelope soapMessage)
Return the Fault element from the SOAP message, if any.

Parameters:
  `soapMessage` - the SOAP 1.1. Envelope being processed
Returns:
  the first Fault element found, or null

### getMessageToLog

@Nullable protected XMLObject getMessageToLog()
Get the XMLObject which will be logged as the protocol message.

Overrides:
  `getMessageToLog` in class `AbstractMessageDecoder`
Returns:
  the XMLObject message considered to be the protocol message for logging purposes