// Path: spring-ws-log-http-headers/src/main/java/com/codenotfound/ws/interceptor/LogHttpHeaderEndpointInterceptor.java
// public class LogHttpHeaderEndpointInterceptor implements EndpointInterceptor {
// 
//   @Override
//   public void afterCompletion(MessageContext arg0, Object arg1, Exception arg2) throws Exception {
//     // No-op
//   }
// 
//   @Override
//   public boolean handleFault(MessageContext messageContext, Object arg1) throws Exception {
//     // No-op
//     return true;
//   }
// 
//   @Override
//   public boolean handleRequest(MessageContext messageContext, Object arg1) throws Exception {
//     HttpLoggingUtils.logMessage("Server Request Message", messageContext.getRequest());
// 
//     return true;
//   }
// 
//   @Override
//   public boolean handleResponse(MessageContext messageContext, Object arg1) throws Exception {
//     HttpLoggingUtils.logMessage("Server Response Message", messageContext.getResponse());
// 
//     return true;
//   }
// }


import java.util.List;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition;
import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
import com.codenotfound.ws.interceptor.LogHttpHeaderEndpointInterceptor;
package com.codenotfound.ws.endpoint;




@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {

  @Bean
  public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
    MessageDispatcherServlet servlet = new MessageDispatcherServlet();
    servlet.setApplicationContext(applicationContext);

    return new ServletRegistrationBean(servlet, "/codenotfound/ws/*");
  }

  @Bean(name = "ticketagent")
  public Wsdl11Definition defaultWsdl11Definition() {
    SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
    wsdl11Definition.setWsdl(new ClassPathResource("/wsdl/ticketagent.wsdl"));

    return wsdl11Definition;
  }

  @Override
  public void addInterceptors(List<EndpointInterceptor> interceptors) {
    // register the LogHttpHeaderEndpointInterceptor
// Path: spring-ws-log-http-headers/src/main/java/com/codenotfound/ws/interceptor/LogHttpHeaderEndpointInterceptor.java
// public class LogHttpHeaderEndpointInterceptor implements EndpointInterceptor {
// 
//   @Override
//   public void afterCompletion(MessageContext arg0, Object arg1, Exception arg2) throws Exception {
//     // No-op
//   }
// 
//   @Override
//   public boolean handleFault(MessageContext messageContext, Object arg1) throws Exception {
//     // No-op
//     return true;
//   }
// 
//   @Override
//   public boolean handleRequest(MessageContext messageContext, Object arg1) throws Exception {
//     HttpLoggingUtils.logMessage("Server Request Message", messageContext.getRequest());
// 
//     return true;
//   }
// 
//   @Override
//   public boolean handleResponse(MessageContext messageContext, Object arg1) throws Exception {
//     HttpLoggingUtils.logMessage("Server Response Message", messageContext.getResponse());
// 
//     return true;
//   }
// }


// Path: spring-ws-log-http-headers/src/main/java/com/codenotfound/ws/endpoint/WebServiceConfig.java
import java.util.List;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.ws.config.annotation.EnableWs;
import org.springframework.ws.config.annotation.WsConfigurerAdapter;
import org.springframework.ws.server.EndpointInterceptor;
import org.springframework.ws.transport.http.MessageDispatcherServlet;
import org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition;
import org.springframework.ws.wsdl.wsdl11.Wsdl11Definition;
import com.codenotfound.ws.interceptor.LogHttpHeaderEndpointInterceptor;

package com.codenotfound.ws.endpoint;




@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {

  @Bean
  public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
    MessageDispatcherServlet servlet = new MessageDispatcherServlet();
    servlet.setApplicationContext(applicationContext);

    return new ServletRegistrationBean(servlet, "/codenotfound/ws/*");
  }

  @Bean(name = "ticketagent")
  public Wsdl11Definition defaultWsdl11Definition() {
    SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
    wsdl11Definition.setWsdl(new ClassPathResource("/wsdl/ticketagent.wsdl"));

    return wsdl11Definition;
  }

  @Override
  public void addInterceptors(List<EndpointInterceptor> interceptors) {
    // register the LogHttpHeaderEndpointInterceptor
    interceptors.add(new LogHttpHeaderEndpointInterceptor());