Yes there is. This is one of the main goals of the JAX-WS handlers. You will not get the XML payload as raw bytes, but formatted; however, if you want, it's easy to re-include it in raw bytes. Example:
public class MyCustomHandler implements SOAPHandler<SOAPMessageContext> { @Override public boolean handleMessage(SOAPMessageContext context) { SOAPMessage msg = context.getMessage(); SOAPEnvelope env = msg.getSOAPPart().getEnvelope(); SOAPBody body = env.getBody();
You can also use this call:
JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class); Object payload = msg.getPayload(jaxbContext);
Literature:
source share