Drop Weather service example.

The SOAP endpoint that supports the Weather module is pretty much gone. Since there are enough demos of various Spring WS features in the other parts, there is little to researching or standing up a counterpart.
This commit is contained in:
Greg L. Turnquist
2021-12-13 10:19:16 -06:00
parent 2787bf67da
commit f880a6512c
5 changed files with 0 additions and 228 deletions

View File

@@ -55,7 +55,6 @@
<module>mtom/client/spring-ws</module>
<module>mtom/server</module>
<module>tutorial</module>
<module>weather</module>
</modules>
<dependencies>

View File

@@ -1,15 +0,0 @@
= Weather Forecast Sample
This sample shows how to use Spring Web Services to connect to the https://wiki.cdyne.com/index.php/CDYNE_Weather[CDYNE Weather Service].
It uses JAXB to generate classes from the service's WSDL, and the `WebServiceTemplate` to
send the request to and receive the response from the service.
You can run the client by using the following command from within this directory:
----
$ ./mvnw spring-boot:run
----
== License
https://projects.spring.io/spring-ws[Spring Web Services] is released under version 2.0 of the http://www.apache.org/licenses/LICENSE-2.0[Apache License].

View File

@@ -1,87 +0,0 @@
<?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.ws</groupId>
<artifactId>spring-ws-samples</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
<relativePath>../</relativePath> <!-- lookup parent from repository -->
</parent>
<groupId>org.springframework.ws</groupId>
<artifactId>weather-client-spring-ws</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Spring Web Services Samples - Weather - Client - Spring WS</name>
<description>Demo project for Spring Web Services</description>
<properties>
<java.version>1.8</java.version>
<log4j2.version>2.15.0</log4j2.version>
<sourcesDir>${project.basedir}/target/generated-sources/xjc</sourcesDir>
<classesDir>${project.basedir}/target/classes</classesDir>
<schema>${project.basedir}/../../server/src/main/resources</schema>
<wsdl>http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl</wsdl>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.14.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<schemas>
<schema>
<url>${wsdl}</url>
</schema>
</schemas>
<generatePackage>org.springframework.ws.samples.weather</generatePackage>
<addCompileSourceRoot>true</addCompileSourceRoot>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>add-source</id>
<phase>process-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${sourcesDir}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,79 +0,0 @@
/*
* Copyright 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 org.springframework.ws.samples.weather;
import java.text.SimpleDateFormat;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.soap.client.core.SoapActionCallback;
public class WeatherClient extends WebServiceGatewaySupport {
public GetCityForecastByZIPResponse getCityForecastByZip(String zipCode) {
GetCityForecastByZIP request = new GetCityForecastByZIP();
request.setZIP(zipCode);
System.out.println();
System.out.println("Requesting forecast for " + zipCode);
GetCityForecastByZIPResponse response = (GetCityForecastByZIPResponse) getWebServiceTemplate()
.marshalSendAndReceive(request, new SoapActionCallback("http://ws.cdyne.com/WeatherWS/GetCityForecastByZIP"));
return response;
}
public void printResponse(GetCityForecastByZIPResponse response) {
ForecastReturn forecastReturn = response.getGetCityForecastByZIPResult();
if (forecastReturn.isSuccess()) {
System.out.println();
System.out.println("Forecast for " + forecastReturn.getCity() + ", " + forecastReturn.getState());
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
for (Forecast forecast : forecastReturn.getForecastResult().getForecast()) {
System.out.print(format.format(forecast.getDate().toGregorianCalendar().getTime()));
System.out.print(" ");
System.out.print(forecast.getDesciption());
System.out.print(" ");
Temp temperature = forecast.getTemperatures();
System.out.print(temperature.getMorningLow() + "\u00b0-" + temperature.getDaytimeHigh() + "\u00b0 ");
System.out.println();
}
} else {
System.out.println("No forecast received");
}
}
public static void main(String[] args) {
ApplicationContext context = new AnnotationConfigApplicationContext(WeatherConfiguration.class);
WeatherClient client = context.getBean(WeatherClient.class);
String zipCode = "94304";
if (args.length > 0) {
zipCode = args[0];
}
GetCityForecastByZIPResponse response = client.getCityForecastByZip(zipCode);
client.printResponse(response);
}
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright 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 org.springframework.ws.samples.weather;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
@Configuration
public class WeatherConfiguration {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
marshaller.setContextPath("org.springframework.ws.samples.weather");
return marshaller;
}
@Bean
public WeatherClient weatherClient(Jaxb2Marshaller marshaller) {
WeatherClient client = new WeatherClient();
client.setDefaultUri("http://wsf.cdyne.com/WeatherWS/Weather.asmx");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}