最近在网上发现有spring集成XFire开发WebService
MyEclipse新建webservice工程在Servlet class选择org.codehaus.xfire.spring.XFireSpringServlet
配置如下:
}
代码考过来启动服务发现出现如下问题
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanDefinitionStoreException: Line 10 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
提示找不到beans标签。
找了以下资料发现是
<beans>标签问题,把<beans标签的schema去掉,加上<DOCTYPE>
修改spring配置文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="helloWS" class="org.ccsoft.HelloWSImp" />
<bean name="helloService"
class="org.codehaus.xfire.spring.ServiceBean">
<property name="serviceBean" ref="helloWS" />
<property name="serviceClass" value="org.ccsoft.HelloWS" />
<property name="inHandlers">
<list>
<ref bean="addressingHandler" />
</list>
</property>
</bean>
<bean id="addressingHandler"
class="org.codehaus.xfire.addressing.AddressingInHandler" />
</beans>
再次启动服务ok;