gpt4 book ai didi

web-services - 如何 : Configure Spring-WS to publish WSDL files with a '?WSDL' style URL?

转载 作者:行者123 更新时间:2023-12-04 05:04:25 26 4
gpt4 key购买 nike

我正在尝试使用 Mule ESB 配置 Web 服务代理。

我正在尝试使用 Mule 的 WSProxyService 来执行此操作,但是在逐步执行相应的代码(使用调试器)之后,很明显该类替换了端点地址。

问题是 Spring-WS WSDL 地址的样式是 http://xxxx/xxxx.wsdl ,但 WSProxyService 期望 http://xxxx/xxxx?wsdlhttp://xxxx/xxxx&wsdl .它将远程端点地址替换为本地 WSDL 地址;它在问号处切断远程 WSDL 地址,即“?WSDL”旨在被切断,因此创建搜索词。但是由于 Spring-WS,这不起作用。

分解:

WSProxyService 最终尝试使用

http://xxxx/xxxx.wsdl

取代
http://xxxx/xxxx


http://yyyy/yyyy

这失败了......导致实际的网络服务调用直接而不是通过代理。

有没有人注意到/解决了这个问题?

干杯,达伦

最佳答案

Spring WS servlet 前面的 servlet 过滤器如何检查 url 和 params?

如果匹配,则返回 WSDL,否则就让请求通过,就好像什么都没发生一样。

如果您绝对必须将 WS + ?WSDL 的 url 附加到它,那么这应该很容易实现并且可以满足您的需求。

这是代码:

public class WsdlQueryCompatibilityFilter implements Filter {
@Override
public void init(final FilterConfig filterConfig) throws ServletException {
// do nothing
}

@Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest httpServletRequest = (HttpServletRequest) request;
if ("GET".equals(httpServletRequest.getMethod())
&& "wsdl".equalsIgnoreCase(httpServletRequest.getQueryString())) {
httpServletRequest.getSession().getServletContext().getRequestDispatcher("/ws.wsdl")
.forward(request, response);
} else {
chain.doFilter(request, response);
}
}

@Override
public void destroy() {
// do nothing
}
}

关于web-services - 如何 : Configure Spring-WS to publish WSDL files with a '?WSDL' style URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1644225/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com