Files
gs-consuming-web-service/complete/src/main/java/hello/QuoteConfiguration.java
Dave Syer a625386b76 Switch to quote service (SOAP endpoint actually exists)
The weather service we had been using no longer exists and there
doesn't seem to be a simple publicly available alternative
(everyone is using plain HTTP these days). So this change converts
the sample to a public SOAP service that does stock quotes.

Fixes gh-9
2017-01-16 11:00:22 +00:00

30 lines
772 B
Java

package hello;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
@Configuration
public class QuoteConfiguration {
@Bean
public Jaxb2Marshaller marshaller() {
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
// this package must match the package in the <generatePackage> specified in
// pom.xml
marshaller.setContextPath("hello.wsdl");
return marshaller;
}
@Bean
public QuoteClient quoteClient(Jaxb2Marshaller marshaller) {
QuoteClient client = new QuoteClient();
client.setDefaultUri("http://www.webservicex.com/stockquote.asmx");
client.setMarshaller(marshaller);
client.setUnmarshaller(marshaller);
return client;
}
}