It depends a little on what you use for SOAP, and if you want the server or client to register.
I know that in Axis2 you can use this to get it
MessageContext msgContext = MessageContext.getCurrentMessageContext();
if (msgContext != null) {
return msgContext.getEnvelope().getBody().toString();
}
source
share