How to remove empty header from SOAP message?
I am using Spring-WS for consuming Webservice which compains if SOAP envelop has empty header element. I figured out that default SOAPMessage implementation adds one. How can I remove it? Thanks in advance http://docs.oracle.com/javaee/5/tutorial/doc/bnbhr.html : The next line is an empty SOAP header. You could remove it by calling header.detachNode after the getSOAPHeader call. So here is the solution in plain SAAJ: MessageFactory messageFactory = MessageFactory.newInstance("SOAP 1.2 Protocol"); SOAPMessage message = messageFactory.createMessage(); message.getSOAPHeader().detachNode(); //