From f880a6512cd14c12948eefa38118eafc3ac36328 Mon Sep 17 00:00:00 2001 From: "Greg L. Turnquist" Date: Mon, 13 Dec 2021 10:19:16 -0600 Subject: [PATCH] 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. --- pom.xml | 1 - weather/README.adoc | 15 ---- weather/pom.xml | 87 ------------------- .../ws/samples/weather/WeatherClient.java | 79 ----------------- .../samples/weather/WeatherConfiguration.java | 46 ---------- 5 files changed, 228 deletions(-) delete mode 100644 weather/README.adoc delete mode 100644 weather/pom.xml delete mode 100644 weather/src/main/java/org/springframework/ws/samples/weather/WeatherClient.java delete mode 100644 weather/src/main/java/org/springframework/ws/samples/weather/WeatherConfiguration.java diff --git a/pom.xml b/pom.xml index 294da23..286bc8c 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,6 @@ mtom/client/spring-ws mtom/server tutorial - weather diff --git a/weather/README.adoc b/weather/README.adoc deleted file mode 100644 index b220db0..0000000 --- a/weather/README.adoc +++ /dev/null @@ -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]. \ No newline at end of file diff --git a/weather/pom.xml b/weather/pom.xml deleted file mode 100644 index 6edb9a5..0000000 --- a/weather/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - 4.0.0 - - - org.springframework.ws - spring-ws-samples - 1.0.0.BUILD-SNAPSHOT - ../ - - - org.springframework.ws - weather-client-spring-ws - 0.0.1-SNAPSHOT - Spring Web Services Samples - Weather - Client - Spring WS - Demo project for Spring Web Services - - - 1.8 - 2.15.0 - ${project.basedir}/target/generated-sources/xjc - ${project.basedir}/target/classes - ${project.basedir}/../../server/src/main/resources - http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl - - - - - - org.springframework.ws - spring-ws-core - - - - - - - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - 0.14.0 - - - - generate - - - - - WSDL - - - ${wsdl} - - - org.springframework.ws.samples.weather - true - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.1 - - - add-source - process-sources - - add-source - - - - ${sourcesDir} - - - - - - - - - - diff --git a/weather/src/main/java/org/springframework/ws/samples/weather/WeatherClient.java b/weather/src/main/java/org/springframework/ws/samples/weather/WeatherClient.java deleted file mode 100644 index d7f4d48..0000000 --- a/weather/src/main/java/org/springframework/ws/samples/weather/WeatherClient.java +++ /dev/null @@ -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); - } -} diff --git a/weather/src/main/java/org/springframework/ws/samples/weather/WeatherConfiguration.java b/weather/src/main/java/org/springframework/ws/samples/weather/WeatherConfiguration.java deleted file mode 100644 index 0c4cda8..0000000 --- a/weather/src/main/java/org/springframework/ws/samples/weather/WeatherConfiguration.java +++ /dev/null @@ -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; - } - -}