// Path: step5_custom-soap-fault/src/main/java/de/jonashackt/tutorial/common/InternalBusinessException.java
// public class InternalBusinessException extends Exception {
// 	private static final long serialVersionUID = 1L;
// 	
// 	public InternalBusinessException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public InternalBusinessException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 	
// 	public InternalBusinessException(String message) {
// 		super(message);
// 	}
// 
// }
// 
// Path: step4_test/src/main/java/de/jonashackt/tutorial/configuration/WebServiceConfiguration.java
// @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() {
//         return new SpringBus();
//     }    
//     
//     @Bean
//     public WeatherService weatherService() {
//     	return new WeatherServiceEndpoint();
//     }
//     
//     @Bean
//     public Endpoint endpoint() {
//         EndpointImpl endpoint = new EndpointImpl(springBus(), weatherService());        
//         // CXF JAX-WS implementation relies on the correct ServiceName as QName-Object with
//         // the name-Attribute´s text <wsdl:service name="Weather"> and the targetNamespace
//         // "http://www.codecentric.de/namespace/weatherservice/"
//         // Also the WSDLLocation must be set
//         endpoint.setServiceName(weather().getServiceName());
//         endpoint.setWsdlLocation(weather().getWSDLDocumentLocation().toString());
//         endpoint.publish(SERVICE_URL);
//         return endpoint;
//     }
//     
//     @Bean
//     public Weather weather() {
//         // Needed for correct ServiceName & WSDLLocation to publish contract first incl. original WSDL
//         return new Weather();
//     }
// }
// 
// Path: step5_custom-soap-fault/src/test/java/de/jonashackt/tutorial/utils/SoapRawClient.java
// @Component
// public class SoapRawClient {
// 
// 	private static final Logger LOGGER = LoggerFactory.getLogger(SoapRawClient.class);
// 	private String soapAction;
// 	
// 	private String soapServiceUrl;
// 	
// 	public <T> SoapRawClient(String soapServiceUrl, Class<T> jaxWsServiceInterfaceClass) throws InternalBusinessException {
// 	    this.soapAction = XmlUtils.getSoapActionFromJaxWsServiceInterface(jaxWsServiceInterfaceClass);
// 	    this.soapServiceUrl = soapServiceUrl;
// 	}
// 	
// 	public SoapRawClientResponse callSoapService(InputStream xmlFile) throws InternalBusinessException {
// 		SoapRawClientResponse rawSoapResponse = new SoapRawClientResponse();
// 		
// 		LOGGER.debug("Calling SoapService with POST on Apache HTTP-Client and configured URL: {}", soapServiceUrl);
// 		
// 		try {
// 			Response httpResponseContainer = Request
// 					.Post(soapServiceUrl)
// 					.bodyStream(xmlFile, contentTypeTextXmlUtf8())
// 					.addHeader("SOAPAction", "\"" + soapAction + "\"")
// 					.execute();
// 			
// 			HttpResponse httpResponse = httpResponseContainer.returnResponse();			
// 			rawSoapResponse.setHttpStatusCode(httpResponse.getStatusLine().getStatusCode());
// 			rawSoapResponse.setHttpResponseBody(XmlUtils.parseFileStream2Document(httpResponse.getEntity().getContent()));
// 			
// 		} catch (Exception exception) {
// 			throw new InternalBusinessException("Some Error accured while trying to Call SoapService for test: " + exception.getMessage());
// 		}		
// 		return rawSoapResponse;
// 	}
// 
// 	private ContentType contentTypeTextXmlUtf8() {
// 		return ContentType.create(ContentType.TEXT_XML.getMimeType(), Consts.UTF_8);
// 	}
// 	
// }


import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import de.codecentric.namespace.weatherservice.WeatherService;
import de.jonashackt.tutorial.common.InternalBusinessException;
import de.jonashackt.tutorial.configuration.WebServiceConfiguration;
import de.jonashackt.tutorial.utils.SoapRawClient;
package de.jonashackt.tutorial;



@Configuration
public class WebServiceSystemTestConfiguration {

// Path: step5_custom-soap-fault/src/main/java/de/jonashackt/tutorial/common/InternalBusinessException.java
// public class InternalBusinessException extends Exception {
// 	private static final long serialVersionUID = 1L;
// 	
// 	public InternalBusinessException(Throwable cause) {
// 		super(cause);
// 	}
// 
// 	public InternalBusinessException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 	
// 	public InternalBusinessException(String message) {
// 		super(message);
// 	}
// 
// }
// 
// Path: step4_test/src/main/java/de/jonashackt/tutorial/configuration/WebServiceConfiguration.java
// @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() {
//         return new SpringBus();
//     }    
//     
//     @Bean
//     public WeatherService weatherService() {
//     	return new WeatherServiceEndpoint();
//     }
//     
//     @Bean
//     public Endpoint endpoint() {
//         EndpointImpl endpoint = new EndpointImpl(springBus(), weatherService());        
//         // CXF JAX-WS implementation relies on the correct ServiceName as QName-Object with
//         // the name-Attribute´s text <wsdl:service name="Weather"> and the targetNamespace
//         // "http://www.codecentric.de/namespace/weatherservice/"
//         // Also the WSDLLocation must be set
//         endpoint.setServiceName(weather().getServiceName());
//         endpoint.setWsdlLocation(weather().getWSDLDocumentLocation().toString());
//         endpoint.publish(SERVICE_URL);
//         return endpoint;
//     }
//     
//     @Bean
//     public Weather weather() {
//         // Needed for correct ServiceName & WSDLLocation to publish contract first incl. original WSDL
//         return new Weather();
//     }
// }
// 
// Path: step5_custom-soap-fault/src/test/java/de/jonashackt/tutorial/utils/SoapRawClient.java
// @Component
// public class SoapRawClient {
// 
// 	private static final Logger LOGGER = LoggerFactory.getLogger(SoapRawClient.class);
// 	private String soapAction;
// 	
// 	private String soapServiceUrl;
// 	
// 	public <T> SoapRawClient(String soapServiceUrl, Class<T> jaxWsServiceInterfaceClass) throws InternalBusinessException {
// 	    this.soapAction = XmlUtils.getSoapActionFromJaxWsServiceInterface(jaxWsServiceInterfaceClass);
// 	    this.soapServiceUrl = soapServiceUrl;
// 	}
// 	
// 	public SoapRawClientResponse callSoapService(InputStream xmlFile) throws InternalBusinessException {
// 		SoapRawClientResponse rawSoapResponse = new SoapRawClientResponse();
// 		
// 		LOGGER.debug("Calling SoapService with POST on Apache HTTP-Client and configured URL: {}", soapServiceUrl);
// 		
// 		try {
// 			Response httpResponseContainer = Request
// 					.Post(soapServiceUrl)
// 					.bodyStream(xmlFile, contentTypeTextXmlUtf8())
// 					.addHeader("SOAPAction", "\"" + soapAction + "\"")
// 					.execute();
// 			
// 			HttpResponse httpResponse = httpResponseContainer.returnResponse();			
// 			rawSoapResponse.setHttpStatusCode(httpResponse.getStatusLine().getStatusCode());
// 			rawSoapResponse.setHttpResponseBody(XmlUtils.parseFileStream2Document(httpResponse.getEntity().getContent()));
// 			
// 		} catch (Exception exception) {
// 			throw new InternalBusinessException("Some Error accured while trying to Call SoapService for test: " + exception.getMessage());
// 		}		
// 		return rawSoapResponse;
// 	}
// 
// 	private ContentType contentTypeTextXmlUtf8() {
// 		return ContentType.create(ContentType.TEXT_XML.getMimeType(), Consts.UTF_8);
// 	}
// 	
// }


// Path: step5_custom-soap-fault/src/test/java/de/jonashackt/tutorial/WebServiceSystemTestConfiguration.java
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import de.codecentric.namespace.weatherservice.WeatherService;
import de.jonashackt.tutorial.common.InternalBusinessException;
import de.jonashackt.tutorial.configuration.WebServiceConfiguration;
import de.jonashackt.tutorial.utils.SoapRawClient;

package de.jonashackt.tutorial;



@Configuration
public class WebServiceSystemTestConfiguration {

    private String webServiceUrl = "http://localhost:8090" + WebServiceConfiguration.BASE_URL + WebServiceConfiguration.SERVICE_URL;