Reputation: 587
I'm using Spring Boot 1.3.* to build a contract first web service. I looked at the answer for the question at How to use WSDL with spring-boot? . This worked fine
@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;
}
}
My wsdl is now located at http://localhost:8080/ws/services.wsdl . Problem is that the application that will be the consumer of this web service requires the wsdl url to be written as
http://localhost:8080/ws/services?wsdl
How can i achieve this?
Upvotes: 1
Views: 5307
Reputation: 2686
To configure urlrewrite as a bean check this tuckey-url-rewrite-filter-java-class-configuration
This will forward in backend and user will not be notified. Ad this rule in your urlrewrite.xml
<rule>
<from>/ws/services?wsdl</from>
<to>/ws/services.wsdl</to>
</rule>
Upvotes: 3