code: private HttpRequest createHttpRequest(MessageContext msgContext)
        throws SOAPException, IOException {
      Message requestMessage =
          Preconditions.checkNotNull(
              msgContext.getRequestMessage(), "Null request message on message context");
      
      // Construct the output stream.
      String contentType = requestMessage.getContentType(msgContext.getSOAPConstants());
      ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE);
  
      if (msgContext.isPropertyTrue(HTTPConstants.MC_GZIP_REQUEST)) {
        logger.debug("Compressing request");
        try (GZIPOutputStream gzipOs = new GZIPOutputStream(bos, BUFFER_SIZE)) {
          requestMessage.writeTo(gzipOs);
        }
      } else {
        logger.debug("Not compressing request");
        requestMessage.writeTo(bos);
      }
  
      HttpRequest httpRequest =
          requestFactory.buildPostRequest(
              new GenericUrl(msgContext.getStrProp(MessageContext.TRANS_URL)),
              new ByteArrayContent(contentType, bos.toByteArray()));
  
      int timeoutMillis = msgContext.getTimeout();
      if (timeoutMillis >= 0) {
        logger.debug("Setting read and connect timeout to {} millis", timeoutMillis);
        // These are not the same, but MessageContext has only one definition of timeout.
        httpRequest.setReadTimeout(timeoutMillis);
        httpRequest.setConnectTimeout(timeoutMillis);
      }
  
      // Copy the request headers from the message context to the post request.
      setHttpRequestHeaders(msgContext, httpRequest);
  
      return httpRequest;
    }
docs: Creates an HTTP request based on the message context.
  
  @param msgContext the Axis message context
  @return a new {@link HttpRequest} with content and headers populated