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
33 lines
919 B
Java
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;
|
|
}
|
|
|
|
}
|