I am banging my head against a wall at the moment. I did some development to create a WebService using CXF and Spring. It all worked fine with Jetty 8, but when I try and run it with Tomcat 6 I can't even get the WSDL from the request. Below are the details:
My webservice interface:
@WebService(name="AlertService")
public interface AlertWebService {
@WebMethod
HandleAlertResponse openHandleAlert(@WebParam(name = "request") HandleAlertRequest request) throws ServiceException;
}
My webservice impl:
@WebService(endpointInterface = "c.h.g.p.service.ws.alert.AlertWebService", serviceName = "AlertService")
public class AlertWebServiceImpl implements AlertWebService {
@Override
public HandleAlertResponse openHandleAlert(HandleAlertRequest request) throws ServiceException {
//Do some stuff
}
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app ...>
<display-name>Prime Service Webapp</display-name>
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/prime-service-webapp/*</url-pattern>
</servlet-mapping>
</web-app>
Endpoint definition
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean id="alertWebService" class="c.h.g.p.service.ws.alert.AlertWebServiceImpl" />
<jaxws:endpoint implementor="#alertWebService" address="/AlertService" />
URL that I hit which gives me 404 error
http://localhost:8090/prime-service-webapp/AlertService?wsdl
I have changed my tomcat config to look at port 8090. I just drop my war called prime-service-webapp into webapps directory of tomcat. Adding an index.html file into the prime-service-webapp directory also seems to resolve ok. But I can't get the wsdl at all.
Any ideas - let me know. Is there anything in specific to tomcat 6 server config I need to change to get this working?
I admit i know nothing about jetty, but in tomcat, the way you put it, you need to use this URL:
http://localhost:8090/prime-service-webapp/prime-service-webapp/AlertService?wsdl
Have a try with that. The reason is tomcat assigns the war name as context root by default, and you have instructed your cxf servlet to listen to
<url-pattern>/prime-service-webapp/*</url-pattern>
which means another level under context root (even if it is the same)