title: Deploying a Spring Boot 2.0.4 SOAP Web Service on Tomcat
body: <p>I've got a Spring Boot 2.0.4 SOAP Web Service working as a .jar file. I used the example here: <a href="https://spring.io/guides/gs/producing-web-service/" rel="nofollow noreferrer">https://spring.io/guides/gs/producing-web-service/</a>. I'm building it using Maven. I followed the article exactly, so I'll just show the changes I made here.</p>
  
  <p>It generates the WSDL and I'm able to call the service using curl as described in the article.</p>
  
  <p>Now I want to create a WAR file and deploy it on Tomcat 8.5.</p>
  
  <p>I've followed all of the directions for converting a Spring Boot app to a WAR but I'm getting a 404 error when attempting to retrieve the WSDL or call the service.</p>
  
  <p>I've looked at other similar questions here, but none of the proposed solutions appear to work with Spring Boot 2.x.</p>
  
  <p>I followed these steps to convert to a deployable WAR:</p>
  
  <p>Modify my SpringBootApplication class like so:</p>
  
  <pre><code>@SpringBootApplication
  public class Application extends SpringBootServletInitializer {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
          return builder.sources(Application.class);
      }
  }
  </code></pre>
  
  <p>Change the packaging to "war" in pom.xml:</p>
  
  <pre><code>&lt;packaging&gt;war&lt;/packaging&gt;
  </code></pre>
  
  <p>Changed the spring-boot-starter-tomcat dependency to "provided" in pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
      &lt;scope&gt;provided&lt;/scope&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>All of the above might have worked on Spring Boot 1.x, but doesn't with Spring Boot 2.x.</p>
  
  <p>I just get a 404 error when trying to reach the WSDL (e.g. using <a href="http://localhost:8180/ws/countries.wsdl" rel="nofollow noreferrer">http://localhost:8180/ws/countries.wsdl</a> - note my Tomcat server is running on port 8180).</p>
  
  <p>My only theory is that Spring's dispatcherServlet is intercepting all of the requests and the "messageDispatcherServlet" isn't ever seeing them. </p>
  
  <p>Note the statement in the article: "By naming this bean messageDispatcherServlet, it does not replace Spring Boot’s default DispatcherServlet bean."</p>
  
  <p>But I don't know how to fix that.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>UPDATE: As M. Deinum pointed out, I had the wrong URL. This works with
   "<a href="http://localhost:8180/spring-boot-soap-example/ws/countries.wsdl" rel="nofollow noreferrer">http://localhost:8180/spring-boot-soap-example/ws/countries.wsdl</a>". Still having 404 errors with my real application, but I'll see what's different and post a different question if I'm not able to solve it.</p>
  
  <p>Thanks,
  Terry</p>