我尝试使用Tomcat6、CXF 2.2、Spring3实现一个简单的Web服务提供者,实际上服务本身运行良好(我可以使用原始的WSDL和SOAPUI调用Web方法)。但是,Tomcat在“”上返回一个空白页。WSDL“请求。另外,当我试图通过添加
publishedEndpointURL
属性到
jaxws:endpoint
元素,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.用弹簧3设置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.将生成的东西打包到战争中部署