Details
Description
I'm using CXF to implement some SOAP web services. I've added a LoggingInInterceptor to my interceptor chain through an XML configuration file so that incoming SOAP messages will be logged. My configuration file looks like this:
--------------------
<jaxws:endpoint id="foo" implementor="#fooServiceImpl" address="/FOO">
<!-- snip... -->
<jaxws:inInterceptors>
<ref bean="loggingInInterceptor"/>
<!-- snip... -->
</jaxws:endpoint>
<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor">
<property name="prettyLogging" value="true"/>
</bean>
--------------------
This logging setup works OK for non-MTOM messages. But when an incoming message uses MTOM, I get an error:
--------------------
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:425)
at net.sf.saxon.event.Sender.send(Sender.java:178)
at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:39)
at org.apache.cxf.interceptor.AbstractLoggingInterceptor.writePayload(AbstractLoggingInterceptor.java:158)
at org.apache.cxf.interceptor.LoggingInInterceptor.logging(LoggingInInterceptor.java:152)
--------------------
The pretty-printing logic in AbstractLoggingInterceptor requires the message to be well-formed XML, but MTOM messages have various non-XML headers and boundaries. The "content not allowed in prolog" comes from AbstractLoggingInterceptor trying to parse one of these boundaries as XML.
I've been able to work around this problem by disabling pretty printing.