}
header2.append(" ");
header2.append(http10 ? HTTPConstants.HEADER_PROTOCOL_10 : HTTPConstants.HEADER_PROTOCOL_11).append(
"\r\n");
MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
if (posting)
{
String contentType;
if (mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE) != null)
{
contentType = mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0];
}
else
{
contentType = reqMessage.getContentType(msgContext.getSOAPConstants());
}
header2.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(contentType).append("\r\n");
}
header2.append(ACCEPT_HEADERS).append(HTTPConstants.HEADER_HOST)
// used for virtual connections
.append(": ")
.append(host)
.append((port == -1) ? ("") : (":" + port))
.append("\r\n")
.append(CACHE_HEADERS)
.append(HTTPConstants.HEADER_SOAP_ACTION)
// The SOAP action.
.append(": \"")
.append(action)
.append("\"\r\n");
if (posting)
{
if (!httpChunkStream)
{
// Content length MUST be sent on HTTP 1.0 requests.
header2.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(": ").append(
reqMessage.getContentLength()).append("\r\n");
}
else
{
// Do http chunking.
header2.append(CHUNKED_HEADER);
}
}
// Transfer MIME headers of SOAPMessage to HTTP headers.
if (mimeHeaders != null)
{
for (Iterator i = mimeHeaders.getAllHeaders(); i.hasNext();)
{
MimeHeader mimeHeader = (MimeHeader)i.next();
String headerName = mimeHeader.getName();
if (headerName.equals(HTTPConstants.HEADER_CONTENT_TYPE)
|| headerName.equals(HTTPConstants.HEADER_SOAP_ACTION))