验证WSDL URL或从暴露中禁用它

时间:2017-05-05 16:30:19

标签: java web-services tomcat wsdl axis

我需要隐藏WSDL网址或仅使其可供经过身份验证的用户使用。我不想公开http://localhost:8080/services/Application?wsdl

Tomcat版本8.5.11,java 8,Axis 1.4(我知道Axis版本太旧了,但我现在必须使用它)

我认为我可以在web http://docs.oracle.com/cd/E19798-01/821-1841/bncbk/index.html中解释为web.xml添加安全约束,如下所示:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>WSDL</web-resource-name>
        <description>WSDL Files</description>
        <url-pattern>*?wsdl</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>*</role-name>
    </auth-constraint>
</security-constraint>

还发现这个帖子建议做同样的事情但不适合我Hiding WSDL in JAX-WS

Tomcat会抛出以下错误:

org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3782)
    at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1377)
    at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1350)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1586)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:280)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1164)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1388)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1392)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1360)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> *?wsdl in security constraint
    at org.apache.catalina.core.StandardContext.addConstraint(StandardContext.java:2827)
    at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1317)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1190)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:775)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5087)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more

知道我做错了什么吗?或者我如何实现上述目标?

非常感谢提前

0 个答案:

没有答案