}
ChannelContext channelContext = null;
final WSConnectionManager wsConnectionManager = WSConnectionManager.getInstance();
try {
final ContentType ct = defaultCodec.getStaticContentType(packet);
channelContext = clientTransport.getConnectionContext();
if (channelContext != null) {
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, MessagesMessages.WSTCP_1002_TCP_SERVICE_TP_PROCESS_TRANSPORT_REUSE());
}
wsConnectionManager.lockConnection(channelContext.getConnectionSession());
} else {
// Initiate new connection session
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, MessagesMessages.WSTCP_1003_TCP_SERVICE_TP_PROCESS_TRANSPORT_CREATE());
}
final ConnectionSession connectionSession =
(ConnectionSession) packet.invocationProperties.get(TCPConstants.TCP_SESSION);
channelContext = connectionSession.getServiceChannelContext();
clientTransport.setup(channelContext);
}
clientTransport.setContentType(ct.getContentType());
/* write transport SOAPAction header if required
* in HTTP this param is sent as HTTP header, in SOAP/TCP
* it is part of content-type (similar to SOAP 1.2) */
writeTransportSOAPActionHeaderIfRequired(channelContext, ct, packet);
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, MessagesMessages.WSTCP_1004_TCP_SERVICE_TP_PROCESS_ENCODE(ct.getContentType()));
}
defaultCodec.encode(packet, clientTransport.openOutputStream());
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, MessagesMessages.WSTCP_1005_TCP_SERVICE_TP_PROCESS_SEND());