简体   繁体   English

web.xml中的spring web服务配置?

[英]spring web services configuration in web.xml?

I am using spring-ws and I have the below configuration in my web.xml 我使用的是spring-ws,我的web.xml中有以下配置

<servlet>
        <servlet-name>spring-ws</servlet-name>
        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
        <init-param>
            <param-name>**transformWsdlLocations**</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>spring-ws</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

Here I have transformWsdlLocations configured. 这里我配置了transformWsdlLocations Please explain me the use of transformWsdlLocations here. 请在这里解释一下transformWsdlLocations的用法。 I am using the dynamic WSDL generation concept. 我正在使用动态WSDL生成概念。

Is transformWsdlLocations really required for dynamic WSDL generation? transformWsdlLocations是否真的需要动态WSDL生成?

Thanks! 谢谢!

Given that it only takes a couple of minutes to remove the value and redeploy your application, I would advise you to do that and see what happens. 鉴于只需要几分钟就可以删除该值并重新部署您的应用程序,我建议您这样做,看看会发生什么。 Just try accessing the WSDL through "localhost" and through "127.0.0.1", and see what differences there are. 只需尝试通过“localhost”和“127.0.0.1”访问WSDL,看看有什么不同。

However I'll explain what you should see here... 但是我会解释你应该在这里看到的......

When you read the WSDL that is generated, you should find that there are URLs in there. 当您阅读生成的WSDL时,您应该发现其中有URL。

ie From the local machine you might use: 即从您可能使用的本地计算机:

http://localhost:8080/myservice.wsdl

But when you go live, your service might be: 但是当你上线时,你的服务可能是:

http://www.<yourdomain>.com/myservice.wsdl

You don't want someone downloading the WSDL from your production domain to have those values populated with "localhost:8080". 您不希望从生产域下载WSDL的人员使用“localhost:8080”填充这些值。 Likewise, you can't test your service properly if the URL being returned in the WSDL is for your production server. 同样,如果WSDL中返回的URL是针对您的生产服务器的,则无法正确测试您的服务。 Or you might have multiple production services with different URLs. 或者您可能有多个具有不同URL的生产服务。

transformWsdlLocations ensures that this is generated dynamically based on whatever URL is being used to access the service. transformWsdlLocations确保根据用于访问服务的URL进行动态生成。

It is not needed for dynamic WSDL generation, but I have always found it very useful to have it. 动态WSDL生成不需要它,但我总是发现它非常有用。 However, it is not enabled by default, so if you do want those URLs to be generated dynamically then it's best to include it. 但是,默认情况下不启用它,因此如果您确实希望动态生成这些URL,则最好包含它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM