I'm trying to consume a third part Web Service using JAX-WS (com.sun.xml.ws.jaxws-rt, version 2.2.10). In all my tests, the XML declaration <?xml version="1.0" ?>
is automatically sent.
Is it possible to remove this? I tried to put javax.xml.soap.SOAPMessage.WRITE_XML_DECLARATION as false in the request context (obtained through javax.xml.ws.BindingProvider), but it has no effects.
Before someone asks, remove the XML declaration from request is required by the WS owner.
Thanks.
I will answer my own question: after many hours of researching, readings and frustrated attempts, I think removing XML declaration with JAXWS is just impossible.
So, I decided to try with CFX as WS provider. I just put the cxf-rt-frontend-jaxws module in project and the comunication works fine, without the XML declaration by default.
[edited] More details could be seen here: https://brunozambiazi.wordpress.com/2015/12/18/removing-xml-declaration-in-ws-request/