[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


 Description   

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.

Thanks,



 Comments   
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 ]

Arjen,

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.

Thanks,

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"/>
                </bean>
            </property>
        </bean>
    </property>
    <property name="messagesProvider">
        <bean class="com.foo.MyCustomMessagesProvider">
            <!--Further customization of messages provider-->
        </bean>
    </property>
    <property name="portTypesProvider">
        <bean class="com.foo.MyCustomPortTypesProvider">
            <!--Further customization of port types provider-->
        </bean>
    </property>
    <property name="bindingsProvider" ref="soapProvider"/>
    <property name="servicesProvider" ref="soapProvider"/>
</bean>
 
<bean id="soapProvider" class="org.springframework.ws.wsdl.wsdl11.provider.SoapProvider">
    <property name="locationUri" value="http://foo.com:8080/myservice"
</bean>

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 ]

Arjen,

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 Mon Dec 11 13:01:27 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.