Spring boot 负载格式Apache CXF SOAP消息

Spring boot 负载格式Apache CXF SOAP消息,spring-boot,soap,cxf,Spring Boot,Soap,Cxf,我有一个在spring boot中创建的SOAP客户端,我正在记录所有SOAP消息,但是新版本的LoggingFeature(org.apache.cxf.ext.logging.LoggingFeature)在一行上显示负载,即使我使用的是prettyLogging,并且这个类的不推荐版本(org.apache.cxf.feature.LoggingFeature)在使用prettyLogging时会格式化负载 当使用我想要的类格式的弃用版本时(随机示例): Payload: <

我有一个在spring boot中创建的SOAP客户端,我正在记录所有SOAP消息,但是新版本的LoggingFeature(org.apache.cxf.ext.logging.LoggingFeature)在一行上显示负载,即使我使用的是prettyLogging,并且这个类的不推荐版本(org.apache.cxf.feature.LoggingFeature)在使用prettyLogging时会格式化负载

当使用我想要的类格式的弃用版本时(随机示例):

    Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Envelope xmlns="URL" xmlns:ns2="URL">
      <Service ID="SERVICE"/>
      <Inquirer ID="ID" CorrelationID="ID" Version="1.0" Timestamp="Timestamp"/>
      <Data Content="xml">
        <ns2:Request>
          <ns2:FILE>ID</ns2:FILE>
          <ns2:ACTION>ACTION</ns2:ACTION>
        </ns2:Request>
      </Data>
      <File>
        <FileDescription ID="ID"/>
      </File>
    </Envelope>
  </soap:Body>
</soap:Envelope>
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Envelope xmlns="URL" xmlns:ns2="URL"><Service ID="SERVICE"/><Inquirer ID="ID" CorrelationID="ID" Version="1.0" Timestamp="Timestamp"/><Data Content="xml"><ns2:Request><ns2:FILE>ID</ns2:FILE>     <ns2:ACTION>ACTION</ns2:ACTION></ns2:Request></Data><File><FileDescription ID="ID"/></File></Envelope></soap:Body></soap:Envelope>
import javax.annotation.PostConstruct;
import org.apache.cxf.ext.logging.AbstractLoggingInterceptor;
import org.apache.cxf.ext.logging.LoggingFeature;
import org.apache.cxf.ext.logging.LoggingInInterceptor;
import org.apache.cxf.ext.logging.LoggingOutInterceptor;
import org.apache.cxf.bus.spring.SpringBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CxfConfig {

    @Autowired
    private SpringBus springBus;

    @PostConstruct
    public void activateLoggingFeature() {
           springBus.getInInterceptors().add(logInInterceptor());
           springBus.getInFaultInterceptors().add(logInInterceptor());
           springBus.getOutInterceptors().add(logOutInterceptor());
           springBus.getOutFaultInterceptors().add(logOutInterceptor());
    }

    @Bean
    public LoggingFeature loggingFeature() {
           LoggingFeature logFeature = new LoggingFeature();
           logFeature.setPrettyLogging(true);
           logFeature.initialize(springBus);
           springBus.getFeatures().add(logFeature);
           return logFeature;
    }

    public AbstractLoggingInterceptor logInInterceptor() {
        LoggingInInterceptor logInInterceptor = new LoggingInInterceptor();
        logInInterceptor.setLimit(-1);
        logInInterceptor.setPrettyLogging(true);
        logInInterceptor.setLogBinary(true);
        logInInterceptor.setLogMultipart(true);
        return logInInterceptor;
    }

    public AbstractLoggingInterceptor logOutInterceptor() {
        LoggingOutInterceptor logOutInterceptor = new LoggingOutInterceptor();
        logOutInterceptor.setPrettyLogging(true);
        logOutInterceptor.setLimit(-1);
        logOutInterceptor.setLogBinary(true);
        logOutInterceptor.setLogMultipart(true);
        return logOutInterceptor;
    }

}