【发布时间】:2010-04-15 23:19:25
【问题描述】:
我正在尝试使用 Tomcat6、CXF 2.2、Spring 3 实现一个简单的 Web 服务提供程序,实际上该服务本身运行良好(我可以使用原始 WSDL 和 SoapUI 调用 Web 方法)。但是,Tomcat 在“?wsdl”请求上返回一个空白页面。此外,当我尝试通过向jaxws:endpoint 元素添加publishedEndpointURL 属性来操作(可能)已发布的WSDL 时,Tomcat 将发出XML 解析异常(类似于property publishedEndpointURL is not allowed in element jaxws:endpoint)
<jaxws:endpoint
id="service"
implementor="org.sample.ServiceImpl"
implementorClass="org.sample.ServiceImpl"
address="/service"
publishedEndpointURL="http://localhost:8080/MyService/service">
我使用“合同优先”的风格。
编辑: 到目前为止我做了什么:
1.使用 Spring3 设置 tomcat6
2.使用maven生成CXF实现类
3.提供web.xml(只显示相关部分)
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>cxf</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
4.提供applicationContext.xml(只显示相关部分)
<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"/>
<jaxws:endpoint
id="service"
implementor="org.sample.ServiceImpl"
implementorClass="org.sample.ServiceImpl"
address="/service"/>
5.将生成的东西打包到war中并部署
【问题讨论】:
标签: java spring tomcat cxf web-services