Commit f0c0f000 authored by Phillip Webb's avatar Phillip Webb

Polish

parent 3975f8c9
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<module>spring-boot-sample-websocket</module> <module>spring-boot-sample-websocket</module>
<module>spring-boot-sample-ws</module> <module>spring-boot-sample-ws</module>
<module>spring-boot-sample-xml</module> <module>spring-boot-sample-xml</module>
</modules> </modules>
<!-- No dependencies - otherwise the samples won't work if you change the <!-- No dependencies - otherwise the samples won't work if you change the
parent --> parent -->
<build> <build>
......
== Spring Boot - Samples - Web Services == Spring Boot - Samples - Web Services
This sample project demonstrates how to use http://projects.spring.io/spring-ws/[Spring 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 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] http://docs.spring.io/spring-ws/site/reference/html/tutorial.html#tutorial.implementing.endpoint[Holiday Request sample]
in the Spring Web Services reference guilde. in the Spring Web Services reference guide.
The sample uses Maven. It can be built and run from the command line: The sample uses Maven. It can be built and run from the command line:
...@@ -11,4 +11,4 @@ The sample uses Maven. It can be built and run from the command line: ...@@ -11,4 +11,4 @@ The sample uses Maven. It can be built and run from the command line:
$ mvn spring-boot:run $ mvn spring-boot:run
---- ----
http://localhost:8080/services/holidayService/holiday.wsdl will now display the generated WSDL. http://localhost:8080/services/holidayService/holiday.wsdl will now display the generated WSDL.
\ No newline at end of file
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package sample.ws; package sample.ws;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
...@@ -28,4 +29,5 @@ public class SampleWsApplication { ...@@ -28,4 +29,5 @@ public class SampleWsApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWsApplication.class, args); SpringApplication.run(SampleWsApplication.class, args);
} }
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package sample.ws; package sample.ws;
import org.springframework.boot.context.embedded.ServletRegistrationBean; import org.springframework.boot.context.embedded.ServletRegistrationBean;
...@@ -52,4 +53,5 @@ public class WebServiceConfig extends WsConfigurerAdapter { ...@@ -52,4 +53,5 @@ public class WebServiceConfig extends WsConfigurerAdapter {
public XsdSchema countriesSchema() { public XsdSchema countriesSchema() {
return new SimpleXsdSchema(new ClassPathResource("META-INF/schemas/hr.xsd")); return new SimpleXsdSchema(new ClassPathResource("META-INF/schemas/hr.xsd"));
} }
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package sample.ws.endpoint; package sample.ws.endpoint;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -76,4 +77,5 @@ public class HolidayEndpoint { ...@@ -76,4 +77,5 @@ public class HolidayEndpoint {
this.humanResourceService.bookHoliday(startDate, endDate, name); this.humanResourceService.bookHoliday(startDate, endDate, name);
} }
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package sample.ws.service; package sample.ws.service;
import java.util.Date; import java.util.Date;
...@@ -20,4 +21,5 @@ import java.util.Date; ...@@ -20,4 +21,5 @@ import java.util.Date;
public interface HumanResourceService { public interface HumanResourceService {
void bookHoliday(Date startDate, Date endDate, String name); void bookHoliday(Date startDate, Date endDate, String name);
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package sample.ws.service; package sample.ws.service;
import java.util.Date; import java.util.Date;
...@@ -31,4 +32,5 @@ public class StubHumanResourceService implements HumanResourceService { ...@@ -31,4 +32,5 @@ public class StubHumanResourceService implements HumanResourceService {
this.logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate, this.logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate,
name); name);
} }
} }
...@@ -21,21 +21,29 @@ import javax.xml.transform.stream.StreamResult; ...@@ -21,21 +21,29 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.OutputCapture;
import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.ws.client.core.WebServiceTemplate; import org.springframework.ws.client.core.WebServiceTemplate;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleWsApplication.class) @SpringApplicationConfiguration(classes = SampleWsApplication.class)
@WebAppConfiguration @WebAppConfiguration
@IntegrationTest @IntegrationTest
public class SampleWsApplicationTests { public class SampleWsApplicationTests {
@Rule
public OutputCapture output = new OutputCapture();
private WebServiceTemplate webServiceTemplate = new WebServiceTemplate(); private WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
@Value("${local.server.port}") @Value("${local.server.port}")
...@@ -65,5 +73,7 @@ public class SampleWsApplicationTests { ...@@ -65,5 +73,7 @@ public class SampleWsApplicationTests {
StreamResult result = new StreamResult(System.out); StreamResult result = new StreamResult(System.out);
this.webServiceTemplate.sendSourceAndReceiveToResult(source, result); this.webServiceTemplate.sendSourceAndReceiveToResult(source, result);
assertThat(this.output.toString(), containsString("Booking holiday for"));
} }
}
\ No newline at end of file }
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<module>spring-boot-starter-velocity</module> <module>spring-boot-starter-velocity</module>
<module>spring-boot-starter-web</module> <module>spring-boot-starter-web</module>
<module>spring-boot-starter-websocket</module> <module>spring-boot-starter-websocket</module>
<module>spring-boot-starter-ws</module> <module>spring-boot-starter-ws</module>
</modules> </modules>
<build> <build>
<plugins> <plugins>
......
...@@ -27,7 +27,7 @@ import org.springframework.util.ReflectionUtils; ...@@ -27,7 +27,7 @@ import org.springframework.util.ReflectionUtils;
/** /**
* Utility used to run a process. * Utility used to run a process.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Dave Syer * @author Dave Syer
* @author Andy Wilkinson * @author Andy Wilkinson
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment