Files
gs-consuming-web-service/complete/src/main/java/hello/CountryClient.java
Dave Syer f5ee891b92 Switch from public SOAP API on internet to local one
Every time we pick a public SOAP API on the internet someone shuts
it down. It's easier to just use the one from the "producing"
guide.

Fixes gh-27
2018-07-30 08:53:52 +01:00

33 lines
919 B
Java

package hello;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ws.client.core.support.WebServiceGatewaySupport;
import org.springframework.ws.soap.client.core.SoapActionCallback;
import hello.wsdl.GetCountryRequest;
import hello.wsdl.GetCountryResponse;
public class CountryClient extends WebServiceGatewaySupport {
private static final Logger log = LoggerFactory.getLogger(CountryClient.class);
public GetCountryResponse getCountry(String country) {
GetCountryRequest request = new GetCountryRequest();
request.setName(country);
log.info("Requesting location for " + country);
GetCountryResponse response = (GetCountryResponse) getWebServiceTemplate()
.marshalSendAndReceive("http://localhost:8080/ws/countries", request,
new SoapActionCallback(
"http://spring.io/guides/gs-producing-web-service/GetCountryRequest"));
return response;
}
}