At work, we've run into the "invalid white space characters     in text
to output" problem. I've been able to deal with these characters using
the wrapped XMLStreamWriter idea in this discussion:
http://old.nabble.com/WSS4JOutInterceptor-and-%22Invalid-white-space-cha
racter-%280x1%29-in-text--to-output%22-td26675746.html

However, there is one nagging concern. While writing the response, when
the invalid white space character was encountered, CXF dumped a Fault
message directly in the response it was writing and returned. We're
using CXF 2.1.9 and we get something like this as a response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
  <soap:Body>
    <ns1:getResponse
      xmlns:ns1="http://mycompany.com/webservices/MyService";>
      <ns1:data>
        <ns2:info
          xmlns:ns2="http://info.mycompany.com";>
          <ns2:name>ABC</ns2:name>
          <ns2:detail>
            <soap:Fault>
              <faultcode>soap:Server</faultcode>
              <faultstring>org.apache.cxf.aegis.DatabindingException:
                Error writing document.. Nested exception is
                com.ctc.wstx.exc.WstxIOException: Invalid white space
character
                (0xb) in text to output</faultstring>
            </soap:Fault>
          </ns2:detail>
        </ns2:info>
      </ns1:data>
    </ns1:getResponse>
  </soap:Body>
</soap:Envelope>

The HTTP status is 200. There is no way for a service client to know
that something went wrong, except perhaps to do a deep inspection of the
message. Also, the response isn't a valid response. I'm guessing that
the reason for this is that CXF is writing the response directly to the
output stream. Is there a way to configure CXF so that it writes and
validates the response in memory before writing to the output stream?

Thanks,

Marc

Reply via email to