Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-762

Allow multiple prefixes and suffixes in DefaultWsdl11Definition

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.5
    • Component/s: Core
    • Labels:
      None

      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,

        Activity

        wgorder William Gorder created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Assignee Arjen Poutsma [ arjen.poutsma ]
        arjen.poutsma Arjen Poutsma made changes -
        Fix Version/s 2.0.5 [ 12848 ]
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        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.

        Show
        arjen.poutsma Arjen Poutsma added a comment - 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.
        arjen.poutsma Arjen Poutsma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Complete [ 8 ]
        Hide
        wgorder William Gorder added a comment -

        That looks easy enough Thanks for the explanation Arjen!

        Show
        wgorder William Gorder added a comment - That looks easy enough Thanks for the explanation Arjen!
        Hide
        wgorder William Gorder added a comment -

        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,

        Show
        wgorder William Gorder added a comment - 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,
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        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.

        Show
        arjen.poutsma Arjen Poutsma added a comment - 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.
        Hide
        wgorder William Gorder added a comment -

        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!

        Show
        wgorder William Gorder added a comment - 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!
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing old issues

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing old issues
        arjen.poutsma Arjen Poutsma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        19d 23h 10m 1 Arjen Poutsma 01/May/12 7:34 AM
        Resolved Resolved Closed Closed
        2d 23h 28m 1 Arjen Poutsma 04/May/12 7:03 AM

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            wgorder William Gorder
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: