try {
SOAPMessageContext soapMsgCtx = (SOAPMessageContext) messageContext;
SOAPMessage soapMsg = soapMsgCtx.getMessage();
SOAPPart soapPart = soapMsg.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
soapEnvelope.getBody().detachNode();
SOAPBody soapBody = soapEnvelope.addBody();
SOAPBodyElement echoElement = soapBody.addBodyElement(soapEnvelope.createName("echo", "ns1", "http://soapinterop.org/"));
SOAPElement argElement = echoElement.addChildElement("arg0");
argElement = argElement.addAttribute(soapEnvelope.createName("type", "xsi", "http://www.w3.org/2001/XMLSchema-instance"), "xsd:string");
argElement.addTextNode("my echo string");
} catch (Exception e) {
e.printStackTrace();
}
return true;