diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 798126d63f5..49e3d1f4c7a 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -79,6 +79,8 @@ 2.4.1 8.1.15.v20140411 2.2.0.v201112011158 + 1.1.6 + 2.0.1 2.3 1.2.1 1.2 @@ -109,6 +111,7 @@ 1.0.1.RELEASE 3.2.4.RELEASE 1.0.2.RELEASE + 2.1.4.RELEASE 2.1.3.RELEASE 2.1.1.RELEASE 1.2.4 @@ -330,6 +333,11 @@ spring-boot-starter-websocket 1.1.0.BUILD-SNAPSHOT + + org.springframework.boot + spring-boot-starter-ws + 1.1.0.BUILD-SNAPSHOT + @@ -454,6 +462,11 @@ jstl ${jstl.version} + + jaxen + jaxen + ${jaxen.version} + joda-time joda-time @@ -819,6 +832,11 @@ jolokia-core ${jolokia.version} + + org.jdom + jdom + ${jdom.version} + org.liquibase liquibase-core @@ -1048,6 +1066,80 @@ spring-social-web ${spring-social.version} + + org.springframework.mobile + spring-mobile-device + ${spring-mobile.version} + + + org.springframework.ws + spring-ws-core + ${spring-ws.version} + + + commons-logging + commons-logging + + + + + org.springframework.ws + spring-ws-support + ${spring-ws.version} + + + commons-logging + commons-logging + + + + + org.springframework.ws + spring-ws-security + ${spring-ws.version} + + + commons-logging + commons-logging + + + + + org.springframework.ws + spring-ws-test + ${spring-ws.version} + + + commons-logging + commons-logging + + + + + wsdl4j + wsdl4j + 1.6.3 + + + xmlunit + xmlunit + 1.5 + + + org.thymeleaf + thymeleaf + ${thymeleaf.version} + + + org.thymeleaf + thymeleaf-spring4 + ${thymeleaf.version} + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity3 + ${thymeleaf-extras-springsecurity3.version} + org.springframework.social spring-social-facebook @@ -1068,21 +1160,6 @@ spring-social-linkedin ${spring-social-linkedin.version} - - org.thymeleaf - thymeleaf - ${thymeleaf.version} - - - org.thymeleaf.extras - thymeleaf-extras-springsecurity3 - ${thymeleaf-extras-springsecurity3.version} - - - org.thymeleaf - thymeleaf-spring4 - ${thymeleaf.version} - org.yaml snakeyaml diff --git a/spring-boot-samples/pom.xml b/spring-boot-samples/pom.xml index 18e2cc5135d..bb1a34e969d 100644 --- a/spring-boot-samples/pom.xml +++ b/spring-boot-samples/pom.xml @@ -57,7 +57,8 @@ spring-boot-sample-web-velocity spring-boot-sample-websocket spring-boot-sample-xml - + spring-boot-sample-ws + diff --git a/spring-boot-samples/spring-boot-sample-ws/README.md b/spring-boot-samples/spring-boot-sample-ws/README.md new file mode 100644 index 00000000000..40e58611053 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/README.md @@ -0,0 +1,14 @@ +# Spring Boot - Samples - Web Services + +This sample project demonstrates how to bootstrap and use Spring Web Services with Spring Boot. + +It is a runnable implementation of the HolidayRequest sample in the Spring Web Services [reference guide](http://docs.spring.io/spring-ws/site/reference/html/tutorial.html#tutorial.implementing.endpoint). + +The sample can be build with Maven (>3) and simply run from the command line. + +``` +$ mvn package +$ java -jar target/*.jar +``` + +Now pointing your browser to [http://localhost:8080/services/holidayService/holiday.wsdl] should display the generated WSDL. \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-ws/pom.xml b/spring-boot-samples/spring-boot-sample-ws/pom.xml new file mode 100644 index 00000000000..2549d930820 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/pom.xml @@ -0,0 +1,49 @@ + + + + spring-boot-samples + org.springframework.boot + 1.1.0.BUILD-SNAPSHOT + + 4.0.0 + + 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 + + + + \ 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 new file mode 100644 index 00000000000..2129f862dde --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/SampleWsApplication.java @@ -0,0 +1,41 @@ +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. + */ +@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; + } +} 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 new file mode 100644 index 00000000000..e6b9ed094b2 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/endpoint/HolidayEndpoint.java @@ -0,0 +1,58 @@ +package sample.ws.endpoint; + +import org.jdom2.Element; +import org.jdom2.JDOMException; +import org.jdom2.Namespace; +import org.jdom2.xpath.XPath; +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 java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Created by in329dei on 28-2-14. + */ +@Endpoint +public class HolidayEndpoint { + + private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas"; + + private XPath startDateExpression; + + private XPath endDateExpression; + + private XPath nameExpression; + + private HumanResourceService humanResourceService; + + @Autowired + public HolidayEndpoint(HumanResourceService humanResourceService) throws JDOMException + { + this.humanResourceService = humanResourceService; + + Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI); + + startDateExpression = XPath.newInstance("//hr:StartDate"); + startDateExpression.addNamespace(namespace); + + 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); + } +} 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 new file mode 100644 index 00000000000..6bcb287dfae --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/HumanResourceService.java @@ -0,0 +1,10 @@ +package sample.ws.service; + +import java.util.Date; + +/** + * Created by in329dei on 28-2-14. + */ +public interface HumanResourceService { + 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 new file mode 100644 index 00000000000..08118be6d94 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/service/StubHumanResourceService.java @@ -0,0 +1,21 @@ +package sample.ws.service; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * Created by in329dei on 28-2-14. + */ +@Service +public class StubHumanResourceService implements HumanResourceService { + + 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); + } +} diff --git a/spring-boot-samples/spring-boot-sample-ws/src/main/resources/META-INF/schemas/hr.xsd b/spring-boot-samples/spring-boot-sample-ws/src/main/resources/META-INF/schemas/hr.xsd new file mode 100644 index 00000000000..eed94778e2e --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/resources/META-INF/schemas/hr.xsd @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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 new file mode 100644 index 00000000000..d5022a615d1 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/src/main/resources/META-INF/spring/spring-ws-context.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml index 87c07167df7..d33244f4646 100644 --- a/spring-boot-starters/pom.xml +++ b/spring-boot-starters/pom.xml @@ -54,6 +54,7 @@ spring-boot-starter-velocity spring-boot-starter-web spring-boot-starter-websocket + spring-boot-starter-ws diff --git a/spring-boot-starters/spring-boot-starter-ws/pom.xml b/spring-boot-starters/spring-boot-starter-ws/pom.xml new file mode 100644 index 00000000000..348fc12f777 --- /dev/null +++ b/spring-boot-starters/spring-boot-starter-ws/pom.xml @@ -0,0 +1,48 @@ + + + + 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 + + + + \ No newline at end of file diff --git a/spring-boot-starters/spring-boot-starter-ws/src/main/resources/META-INF/spring.provides b/spring-boot-starters/spring-boot-starter-ws/src/main/resources/META-INF/spring.provides new file mode 100644 index 00000000000..9a488a0a6dc --- /dev/null +++ b/spring-boot-starters/spring-boot-starter-ws/src/main/resources/META-INF/spring.provides @@ -0,0 +1 @@ +provides: spring-ws-core,spring-ws-support,spring-ws-security \ No newline at end of file