Class HttpClientRequestSOAP11Encoder

All Implemented Interfaces:
Component, DestructableComponent, InitializableComponent, UnmodifiableComponent, HttpClientRequestMessageEncoder, MessageEncoder
Direct Known Subclasses:
HttpClientRequestSOAP11Encoder, HttpClientRequestSOAP11Encoder

public class HttpClientRequestSOAP11Encoder extends BaseHttpClientRequestXMLMessageEncoder
Basic SOAP 1.1 encoder for HTTP transport via an HttpClient's HttpRequest.
  • Field Details

  • Constructor Details

    • HttpClientRequestSOAP11Encoder

      public HttpClientRequestSOAP11Encoder()
  • Method Details

    • getHttpRequest

      @Nullable public org.apache.http.client.methods.HttpPost getHttpRequest()
      Get the HTTP client request on which to operate.

      This encoder implementation only operates on instances of HttpPost.

      Specified by:
      getHttpRequest in interface HttpClientRequestMessageEncoder
      getHttpRequest in class AbstractHttpClientRequestMessageEncoder
      the HTTP client request
    • setHttpRequest

      public void setHttpRequest(org.apache.http.HttpRequest httpRequest)
      Set the HTTP client request on which to operate.

      This encoder implementation only operates on instances of HttpPost.

      Specified by:
      setHttpRequest in interface HttpClientRequestMessageEncoder
      setHttpRequest in class AbstractHttpClientRequestMessageEncoder
      httpRequest - the HTTP client request
    • prepareContext

      public void prepareContext() throws MessageEncodingException
      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 interface MessageEncoder
      prepareContext in class AbstractMessageEncoder
      MessageEncodingException - if there is a problem preparing the message context for encoding
    • doEncode

      protected void doEncode() throws MessageEncodingException
      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 class AbstractMessageEncoder
      MessageEncodingException - thrown if there is a problem encoding the message
    • createRequestEntity

      protected org.apache.http.HttpEntity createRequestEntity(@Nonnull Envelope message, @Nullable Charset charset) throws MessageEncodingException
      Create the request entity that makes up the POST message body.
      message - message to be sent
      charset - character set used for the message
      request entity that makes up the POST message body
      MessageEncodingException - thrown if the message could not be marshalled
    • storeSOAPEnvelope

      protected void storeSOAPEnvelope(Envelope envelope)
      Store the constructed SOAP envelope in the message context for later encoding.
      envelope - the SOAP envelope
    • getSOAPEnvelope

      protected Envelope getSOAPEnvelope()
      Retrieve the previously stored SOAP envelope from the message context.
      the previously stored SOAP envelope
    • buildAndStoreSOAPMessage

      protected void buildAndStoreSOAPMessage(@Nonnull XMLObject payload)
      Builds the SOAP message to be encoded.
      payload - body of the SOAP message
    • prepareHttpRequest

      protected void prepareHttpRequest() throws MessageEncodingException

      This implementation performs the following actions on the context's HttpRequest:

      1. 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().

      MessageEncodingException - thrown if there is a problem preprocessing the transport
    • getSOAPAction

      protected String 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.

      a SOAPAction HTTP header URI value
    • getMessageToLog

      protected XMLObject getMessageToLog()
      Get the XMLObject which will be logged as the protocol message.
      getMessageToLog in class BaseHttpClientRequestXMLMessageEncoder
      the XMLObject message considered to be the protocol message for logging purposes