SPa*_*ala 6 web-services spring-boot
我的客户希望使用?wsdl表示法访问wsdl,但是我创建的springboot服务仅使用'.wsdl'格式。我需要一个有效的示例/示例,该示例/示例如何在springboot应用程序中配置Tuckey urlrewrite。我尝试使用下面的代码,但是应用程序抱怨它找不到urlrewrite.xml(我将其放置在src / main / resources文件夹中。
问题1:如何使用http:// localhost:8080 / ws / organisation下的 url访问服务 ?
我尝试使用下面的代码,但是tuckey找不到src / java / resources下的urlrewrite.xml。
@Bean
public FilterRegistrationBean tuckeyRegistrationBean() {
final FilterRegistrationBean registrationBean = new ilterRegistrationBean();
registrationBean.setFilter(new UrlRewriteFilter());
registrationBean.addInitParameter("confPath", "urlrewrite.xml");
return registrationBean;
}
Run Code Online (Sandbox Code Playgroud)
最后,我可以找出解决方案。现在urlrewrite.xml
从src / main / resources文件夹中读取。
无需在问题post(public FilterRegistrationBean tuckeyRegistrationBean()
)中声明上述bean定义,因为以下声明为的代码@Component
将自动在上下文中注册并执行url重写。
@Component
public class WsdlUrlRewriteFilter extends UrlRewriteFilter {
private static final String CONFIG_LOCATION = "classpath:/urlrewrite.xml";
@Value(CONFIG_LOCATION)
private Resource resource;
@Override
protected void loadUrlRewriter(FilterConfig filterConfig) throws ServletException {
try {
Conf conf = new Conf(filterConfig.getServletContext(), resource.getInputStream(), resource.getFilename(), "");
checkConf(conf);
} catch (IOException ex) {
throw new ServletException("Unable to load URL-rewrite configuration file from " + CONFIG_LOCATION, ex);
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4033 次 |
最近记录: |