@ThreadSafe public class HttpSOAPClient extends AbstractInitializableComponent implements SOAPClient
SOAPClient.SOAPRequestParameters| Modifier and Type | Field and Description |
|---|---|
private HttpClient |
httpClient
HTTP client used to send requests and receive responses.
|
private org.slf4j.Logger |
log
Class logger.
|
private ParserPool |
parserPool
Pool of XML parsers used to parser incoming responses.
|
private Function<MessageContext,SOAP11Context> |
soap11ContextLookupStrategy
Strategy used to look up the
SOAP11Context associated with the
outbound message context. |
private Function<MessageContext,SOAPClientContext> |
soapClientContextLookupStrategy
Strategy used to look up the
SOAPClientContext associated with the
outbound message context. |
| Constructor and Description |
|---|
HttpSOAPClient()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected HttpPost |
createPostMethod(String endpoint,
HttpSOAPRequestParameters requestParams,
Envelope message)
Create the post method used to send the SOAP request.
|
protected org.apache.http.HttpEntity |
createRequestEntity(Envelope message,
Charset charset)
Create the request entity that makes up the POST message body.
|
protected void |
doInitialize() |
protected void |
evaluateSecurityPolicy(SOAPClientContext messageContext)
Evaluates the security policy associated with the given message context.
|
Function<MessageContext,SOAP11Context> |
getSOAP11ContextLookupStrategy()
Get the strategy used to look up the
SOAP11Context associated with the outbound message
context. |
Function<MessageContext,SOAPClientContext> |
getSOAPClientContextLookupStrategy()
Get the strategy used to look up the
SOAPClientContext associated with the outbound message
context. |
protected void |
processFaultResponse(org.apache.http.HttpResponse httpResponse,
InOutOperationContext context)
Process a SOAP fault, as determined by an HTTP 500 status code, response.
|
protected void |
processSuccessfulResponse(org.apache.http.HttpResponse httpResponse,
InOutOperationContext context)
Process a successful, as determined by an HTTP 200 status code, response.
|
void |
send(String endpoint,
InOutOperationContext context)
Sends a message and waits for a response.
|
void |
setHttpClient(HttpClient client)
Set the client used to make outbound HTTP requests.
|
void |
setParserPool(ParserPool parser)
Set the pool of XML parsers used to parse incoming responses.
|
void |
setSOAP11ContextLookupStrategy(Function<MessageContext,SOAP11Context> strategy)
Set the strategy used to look up the
SOAP11Context associated with the outbound message
context. |
void |
setSOAPClientContextLookupStrategy(Function<MessageContext,SOAPClientContext> strategy)
Set the strategy used to look up the
SOAPClientContext associated with the outbound message
context. |
protected Envelope |
unmarshallResponse(InputStream responseStream)
Unmarshall the incoming response from a POST request.
|
destroy, doDestroy, initialize, isDestroyed, isInitialized@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private HttpClient httpClient
@NonnullAfterInit private ParserPool parserPool
@Nonnull private Function<MessageContext,SOAPClientContext> soapClientContextLookupStrategy
SOAPClientContext associated with the
outbound message context.@Nonnull private Function<MessageContext,SOAP11Context> soap11ContextLookupStrategy
SOAP11Context associated with the
outbound message context.protected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractInitializableComponentComponentInitializationExceptionpublic void setHttpClient(@Nonnull HttpClient client)
This client SHOULD employ a thread-safe HttpClient and may be shared with other objects.
client - client objectpublic void setParserPool(@Nonnull ParserPool parser)
parser - parser pool@Nonnull public Function<MessageContext,SOAPClientContext> getSOAPClientContextLookupStrategy()
SOAPClientContext associated with the outbound message
context.SOAPClientContext associated with the outbound message
contextpublic void setSOAPClientContextLookupStrategy(@Nonnull Function<MessageContext,SOAPClientContext> strategy)
SOAPClientContext associated with the outbound message
context.strategy - strategy used to look up the SOAPClientContext associated with the outbound
message context@Nonnull public Function<MessageContext,SOAP11Context> getSOAP11ContextLookupStrategy()
SOAP11Context associated with the outbound message
context.SOAP11Context associated with the outbound message
contextpublic void setSOAP11ContextLookupStrategy(@Nonnull Function<MessageContext,SOAP11Context> strategy)
SOAP11Context associated with the outbound message
context.strategy - strategy used to look up the SOAP11Context associated with the outbound
message contextpublic void send(@Nonnull @NotEmpty String endpoint, @Nonnull InOutOperationContext context) throws SOAPException, org.opensaml.security.SecurityException
send in interface SOAPClientendpoint - the endpoint to which to send the messagecontext - the operation context containing the outbound SOAP messageSOAPException - thrown if there is a problem sending the message or receiving the response or if the
response is a SOAP faultorg.opensaml.security.SecurityException - thrown if the response does not meet any security policy associated with the message
contextprotected HttpPost createPostMethod(@Nonnull @NotEmpty String endpoint, @Nullable HttpSOAPRequestParameters requestParams, @Nonnull Envelope message) throws SOAPClientException
endpoint - endpoint to which the message is sentrequestParams - HTTP request parametersmessage - message to be sentSOAPClientException - thrown if the message could not be marshalledprotected org.apache.http.HttpEntity createRequestEntity(@Nonnull Envelope message, @Nullable Charset charset) throws SOAPClientException
message - message to be sentcharset - character set used for the messageSOAPClientException - thrown if the message could not be marshalledprotected void processSuccessfulResponse(@Nonnull org.apache.http.HttpResponse httpResponse, @Nonnull InOutOperationContext context) throws SOAPClientException
httpResponse - the HTTP responsecontext - current operation contextSOAPClientException - thrown if there is a problem reading the response from the HttpPostprotected void processFaultResponse(@Nonnull org.apache.http.HttpResponse httpResponse, @Nonnull InOutOperationContext context) throws SOAPClientException, SOAPFaultException
httpResponse - the HTTP responsecontext - current operation contextSOAPClientException - thrown if the response can not be read from the HttpPostSOAPFaultException - an exception containing the SOAP faultprotected Envelope unmarshallResponse(@Nonnull InputStream responseStream) throws SOAPClientException
responseStream - input stream bearing the responseSOAPClientException - thrown if the incoming response can not be unmarshalled into an Envelopeprotected void evaluateSecurityPolicy(SOAPClientContext messageContext) throws SOAPClientException
messageContext - current message contextSOAPClientException - thrown if there is a problem resolving or evaluating a security policyCopyright © 1999–2017 Shibboleth Consortium. All rights reserved.