[SWS-762] Allow multiple prefixes and suffixes in DefaultWsdl11Definition Created: 11/Apr/12  Updated: 04/May/12  Resolved: 01/May/12

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 2.0.4
Fix Version/s: 2.0.5

Type: Improvement Priority: Minor
Reporter: William Gorder Assignee: Arjen Poutsma
Resolution: Complete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


I have just recently started using spring-ws and am converting portions of an existing CXF project to use spring-ws. The naming conventions are not consistent for operations around here they may end in POST or REQUEST. Changing the name on the existing operations is not an option for me but I would still like to be able to generate the WSDL for new additions I make. It would be nice if I could have more then one defined.


Comment by Arjen Poutsma [ 01/May/12 ]

DefaultWsdl11Definition is basically a wrapper around a ProviderBasedWsdl4jDefinition, and a number of classes from the org.springframework.ws.wsdl.wsdl11.provider package. To customize the WSDL creation process, you can write your own implementation of those classes and plug those into the ProviderBasedWsdl4jDefinition.

For the problem you describe, you probably want to subclass/create custom implementations of the SuffixBasedPortTypesProvider and SuffixBasedMessagesProvider.

Hope this helps.

Comment by William Gorder [ 01/May/12 ]

That looks easy enough Thanks for the explanation Arjen!

Comment by William Gorder [ 02/May/12 ]


I did as you said, my question now is how do I make the <sws:dynamic-wsdl> tag use my new providers so I can plug in the multiple suffixes?

I am guessing that I cannot use <sws:dynamic-wsdl> anymore but I am not exactly sure all the beans I need to declare in that case. Where in the code do I need to look to see what happens with these special namespace prefixes? I know they are there for convenience but I am at a loss to figure out where to look to figure out just what its doing for me now that I cannot use it.


Comment by Arjen Poutsma [ 03/May/12 ]

Indeed, you cannot use that tag with your own custom definition implementation. So you will have to wire up the PoviderBasedWsdl4jDefinition, like so:

<bean id="definition" class="org.springframework.ws.wsdl.wsdl11.ProviderBasedWsdl4jDefinition">
    <property name="typesProvider">
        <bean class="org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider">
            <property name="schema">
                <bean class="org.springframework.xml.xsd.SimpleXsdSchema">
                    <property name="xsd" value="classpath:org/springframework/ws/client/support/destination/simple.wsdl"/>
    <property name="messagesProvider">
        <bean class="com.foo.MyCustomMessagesProvider">
            <!--Further customization of messages provider-->
    <property name="portTypesProvider">
        <bean class="com.foo.MyCustomPortTypesProvider">
            <!--Further customization of port types provider-->
    <property name="bindingsProvider" ref="soapProvider"/>
    <property name="servicesProvider" ref="soapProvider"/>

<bean id="soapProvider" class="org.springframework.ws.wsdl.wsdl11.provider.SoapProvider">
    <property name="locationUri" value="http://foo.com:8080/myservice"

Note that I did not test this configuration, but it should point you in the right direction.

Alternatively, you can write your own namespace handler, to support your own version of the <sws:dynamic-wsdl> tag. See http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/extensible-xml.html, and take a look at the org.springframework.ws.config.DynamicWsdlBeanDefinitionParser class in SWS to see how this is done.

The definition is automatically picked up by the MessageDispatcherServlet, so you don't need to explicitly reference it from somewhere.

Comment by William Gorder [ 03/May/12 ]


That got me going thanks!
Thank you for the info on the namespace handler stuff as well, I have not had time to to look at that bit yet but I definitely will be!

Comment by Arjen Poutsma [ 04/May/12 ]

Closing old issues

Generated at Wed Nov 14 13:12:53 UTC 2018 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.