Polish
This commit is contained in:
parent
3975f8c931
commit
f0c0f00089
|
|
@ -58,7 +58,7 @@
|
|||
<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>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
== 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
|
||||
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.
|
||||
in the Spring Web Services reference guide.
|
||||
|
||||
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
|
||||
----
|
||||
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.ws;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
|
@ -28,4 +29,5 @@ public class SampleWsApplication {
|
|||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(SampleWsApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.ws;
|
||||
|
||||
import org.springframework.boot.context.embedded.ServletRegistrationBean;
|
||||
|
|
@ -52,4 +53,5 @@ public class WebServiceConfig extends WsConfigurerAdapter {
|
|||
public XsdSchema countriesSchema() {
|
||||
return new SimpleXsdSchema(new ClassPathResource("META-INF/schemas/hr.xsd"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.ws.endpoint;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
|
@ -76,4 +77,5 @@ public class HolidayEndpoint {
|
|||
|
||||
this.humanResourceService.bookHoliday(startDate, endDate, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.ws.service;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -20,4 +21,5 @@ import java.util.Date;
|
|||
public interface HumanResourceService {
|
||||
|
||||
void bookHoliday(Date startDate, Date endDate, String name);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package sample.ws.service;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -31,4 +32,5 @@ public class StubHumanResourceService implements HumanResourceService {
|
|||
this.logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate,
|
||||
name);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,21 +21,29 @@ import javax.xml.transform.stream.StreamResult;
|
|||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
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.OutputCapture;
|
||||
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;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = SampleWsApplication.class)
|
||||
@WebAppConfiguration
|
||||
@IntegrationTest
|
||||
public class SampleWsApplicationTests {
|
||||
|
||||
@Rule
|
||||
public OutputCapture output = new OutputCapture();
|
||||
|
||||
private WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
|
||||
|
||||
@Value("${local.server.port}")
|
||||
|
|
@ -65,5 +73,7 @@ public class SampleWsApplicationTests {
|
|||
StreamResult result = new StreamResult(System.out);
|
||||
|
||||
this.webServiceTemplate.sendSourceAndReceiveToResult(source, result);
|
||||
assertThat(this.output.toString(), containsString("Booking holiday for"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +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>
|
||||
<module>spring-boot-starter-ws</module>
|
||||
</modules>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.springframework.util.ReflectionUtils;
|
|||
|
||||
/**
|
||||
* Utility used to run a process.
|
||||
*
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
* @author Andy Wilkinson
|
||||
|
|
|
|||
Loading…
Reference in New Issue