Spring Boot wsdl 首先 - 将 url 更改为 wsdl [英] Spring Boot wsdl first - change url to wsdl

查看:49
本文介绍了Spring Boot wsdl 首先 - 将 url 更改为 wsdl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Spring Boot 1.3.* 来构建契约优先的 Web 服务.我在 How to use WSDL with spring-boot? .这工作得很好

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;
}
}

我的 wsdl 现在位于 http://localhost:8080/ws/services.wsdl.问题是将成为此 Web 服务使用者的应用程序需要将 wsdl url 写为

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?

推荐答案

要将 urlrewrite 配置为 bean 检查此tuckey-url-rewrite-filter-java-class-configuration

To configure urlrewrite as a bean check this tuckey-url-rewrite-filter-java-class-configuration

这将在后端转发,用户不会收到通知.在您的 urlrewrite.xml 中添加此规则

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>

这篇关于Spring Boot wsdl 首先 - 将 url 更改为 wsdl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆