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

I can't set transformSchemaLocation attribute in MessageDispatcherServlet class through web.xml file

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.3
    • Fix Version/s: 2.1.4
    • Component/s: Core, XML
    • Labels:
      None

      Description

      In my Spring XML file I have a static-wsdl defined and in the WSDL I imported a XML Schema Definition with namespace and schemaLocation attributes.

      When I deploy my Web Application I want to the

       <soap:address location /> 

      and

       <xs:import schemaLocation /> 

      in WSDL to be transformed to reflect the URI of the incoming HttpServletRequest.

      So to achieve this behavior in the web.xml file I have this configuration:

      <servlet>
         <servlet-name>spring-ws-dispatcher</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>
            <init-param>
               <param-name>transformSchemaLocations</param-name>
               <param-value>true</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
          </servlet>

      The problem:

      When the application is deployed, the method 'initWsdlDefinitionHandlerAdapter' in class 'MessageDispatcherServlet' runs, but only the attribute

       transformLocations 

      in class 'WsdlDefinitionHandlerAdapter' is properly setted with the value passed through the

      <init-param />

      tag in the web.xml file, and the attribute

       transformSchemaLocations 

      is not. As can be seen in red in the code below:

      MessageDispatcherServlet.class

      private void initWsdlDefinitionHandlerAdapter(ApplicationContext context) {
         try {
            try {
               wsdlDefinitionHandlerAdapter = context.getBean(getWsdlDefinitionHandlerAdapterBeanName(), WsdlDefinitionHandlerAdapter.class);
       
            } catch (NoSuchBeanDefinitionException ignored) {
                 wsdlDefinitionHandlerAdapter = new WsdlDefinitionHandlerAdapter();
            }
      {color:red} 
            wsdlDefinitionHandlerAdapter.setTransformLocations(isTransformWsdlLocations());
      {color}
            wsdlDefinitionHandlerAdapter.afterPropertiesSet();
       
         } catch (Exception ex) {
              throw new BeanInitializationException("Could not initialize WsdlDefinitionHandlerAdapter", ex);
         }
      }

      My solution was:

      Create in the Spring XML file a wsdlDefinitionHandlerAdapter bean and set the properties 'transformLocations' and 'transformSchemaLocations' with value true.

      <bean id="wsdlDefinitionHandlerAdapter" class="org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter">
      	<property name="transformSchemaLocations" value="true" />
          	<property name="transformLocations" value="true" />
      </bean>

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        32d 9h 52m 1 Arjen Poutsma 19/Aug/13 4:00 AM
        In Progress In Progress Resolved Resolved
        17m 54s 1 Arjen Poutsma 19/Aug/13 4:18 AM

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            thiago gutenberg Thiago Gutenberg Carvalho da Costa
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: