org.opensaml.ws.soap.client.http
Class HttpSOAPClient

java.lang.Object
  extended by org.opensaml.ws.soap.client.http.HttpSOAPClient
All Implemented Interfaces:
SOAPClient

@ThreadSafe
public class HttpSOAPClient
extends Object
implements SOAPClient

SOAP client that uses HTTP as the underlying transport and POST as the binding. NOTE this client does not provide access to a InTransport or OutTransport. Therefore any SecurityPolicy which operates on these object can not be used with this client.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opensaml.ws.soap.client.SOAPClient
SOAPClient.SOAPRequestParameters
 
Constructor Summary
HttpSOAPClient(org.apache.commons.httpclient.HttpClient client, org.opensaml.xml.parse.ParserPool parser)
          Constructor.
 
Method Summary
protected  org.apache.commons.httpclient.methods.PostMethod createPostMethod(String endpoint, HttpSOAPRequestParameters requestParams, Envelope message)
          Creates the post method used to send the SOAP request.
protected  org.apache.commons.httpclient.methods.RequestEntity createRequestEntity(Envelope message, Charset charset)
          Creates the request entity that makes up the POST message body.
protected  void evaluateSecurityPolicy(SOAPMessageContext messageContext)
          Evaluates the security policy associated with the given message context.
protected  void processFaultResponse(org.apache.commons.httpclient.methods.PostMethod httpMethod, SOAPMessageContext messageContext)
          Processes a SOAP fault, as determined by an HTTP 500 status code, response.
protected  void processSuccessfulResponse(org.apache.commons.httpclient.methods.PostMethod httpMethod, SOAPMessageContext messageContext)
          Processes a successful, as determined by an HTTP 200 status code, response.
 void send(String endpoint, SOAPMessageContext messageContext)
          Sends a message and waits for a response.
protected  Envelope unmarshallResponse(InputStream responseStream)
          Unmarshalls the incoming response from a POST request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpSOAPClient

public HttpSOAPClient(org.apache.commons.httpclient.HttpClient client,
                      org.opensaml.xml.parse.ParserPool parser)
Constructor.

Parameters:
client - Client used to make outbound HTTP requests. This client SHOULD employ a MultiThreadedHttpConnectionManager and may be shared with other objects.
parser - pool of XML parsers used to parse incoming responses
Method Detail

send

public void send(String endpoint,
                 SOAPMessageContext messageContext)
          throws SOAPException,
                 org.opensaml.xml.security.SecurityException
Sends a message and waits for a response.

Specified by:
send in interface SOAPClient
Parameters:
endpoint - the endpoint to which to send the message
messageContext - the message context containing the outbound SOAP message
Throws:
SOAPClientException - thrown if there is a problem sending the message or receiving the response or if the response is a SOAP fault
org.opensaml.xml.security.SecurityException - thrown if the response does not meet any security policy associated with the message context
SOAPException

createPostMethod

protected org.apache.commons.httpclient.methods.PostMethod createPostMethod(String endpoint,
                                                                            HttpSOAPRequestParameters requestParams,
                                                                            Envelope message)
                                                                     throws SOAPClientException
Creates the post method used to send the SOAP request.

Parameters:
endpoint - endpoint to which the message is sent
requestParams - HTTP request parameters
message - message to be sent
Returns:
the post method to be used to send this message
Throws:
SOAPClientException - thrown if the message could not be marshalled

createRequestEntity

protected org.apache.commons.httpclient.methods.RequestEntity createRequestEntity(Envelope message,
                                                                                  Charset charset)
                                                                           throws SOAPClientException
Creates the request entity that makes up the POST message body.

Parameters:
message - message to be sent
charset - character set used for the message
Returns:
request entity that makes up the POST message body
Throws:
SOAPClientException - thrown if the message could not be marshalled

processSuccessfulResponse

protected void processSuccessfulResponse(org.apache.commons.httpclient.methods.PostMethod httpMethod,
                                         SOAPMessageContext messageContext)
                                  throws SOAPClientException
Processes a successful, as determined by an HTTP 200 status code, response.

Parameters:
httpMethod - the HTTP method used to send the request and receive the response
messageContext - current messages context
Throws:
SOAPClientException - thrown if there is a problem reading the response from the PostMethod

processFaultResponse

protected void processFaultResponse(org.apache.commons.httpclient.methods.PostMethod httpMethod,
                                    SOAPMessageContext messageContext)
                             throws SOAPClientException,
                                    SOAPFaultException
Processes a SOAP fault, as determined by an HTTP 500 status code, response.

Parameters:
httpMethod - the HTTP method used to send the request and receive the response
messageContext - current messages context
Throws:
SOAPClientException - thrown if the response can not be read from the PostMethod
SOAPFaultException - an exception containing the SOAP fault

unmarshallResponse

protected Envelope unmarshallResponse(InputStream responseStream)
                               throws SOAPClientException
Unmarshalls the incoming response from a POST request.

Parameters:
responseStream - input stream bearing the response
Returns:
the response
Throws:
SOAPClientException - thrown if the incoming response can not be unmarshalled into an Envelope

evaluateSecurityPolicy

protected void evaluateSecurityPolicy(SOAPMessageContext messageContext)
                               throws SOAPClientException
Evaluates the security policy associated with the given message context. If no policy resolver is registered or no policy is located during the resolution process then no policy is evaluated. Note that neither the inbound or outbound message transport is available.

Parameters:
messageContext - current message context
Throws:
SOAPClientException - thrown if there is a problem resolving or evaluating a security policy


Copyright © 2006-2013 Internet2. All Rights Reserved.