Various changes to the README file

to account for changes in how Spring Boot handles SOAP.

Also removed the Jenkinsfile, because the test script can
never succeed (due to a port collision in the /initial branch).
This commit is contained in:
Jay Bryant
2023-08-02 15:43:37 -05:00
parent 92fb5963b5
commit f317b9cf85
4 changed files with 41 additions and 75 deletions

60
Jenkinsfile vendored
View File

@@ -1,60 +0,0 @@
pipeline {
agent none
triggers {
pollSCM 'H/10 * * * *'
}
options {
disableConcurrentBuilds()
buildDiscarder(logRotator(numToKeepStr: '14'))
}
stages {
stage('Publish OpenJDK 8 + git') {
when {
changeset "ci/Dockerfile"
}
agent any
steps {
script {
def image = docker.build("springci/gs-consuming-web-service-and-git", "ci/")
docker.withRegistry('', 'hub.docker.com-springbuildmaster') {
image.push()
}
}
}
}
stage("test: baseline (jdk8)") {
agent {
docker {
image 'springci/gs-consuming-web-service-and-git:latest'
args '-v $HOME/.m2:/tmp/jenkins-home/.m2'
}
}
options { timeout(time: 30, unit: 'MINUTES') }
steps {
sh 'test/run.sh'
}
}
}
post {
changed {
script {
slackSend(
color: (currentBuild.currentResult == 'SUCCESS') ? 'good' : 'danger',
channel: '#sagan-content',
message: "${currentBuild.fullDisplayName} - `${currentBuild.currentResult}`\n${env.BUILD_URL}")
emailext(
subject: "[${currentBuild.fullDisplayName}] ${currentBuild.currentResult}",
mimeType: 'text/html',
recipientProviders: [[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']],
body: "<a href=\"${env.BUILD_URL}\">${currentBuild.fullDisplayName} is reported as ${currentBuild.currentResult}</a>")
}
}
}
}

View File

@@ -32,7 +32,7 @@ https://spring.io/guides/gs/producing-web-service/[companion guide] or clone the
https://github.com/spring-guides/gs-producing-web-service[repository] and run the service
(for example, by using `mvn spring-boot:run`) from its `complete` directory. You can
verify that it works by visiting `http://localhost:8080/ws/countries.wsdl` in your
browser. If you don't do this you will see a confusing exception in your build later from the JAXB tooling.
browser. If you do not do so, you will see a confusing exception in your build later from the JAXB tooling.
[[scratch]]
== Starting with Spring Initializr
@@ -42,6 +42,8 @@ Initializr]. The Initializr offers a fast way to pull in all the dependencies yo
an application and does a lot of the setup for you. This example needs only the Spring Web
Services dependency.
You can use this https://start.spring.io/#!type=maven-project&language=java&&packaging=jar&jvmVersion=17&groupId=com.example&artifactId=consuming-web-service&name=consuming-web-service&description=Demo%20project%20for%20Spring%20Boot&packageName=com.example.consuming-web-service&dependencies=web-services[pre-initialized project] and click Generate to download a ZIP file. This project is configured to fit the examples in this tutorial.
To initialize the project:
. Navigate to https://start.spring.io.
@@ -102,14 +104,10 @@ include::complete/build.gradle[tags=dependency]
Note the exclusion of Tomcat. If Tomcat is allowed to run in this build, you get a port
collision with the Tomcat instance that provides the country data.
The following listing shows the `bootJar` section you need to add in Gradle:
====
[source,xml,indent=0]
----
include::complete/build.gradle[tags=bootjar]
----
====
NOTE: Due to this port collision, the initial project fails to start.
You can fix it by adding an `application.properties` file with a single property of
`server.port=8081`. Since the initial project exists to be a starting point, you
can skip trying to get it to run.
The <<initial>> section describes the WSDL generation plugin.
@@ -140,11 +138,11 @@ include::complete/pom.xml[tags=wsdl]
----
====
This setup will generate classes for the WSDL found at the specified URL, putting those
classes in the `com.example.consumingwebservice.wsdl` package. To generate that code run `./mvnw compile`
This setup generates classes for the WSDL found at the specified URL, putting those
classes in the `com.example.consumingwebservice.wsdl` package. To generate that code run, `./mvnw compile`
and then look in `target/generated-sources` if you want to check that it worked.
To do the same with Gradle, you will need the following in your build file:
To do the same with Gradle, you need the following in your build file:
====
[source,java,tabsize=2,indent=0]
@@ -157,7 +155,7 @@ As Gradle does not (yet) have a JAXB plugin, it involves an Ant task, which make
more complex than in Maven. To generate that code run `./gradlew compileJava`
and then look in `build/generated-sources` if you want to check that it worked.
In both cases, the JAXB domain object generation process has been wired into the build
In both Maven and Gradle, the JAXB domain object generation process has been wired into the build
tool's lifecycle, so you need not run any extra steps once you have a successful build.
== Create a Country Service Client

25
build.gradle Normal file
View File

@@ -0,0 +1,25 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.2'
id 'io.spring.dependency-management' version '1.1.2'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web-services'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}

View File

@@ -13,12 +13,15 @@
<version>0.0.1-SNAPSHOT</version>
<name>consuming-web-service-initial</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>