commit
0b7836b447
31
pom.xml
31
pom.xml
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/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">
|
||||
<project xmlns="http://maven.apache.org/POM/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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-build</artifactId>
|
||||
|
|
@ -148,20 +149,20 @@
|
|||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<target>
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
|
||||
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" />
|
||||
<var name="version-type" value="${project.version}" />
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp=".*\.(.*)" replace="\1" />
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp="(M)\d+" replace="MILESTONE" />
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp="(RC)\d+" replace="MILESTONE" />
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp="BUILD-(.*)" replace="SNAPSHOT" />
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
|
||||
<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask"/>
|
||||
<var name="version-type" value="${project.version}"/>
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp=".*\.(.*)" replace="\1"/>
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp="(M)\d+" replace="MILESTONE"/>
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp="(RC)\d+" replace="MILESTONE"/>
|
||||
<propertyregex property="version-type" override="true" input="${version-type}" regexp="BUILD-(.*)" replace="SNAPSHOT"/>
|
||||
<stringutil string="${version-type}" property="profile">
|
||||
<lowercase />
|
||||
<lowercase/>
|
||||
</stringutil>
|
||||
<echo message="Writing settings for ${profile} profile" />
|
||||
<echo message="Writing settings for ${profile} profile"/>
|
||||
<copy file=".settings-template.xml" tofile="settings.xml" overwrite="true">
|
||||
<filterset>
|
||||
<filter token="profile" value="${profile}" />
|
||||
<filter token="profile" value="${profile}"/>
|
||||
</filterset>
|
||||
</copy>
|
||||
</target>
|
||||
|
|
@ -176,7 +177,7 @@
|
|||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<target>
|
||||
<property name="sourceFile" value="spring-boot-dependencies/pom.xml" />
|
||||
<property name="sourceFile" value="spring-boot-dependencies/pom.xml"/>
|
||||
<xslt in="${sourceFile}" out="${sourceFile}.new" force="true">
|
||||
<style>
|
||||
<string><![CDATA[
|
||||
|
|
@ -199,9 +200,9 @@
|
|||
</string>
|
||||
</style>
|
||||
</xslt>
|
||||
<move file="${sourceFile}" tofile="${sourceFile}.old" />
|
||||
<move file="${sourceFile}.new" tofile="${sourceFile}" />
|
||||
<delete file="${sourceFile}.old" />
|
||||
<move file="${sourceFile}" tofile="${sourceFile}.old"/>
|
||||
<move file="${sourceFile}.new" tofile="${sourceFile}"/>
|
||||
<delete file="${sourceFile}.old"/>
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
|||
|
|
@ -79,6 +79,8 @@
|
|||
<jedis.version>2.4.1</jedis.version>
|
||||
<jetty.version>8.1.15.v20140411</jetty.version>
|
||||
<jetty-jsp.version>2.2.0.v201112011158</jetty-jsp.version>
|
||||
<jaxen.version>1.1.6</jaxen.version>
|
||||
<jdom2.version>2.0.5</jdom2.version>
|
||||
<joda-time.version>2.3</joda-time.version>
|
||||
<jolokia.version>1.2.1</jolokia.version>
|
||||
<jstl.version>1.2</jstl.version>
|
||||
|
|
@ -109,12 +111,14 @@
|
|||
<spring-social-linkedin.version>1.0.1.RELEASE</spring-social-linkedin.version>
|
||||
<spring-security.version>3.2.4.RELEASE</spring-security.version>
|
||||
<spring-security-jwt.version>1.0.2.RELEASE</spring-security-jwt.version>
|
||||
<spring-ws.version>2.2.0.RELEASE</spring-ws.version>
|
||||
<thymeleaf.version>2.1.3.RELEASE</thymeleaf.version>
|
||||
<thymeleaf-extras-springsecurity3.version>2.1.1.RELEASE</thymeleaf-extras-springsecurity3.version>
|
||||
<thymeleaf-layout-dialect.version>1.2.4</thymeleaf-layout-dialect.version>
|
||||
<tomcat.version>7.0.54</tomcat.version>
|
||||
<velocity.version>1.7</velocity.version>
|
||||
<velocity-tools.version>2.0</velocity-tools.version>
|
||||
<wsdl4j.version>1.6.1</wsdl4j.version>
|
||||
</properties>
|
||||
<prerequisites>
|
||||
<maven>3.0.0</maven>
|
||||
|
|
@ -330,6 +334,11 @@
|
|||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-ws</artifactId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Third Party -->
|
||||
<dependency>
|
||||
|
|
@ -454,6 +463,11 @@
|
|||
<artifactId>jstl</artifactId>
|
||||
<version>${jstl.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jaxen</groupId>
|
||||
<artifactId>jaxen</artifactId>
|
||||
<version>${jaxen.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
|
|
@ -819,6 +833,11 @@
|
|||
<artifactId>jolokia-core</artifactId>
|
||||
<version>${jolokia.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jdom</groupId>
|
||||
<artifactId>jdom2</artifactId>
|
||||
<version>${jdom2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
|
|
@ -1058,31 +1077,75 @@
|
|||
<artifactId>spring-social-facebook-web</artifactId>
|
||||
<version>${spring-social-facebook.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-linkedin</artifactId>
|
||||
<version>${spring-social-linkedin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-twitter</artifactId>
|
||||
<version>${spring-social-twitter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.social</groupId>
|
||||
<artifactId>spring-social-linkedin</artifactId>
|
||||
<version>${spring-social-linkedin.version}</version>
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-core</artifactId>
|
||||
<version>${spring-ws.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-support</artifactId>
|
||||
<version>${spring-ws.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-security</artifactId>
|
||||
<version>${spring-ws.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-test</artifactId>
|
||||
<version>${spring-ws.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf</artifactId>
|
||||
<version>${thymeleaf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf.extras</groupId>
|
||||
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
|
||||
<version>${thymeleaf-extras-springsecurity3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf-spring4</artifactId>
|
||||
<version>${thymeleaf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf.extras</groupId>
|
||||
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
|
||||
<version>${thymeleaf-extras-springsecurity3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
|
|
@ -1093,6 +1156,11 @@
|
|||
<artifactId>jedis</artifactId>
|
||||
<version>${jedis.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>wsdl4j</groupId>
|
||||
<artifactId>wsdl4j</artifactId>
|
||||
<version>${wsdl4j.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -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 '<<production-ready-features.adoc#production-ready, production ready>>' features.
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,9 @@
|
|||
<module>spring-boot-sample-web-ui</module>
|
||||
<module>spring-boot-sample-web-velocity</module>
|
||||
<module>spring-boot-sample-websocket</module>
|
||||
<module>spring-boot-sample-ws</module>
|
||||
<module>spring-boot-sample-xml</module>
|
||||
</modules>
|
||||
</modules>
|
||||
<!-- No dependencies - otherwise the samples won't work if you change the
|
||||
parent -->
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<!-- Your own application should inherit from spring-boot-starter-parent -->
|
||||
<artifactId>spring-boot-samples</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-boot-sample-ws</artifactId>
|
||||
<name>Spring Boot Web Services Sample</name>
|
||||
<description>Spring Boot Web Services Sample</description>
|
||||
<url>http://projects.spring.io/spring-boot/</url>
|
||||
<organization>
|
||||
<name>Pivotal Software, Inc.</name>
|
||||
<url>http://www.spring.io</url>
|
||||
</organization>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-ws</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jaxen</groupId>
|
||||
<artifactId>jaxen</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jdom</groupId>
|
||||
<artifactId>jdom2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>wsdl4j</groupId>
|
||||
<artifactId>wsdl4j</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* 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;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
public class SampleWsApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(SampleWsApplication.class, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
@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"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
@Endpoint
|
||||
public class HolidayEndpoint {
|
||||
|
||||
private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas";
|
||||
|
||||
private XPathExpression<Element> startDateExpression;
|
||||
private XPathExpression<Element> endDateExpression;
|
||||
private XPathExpression<String> nameExpression;
|
||||
|
||||
private HumanResourceService humanResourceService;
|
||||
|
||||
@Autowired
|
||||
public HolidayEndpoint(HumanResourceService humanResourceService)
|
||||
throws JDOMException, XPathFactoryConfigurationException,
|
||||
XPathExpressionException {
|
||||
this.humanResourceService = humanResourceService;
|
||||
|
||||
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
|
||||
|
||||
XPathFactory xPathFactory = XPathFactory.instance();
|
||||
|
||||
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 {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date startDate = dateFormat.parse(this.startDateExpression.evaluateFirst(
|
||||
holidayRequest).getText());
|
||||
Date endDate = dateFormat.parse(this.endDateExpression.evaluateFirst(
|
||||
holidayRequest).getText());
|
||||
String name = this.nameExpression.evaluateFirst(holidayRequest);
|
||||
|
||||
this.humanResourceService.bookHoliday(startDate, endDate, name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +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;
|
||||
|
||||
public interface HumanResourceService {
|
||||
|
||||
void bookHoliday(Date startDate, Date endDate, String name);
|
||||
}
|
||||
|
|
@ -0,0 +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;
|
||||
|
||||
@Service
|
||||
public class StubHumanResourceService implements HumanResourceService {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(StubHumanResourceService.class);
|
||||
|
||||
@Override
|
||||
public void bookHoliday(Date startDate, Date endDate, String name) {
|
||||
this.logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate,
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:hr="http://mycompany.com/hr/schemas"
|
||||
elementFormDefault="qualified"
|
||||
targetNamespace="http://mycompany.com/hr/schemas">
|
||||
<xs:element name="HolidayRequest">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="Holiday" type="hr:HolidayType"/>
|
||||
<xs:element name="Employee" type="hr:EmployeeType"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="HolidayType">
|
||||
<xs:sequence>
|
||||
<xs:element name="StartDate" type="xs:date"/>
|
||||
<xs:element name="EndDate" type="xs:date"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:complexType name="EmployeeType">
|
||||
<xs:sequence>
|
||||
<xs:element name="Number" type="xs:integer"/>
|
||||
<xs:element name="FirstName" type="xs:string"/>
|
||||
<xs:element name="LastName" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:schema>
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* 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;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.test.IntegrationTest;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.ws.client.core.WebServiceTemplate;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = SampleWsApplication.class)
|
||||
@WebAppConfiguration
|
||||
@IntegrationTest
|
||||
public class SampleWsApplicationTests {
|
||||
|
||||
private WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
|
||||
|
||||
@Value("${local.server.port}")
|
||||
private int serverPort;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.webServiceTemplate.setDefaultUri("http://localhost:" + this.serverPort
|
||||
+ "/services/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendingHolidayRequest() {
|
||||
final String request = "<hr:HolidayRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">"
|
||||
+ " <hr:Holiday>"
|
||||
+ " <hr:StartDate>2013-10-20</hr:StartDate>"
|
||||
+ " <hr:EndDate>2013-11-22</hr:EndDate>"
|
||||
+ " </hr:Holiday>"
|
||||
+ " <hr:Employee>"
|
||||
+ " <hr:Number>1</hr:Number>"
|
||||
+ " <hr:FirstName>John</hr:FirstName>"
|
||||
+ " <hr:LastName>Doe</hr:LastName>"
|
||||
+ " </hr:Employee>"
|
||||
+ "</hr:HolidayRequest>";
|
||||
|
||||
StreamSource source = new StreamSource(new StringReader(request));
|
||||
StreamResult result = new StreamResult(System.out);
|
||||
|
||||
this.webServiceTemplate.sendSourceAndReceiveToResult(source, result);
|
||||
}
|
||||
}
|
||||
|
|
@ -54,6 +54,7 @@
|
|||
<module>spring-boot-starter-velocity</module>
|
||||
<module>spring-boot-starter-web</module>
|
||||
<module>spring-boot-starter-websocket</module>
|
||||
<module>spring-boot-starter-ws</module>
|
||||
</modules>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starters</artifactId>
|
||||
<version>1.1.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>spring-boot-starter-ws</artifactId>
|
||||
<name>Spring Boot Web Services Starter</name>
|
||||
<description>Spring Boot Web Services Starter</description>
|
||||
<url>http://projects.spring.io/spring-boot/</url>
|
||||
<organization>
|
||||
<name>Pivotal Software, Inc.</name>
|
||||
<url>http://www.spring.io</url>
|
||||
</organization>
|
||||
<properties>
|
||||
<main.basedir>${basedir}/../..</main.basedir>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ws</groupId>
|
||||
<artifactId>spring-ws-support</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1 @@
|
|||
provides: spring-ws-core,spring-ws-support
|
||||
|
|
@ -273,5 +273,9 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-ws</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue