Reputation: 17042
I created a webservice using Spring Boot using the steps defined hereWhen I try to download the wsdl , I am having to use .wsdl in the url. However when I use ?wsdl , the wsdl is not getting downloaded. How can I rewrite the url to download the wsdl when I use ?wsdl in the url?
Upvotes: 3
Views: 2087
Reputation: 2085
I use this filter to be able to acces wsdl with Spring styled .wsdl
as well as ?wsdl
:
public class WsdRequestCompatibilityFilter extends OncePerRequestFilter {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
if ("GET".equals(request.getMethod()) && "wsdl".equalsIgnoreCase(request.getQueryString())) {
request.getSession().getServletContext().getRequestDispatcher(request.getRequestURI() + ".wsdl").forward(request, response);
} else {
filterChain.doFilter(request, response);
}
}
}
You need to register this as been named wsdlRequestCompatibilityFilter
and add folowing config to your web.xml
:
<filter>
<filter-name>wsdlRequestCompatibilityFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>wsdlRequestCompatibilityFilter</filter-name>
<url-pattern>/ws/*</url-pattern>
</filter-mapping>
Upvotes: 6