aaron pieper created CXF-4475:
---------------------------------

             Summary: LoggingInInterceptor throws when pretty printing MTOM 
messages
                 Key: CXF-4475
                 URL: https://issues.apache.org/jira/browse/CXF-4475
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.6.1
            Reporter: aaron pieper
            Priority: Minor


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to