title: Deploying CXF SOAP Web Services to Apache Tomcat
body: <p>I've recently re-written a web services application to use CXF instead of Axis.  The switch was easy enough, but I'm having issues deploying the webapp.  Previously, with Axis, you could navigate to a page, served by Tomcat, that would list all Axis services; something similar to <code>http://localhost:8080/axis2/services/listServices</code>.  And to view a service's WSDL, I'd navigate to <code>http://localhost:8080/axis2/services/Service?wsdl</code>.</p>
  
  <p>After rewriting the services in CXF, I've found I don't really know how to deploy and configure the application.  I've followed a basic CXF setup, where my application's <code>web.xml</code> file imports a Spring config file, <code>beans.xml</code>.  I can war all this up just fine and deploy it in Tomcat, where it explodes just fine and no error logging occurs, but I cannot figure out how to even browse on the host to see a listing of the deployed web services.</p>
  
  <p>Can I get some help and explanation for this?  I'd like to understand how to configure CXF so that I know what URLs to use in order to list services and see their corresponding WSDLs.  Feel free to explain this portion as if I were five years old; I'm a solid programmer, but deployment and configuration aren't my strongest areas of knowledge.  </p>
  
  <p>One thing I've noticed in trying to understand this is that the beans.xml file references an import of <code>classpath:META-INF/cxf/cxf.xml</code>.  I have no idea what this file is or where it is, but my assumption would be that it's probably needed and that I should probably understand its role.  Would someone mind explaining that as well?  Does Tomcat's <code>web.xml</code> have anything to do with this configuration?</p>
  
  <p>If I can provide any more information or configuration in order to assist with this post, let me know!</p>
  
  <p>Here's my application's web.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0"&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;WEB-INF/beans.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
      &lt;listener&gt;
          &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
      &lt;/listener&gt;
      &lt;servlet&gt;
          &lt;display-name&gt;CXF Servlet&lt;/display-name&gt;
          &lt;servlet-name&gt;CXFServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.apache.cxf.transport.servlet.CXFServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;CXFServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/services/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;mime-mapping&gt;
          &lt;extension&gt;inc&lt;/extension&gt;
          &lt;mime-type&gt;text/plain&lt;/mime-type&gt;
      &lt;/mime-mapping&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p>And here's my beans.xml:  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans
      xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jaxws="http://cxf.apache.org/jaxws"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"&gt;
  
      &lt;import resource="classpath:META-INF/cxf/cxf.xml" /&gt;
  
      &lt;jaxws:endpoint
          id="accountService"
          implementor="com.company.ws.data.services.AccountService"
          address="/AccountService" /&gt;
  
      &lt;jaxws:endpoint
          id="loggingService"
          implementor="com.company.ws.data.services.LoggingService"
          address="/LoggingService" /&gt;
  
      &lt;jaxws:endpoint
          id="searchService"
          implementor="com.company.ws.data.services.SearchService"
          address="/SearchService" /&gt;
  
      &lt;jaxws:endpoint
          id="validationService"
          implementor="com.company.ws.data.services.ValidationService"
          address="/ValidationService" /&gt;
  &lt;/beans&gt;
  </code></pre>