throw new IllegalStateException("No message context available for sending message");
}
if (!m_exchangeCtx.getCurrentMessageContext().isOutbound()) {
throw new IllegalStateException("Cannot send message when current message context is inbound");
}
OutContext context = (OutContext) m_exchangeCtx.getCurrentMessageContext();
SoapWriter soapWriter = new SoapWriter(conn);
boolean requestCompleted = false;
try {
logger.debug("Starting send message");
soapWriter.startMessage(m_encodingStyle);
IXMLWriter xmlWriter = soapWriter.getWriter();
if (context.hasHandlers(SoapPhase.HEADER)) {
soapWriter.startHeader();
context.invokeHandlers(SoapPhase.HEADER, xmlWriter);
soapWriter.endHeader();
}
soapWriter.startBody();
context.invokeBodyWriter(xmlWriter);
logger.debug("Ending send message body");
soapWriter.endBody();
soapWriter.sendMessageCompletely();
logger.debug("Message sent");
requestCompleted = true;