// Path: step3_jaxws-endpoint-cxf-spring-boot/src/main/java/de/jonashackt/tutorial/endpoint/WeatherServiceEndpoint.java
// public class WeatherServiceEndpoint implements WeatherService {
// 
//     @Override
//     public ForecastReturn getCityForecastByZIP(ForecastRequest forecastRequest)
//             throws WeatherException {
//         // TODO Auto-generated method stub
//         return null;
//     }
//     
//     @Override
//     public WeatherInformationReturn getWeatherInformation(String zip)
//             throws WeatherException {
//         // TODO Auto-generated method stub
//         return null;
//     }
// 
//     @Override
//     public WeatherReturn getCityWeatherByZIP(ForecastRequest forecastRequest)
//             throws WeatherException {
//         // TODO Auto-generated method stub
//         return null;
//     }
// 
// }
// 
// Path: step8_logging_into_elasticstack/src/main/java/de/jonashackt/tutorial/soapmsglogging/LoggingInInterceptorXmlOnly.java
// public class LoggingInInterceptorXmlOnly extends LoggingInInterceptor {
// 
// 	@Override
//     protected String formatLoggingMessage(LoggingMessage loggingMessage) {
//         StringBuilder buffer = new StringBuilder();
//         buffer.append("Inbound Message:\n");
// 
//         // Only write the Payload (SOAP-Xml) to Logger
//         if (loggingMessage.getPayload().length() > 0) {
//             buffer.append(loggingMessage.getPayload());
//         }        
//         return buffer.toString();
//     }
// 
// }
// 
// Path: step8_logging_into_elasticstack/src/main/java/de/jonashackt/tutorial/soapmsglogging/LoggingOutInterceptorXmlOnly.java
// public class LoggingOutInterceptorXmlOnly extends LoggingOutInterceptor {
//     
//     @Override
//     protected String formatLoggingMessage(LoggingMessage loggingMessage) {
//         StringBuilder buffer = new StringBuilder();
//         buffer.append("Outbound Message:\n");
// 
//         // Only write the Payload (SOAP-Xml) to Logger
//         if (loggingMessage.getPayload().length() > 0) {
//             buffer.append(loggingMessage.getPayload());
//         }
//         return buffer.toString();
//     }
// }


import de.codecentric.namespace.weatherservice.Weather;
import de.codecentric.namespace.weatherservice.WeatherService;
import de.jonashackt.tutorial.endpoint.WeatherServiceEndpoint;
import de.jonashackt.tutorial.soapmsglogging.LoggingInInterceptorXmlOnly;
import de.jonashackt.tutorial.soapmsglogging.LoggingOutInterceptorXmlOnly;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.interceptor.AbstractLoggingInterceptor;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;
package de.jonashackt.tutorial.configuration;



@Configuration
public class WebServiceConfiguration {
	
    public static final String BASE_URL = "/soap-api";
    public static final String SERVICE_URL = "/WeatherSoapService_1.0";
    
    @Bean
    public ServletRegistrationBean cxfServlet() {
        return new ServletRegistrationBean(new CXFServlet(), BASE_URL + "/*");
    }

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        SpringBus springBus = new SpringBus();
        springBus.getInInterceptors().add(logInInterceptor());
        springBus.getInFaultInterceptors().add(logInInterceptor());
        springBus.getOutInterceptors().add(logOutInterceptor());
        springBus.getOutFaultInterceptors().add(logOutInterceptor());
        return springBus;
    }    
    
    @Bean
    public WeatherService weatherService() {
// Path: step3_jaxws-endpoint-cxf-spring-boot/src/main/java/de/jonashackt/tutorial/endpoint/WeatherServiceEndpoint.java
// public class WeatherServiceEndpoint implements WeatherService {
// 
//     @Override
//     public ForecastReturn getCityForecastByZIP(ForecastRequest forecastRequest)
//             throws WeatherException {
//         // TODO Auto-generated method stub
//         return null;
//     }
//     
//     @Override
//     public WeatherInformationReturn getWeatherInformation(String zip)
//             throws WeatherException {
//         // TODO Auto-generated method stub
//         return null;
//     }
// 
//     @Override
//     public WeatherReturn getCityWeatherByZIP(ForecastRequest forecastRequest)
//             throws WeatherException {
//         // TODO Auto-generated method stub
//         return null;
//     }
// 
// }
// 
// Path: step8_logging_into_elasticstack/src/main/java/de/jonashackt/tutorial/soapmsglogging/LoggingInInterceptorXmlOnly.java
// public class LoggingInInterceptorXmlOnly extends LoggingInInterceptor {
// 
// 	@Override
//     protected String formatLoggingMessage(LoggingMessage loggingMessage) {
//         StringBuilder buffer = new StringBuilder();
//         buffer.append("Inbound Message:\n");
// 
//         // Only write the Payload (SOAP-Xml) to Logger
//         if (loggingMessage.getPayload().length() > 0) {
//             buffer.append(loggingMessage.getPayload());
//         }        
//         return buffer.toString();
//     }
// 
// }
// 
// Path: step8_logging_into_elasticstack/src/main/java/de/jonashackt/tutorial/soapmsglogging/LoggingOutInterceptorXmlOnly.java
// public class LoggingOutInterceptorXmlOnly extends LoggingOutInterceptor {
//     
//     @Override
//     protected String formatLoggingMessage(LoggingMessage loggingMessage) {
//         StringBuilder buffer = new StringBuilder();
//         buffer.append("Outbound Message:\n");
// 
//         // Only write the Payload (SOAP-Xml) to Logger
//         if (loggingMessage.getPayload().length() > 0) {
//             buffer.append(loggingMessage.getPayload());
//         }
//         return buffer.toString();
//     }
// }


// Path: step7_soap_message_logging_payload_only/src/main/java/de/jonashackt/tutorial/configuration/WebServiceConfiguration.java
import de.codecentric.namespace.weatherservice.Weather;
import de.codecentric.namespace.weatherservice.WeatherService;
import de.jonashackt.tutorial.endpoint.WeatherServiceEndpoint;
import de.jonashackt.tutorial.soapmsglogging.LoggingInInterceptorXmlOnly;
import de.jonashackt.tutorial.soapmsglogging.LoggingOutInterceptorXmlOnly;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.interceptor.AbstractLoggingInterceptor;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.xml.ws.Endpoint;

package de.jonashackt.tutorial.configuration;



@Configuration
public class WebServiceConfiguration {
	
    public static final String BASE_URL = "/soap-api";
    public static final String SERVICE_URL = "/WeatherSoapService_1.0";
    
    @Bean
    public ServletRegistrationBean cxfServlet() {
        return new ServletRegistrationBean(new CXFServlet(), BASE_URL + "/*");
    }

    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        SpringBus springBus = new SpringBus();
        springBus.getInInterceptors().add(logInInterceptor());
        springBus.getInFaultInterceptors().add(logInInterceptor());
        springBus.getOutInterceptors().add(logOutInterceptor());
        springBus.getOutFaultInterceptors().add(logOutInterceptor());
        return springBus;
    }    
    
    @Bean
    public WeatherService weatherService() {
    	return new WeatherServiceEndpoint();