@ThreadSafe public class HttpSOAPClient extends net.shibboleth.utilities.java.support.component.AbstractInitializableComponent implements SOAPClient
SOAPClient.SOAPRequestParameters
Modifier and Type | Field and Description |
---|---|
private org.apache.http.client.HttpClient |
httpClient
HTTP client used to send requests and receive responses.
|
private org.slf4j.Logger |
log
Class logger.
|
private net.shibboleth.utilities.java.support.xml.ParserPool |
parserPool
Pool of XML parsers used to parser incoming responses.
|
private com.google.common.base.Function<MessageContext,SOAP11Context> |
soap11ContextLookupStrategy
Strategy used to look up the
SOAP11Context associated with the
outbound message context. |
private com.google.common.base.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 org.apache.http.client.methods.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.
|
com.google.common.base.Function<MessageContext,SOAP11Context> |
getSOAP11ContextLookupStrategy()
Get the strategy used to look up the
SOAP11Context associated with the outbound message
context. |
com.google.common.base.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(org.apache.http.client.HttpClient client)
Set the client used to make outbound HTTP requests.
|
void |
setParserPool(net.shibboleth.utilities.java.support.xml.ParserPool parser)
Set the pool of XML parsers used to parse incoming responses.
|
void |
setSOAP11ContextLookupStrategy(com.google.common.base.Function<MessageContext,SOAP11Context> strategy)
Set the strategy used to look up the
SOAP11Context associated with the outbound message
context. |
void |
setSOAPClientContextLookupStrategy(com.google.common.base.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.
|
@Nonnull private final org.slf4j.Logger log
@NonnullAfterInit private org.apache.http.client.HttpClient httpClient
@NonnullAfterInit private net.shibboleth.utilities.java.support.xml.ParserPool parserPool
@Nonnull private com.google.common.base.Function<MessageContext,SOAPClientContext> soapClientContextLookupStrategy
SOAPClientContext
associated with the
outbound message context.@Nonnull private com.google.common.base.Function<MessageContext,SOAP11Context> soap11ContextLookupStrategy
SOAP11Context
associated with the
outbound message context.protected void doInitialize() throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize
in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.utilities.java.support.component.ComponentInitializationException
public void setHttpClient(@Nonnull org.apache.http.client.HttpClient client)
This client SHOULD employ a thread-safe HttpClient
and may be shared with other objects.
client
- client objectpublic void setParserPool(@Nonnull net.shibboleth.utilities.java.support.xml.ParserPool parser)
parser
- parser pool@Nonnull public com.google.common.base.Function<MessageContext,SOAPClientContext> getSOAPClientContextLookupStrategy()
SOAPClientContext
associated with the outbound message
context.SOAPClientContext
associated with the outbound message
contextpublic void setSOAPClientContextLookupStrategy(@Nonnull com.google.common.base.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 com.google.common.base.Function<MessageContext,SOAP11Context> getSOAP11ContextLookupStrategy()
SOAP11Context
associated with the outbound message
context.SOAP11Context
associated with the outbound message
contextpublic void setSOAP11ContextLookupStrategy(@Nonnull com.google.common.base.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 SOAPClient
endpoint
- 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 org.apache.http.client.methods.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 HttpPost
protected 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 HttpPost
SOAPFaultException
- 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 Envelope
protected void evaluateSecurityPolicy(SOAPClientContext messageContext) throws SOAPClientException
messageContext
- current message contextSOAPClientException
- thrown if there is a problem resolving or evaluating a security policyCopyright © 1999–2020 Shibboleth Consortium. All rights reserved.