spring-ws发布的webservice默认url是http://xx:xx/xxx.wsdl,不符合常规的http://xx:xx/xxx?wsdl格式,利用urlrewritefilter去做一下转发没有效果

package com.ai.toptea.kbm.filter;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.tuckey.web.filters.urlrewrite.Conf;
import org.tuckey.web.filters.urlrewrite.UrlRewriteFilter;

import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import java.io.IOException;

/**

  • 〈将.wsdl转化为?wsdl〉 *
  • @author
  • @create 2019/10/11 */

@Configuration
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("无法读取配置文件: " + CONFIG_LOCATION, ex);
}
}

}

配置文件:

备注:解决了,少了一个use-query-string ="true"配置

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐