Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4475

LoggingInInterceptor throws when pretty printing MTOM messages

    XMLWordPrintableJSON

Details

    • Unknown

    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.

      Attachments

        Activity

          People

            ffang Freeman Yue Fang
            piepera aaron pieper
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: