Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring web services configuration in web.xml?

I am using spring-ws and I have the below configuration in my 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. Please explain me the use of transformWsdlLocations here. I am using the dynamic WSDL generation concept.

Is transformWsdlLocations really required for dynamic WSDL generation?

Thanks!

like image 700
user755806 Avatar asked Apr 10 '26 13:04

user755806


1 Answers

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.

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.

i.e. 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". Likewise, you can't test your service properly if the URL being returned in the WSDL is for your production server. Or you might have multiple production services with different URLs.

transformWsdlLocations ensures that this is generated dynamically based on whatever URL is being used to access the service.

It is not needed for dynamic WSDL generation, but I have always found it very useful to have it. 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.

like image 74
Steve Avatar answered Apr 13 '26 18:04

Steve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!