我创建了一个 JAX-WS 网络服务并将其部署在 weblogic 10.3.3 上。它已成功部署,一切正常。
现在,我们想通过隐藏 WSDL 来访问 web 服务。我尝试从 weblogic 管理控制台隐藏 WSDL。转到此位置
Deployed application -> Webservice -> Configuration tab
在此选项卡中,通过将“false”置于参数“WSDL 发布文件”中。
保存它创建了一个 Plan.xml。当我尝试激活 Weblogic 中的更改时出现问题。以下是我得到的异常:
An error occurred during activation of changes, please see the log for details.
Error encountered during prepare phase of deploying WebService module 'TB_DBLEGI_SIMULATOR-trunk.war'. Error encountered while deploying WebService module 'TB_DBLEGI_SIMULATOR-trunk.war'. Failed to publish wsdl java.io.IOException: Wsdl file should be placed at META-INF/wsdl, or WEB-INF/wsdl
Wsdl file should be placed at META-INF/wsdl, or WEB-INF/wsdl
在我的 war 中,WSDL 位于 WEB-INF/wsdl 文件夹中。 另外,我试着把它放在不同的地方,但我没有运气。
最佳答案
您始终可以编写并注册一个过滤器
来阻止对给定资源的访问。
例如:
public class BlockFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {}
@Override
public void destroy() {}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
return;
}
}
并在web.xml
中注册过滤器:
<filter>
<filter-name>blockFilter</filter-name>
<filter-class>namespace.BlockFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>blockFilter</filter-name>
<url-pattern>*?wsdl</url-pattern>
</filter-mapping>
关于java - JAX-WS 如何在 weblogic 中隐藏 WSDL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10734880/