我使用Spring Boot 1.3。*構建合同的第一個Web服務。我看了How to use WSDL with spring-boot?這個問題的答案。這工作正常Spring Boot wsdl first - 將url更改爲wsdl
@EnableWs
@Configuration
public class WebServiceConfig extends WsConfigurerAdapter {
@Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
//http://localhost:8080/ws/services.wsdl --bean name is set to 'services'
@Bean(name = "services")
public Wsdl11Definition defaultWsdl11Definition() {
SimpleWsdl11Definition wsdl11Definition = new SimpleWsdl11Definition();
wsdl11Definition.setWsdl(new ClassPathResource("/schema/MyWsdl.wsdl")); //your wsdl location
return wsdl11Definition;
}
}
我的wsdl現在位於http://localhost:8080/ws/services.wsdl。問題是,這將是此Web服務的消費者的應用需要WSDL URL寫爲
http://localhost:8080/ws/services?wsdl
我怎樣才能做到這一點?
您會使用類似urlrewrite的內容嗎?我應該提供解決方案嗎? – sgpalit
這可能會訣竅,所以是的。 – baron5
你使用tomcat容器嗎? http://tuckey.org/urlrewrite/你可以做這些設置嗎?否則它不會工作:( – sgpalit