此刻我正撞在墙上。我做了一些开发,使用CXF和Spring创建WebService。这一切都与Jetty 8完美配合,但是当我尝试使用Tomcat 6运行它时,我甚至无法从请求中获取WSDL。以下是详细信息:
我的网络服务界面:
@WebService(name="AlertService")
public interface AlertWebService {
@WebMethod
HandleAlertResponse openHandleAlert(@WebParam(name = "request") HandleAlertRequest request) throws ServiceException;
}
我的网络服务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
}
我的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>
终点定义
<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" />
我点击的网址给出了404错误
http://localhost:8090/prime-service-webapp/AlertService?wsdl
我已经更改了我的tomcat配置以查看端口8090.我只是将名为prime-service-webapp的war放入tomcat的webapps目录中。将index.html文件添加到prime-service-webapp目录似乎也解决了。但我根本无法得到wsdl。
任何想法 - 让我知道。是否有特定于tomcat 6服务器配置的任何内容我需要更改以使其正常工作?
答案 0 :(得分:1)
我承认我对码头一无所知,但在tomcat中,就像你说的那样,你需要使用这个URL:
http://localhost:8090/prime-service-webapp/prime-service-webapp/AlertService?wsdl
尝试一下。原因是tomcat默认将war名称指定为上下文根,并指示你的cxf servlet监听
<url-pattern>/prime-service-webapp/*</url-pattern>
表示上下文根目录下的另一个级别(即使它是相同的)