You can use the incoming interceptor on the server and / or the outgoing client and clear the xml before the decoupling occurs.
Incoming phases
------------------------------------------------------------------------------
|Phase | Functions |
------------------------------------------------------------------------------
|RECEIVE | Transport level processing |
|(PRE/USER/POST)_STREAM | Stream level processing/transformations |
|READ | | This is where header reading typically occurs |
|(PRE/USER/POST)_PROTOCOL | Protocol processing, such as JAX-WS SOAP handlers|
|UNMARSHAL | Unmarshalling of the request |
|(PRE/USER/POST)_LOGICAL | Processing of the umarshalled request |
|PRE_INVOKE | Pre invocation actions |
|INVOKE | Invocation of the service |
|POST_INVOKE | Invocation of the outgoing chain if there is one |
------------------------------------------------------------------------------
Outgoing phases
|Phase | Functions |
|SETUP | Any set up for the following phases |
|(PRE/USER/POST)_LOGICAL | Processing of objects about to marshalled |
|PREPARE_SEND | Opening of the connection |
|PRE_STREAM | |
|PRE_PROTOCOL | Misc protocol actions |
|WRITE | Writing of the protocol message, such as the SOAP Envelope|
|MARSHAL | Marshalling of the objects |
|(USER/POST)_PROTOCOL | Processing of the protocol message |
|(USER/POST)_STREAM | Processing of the byte level message |
|SEND | |
, () ().
, inteceptors.
:
( SO)
package tmp;
public class MyWstxOutputFatory extends WstxOutputFactory {
public MyWstxOutputFatory() {
setProperty(com.ctc.wstx.api.WstxOutputProperties.P_OUTPUT_INVALID_CHAR_HANDLER,
new
com.ctc.wstx.api.InvalidCharHandler.ReplacingHandler(' '));
}
}
jaxws
<bean id="outStaxFactory" class="tmp.MyWstxOutputFatory"/>
...
<jaxws:properties>
<entry key="javax.xml.stream.XMLOutputFactory">
<ref bean="outStaxFactory"/>
</entry>
</jaxws:properties>
...