diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 8fe4b56bb91..b3baeca2bd0 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -80,7 +80,7 @@ 8.1.15.v20140411 2.2.0.v201112011158 1.1.6 - 2.0.1 + 2.0.5 2.3 1.2.1 1.2 @@ -118,6 +118,7 @@ 7.0.54 1.7 2.0 + 1.6.1 3.0.0 @@ -834,8 +835,8 @@ org.jdom - jdom - ${jdom.version} + jdom2 + ${jdom2.version} org.liquibase @@ -1066,6 +1067,26 @@ spring-social-web ${spring-social.version} + + org.springframework.social + spring-social-facebook + ${spring-social-facebook.version} + + + org.springframework.social + spring-social-facebook-web + ${spring-social-facebook.version} + + + org.springframework.social + spring-social-linkedin + ${spring-social-linkedin.version} + + + org.springframework.social + spring-social-twitter + ${spring-social-twitter.version} + org.springframework.ws spring-ws-core @@ -1110,16 +1131,6 @@ - - wsdl4j - wsdl4j - 1.6.3 - - - xmlunit - xmlunit - 1.5 - org.thymeleaf thymeleaf @@ -1135,26 +1146,6 @@ thymeleaf-extras-springsecurity3 ${thymeleaf-extras-springsecurity3.version} - - org.springframework.social - spring-social-facebook - ${spring-social-facebook.version} - - - org.springframework.social - spring-social-facebook-web - ${spring-social-facebook.version} - - - org.springframework.social - spring-social-twitter - ${spring-social-twitter.version} - - - org.springframework.social - spring-social-linkedin - ${spring-social-linkedin.version} - org.yaml snakeyaml @@ -1165,6 +1156,11 @@ jedis ${jedis.version} + + wsdl4j + wsdl4j + ${wsdl4j.version} + diff --git a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc index b7a67803f0e..fdb1e1a531e 100644 --- a/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc +++ b/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc @@ -289,6 +289,10 @@ and Hibernate. |Support for websocket development with Tomcat. |=== +|`spring-boot-starter-ws` +|Support for Spring Web Services +|=== + In addition to the application starters, the following starters can be used to add '<>' features. diff --git a/spring-boot-samples/pom.xml b/spring-boot-samples/pom.xml index bb1a34e969d..627d535af17 100644 --- a/spring-boot-samples/pom.xml +++ b/spring-boot-samples/pom.xml @@ -56,8 +56,8 @@ spring-boot-sample-web-ui spring-boot-sample-web-velocity spring-boot-sample-websocket + spring-boot-sample-ws spring-boot-sample-xml - spring-boot-sample-ws diff --git a/spring-boot-samples/spring-boot-sample-ws/README.adoc b/spring-boot-samples/spring-boot-sample-ws/README.adoc new file mode 100644 index 00000000000..051ac85e151 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-ws/README.adoc @@ -0,0 +1,14 @@ +== Spring Boot - Samples - Web Services + +This sample project demonstrates how to use http://projects.spring.io/spring-ws/[Spring Web Services] +with Spring Boot. It is an implementation of the +http://docs.spring.io/spring-ws/site/reference/html/tutorial.html#tutorial.implementing.endpoint[Holiday Request sample] +in the Spring Web Services reference guilde. + +The sample uses Maven. It can be built and run from the command line: + +---- +$ mvn spring-boot:run +---- + +http://localhost:8080/services/holidayService/holiday.wsdl will now display the generated WSDL. \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-ws/README.md b/spring-boot-samples/spring-boot-sample-ws/README.md deleted file mode 100644 index 40e58611053..00000000000 --- a/spring-boot-samples/spring-boot-sample-ws/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# 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 index 2e6ef4e07c1..61706f1fc31 100644 --- a/spring-boot-samples/spring-boot-sample-ws/pom.xml +++ b/spring-boot-samples/spring-boot-sample-ws/pom.xml @@ -1,45 +1,44 @@ - + + 4.0.0 + spring-boot-samples org.springframework.boot 1.1.0.BUILD-SNAPSHOT - 4.0.0 - spring-boot-sample-ws - + Spring Boot Web Services Sample + Spring Boot Web Services Sample + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + ${basedir}/../.. - 1.7 org.springframework.boot - spring-boot-starter-ws + spring-boot-starter-test + test org.springframework.boot - spring-boot-starter-actuator - - - org.jdom - jdom + spring-boot-starter-ws jaxen jaxen - wsdl4j - wsdl4j + org.jdom + jdom2 - ${project.groupId} - spring-boot-starter-test - test + wsdl4j + wsdl4j 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 5dd802eaf1d..35f5056084e 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 @@ -1,3 +1,18 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package sample.ws; import org.springframework.boot.SpringApplication; @@ -5,9 +20,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; -/** - * Created by in329dei on 28-2-14. - */ @Configuration @EnableAutoConfiguration @ComponentScan 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 index 9935f7537b5..b6ac0a6f082 100644 --- 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 @@ -1,3 +1,18 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package sample.ws; import org.springframework.boot.context.embedded.ServletRegistrationBean; @@ -12,19 +27,14 @@ 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/*"); } 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 606367974fa..db86e0dd2e5 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 @@ -1,5 +1,26 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package sample.ws.endpoint; +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactoryConfigurationException; + import org.jdom2.Element; import org.jdom2.JDOMException; import org.jdom2.Namespace; @@ -10,17 +31,9 @@ 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; - -/** - * @author in329dei - * @author Maciej Walkowiak - */ @Endpoint public class HolidayEndpoint { @@ -33,25 +46,34 @@ public class HolidayEndpoint { private HumanResourceService humanResourceService; @Autowired - public HolidayEndpoint(HumanResourceService humanResourceService) throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException { + public HolidayEndpoint(HumanResourceService humanResourceService) + throws JDOMException, XPathFactoryConfigurationException, + XPathExpressionException { this.humanResourceService = humanResourceService; Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI); XPathFactory xPathFactory = XPathFactory.instance(); - 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); + this.startDateExpression = xPathFactory.compile("//hr:StartDate", + Filters.element(), null, namespace); + this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), + null, namespace); + this.nameExpression = xPathFactory.compile( + "concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(), null, + namespace); } @PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest") - public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception { + 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); + Date startDate = dateFormat.parse(this.startDateExpression.evaluateFirst( + holidayRequest).getText()); + Date endDate = dateFormat.parse(this.endDateExpression.evaluateFirst( + holidayRequest).getText()); + String name = this.nameExpression.evaluateFirst(holidayRequest); - humanResourceService.bookHoliday(startDate, endDate, name); + this.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 5f7c7416099..4289d70cda8 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 @@ -1,10 +1,23 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ 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 index 0f030889cf6..5d3fdc071c2 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 @@ -1,20 +1,34 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package sample.ws.service; +import java.util.Date; + 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); + this.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 index eed94778e2e..860ba4e59b5 100644 --- 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 @@ -1,26 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - + xmlns:hr="http://mycompany.com/hr/schemas" + elementFormDefault="qualified" + targetNamespace="http://mycompany.com/hr/schemas"> + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java index da2c3554eb3..055db790e1b 100644 --- a/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-ws/src/test/java/sample/ws/SampleWsApplicationTests.java @@ -1,5 +1,25 @@ +/* + * Copyright 2012-2014 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package sample.ws; +import java.io.StringReader; + +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -10,20 +30,12 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.ws.client.core.WebServiceTemplate; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import java.io.StringReader; - -/** - * Tests handling SOAP message - * - * @author Maciej Walkowiak - */ @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = SampleWsApplication.class) @WebAppConfiguration @IntegrationTest public class SampleWsApplicationTests { + private WebServiceTemplate webServiceTemplate = new WebServiceTemplate(); @Value("${local.server.port}") @@ -31,7 +43,8 @@ public class SampleWsApplicationTests { @Before public void setUp() { - webServiceTemplate.setDefaultUri("http://localhost:" + serverPort + "/services/"); + this.webServiceTemplate.setDefaultUri("http://localhost:" + this.serverPort + + "/services/"); } @Test @@ -51,6 +64,6 @@ public class SampleWsApplicationTests { StreamSource source = new StreamSource(new StringReader(request)); StreamResult result = new StreamResult(System.out); - webServiceTemplate.sendSourceAndReceiveToResult(source, result); + this.webServiceTemplate.sendSourceAndReceiveToResult(source, result); } } \ 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 5c3600a5b87..c52b2f6c490 100644 --- a/spring-boot-starters/spring-boot-starter-ws/pom.xml +++ b/spring-boot-starters/spring-boot-starter-ws/pom.xml @@ -2,28 +2,41 @@ + 4.0.0 - spring-boot-starters org.springframework.boot + spring-boot-starters 1.1.0.BUILD-SNAPSHOT - 4.0.0 - spring-boot-starter-ws - jar + Spring Boot Web Services Starter + Spring Boot Web Services Starter + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + ${basedir}/../.. - ${project.groupId} + org.springframework.boot spring-boot-starter - ${project.version} - ${project.groupId} - spring-boot-starter-tomcat - ${project.version} + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-core + + + commons-logging + commons-logging + + org.springframework.ws @@ -33,16 +46,5 @@ 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 index 9a488a0a6dc..e7486ed01df 100644 --- 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 @@ -1 +1 @@ -provides: spring-ws-core,spring-ws-support,spring-ws-security \ No newline at end of file +provides: spring-ws-core,spring-ws-support \ No newline at end of file diff --git a/spring-boot-versions/pom.xml b/spring-boot-versions/pom.xml index 63160430b0a..8e67d18599f 100644 --- a/spring-boot-versions/pom.xml +++ b/spring-boot-versions/pom.xml @@ -273,5 +273,9 @@ org.springframework.boot spring-boot-starter-websocket + + org.springframework.boot + spring-boot-starter-ws +