Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic WSDL address locations [SWS-47] #206

Closed
gregturn opened this issue Jul 18, 2006 · 4 comments
Closed

Dynamic WSDL address locations [SWS-47] #206

gregturn opened this issue Jul 18, 2006 · 4 comments

Comments

@gregturn
Copy link
Contributor

Arjen Poutsma opened SWS-47 and commented

One disadvantage of writing your WSDLs yourself is that you don't have dynamic address locations anymore. Sometimes, it is needed to transform the address given in the WSDL document to one that matches the current url of the war.

Basically, this feature would allow people to use a relative paths in their wsdl description (such as /services/myservice). When a request comes in, the full context path is prepended to this relative url (resulting in something like http://example.com:8080/context/services/myservice).


1 votes, 1 watchers

@gregturn
Copy link
Contributor Author

Arjen Poutsma commented

This is now implemented in SVN.

The basic idea is to define a WsdlDefinition bean in your app context, and to add the WsdlDefinitionHandlerAdapter to your *-servlet.xml app context. You then map the incoming requires for the WSDL file to the WsdlDefintion instead of the WSDL file itself.

The adapter has a property transformLocations. When enabled, this adapter transforms all location attributes to reflect the incoming request.

For instance, if the location attribute defined in the WSDL is http://localhost:8080/context/services/myService, and the request URI for the WSDL is http://example.com/context/myService.wsdl, the location will be changed to http://example.com/context/services/myService.

Note that - contrary to my previous comment on this issue - you should not use relative URLs in the location!

@gregturn
Copy link
Contributor Author

Arjen Poutsma commented

Also, you can look in the echo sample, which uses this functionality.

@gregturn
Copy link
Contributor Author

Arjen Poutsma commented

Turns out that the relative path option can be pretty useful as well, especially in situations where the running context is not known beforehand (see http://forum.springframework.org/showpost.php?p=70606&postcount=9). So, I will implement this as well.

Basically, if a location contains a relative url, the the full context path is prepended to this relative url. When the location is non-relative, only the server information is changed.

@gregturn
Copy link
Contributor Author

Jason Stiefel commented

Thought this was worth commenting on since it's not clear from the above text just how to implement this feature. Adding a WsdlDefinitionHandlerAdapter to your servlet context is ignored from the MessageDispatcherServlet. The servlet instantiates it's own instance that is configured through exposed init-params on the servlet itself. So for the current version (1.0-rc2) you must add an init-param value to your 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>

I plan to open a bug regarding the handler adapter being overlooked within the servlet context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants