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

Order of setting properties in WebServiceGatewaySupport

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0.1
    • Component/s: Core
    • Labels:
      None

      Description

      In WebServiceGatewaySupport the set* properties delegate to WebServiceTemplate in the moment the call is made.
      As long as one uses the default WebServiceTemplate there is no problem.
      But as soon as using a custom WebServiceTemplate the order the properties are becomes critical, fact that should not be the case.
      E.g.

      if I have:
      <bean id="airlineClient" class="org.springframework.ws.samples.airline.client.sws.AirlineClient">
      <property name="marshaller" ref="marshaller"/>
      <property name="unmarshaller" ref="marshaller"/>
      <property name="defaultUri" value="http://localhost:8080/airline/services"/>
      <property name="webServiceTemplate" ref="myWebServiceTemplate"/>
      </bean>
      will fail when used as the delegate will go to the default template, template that is replaced in the last property set with my template.
      If I have :
      <bean id="airlineClient" class="org.springframework.ws.samples.airline.client.sws.AirlineClient">
      <property name="webServiceTemplate" ref="myWebServiceTemplate"/>
      <property name="marshaller" ref="marshaller"/>
      <property name="unmarshaller" ref="marshaller"/>
      <property name="defaultUri" value="http://localhost:8080/airline/services"/>
      </bean>
      everithing works file since teh web template is already set before the delegate take place.

      I suggest that delegates takes place in afterPropertiesSet not in the set* methods.

        Activity

        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Storing the properties temporarily, and then populate the template instance in afterPropertiesSet() would complicate programmatic usage (i.e. outside a spring application context). We don't want to unnecessarily require a call to afterPropertiesSet. I've added the following documentation to the WebServiceGatewaySupport, documenting this feature:

        Note that when injecting a WebServiceTemplate directly, the convenience setters (setMarshaller(Marshaller), setUnmarshaller(Unmarshaller), setMessageSender(WebServiceMessageSender), setMessageSenders(WebServiceMessageSender[]), and setDefaultUri(String)) should not be used on this class, but on the template directly.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Storing the properties temporarily, and then populate the template instance in afterPropertiesSet() would complicate programmatic usage (i.e. outside a spring application context). We don't want to unnecessarily require a call to afterPropertiesSet. I've added the following documentation to the WebServiceGatewaySupport, documenting this feature: Note that when injecting a WebServiceTemplate directly, the convenience setters (setMarshaller(Marshaller), setUnmarshaller(Unmarshaller), setMessageSender(WebServiceMessageSender), setMessageSenders(WebServiceMessageSender[]), and setDefaultUri(String)) should not be used on this class, but on the template directly.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing 1.0.1 issues.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing 1.0.1 issues.

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            adreghiciu Alin Dreghiciu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: