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?
Asked
Active
Viewed 1,569 times
1 Answers
6
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>

chimmi
- 2,054
- 16
- 30
-
Thank you ! Is there a way to do it using annotations in Spring ? – Punter Vicky Aug 31 '17 at 12:31
-
No, Im afraid it is not configurable. – chimmi Aug 31 '17 at 12:39
-
You can code this in Java: https://stackoverflow.com/a/30658752/1705830 – Robert Jakubowski Aug 10 '18 at 13:21