diff --git a/pom.xml b/pom.xml index 37652568938..2c6def53f8c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 org.springframework.boot spring-boot-build @@ -148,20 +149,20 @@ false - - - - - - - + + + + + + + - + - + - + @@ -176,7 +177,7 @@ false - + - - - + + + diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 49e3d1f4c7a..8fe4b56bb91 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -111,7 +111,7 @@ 1.0.1.RELEASE 3.2.4.RELEASE 1.0.2.RELEASE - 2.1.4.RELEASE + 2.2.0.RELEASE 2.1.3.RELEASE 2.1.1.RELEASE 1.2.4 @@ -1066,11 +1066,6 @@ spring-social-web ${spring-social.version} - - org.springframework.mobile - spring-mobile-device - ${spring-mobile.version} - org.springframework.ws spring-ws-core diff --git a/spring-boot-samples/spring-boot-sample-ws/pom.xml b/spring-boot-samples/spring-boot-sample-ws/pom.xml index 2549d930820..2e6ef4e07c1 100644 --- a/spring-boot-samples/spring-boot-sample-ws/pom.xml +++ b/spring-boot-samples/spring-boot-sample-ws/pom.xml @@ -1,49 +1,53 @@ - - spring-boot-samples - org.springframework.boot - 1.1.0.BUILD-SNAPSHOT - - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + spring-boot-samples + org.springframework.boot + 1.1.0.BUILD-SNAPSHOT + + 4.0.0 - spring-boot-sample-ws + spring-boot-sample-ws - - ${basedir}/../.. - 1.7 - - - - org.springframework.boot - spring-boot-starter-ws - - - org.springframework.boot - spring-boot-starter-actuator - - - org.jdom - jdom - - - jaxen - jaxen - - - ${project.groupId} - spring-boot-starter-test - test - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - + + ${basedir}/../.. + 1.7 + + + + org.springframework.boot + spring-boot-starter-ws + + + org.springframework.boot + spring-boot-starter-actuator + + + org.jdom + jdom + + + jaxen + jaxen + + + wsdl4j + wsdl4j + + + ${project.groupId} + spring-boot-starter-test + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/SampleWsApplication.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/SampleWsApplication.java index 2129f862dde..5dd802eaf1d 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/SampleWsApplication.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/SampleWsApplication.java @@ -2,12 +2,8 @@ package sample.ws; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.context.embedded.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; -import org.springframework.ws.transport.http.MessageDispatcherServlet; /** * Created by in329dei on 28-2-14. @@ -15,27 +11,9 @@ import org.springframework.ws.transport.http.MessageDispatcherServlet; @Configuration @EnableAutoConfiguration @ComponentScan -@ImportResource("classpath:/META-INF/spring/spring-ws-context.xml") public class SampleWsApplication { - public static void main(String[] args) throws Exception { - SpringApplication.run(SampleWsApplication.class, args); - } - - @Bean - public ServletRegistrationBean messageDispatcherServletRegistration() { - MessageDispatcherServlet mds = new MessageDispatcherServlet(); - mds.setTransformWsdlLocations(true); - - ServletRegistrationBean srb = new ServletRegistrationBean(messageDispatcherServlet(), "/services/*"); - srb.setLoadOnStartup(1); - return srb; - } - - @Bean - public MessageDispatcherServlet messageDispatcherServlet() { - MessageDispatcherServlet mds = new MessageDispatcherServlet(); - mds.setTransformWsdlLocations(true); - return mds; - } + public static void main(String[] args) throws Exception { + SpringApplication.run(SampleWsApplication.class, args); + } } diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java new file mode 100644 index 00000000000..9935f7537b5 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java @@ -0,0 +1,45 @@ +package sample.ws; + +import org.springframework.boot.context.embedded.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.transport.http.MessageDispatcherServlet; +import org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition; +import org.springframework.xml.xsd.SimpleXsdSchema; +import org.springframework.xml.xsd.XsdSchema; + +/** + * Configures Spring Web Service components + * + * @author Maciej Walkowiak + */ +@EnableWs +@Configuration +public class WebServiceConfig extends WsConfigurerAdapter { + @Bean + public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) { + MessageDispatcherServlet servlet = new MessageDispatcherServlet(); + servlet.setApplicationContext(applicationContext); + + return new ServletRegistrationBean(servlet, "/services/*"); + } + + @Bean(name = "holiday") + public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) { + DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition(); + wsdl11Definition.setPortTypeName("HumanResource"); + wsdl11Definition.setLocationUri("/holidayService/"); + wsdl11Definition.setTargetNamespace("http://mycompany.com/hr/definitions"); + wsdl11Definition.setSchema(countriesSchema); + return wsdl11Definition; + } + + @Bean + public XsdSchema countriesSchema() { + return new SimpleXsdSchema(new ClassPathResource("META-INF/schemas/hr.xsd")); + } +} diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java index e6b9ed094b2..606367974fa 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java @@ -3,56 +3,55 @@ package sample.ws.endpoint; import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.Namespace; -import org.jdom2.xpath.XPath; +import org.jdom2.filter.Filters; +import org.jdom2.xpath.XPathExpression; +import org.jdom2.xpath.XPathFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.RequestPayload; import sample.ws.service.HumanResourceService; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactoryConfigurationException; import java.text.SimpleDateFormat; import java.util.Date; /** - * Created by in329dei on 28-2-14. + * @author in329dei + * @author Maciej Walkowiak */ @Endpoint public class HolidayEndpoint { - private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas"; + private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas"; - private XPath startDateExpression; + private XPathExpression startDateExpression; + private XPathExpression endDateExpression; + private XPathExpression nameExpression; - private XPath endDateExpression; + private HumanResourceService humanResourceService; - private XPath nameExpression; + @Autowired + public HolidayEndpoint(HumanResourceService humanResourceService) throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException { + this.humanResourceService = humanResourceService; - private HumanResourceService humanResourceService; + Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI); - @Autowired - public HolidayEndpoint(HumanResourceService humanResourceService) throws JDOMException - { - this.humanResourceService = humanResourceService; + XPathFactory xPathFactory = XPathFactory.instance(); - Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI); + startDateExpression = xPathFactory.compile("//hr:StartDate", Filters.element(), null, namespace); + endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), null, namespace); + nameExpression = xPathFactory.compile("concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(), null, namespace); + } - startDateExpression = XPath.newInstance("//hr:StartDate"); - startDateExpression.addNamespace(namespace); + @PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest") + public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date startDate = dateFormat.parse(startDateExpression.evaluateFirst(holidayRequest).getText()); + Date endDate = dateFormat.parse(endDateExpression.evaluateFirst(holidayRequest).getText()); + String name = nameExpression.evaluateFirst(holidayRequest); - endDateExpression = XPath.newInstance("//hr:EndDate"); - endDateExpression.addNamespace(namespace); - - nameExpression = XPath.newInstance("concat(//hr:FirstName,' ',//hr:LastName)"); - nameExpression.addNamespace(namespace); - } - - @PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest") - public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date startDate = dateFormat.parse(startDateExpression.valueOf(holidayRequest)); - Date endDate = dateFormat.parse(endDateExpression.valueOf(holidayRequest)); - String name = nameExpression.valueOf(holidayRequest); - - humanResourceService.bookHoliday(startDate, endDate, name); - } + humanResourceService.bookHoliday(startDate, endDate, name); + } } diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/HumanResourceService.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/HumanResourceService.java index 6bcb287dfae..5f7c7416099 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/HumanResourceService.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/HumanResourceService.java @@ -6,5 +6,5 @@ import java.util.Date; * Created by in329dei on 28-2-14. */ public interface HumanResourceService { - void bookHoliday(Date startDate, Date endDate, String name); + void bookHoliday(Date startDate, Date endDate, String name); } diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/StubHumanResourceService.java b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/StubHumanResourceService.java index 08118be6d94..0f030889cf6 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/StubHumanResourceService.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/StubHumanResourceService.java @@ -11,11 +11,10 @@ import java.util.Date; */ @Service public class StubHumanResourceService implements HumanResourceService { + private final Logger logger = LoggerFactory.getLogger(StubHumanResourceService.class); - private final Logger logger = LoggerFactory.getLogger(StubHumanResourceService.class); - - @Override - public void bookHoliday(Date startDate, Date endDate, String name) { - logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate, name); - } + @Override + public void bookHoliday(Date startDate, Date endDate, String name) { + logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate, name); + } } diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/resources/META-INF/spring/spring-ws-context.xml b/spring-boot-samples/spring-boot-sample-ws/src/main/resources/META-INF/spring/spring-ws-context.xml deleted file mode 100644 index d5022a615d1..00000000000 --- a/spring-boot-samples/spring-boot-sample-ws/src/main/resources/META-INF/spring/spring-ws-context.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/spring-boot-starters/spring-boot-starter-ws/pom.xml b/spring-boot-starters/spring-boot-starter-ws/pom.xml index 348fc12f777..5c3600a5b87 100644 --- a/spring-boot-starters/spring-boot-starter-ws/pom.xml +++ b/spring-boot-starters/spring-boot-starter-ws/pom.xml @@ -1,48 +1,48 @@ - - spring-boot-starters - org.springframework.boot - 1.1.0.BUILD-SNAPSHOT - - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + spring-boot-starters + org.springframework.boot + 1.1.0.BUILD-SNAPSHOT + + 4.0.0 - spring-boot-starter-ws - jar - - ${basedir}/../.. - - - - ${project.groupId} - spring-boot-starter - ${project.version} - - - ${project.groupId} - spring-boot-starter-tomcat - ${project.version} - - - org.springframework.ws - spring-ws-core - - - org.springframework.ws - spring-ws-support - - - org.springframework.ws - spring-ws-security - true - - - org.springframework.ws - spring-ws-test - test - - + spring-boot-starter-ws + jar + + ${basedir}/../.. + + + + ${project.groupId} + spring-boot-starter + ${project.version} + + + ${project.groupId} + spring-boot-starter-tomcat + ${project.version} + + + org.springframework.ws + spring-ws-core + + + org.springframework.ws + spring-ws-support + + + org.springframework.ws + spring-ws-security + true + + + org.springframework.ws + spring-ws-test + test + + \ No newline at end of file